Skip to main content

PlanRectangle

Struct PlanRectangle 

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

The rectangle of least area enclosing an object’s footprint, oriented in plan: a centre, two unit axes and the half extents along them.

Every value is bounded: the true centre lies within Self::centre_radius_metres of Self::centre, each true axis within Self::axis_error_radians of the stated one, and each true half extent inside its interval. The evidence is exact exactly when every bound is a point and the orientation is RectangleOrientation::Unique.

Implementations§

Source§

impl PlanRectangle

Source

pub fn try_new( object: ObjectId, centre: [f64; 2], centre_radius: f64, axes: [[f64; 2]; 2], axis_error: f64, half_extents: [(f64, f64); 2], orientation: RectangleOrientation, evidence: Evidence, ) -> Result<Self, PlanSpanError>

The rectangle enclosing object’s footprint.

axes are unit vectors, the second the first turned a quarter counter-clockwise, the first pointing into [0, 90) degrees, so one rectangle has one spelling. half_extents are (lower, upper) intervals along the axes in order.

Source

pub fn object(&self) -> &ObjectId

The object whose footprint the rectangle encloses.

Source

pub fn centre(&self) -> [f64; 2]

The measured centre, in canonical metres.

Source

pub fn centre_radius_metres(&self) -> f64

How far, in metres, the true centre can lie from Self::centre.

Source

pub fn axes(&self) -> [[f64; 2]; 2]

The two unit axes, the second the first turned a quarter counter-clockwise.

Source

pub fn axis_error_radians(&self) -> f64

How far, in radians, each true axis can be turned from the stated one.

Source

pub fn half_extents_metres(&self) -> [(f64, f64); 2]

The half extents along the two axes, each (lower, upper) metres.

Source

pub fn orientation(&self) -> RectangleOrientation

How well the orientation is known.

Source

pub fn is_exact(&self) -> bool

Whether the rectangle is known exactly.

Source

pub fn evidence(&self) -> &Evidence

Reviewable provenance of the measurement.

Source

pub fn width_and_length(&self) -> Result<[(f64, f64); 2], String>

The footprint’s width and length along its own axes: the shorter and the longer side, each (lower, upper) metres.

Refused unless the orientation is RectangleOrientation::Unique: another rectangle of least area may have other sides. Near-equal sides are fine; which of them is the longer does not matter here.

Source

pub fn long_axis(&self) -> Result<usize, String>

The index of the longer axis, when the orientation is unique and one side is surely longer than the other. A square, or a rectangle whose sides the measurement cannot order, has no long axis.

Source

pub fn long_axis_angle(&self, other: &Self) -> Result<(f64, f64), String>

The acute angle between this footprint’s long axis and other’s, in degrees within [0, 90], as (lower, upper) sure to hold the angle between the true axes.

Trait Implementations§

Source§

impl Clone for PlanRectangle

Source§

fn clone(&self) -> Self

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 Debug for PlanRectangle

Source§

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

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

impl PartialEq for PlanRectangle

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

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

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for PlanRectangle

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 = !

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

fn try_from(value: U) -> Result<T, !>

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.