Skip to main content

Curve2d

Trait Curve2d 

Source
pub trait Curve2d {
    // Required methods
    fn domain(&self) -> (f64, f64);
    fn point_at(&self, u: f64, tol: Tolerances) -> OgeomResult<Point2>;
    fn d1_at(&self, u: f64, tol: Tolerances) -> OgeomResult<Vector2>;
    fn derivatives_at(
        &self,
        u: f64,
        n: usize,
        tol: Tolerances,
    ) -> OgeomResult<Vec<Vector2>>;
    fn kind(&self) -> CurveKind;
    fn is_closed(&self, tol: Tolerances) -> bool;
    fn is_periodic(&self) -> bool;

    // Provided methods
    fn start(&self, tol: Tolerances) -> OgeomResult<Point2> { ... }
    fn end(&self, tol: Tolerances) -> OgeomResult<Point2> { ... }
}
Expand description

A parametric curve in the plane.

The same contract as Curve3d, one dimension down. Kept as a separate trait rather than a generic parameter because pcurves (curves in a surface’s parameter space) are used differently enough from spatial curves that conflating them invites mistakes.

Required Methods§

Source

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

The parameter interval over which the curve is defined.

Source

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

The point at u.

§Errors

OgeomError::Domain if u is outside the domain and the curve is not periodic.

Source

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

The first derivative at u.

§Errors

As Curve2d::point_at.

Source

fn derivatives_at( &self, u: f64, n: usize, tol: Tolerances, ) -> OgeomResult<Vec<Vector2>>

Derivatives up to order n, with result[0] the point itself.

§Errors

As Curve2d::point_at.

Source

fn kind(&self) -> CurveKind

What kind of curve this is.

Source

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

Whether the curve’s ends meet.

Source

fn is_periodic(&self) -> bool

Whether the curve continues past its domain by repeating.

Provided Methods§

Source

fn start(&self, tol: Tolerances) -> OgeomResult<Point2>

The start point.

§Errors

As Curve2d::point_at.

Source

fn end(&self, tol: Tolerances) -> OgeomResult<Point2>

The end point.

§Errors

As Curve2d::point_at.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§