Skip to main content

SemanticRegion

Struct SemanticRegion 

Source
pub struct SemanticRegion<ObjectCategory, RegionCategory> { /* private fields */ }
Expand description

Represents a semantic region, typically a room in a level of a house.

MP3D descriptors provide an AABB but not polyloop geometry. Polyloop-related accessors return empty slices unless a dataset supplies that geometry.

Implementations§

Source§

impl<ObjectCategory, RegionCategory> SemanticRegion<ObjectCategory, RegionCategory>

Source

pub fn new( index: i32, category: RegionCategory, position: Vec3, aabb: Aabb, objects: Vec<SemanticObject<ObjectCategory>>, ) -> Self

Creates a semantic region.

index is the original descriptor index for this region.

Source

pub const fn index(&self) -> i32

Returns the source descriptor index.

Source

pub const fn category(&self) -> &RegionCategory

Returns the semantic category of the region.

Source

pub const fn position(&self) -> Vec3

Returns the region position from the source descriptor.

Source

pub const fn aabb(&self) -> &Aabb

Returns the region axis-aligned bounding box.

Source

pub fn objects(&self) -> &[SemanticObject<ObjectCategory>]

Returns objects contained by this region.

Source

pub fn contains(&self, point: Vec3) -> bool

Tests whether this region contains the point.

For MP3D-loaded scenes this uses the region AABB. Future descriptor loaders with polyloop geometry can provide tighter containment.

Source

pub fn poly_loop_points(&self) -> &[Vec2]

Returns points making up the region’s floor-parallel polyloop.

Source

pub fn volume_edges(&self) -> &[Vec<Vec3>]

Returns bounding volume edges for visualization.

Source

pub const fn floor_height(&self) -> f64

Returns the floor height above the x-z plane.

Source

pub const fn extrusion_height(&self) -> f64

Returns the extrusion height above the floor.

Source

pub const fn area(&self) -> f64

Returns the area of the region base.

Source

pub const fn volume(&self) -> f64

Returns the volume of the region bounds.

Trait Implementations§

Source§

impl<ObjectCategory: Clone, RegionCategory: Clone> Clone for SemanticRegion<ObjectCategory, RegionCategory>

Source§

fn clone(&self) -> SemanticRegion<ObjectCategory, RegionCategory>

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

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

Performs copy-assignment from source. Read more
Source§

impl<ObjectCategory: Debug, RegionCategory: Debug> Debug for SemanticRegion<ObjectCategory, RegionCategory>

Source§

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

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

impl<OC, RC: Display> Display for SemanticRegion<OC, RC>

Source§

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

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

impl<ObjectCategory: PartialEq, RegionCategory: PartialEq> PartialEq for SemanticRegion<ObjectCategory, RegionCategory>

Source§

fn eq(&self, other: &SemanticRegion<ObjectCategory, RegionCategory>) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<ObjectCategory, RegionCategory> StructuralPartialEq for SemanticRegion<ObjectCategory, RegionCategory>

Auto Trait Implementations§

§

impl<ObjectCategory, RegionCategory> Freeze for SemanticRegion<ObjectCategory, RegionCategory>
where RegionCategory: Freeze,

§

impl<ObjectCategory, RegionCategory> RefUnwindSafe for SemanticRegion<ObjectCategory, RegionCategory>
where RegionCategory: RefUnwindSafe, ObjectCategory: RefUnwindSafe,

§

impl<ObjectCategory, RegionCategory> Send for SemanticRegion<ObjectCategory, RegionCategory>
where RegionCategory: Send, ObjectCategory: Send,

§

impl<ObjectCategory, RegionCategory> Sync for SemanticRegion<ObjectCategory, RegionCategory>
where RegionCategory: Sync, ObjectCategory: Sync,

§

impl<ObjectCategory, RegionCategory> Unpin for SemanticRegion<ObjectCategory, RegionCategory>
where RegionCategory: Unpin, ObjectCategory: Unpin,

§

impl<ObjectCategory, RegionCategory> UnsafeUnpin for SemanticRegion<ObjectCategory, RegionCategory>
where RegionCategory: UnsafeUnpin,

§

impl<ObjectCategory, RegionCategory> UnwindSafe for SemanticRegion<ObjectCategory, RegionCategory>
where RegionCategory: UnwindSafe, ObjectCategory: UnwindSafe,

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> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. 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.