pub trait Curve: Send + Sync {
// Required method
fn sample(&self, t: f32) -> Vec3;
// Provided methods
fn tangent(&self, t: f32) -> Vec3 { ... }
fn unit_tangent(&self, t: f32) -> Vec3 { ... }
fn normal_2d(&self, t: f32) -> Vec3 { ... }
fn arc_length(&self, n: u32) -> f32 { ... }
fn build_arc_table(&self, n: u32) -> ArcTable { ... }
fn sample_uniform(&self, n: usize) -> Vec<Vec3> { ... }
fn sample_arc_uniform(&self, n: usize, table_resolution: u32) -> Vec<Vec3> { ... }
fn bounding_box(&self, resolution: u32) -> (Vec3, Vec3) { ... }
fn closest_point(&self, query: Vec3, resolution: u32) -> (f32, Vec3) { ... }
}Expand description
Common interface for parametric curves.
Required Methods§
Provided Methods§
Sourcefn unit_tangent(&self, t: f32) -> Vec3
fn unit_tangent(&self, t: f32) -> Vec3
Sample unit tangent at t.
Sourcefn normal_2d(&self, t: f32) -> Vec3
fn normal_2d(&self, t: f32) -> Vec3
Sample the normal (perpendicular to tangent) at t, in the XY plane.
Sourcefn arc_length(&self, n: u32) -> f32
fn arc_length(&self, n: u32) -> f32
Approximate arc length using n segments.
Sourcefn build_arc_table(&self, n: u32) -> ArcTable
fn build_arc_table(&self, n: u32) -> ArcTable
Build an arc-length table with n segments for uniform-speed queries.
Sourcefn sample_uniform(&self, n: usize) -> Vec<Vec3>
fn sample_uniform(&self, n: usize) -> Vec<Vec3>
Sample n evenly-spaced points along the curve (by parameter).
Sourcefn sample_arc_uniform(&self, n: usize, table_resolution: u32) -> Vec<Vec3>
fn sample_arc_uniform(&self, n: usize, table_resolution: u32) -> Vec<Vec3>
Sample n points at equal arc-length intervals.
Sourcefn bounding_box(&self, resolution: u32) -> (Vec3, Vec3)
fn bounding_box(&self, resolution: u32) -> (Vec3, Vec3)
Bounding box as (min, max).