Skip to main content

Surface

Trait Surface 

Source
pub trait Surface {
    // Required method
    fn evaluate(&self, u: f32, v: f32) -> Vec3;

    // Provided methods
    fn normal(&self, u: f32, v: f32) -> Vec3 { ... }
    fn tangent_u(&self, u: f32, v: f32) -> Vec3 { ... }
    fn tangent_v(&self, u: f32, v: f32) -> Vec3 { ... }
    fn u_range(&self) -> (f32, f32) { ... }
    fn v_range(&self) -> (f32, f32) { ... }
    fn wraps_u(&self) -> bool { ... }
    fn wraps_v(&self) -> bool { ... }
    fn name(&self) -> &str { ... }
}
Expand description

A parametric surface defined over (u, v) in [0, 1] x [0, 1].

Required Methods§

Source

fn evaluate(&self, u: f32, v: f32) -> Vec3

Evaluate the surface position at parameter (u, v).

Provided Methods§

Source

fn normal(&self, u: f32, v: f32) -> Vec3

Compute the surface normal at parameter (u, v). Default implementation uses central differences.

Source

fn tangent_u(&self, u: f32, v: f32) -> Vec3

Compute the partial derivative with respect to u at (u, v).

Source

fn tangent_v(&self, u: f32, v: f32) -> Vec3

Compute the partial derivative with respect to v at (u, v).

Source

fn u_range(&self) -> (f32, f32)

Parameter domain for u: (min, max). Defaults to (0, 1).

Source

fn v_range(&self) -> (f32, f32)

Parameter domain for v: (min, max). Defaults to (0, 1).

Source

fn wraps_u(&self) -> bool

Whether the surface wraps in u. Used for seamless tessellation.

Source

fn wraps_v(&self) -> bool

Whether the surface wraps in v. Used for seamless tessellation.

Source

fn name(&self) -> &str

Human-readable name for debugging.

Implementors§