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
impl SwingSector
Sourcepub fn try_new(
hinge: [f64; 3],
radius: f64,
closed: MetricDirection,
open: MetricDirection,
double_acting: bool,
) -> Result<Self, DoorLeavesError>
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.
Sourcepub fn radius_metres(&self) -> f64
pub fn radius_metres(&self) -> f64
The radius, the leaf’s width.
Sourcepub fn closed(&self) -> MetricDirection
pub fn closed(&self) -> MetricDirection
From the hinge towards the closed leaf’s free edge.
Sourcepub fn open(&self) -> MetricDirection
pub fn open(&self) -> MetricDirection
From the hinge along the leaf standing open at right angles.
Sourcepub fn is_double_acting(&self) -> bool
pub fn is_double_acting(&self) -> bool
Whether the leaf swings to both sides.
Sourcepub fn direction_at(&self, angle: f64) -> [f64; 3]
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.
Sourcepub fn is_horizontal(&self) -> bool
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.
Sourcepub fn plan_bounds(&self, segments: usize) -> Option<(PlanRing, PlanRing)>
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.