Skip to main content

Spline3D

Struct Spline3D 

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

Parametric 3D spline supporting Catmull-Rom, Cubic Bezier, closed loops, arc-length LUTs, and Bishop frames.

Implementations§

Source§

impl Spline3D

Evaluation, arc-length parameterization, and Bishop frame transport for Spline3D.

Source

pub fn catmull_rom(points: Vec<Vec3>, closed: bool) -> Self

Constructs a Catmull-Rom Spline3D with a precomputed arc-length lookup table.

§Arguments
  • Vec<Vec3> - Control points passed through by the curve.
  • bool - Whether the spline forms a closed periodic loop.
§Returns
  • Self - Constructed Spline3D with precomputed arc-length LUT.
Source

pub fn cubic_bezier(points: Vec<Vec3>, closed: bool) -> Self

Constructs a chained piecewise Cubic Bezier Spline3D with a precomputed arc-length lookup table.

§Arguments
  • Vec<Vec3> - Anchor and handle control points ([P0, C0, C1, P1, ...]).
  • bool - Whether the spline closes back to the initial anchor.
§Returns
  • Self - Constructed Spline3D with precomputed arc-length LUT.
Source

pub fn segment_count(&self) -> usize

Returns the number of piecewise cubic segments in this spline.

§Returns
  • usize - Number of curve segments (0 when fewer than 2 control points exist).
Source

pub fn sample_point(&self, t: f32) -> Vec3

Evaluates the 3D position on the spline at normalized parameter t in [0, 1].

§Arguments
  • f32 - Normalized curve parameter.
§Returns
  • Vec3 - Interpolated finite 3D curve position.
Source

pub fn sample_tangent(&self, t: f32) -> Vec3

Evaluates the unit forward tangent vector on the spline at normalized parameter t.

§Arguments
  • f32 - Normalized curve parameter.
§Returns
  • Vec3 - Unit forward tangent direction.
Source

pub fn sample_t_at_distance(&self, distance: f32) -> f32

Maps an arc-length distance to the corresponding spline parameter t in [0, 1] using binary search.

§Arguments
  • f32 - Distance along the spline from its start.
§Returns
  • f32 - Spline parameter t in [0, 1].
Source

pub fn sample_by_arc_length(&self, distance: f32) -> Vec3

Evaluates the 3D spline position at exact arc-length distance with zero heap allocations.

§Arguments
  • f32 - Arc-length distance along the curve.
§Returns
  • Vec3 - Uniformly parameterized 3D position on the curve.
Source

pub fn sample_bishop_frames(&self, samples: usize) -> Vec<SplineFrame3D>

Computes twist-free parallel-transport Bishop frames uniformly distributed by arc length.

§Arguments
  • usize - Number of frames to generate (clamped to >= 2).
§Returns
  • Vec<SplineFrame3D> - Orthonormal twist-free Bishop frames along the spline.
Source§

impl Spline3D

Implements impl #impl_generics #name #ty_generics #where_clause.

Source

pub fn get_control_points(&self) -> &Vec<Vec3>

Source

pub fn get_mut_control_points(&mut self) -> &mut Vec<Vec3>

Source

pub fn set_control_points(&mut self, val: Vec<Vec3>) -> &mut Self

Source

pub fn get_kind(&self) -> SplineKind

Source

pub fn get_mut_kind(&mut self) -> &mut SplineKind

Source

pub fn set_kind(&mut self, val: SplineKind) -> &mut Self

Source

pub fn get_closed(&self) -> bool

Source

pub fn get_mut_closed(&mut self) -> &mut bool

Source

pub fn set_closed(&mut self, val: bool) -> &mut Self

Source

pub fn get_arc_table(&self) -> &Vec<(f32, f32)>

Source

pub fn get_mut_arc_table(&mut self) -> &mut Vec<(f32, f32)>

Source

pub fn set_arc_table(&mut self, val: Vec<(f32, f32)>) -> &mut Self

Source

pub fn get_total_length(&self) -> f32

Source

pub fn get_mut_total_length(&mut self) -> &mut f32

Source

pub fn set_total_length(&mut self, val: f32) -> &mut Self

Trait Implementations§

Source§

impl Clone for Spline3D

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 Spline3D

Source§

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

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

impl PartialEq for Spline3D

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 Spline3D

Auto Trait Implementations§

§

impl Forget for Spline3D

§

impl Freeze for Spline3D

§

impl Move for Spline3D

§

impl RefUnwindSafe for Spline3D

§

impl Send for Spline3D
where RawVecInner: Send,

§

impl Sync for Spline3D
where RawVecInner: Sync,

§

impl Unpin for Spline3D
where *const u8 is !null: Unpin,

§

impl UnsafeUnpin for Spline3D

§

impl UnwindSafe for Spline3D
where RawVecInner: UnwindSafe,

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.