Skip to main content

Condition

Trait Condition 

Source
pub trait Condition {
    // Required methods
    fn unknowns(&self) -> usize;
    fn position(&self, x: &[f64], tol: Tolerances) -> Option<Point>;
    fn position_gradient(
        &self,
        x: &[f64],
        tol: Tolerances,
    ) -> Option<Vec<Vector>>;
    fn system(
        &self,
        x: &[f64],
        tol: Tolerances,
    ) -> Option<(Vec<f64>, Vec<Vec<f64>>)>;
    fn clamp(&self, x: &mut [f64]);
    fn outside(&self, x: &[f64], tol: Tolerances) -> bool;
    fn near_edge(&self, x: &[f64]) -> bool;
    fn extent(&self) -> f64;

    // Provided methods
    fn tangent_is_oriented(&self) -> bool { ... }
    fn tangent(&self, x: &[f64], tol: Tolerances) -> Option<Vector> { ... }
}
Expand description

A curve stated as what it satisfies, and everything needed to follow it.

The parameter vector is whatever the condition is posed in: four numbers for a surface pair, two for a silhouette, five for a blend section marching a guide. The walker never interprets them.

Required Methods§

Source

fn unknowns(&self) -> usize

How many unknowns the condition is posed in.

Source

fn position(&self, x: &[f64], tol: Tolerances) -> Option<Point>

Where a parameter vector puts the curve in space.

Source

fn position_gradient(&self, x: &[f64], tol: Tolerances) -> Option<Vec<Vector>>

How the position moves with each unknown: one vector per unknown.

The walker needs this to write its own travel equation, which is a statement about where the point goes rather than about the parameters.

Source

fn system( &self, x: &[f64], tol: Tolerances, ) -> Option<(Vec<f64>, Vec<Vec<f64>>)>

The condition itself: n − 1 residuals, and the Jacobian of them.

None where the condition cannot be evaluated there at all, which the walker reads as a stall rather than as a zero.

Source

fn clamp(&self, x: &mut [f64])

Bring a parameter vector back into the region the condition is posed on. Called before every evaluation, so a condition may assume it.

Source

fn outside(&self, x: &[f64], tol: Tolerances) -> bool

Whether a parameter vector has left that region.

Source

fn near_edge(&self, x: &[f64]) -> bool

Whether it is at the edge of it, which is how a stall at a boundary is told apart from a stall at a singularity.

Source

fn extent(&self) -> f64

A length scale for the step control: how big the thing being walked is.

Provided Methods§

Source

fn tangent_is_oriented(&self) -> bool

Whether Condition::tangent’s sign is its own, continuous along the curve, or arbitrary from point to point.

A null vector’s sign is whatever the arithmetic gave it, so the default answer is no and the walker keeps its own heading. Saying yes is a claim, and a load-bearing one: where two surfaces touch, the cross product of their normals swaps sides, and a walker that quietly turned it back round would march from one branch onto the other straight through the tangency: two thin curves through two touching points coming back as one confident loop that is on neither of them. The flip is the signal, not noise.

Source

fn tangent(&self, x: &[f64], tol: Tolerances) -> Option<Vector>

The direction the curve runs, as a unit vector in space.

The default derives it from the condition’s own Jacobian: the tangent in parameter space is that matrix’s null vector, and the space tangent is the position gradient applied to it. A condition with a cheaper or more careful formula overrides this, and “more careful” is not hypothetical, since the null vector says nothing about whether the direction it found is real or is the residual’s own noise.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§