ModelBounds

Struct ModelBounds 

Source
pub struct ModelBounds {
    pub min_x: f64,
    pub min_y: f64,
    pub min_z: f64,
    pub max_x: f64,
    pub max_y: f64,
    pub max_z: f64,
    pub sample_count: usize,
}
Expand description

Model bounds in f64 precision

Fields§

§min_x: f64

Minimum X coordinate found

§min_y: f64

Minimum Y coordinate found

§min_z: f64

Minimum Z coordinate found

§max_x: f64

Maximum X coordinate found

§max_y: f64

Maximum Y coordinate found

§max_z: f64

Maximum Z coordinate found

§sample_count: usize

Number of points sampled

Implementations§

Source§

impl ModelBounds

Source

pub fn new() -> Self

Create new bounds initialized to invalid state

Source

pub fn is_valid(&self) -> bool

Check if bounds are valid (at least one point added)

Source

pub fn expand(&mut self, x: f64, y: f64, z: f64)

Expand bounds to include a point

Source

pub fn centroid(&self) -> (f64, f64, f64)

Get centroid (center of bounding box)

Source

pub fn has_large_coordinates(&self, length_unit_scale: f64) -> bool

Check if bounds reach more than crate::limits::LARGE_COORD_THRESHOLD_METERS (1 km, in METRES; was 10 km before #4934) from the origin.

The sampled values are raw IfcCartesianPoint coordinates in the file’s length unit, so the caller passes length_unit_scale (file unit to metres, e.g. 0.001 for millimetres, 1000.0 for kilometres) and the comparison happens in metres. Gating on the raw values against a metre-shaped constant let a kilometre-unit model 500 000 km out read as “500 < 1000” and skip the RTC rebase, and the caller’s scaling afterwards could not undo a decision already taken.

Source

pub fn rtc_offset(&self, length_unit_scale: f64) -> Option<RtcVerdict>

The RTC verdict in metres: None when no point was sampled, Large with the unit-scaled bbox centre when a corner is past the threshold (see has_large_coordinates), Small otherwise. The centre can be inside the threshold while a corner is not, which is why the decision is carried rather than re-derived from it.

Trait Implementations§

Source§

impl Clone for ModelBounds

Source§

fn clone(&self) -> ModelBounds

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for ModelBounds

Source§

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

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

impl Default for ModelBounds

Source§

fn default() -> Self

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
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
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.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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.