Skip to main content

Module direction

Module direction 

Source
Expand description

IfcDirection and IfcVector: orientation, with and without magnitude.

§DirectionRatios are ratios, not a unit vector

The attribute is named DirectionRatios because only the ratios between the components are meaningful: (3, 4, 0) and (0.6, 0.8, 0) denote the same direction, and exporters write both. Nothing in the schema requires normalization, so any consumer that treats the raw values as a unit vector is wrong on real files: a 5x-long “unit” axis fed into a placement basis scales the geometry it positions.

Hence Direction::unit normalizes and Direction::ratios does not, and the names say which is which.

§Zero length is degenerate, not zero

The schema’s MagnitudeGreaterZero rule forbids an all-zero direction, but files contain them. Normalizing one produces NaN, which then propagates silently through every transform it touches until geometry disappears far from the cause. Direction::unit returns crate::GeometryError::Degenerate instead.

§2D or 3D

DirectionRatios is LIST [2:3], so a direction in a 2D context has two components. As with points, promotion to 3D is explicit.

Structs§

Direction
A borrowed view of an IfcDirection.
Vector
A borrowed view of an IfcVector: a direction plus a length.

Functions§

resolve_ratios_3d
Resolve a reference that must be an IfcDirection, keeping raw ratios.
resolve_unit
Resolve a reference that must be an IfcDirection, normalized to 3D.