Skip to main content

PlacementResolver

Struct PlacementResolver 

Source
pub struct PlacementResolver { /* private fields */ }
Expand description

Resolves placement chains to world transforms, with memoization.

§Why a resolver rather than a free function

Placement chains share their upper links: every element in a storey walks the same storey-building-site tail. Caching per placement turns repeated work into a lookup, which matters because this runs once per element in the file.

§Every IfcObjectPlacement kind (#363)

IFC4.3 ADD2 declares PlacementRelTo : OPTIONAL IfcObjectPlacement on IfcObjectPlacement itself, so any placement may be relative to any other: a bracket on a linearly placed signal mast, a fixing on a column placed on a grid. The walk resolves each link by its kind – IfcLocalPlacement by its RelativePlacement, IfcGridPlacement by its grid intersection in the grid’s frame (#362), IfcLinearPlacement along its basis curve in the alignment’s frame (#357) – and caches each. Grid and linear placements reach their frames through further placements (the grid’s or the alignment’s ObjectPlacement), so the walk follows those too; the depth limit and the cycle check cover the whole mixed chain.

A resolver’s cache holds transforms resolved one way: the crate’s entry points use a fresh resolver per resolution mode, so a cached linear placement never mixes a cache-only answer with a derived one.

Implementations§

Source§

impl PlacementResolver

Source

pub fn new() -> Self

A resolver with an empty cache.

Source

pub fn cached(&self) -> usize

How many placements are memoized.

Source

pub fn world_transform( &mut self, model: &Model, placement: EntityId, ) -> GeometryResult<Transform>

Resolve a placement to its world transform, in FILE units.

Walks PlacementRelTo to the root, then composes downward. Detects cycles rather than overflowing the stack, and reports the entity where the cycle closes so the file can be repaired.

Every placement kind resolves (#363): an IfcGridPlacement with straight axes, and an IfcLinearPlacement from its cached CartesianPosition. Deriving an uncached linear placement or intersecting curved grid axes needs a curve evaluator, which this entry point does not take: those are refused by name, and product_world_transform_with_evaluator (feature compile) resolves them.

Trait Implementations§

Source§

impl Debug for PlacementResolver

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for PlacementResolver

Source§

fn default() -> PlacementResolver

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.