Skip to main content

Surface

Trait Surface 

Source
pub trait Surface {
Show 16 methods // Required methods fn domain(&self) -> ((f64, f64), (f64, f64)); fn point_at(&self, u: f64, v: f64, tol: Tolerances) -> OgeomResult<Point>; fn d1_at( &self, u: f64, v: f64, tol: Tolerances, ) -> OgeomResult<(Vector, Vector)>; fn d2_at( &self, u: f64, v: f64, tol: Tolerances, ) -> OgeomResult<(Vector, Vector, Vector)>; fn kind(&self) -> SurfaceKind; fn continuity(&self) -> Continuity; fn is_closed_u(&self, tol: Tolerances) -> bool; fn is_closed_v(&self, tol: Tolerances) -> bool; fn is_periodic_u(&self) -> bool; fn is_periodic_v(&self) -> bool; // Provided methods fn jet_at(&self, u: f64, v: f64, tol: Tolerances) -> OgeomResult<SurfaceJet> { ... } fn normal_at( &self, u: f64, v: f64, tol: Tolerances, ) -> OgeomResult<Direction> { ... } fn curvature_at( &self, u: f64, v: f64, tol: Tolerances, ) -> OgeomResult<SurfaceCurvature> { ... } fn is_degenerate_at( &self, u: f64, v: f64, tol: Tolerances, ) -> OgeomResult<bool> { ... } fn normalize_parameters( &self, u: f64, v: f64, tol: Tolerances, ) -> OgeomResult<(f64, f64)> { ... } fn parameter_outside( &self, t: f64, a: f64, b: f64, periodic: bool, across: bool, tol: Tolerances, ) -> OgeomResult<f64> { ... }
}
Expand description

A parametric surface.

Implementors must guarantee:

  • both domain intervals are non-empty and finite;
  • the derivative methods agree with Surface::point_at;
  • du and dv are the derivatives along the first and second parameters respectively, in that order, for every surface.

Required Methods§

Source

fn domain(&self) -> ((f64, f64), (f64, f64))

The u and v parameter intervals.

Source

fn point_at(&self, u: f64, v: f64, tol: Tolerances) -> OgeomResult<Point>

The point at (u, v).

§Errors

OgeomError::Domain if the parameters lie outside the domain in a direction that is not periodic.

Source

fn d1_at( &self, u: f64, v: f64, tol: Tolerances, ) -> OgeomResult<(Vector, Vector)>

The two first derivatives at (u, v).

§Errors

As Surface::point_at.

Source

fn d2_at( &self, u: f64, v: f64, tol: Tolerances, ) -> OgeomResult<(Vector, Vector, Vector)>

The three second derivatives at (u, v): d2u, duv, d2v.

§Errors

As Surface::point_at.

Source

fn kind(&self) -> SurfaceKind

What kind of surface this is.

Source

fn continuity(&self) -> Continuity

How smooth the surface is across its domain.

Source

fn is_closed_u(&self, tol: Tolerances) -> bool

Whether the surface closes on itself along u.

Source

fn is_closed_v(&self, tol: Tolerances) -> bool

Whether the surface closes on itself along v.

Source

fn is_periodic_u(&self) -> bool

Whether u repeats past the domain.

Source

fn is_periodic_v(&self) -> bool

Whether v repeats past the domain.

Provided Methods§

Source

fn jet_at(&self, u: f64, v: f64, tol: Tolerances) -> OgeomResult<SurfaceJet>

The point and every derivative through second order, together.

The default asks the three accessors above, which is right for a surface carrying its answer in closed form: a plane or a cylinder costs the same either way.

It is not right for a tensor-product patch, where each accessor re-locates the knot spans, rebuilds the basis functions and sums the control grid again, three times, for numbers the order-two table already holds. Anything walking a surface and asking for all six at a point, as a foot-point solve does at every step, pays that over and over. Such surfaces override this.

The contract is agreement to rounding, not to the bit. A patch sums its point by de Boor and its derivatives by basis functions, and those reassociate differently; the combined answer may differ from the separate accessors’ in the last ulp. Callers needing one consistent jet (every value from the same evaluation) should use this and not mix it with the accessors at the same parameters.

§Errors

As Surface::point_at.

Source

fn normal_at(&self, u: f64, v: f64, tol: Tolerances) -> OgeomResult<Direction>

The unit normal at (u, v), following du x dv.

§Errors

OgeomError::Construction at a degeneracy (a pole or an apex) where the tangents determine no normal.

Source

fn curvature_at( &self, u: f64, v: f64, tol: Tolerances, ) -> OgeomResult<SurfaceCurvature>

The principal curvatures and directions at (u, v).

From the two fundamental forms of the jet: the principal curvatures are the eigenvalues of the shape operator I⁻¹ II, the directions its eigenvectors carried into space. Signed against the surface’s own normal, Surface::normal_at, so a sphere of radius r seen from outside reads -1/r twice and a cylinder -1/r round and 0 along.

§Errors

As Surface::normal_at: at a degenerate point there is no normal to sign against.

Source

fn is_degenerate_at(&self, u: f64, v: f64, tol: Tolerances) -> OgeomResult<bool>

Whether the surface degenerates at (u, v).

§Errors

As Surface::point_at.

Source

fn normalize_parameters( &self, u: f64, v: f64, tol: Tolerances, ) -> OgeomResult<(f64, f64)>

Bring (u, v) into the domain, wrapping in whichever directions are periodic, or closed.

A surface that merely closes on itself (a clamped B-spline tube whose first and last control columns coincide) has the same points at both ends of its domain exactly as a periodic one does, and a parameter a whole period past the end names a point it has. A face whose trim runs right round such a tube has a ring that straddles the join whichever way it is slid, so somewhere it is asked past the end; refusing there stopped three bodies of one assembly from meshing at all. Closure is consulted only once a parameter is actually outside, so the common case pays nothing for it.

§Errors

OgeomError::Domain if a parameter is outside a direction’s domain by more than tol.parametric() and that direction neither repeats nor closes.

Source

fn parameter_outside( &self, t: f64, a: f64, b: f64, periodic: bool, across: bool, tol: Tolerances, ) -> OgeomResult<f64>

A parameter outside its domain, or on a periodic direction: wrapped where the direction repeats or closes on itself, refused otherwise.

A surface that merely closes on itself (a clamped B-spline tube whose first and last control columns coincide) has the same points at both ends of its domain exactly as a periodic one does, and a parameter a whole period past the end names a point it has. A face whose trim runs right round such a tube has a ring that straddles the join whichever way it is slid, so somewhere it is asked past the end; refusing there stopped three bodies of one assembly from meshing at all. Closure is consulted only here, once a parameter is actually outside.

§Errors

OgeomError::Domain if the parameter is outside by more than tol.parametric() and the direction neither repeats nor closes.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§