Skip to content

@idfkit/geometry

Read-only geometry extraction: where a model's surfaces are, in one frame, without editing the model to find out. getScene resolves every detailed surface a model states, reports what it could not place and what it did not attempt, and leaves the document byte-for-byte unchanged. It reads no files and holds no state, so the same code runs in Node, a browser, a worker, or an edge runtime.

Not installed by @idfkit/idfkit and not reachable through a subpath of the shared name. It is added by name.

npm install @idfkit/geometry

For a task-shaped walkthrough, see How to read a model's geometry.

Classes

Polygon3D

A closed ring of vertices in one frame. Immutable: every transformation returns a new polygon.

Constructors

constructor

Polygon3D

Properties

vertices

Accessors

area

azimuth

centroid

isHorizontal

isVertical

normal

numVertices

tilt

Methods

asTupleList


rotateZ


Turned about the vertical axis through anchor, or through the centroid when given none.

translate


fromTuples


From coordinate triples, as an expectation file or a test states them.

Vector3D

One point or direction in the model's frame. Immutable: every operation returns a new vector.

Constructors

constructor

Vector3D

Properties

x

y

z

Methods

add


asTuple


cross


divide


dot


equals


Whether two vectors hold the same three numbers.

Python compares two frozen dataclasses with == and gets this for nothing. JavaScript compares object identity, so the comparison has to be written, and a caller who omits it silently gets the answer false for two equal vectors.

length


The magnitude, by Math.hypot, which is Python's math.hypot and does not overflow.

negate


normalize


The unit vector in the same direction, and the zero vector for the zero vector.

rotateZ


Turned about the vertical axis, counter-clockwise seen from above, in degrees.

The engine measures its own north axis the other way round, which is why the resolution negates the angle before calling this rather than this function turning the other way.

scale


subtract


toString


fromTuple


From a triple, as an expectation file or a test states one.

origin


The zero vector, which is the world origin.

Interfaces

AppliedRules

What resolution read from the model, and what it had to assume.

Properties

coordinateSystem

As declared, or the engine's default.

defaulted

Which of the above were absent from the model and defaulted.

isClockwise

Whether the author entered vertices clockwise, which clause three reverses.

isRelative

Whether zone origins and zone rotations apply, which is clause one's condition.

Derived from coordinateSystem rather than declared separately, and carried because the first language carries it: a reader following the one documentation page should not find a fact available in one language and absent in the other.

northAxis

Degrees, as applied to the resolved building.

Recorded although it has already been applied to the vertices. That is what makes the choice reversible: a consumer wanting to draw the building unrotated under a compass can undo it exactly rather than reimplementing the clause most easily got wrong.

startingVertexPosition

Recorded and deliberately not acted on: the author's starting vertex is preserved.

vertexEntryDirection

As declared, or the engine's default.

ResolvedSurface

One surface, placed.

objectType together with name is the address. A name alone is not unique across types, and a consumer that must search the document by name to find what its user selected has been handed a picture rather than a view of the model.

Properties

area

The area of the resolved polygon.

boundary

The outside boundary condition in the schema's spelling, empty where the type has none.

construction

The construction name, empty where the type has none.

isShading

Shading surfaces are drawable and are not heat transfer surfaces.

name

normal

The outward normal, signed by the declared entry direction.

objectType

parentSurface

The surface a fenestration sits on, and undefined for anything else.

polygon

The vertices in the resolved frame, in the author's ring order.

surfaceType

In the schema's spelling, or the canonical object type on a shading surface.

zone

The parent zone, empty for site and building shading.

Scene

A model's geometry, resolved into one frame.

All three lists are in document order. The corpus compares unresolved and unattempted as sets, because neither carries a semantically meaningful order; that is a statement about what counts as equal and not permission for the producer to vary. A list that reorders between runs is a flickering interface and an unreadable diff, and ordering costs nothing here because resolution already walks the document in order.

Properties

applied

bounds

Absent when nothing resolved, never a degenerate box at the origin.

surfaces

unattempted

unresolved

SceneBounds

The box enclosing every resolved vertex, and no more.

Properties

max

min

UnattemptedType

A geometry type present in the model that this slice does not read.

Properties

count

objectType

UnresolvedObject

A geometry object that could not be placed, and why.

The reason is an enumeration rather than a message, so that a consumer can group on it and a reworded string does not change behaviour.

missingReference names what the object pointed at and the model does not hold, for the two reasons that are a dangling reference. The reason says how to group the failure; it does not say which wall to go and find, and a reader fixing the model needs the name rather than a second search through the document. Absent when nothing was referenced, as for an object whose vertex list is too short.

Properties

missingReference

name

objectType

reason

Functions

getScene