Trait Approx

Source
pub trait Approx: Sized {
    type Approximation;
    type Cache: Default;

    // Required method
    fn approx_with_cache(
        self,
        tolerance: impl Into<Tolerance>,
        cache: &mut Self::Cache,
    ) -> Self::Approximation;

    // Provided method
    fn approx(self, tolerance: impl Into<Tolerance>) -> Self::Approximation { ... }
}
Expand description

Approximate an object

Required Associated Types§

Source

type Approximation

The approximation of the object

Source

type Cache: Default

The cache used to cache approximation results

Required Methods§

Source

fn approx_with_cache( self, tolerance: impl Into<Tolerance>, cache: &mut Self::Cache, ) -> Self::Approximation

Approximate the object, using the provided cache

This is a lower-level method that allows some degree of control over caching. Callers might consider using Approx::approx instead.

Provided Methods§

Source

fn approx(self, tolerance: impl Into<Tolerance>) -> Self::Approximation

Approximate the object

tolerance defines how far the approximation is allowed to deviate from the actual object.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types§

Source§

impl Approx for (&Curve, RangeOnPath)

Source§

type Approximation = Vec<(Point<1>, Point<2>)>

Source§

type Cache = ()

Source§

fn approx_with_cache( self, tolerance: impl Into<Tolerance>, (): &mut Self::Cache, ) -> Self::Approximation

Source§

impl Approx for (&Cycle, &Surface)

Source§

type Approximation = CycleApprox

Source§

type Cache = EdgeCache

Source§

fn approx_with_cache( self, tolerance: impl Into<Tolerance>, cache: &mut Self::Cache, ) -> Self::Approximation

Source§

impl Approx for (&HalfEdge, &Surface)

Source§

type Approximation = HalfEdgeApprox

Source§

type Cache = EdgeCache

Source§

fn approx_with_cache( self, tolerance: impl Into<Tolerance>, cache: &mut Self::Cache, ) -> Self::Approximation

Source§

impl Approx for (GlobalPath, RangeOnPath)

Source§

type Approximation = Vec<(Point<1>, Point<3>)>

Source§

type Cache = ()

Source§

fn approx_with_cache( self, tolerance: impl Into<Tolerance>, (): &mut Self::Cache, ) -> Self::Approximation

Implementors§