Skip to main content

SwingSector

Struct SwingSector 

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

The floor sector a hinged leaf sweeps, in world metres.

A single-swing leaf sweeps the quarter disc of radius about hinge from closed (hinge towards the closed leaf’s free edge) to open (the leaf standing open at right angles). A double-acting leaf sweeps the half disc from the reverse of open, through closed, to open.

Implementations§

Source§

impl SwingSector

Source

pub fn try_new( hinge: [f64; 3], radius: f64, closed: MetricDirection, open: MetricDirection, double_acting: bool, ) -> Result<Self, DoorLeavesError>

A sector; closed and open must be perpendicular and the radius positive.

Source

pub fn hinge(&self) -> [f64; 3]

The hinge, the sector’s centre.

Source

pub fn radius_metres(&self) -> f64

The radius, the leaf’s width.

Source

pub fn closed(&self) -> MetricDirection

From the hinge towards the closed leaf’s free edge.

Source

pub fn open(&self) -> MetricDirection

From the hinge along the leaf standing open at right angles.

Source

pub fn is_double_acting(&self) -> bool

Whether the leaf swings to both sides.

Source

pub fn sweep(&self) -> f64

The swept angle in radians: π/2, or π for a double-acting leaf.

Source

pub fn direction_at(&self, angle: f64) -> [f64; 3]

Unit direction from the hinge at angle radians along the sweep: the first boundary ray (closed, or the reverse of open for a double-acting leaf) at zero, open at Self::sweep.

Source

pub fn is_horizontal(&self) -> bool

Whether the sector lies in a horizontal plane (its rotation axis is vertical), so that it has a plan footprint of its own shape.

Source

pub fn plan_bounds(&self, segments: usize) -> Option<(PlanRing, PlanRing)>

Two convex plan polygons bracketing the sector’s footprint, each anticlockwise: the first inscribed (every point lies in the sector), the second circumscribed (the sector lies in it). segments chords or tangents approximate each quarter turn; their radial gap is at most radius · (1 / cos(π / (4 · segments)) − 1).

None for a sector that is not horizontal or for no segments.

Trait Implementations§

Source§

impl Clone for SwingSector

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 Copy for SwingSector

Source§

impl Debug for SwingSector

Source§

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

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

impl PartialEq for SwingSector

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 SwingSector

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.