pub struct MobiusStrip {
pub radius: f32,
pub width: f32,
}Expand description
A Mobius strip parameterized by radius (center circle) and width (strip half-width).
Fields§
§radius: f32§width: f32Implementations§
Source§impl MobiusStrip
impl MobiusStrip
pub fn new(radius: f32, width: f32) -> Self
Sourcepub fn parametric(&self, u: f32, v: f32) -> Vec3
pub fn parametric(&self, u: f32, v: f32) -> Vec3
Parametric surface of the Mobius strip. u in [0, 2*PI) — around the strip v in [-1, 1] — across the strip width
Sourcepub fn position_on_strip(&self, t: f32, s: f32) -> Vec3
pub fn position_on_strip(&self, t: f32, s: f32) -> Vec3
Position on the strip given: t in [0, 1) — fraction around the strip s in [-1, 1] — fraction across the strip width
Sourcepub fn normal_at(&self, u: f32, v: f32) -> Vec3
pub fn normal_at(&self, u: f32, v: f32) -> Vec3
Surface normal at (u, v). The normal flips sign after one full loop (u -> u + 2*PI), demonstrating the one-sidedness of the Mobius strip.
Sourcepub fn walk(&self, distance: f32) -> (Vec3, bool)
pub fn walk(&self, distance: f32) -> (Vec3, bool)
Walk a given distance along the center of the strip. Returns (position, on_backside). After traveling the full circumference (2PIradius), you end up on the back side.
Sourcepub fn generate_mesh(&self, u_steps: usize, v_steps: usize) -> Vec<Vec3>
pub fn generate_mesh(&self, u_steps: usize, v_steps: usize) -> Vec<Vec3>
Generate a mesh of the strip for rendering.
Sourcepub fn centerline(&self, steps: usize) -> Vec<Vec3>
pub fn centerline(&self, steps: usize) -> Vec<Vec3>
Generate the centerline of the strip.
Trait Implementations§
Source§impl Clone for MobiusStrip
impl Clone for MobiusStrip
Source§fn clone(&self) -> MobiusStrip
fn clone(&self) -> MobiusStrip
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for MobiusStrip
impl RefUnwindSafe for MobiusStrip
impl Send for MobiusStrip
impl Sync for MobiusStrip
impl Unpin for MobiusStrip
impl UnsafeUnpin for MobiusStrip
impl UnwindSafe for MobiusStrip
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
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Convert
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Convert
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Convert
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Convert
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.