pub struct Torus { /* private fields */ }Expand description
A torus, with the frame’s z as its axis of revolution.
Implementations§
Source§impl Torus
impl Torus
Sourcepub fn new(
frame: Frame,
major_radius: f64,
minor_radius: f64,
tol: Tolerances,
) -> OgeomResult<Self>
pub fn new( frame: Frame, major_radius: f64, minor_radius: f64, tol: Tolerances, ) -> OgeomResult<Self>
A torus about frame’s z axis.
major_radius is the distance from the axis to the centre of the tube;
minor_radius is the tube’s own radius.
§Errors
OgeomError::Construction if either
radius is not finite and positive. A minor radius exceeding the major is
allowed: that is a spindle torus, a real self-intersecting surface, and
Torus::kind reports which case this is.
Sourcepub const fn major_radius(&self) -> f64
pub const fn major_radius(&self) -> f64
The distance from the axis to the centre of the tube.
Sourcepub const fn minor_radius(&self) -> f64
pub const fn minor_radius(&self) -> f64
The radius of the tube.
Sourcepub fn kind(&self, tol: Tolerances) -> TorusKind
pub fn kind(&self, tol: Tolerances) -> TorusKind
Which of the three topological cases this torus falls into.
Sourcepub fn self_intersects(&self, tol: Tolerances) -> bool
pub fn self_intersects(&self, tol: Tolerances) -> bool
Whether the surface passes through itself.
Sourcepub fn signed_distance_to(&self, p: Point) -> f64
pub fn signed_distance_to(&self, p: Point) -> f64
The signed distance from p: negative inside, magnitude the
distance to the nearest sheet.
For a TorusKind::Ring or TorusKind::Horn torus, inside is
the tube. A TorusKind::Spindle torus passes through itself and
bounds two nested regions, and “inside” cannot name both; here it
names the outer one (the apple, the solid of revolution the
outer sheet bounds, which contains the lemon) because that is the
region the torus-as-a-solid occupies. The magnitude is measured to
whichever sheet is nearer, the folded inner sheet included, so a
point on either sheet reads zero.
Sourcepub fn distance_to(&self, p: Point) -> f64
pub fn distance_to(&self, p: Point) -> f64
The distance from p to the surface.
Correct for all three kinds. In the half-plane at a fixed azimuth, the surface’s profile is the generating circle folded about the axis: when the minor radius exceeds the major, part of that circle lies on the far side of the axis and sweeps to the near side. Measuring only to the unfolded branch (which is what the signed form does) then reports a point on the surface as being some distance off it.
Sourcepub fn contains(&self, p: Point, tol: Tolerances) -> bool
pub fn contains(&self, p: Point, tol: Tolerances) -> bool
Whether p lies on the surface within tol.confusion().
Sourcepub fn area(&self) -> f64
pub fn area(&self) -> f64
The surface area, for a ring torus.
Meaningless for a spindle torus, whose surface overlaps itself.
Sourcepub fn transformed(&self, t: &Transform, tol: Tolerances) -> OgeomResult<Self>
pub fn transformed(&self, t: &Transform, tol: Tolerances) -> OgeomResult<Self>
Trait Implementations§
impl Copy for Torus
impl StructuralPartialEq for Torus
Auto Trait Implementations§
impl Freeze for Torus
impl RefUnwindSafe for Torus
impl Send for Torus
impl Sync for Torus
impl Unpin for Torus
impl UnsafeUnpin for Torus
impl UnwindSafe for Torus
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> Scalar for T
§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self from the equivalent element of its
superset. Read more§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self is actually part of its subset T (and can be converted to it).§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset but without any property checks. Always succeeds.§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self to the equivalent element of its superset.