pub enum ConstructionMethod<Point, Input, Error> {
FromData {
points: BTreeSet<Point>,
},
Parametric {
f: Box<dyn Fn(Input) -> Result<Point, Error> + Send + Sync>,
params: ConstructionParams,
},
}Expand description
Defines methods for constructing geometric objects.
This enum provides two primary approaches to creating geometric objects:
- Direct construction from a set of predefined points
- Parametric generation using a mathematical function
The generic parameters allow flexibility in the types of points and input parameters used:
Point: The type representing a coordinate in the geometric spaceInput: The parameter type passed to parametric functions (typicallyDecimalfor 2D or(Decimal, Decimal)for 3D)Error: The error the parametric generator reports.crate::geometrics::GeometricObject::constructbinds it to the object’s ownSelf::Error, so a generator for acrate::curves::Curvereturnscrate::error::CurveErrorand one for acrate::surfaces::Surfacereturnscrate::error::SurfaceError. The generator’s own failure travels in that type’sGeneratorvariant, which keeps the original cause as itssourcerather than flattening it at the construction boundary.
Variants§
FromData
Construct a geometric object from an explicit set of points.
This method uses a sorted collection of points to directly define the geometry without requiring any computation.
Parametric
Construct a geometric object using a parametric function.
This method generates points by evaluating a mathematical function at specific parameter values defined by the construction parameters.
Fields
f: Box<dyn Fn(Input) -> Result<Point, Error> + Send + Sync>Function that maps from parameter space to point coordinates. Must be thread-safe to support parallel computation.
It reports the constructed object’s own error type, so a failure reaches the caller as the variant the generator raised instead of being flattened into a string at the construction boundary.
params: ConstructionParamsParameters defining the domain for sampling the parametric function
Auto Trait Implementations§
impl<Point, Input, Error> !RefUnwindSafe for ConstructionMethod<Point, Input, Error>
impl<Point, Input, Error> !UnwindSafe for ConstructionMethod<Point, Input, Error>
impl<Point, Input, Error> Freeze for ConstructionMethod<Point, Input, Error>
impl<Point, Input, Error> Send for ConstructionMethod<Point, Input, Error>
impl<Point, Input, Error> Sync for ConstructionMethod<Point, Input, Error>
impl<Point, Input, Error> Unpin for ConstructionMethod<Point, Input, Error>
impl<Point, Input, Error> UnsafeUnpin for ConstructionMethod<Point, Input, Error>where
BTreeSet<Point>: UnsafeUnpin,
Box<dyn Fn(Input) -> Result<Point, Error> + Send + Sync>: UnsafeUnpin,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self to the equivalent element of its superset.