pub trait GeometricObject<Point: Clone, Input> {
type Error;
// Required methods
fn get_points(&self) -> BTreeSet<&Point>;
fn from_vector<T>(points: Vec<T>) -> Self
where Self: Sized,
T: Into<Point> + Clone;
fn construct<T>(method: T) -> Result<Self, Self::Error>
where Self: Sized,
T: Into<ConstructionMethod<Point, Input, Self::Error>>;
// Provided methods
fn vector(&self) -> Vec<&Point> { ... }
fn to_vector(&self) -> Vec<&Point> { ... }
fn calculate_range<I>(iter: I) -> (Decimal, Decimal)
where I: Iterator<Item = Decimal> { ... }
}Expand description
Defines a geometric object constructed from a set of points. Provides methods for creating, accessing, and manipulating these objects.
Required Associated Types§
Required Methods§
Sourcefn get_points(&self) -> BTreeSet<&Point>
fn get_points(&self) -> BTreeSet<&Point>
Returns a BTreeSet containing references to the points that constitute the geometric object.
The BTreeSet ensures that the points are ordered and unique.
Sourcefn from_vector<T>(points: Vec<T>) -> Self
fn from_vector<T>(points: Vec<T>) -> Self
Creates a new geometric object from a Vec of points.
The generic type T represents the input point type, which can be converted into the Point
type associated with the geometric object.
Sourcefn construct<T>(method: T) -> Result<Self, Self::Error>
fn construct<T>(method: T) -> Result<Self, Self::Error>
Constructs a geometric object using a specific construction method.
The generic type T represents a type that can be converted into a ConstructionMethod.
The ConstructionMethod enum provides different strategies for building geometric objects,
such as constructing from a set of data points or from a parametric function.
This method returns a Result to handle potential errors during construction.
§Errors
Returns the implementation’s Self::Error when the provided
construction method cannot produce a valid geometry, for
example when a FromData input is empty or a parametric
function surfaces a domain violation.
Provided Methods§
Sourcefn vector(&self) -> Vec<&Point>
fn vector(&self) -> Vec<&Point>
Returns a Vec containing references to the points that constitute the geometric object.
This method simply converts the BTreeSet from get_points into a Vec.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".
Implementors§
Source§impl GeometricObject<Point2D, Decimal> for Curve
impl GeometricObject<Point2D, Decimal> for Curve
type Error = CurveError
Source§impl GeometricObject<Point3D, Point2D> for Surface
Implementation of the GeometricObject trait for the Surface struct.
impl GeometricObject<Point3D, Point2D> for Surface
Implementation of the GeometricObject trait for the Surface struct.
This implementation provides functionality to create and manipulate 3D surfaces using points in three-dimensional space. It supports construction from explicit point collections or through parametric functions.
§Type Parameters
- Uses
Point3Das the points that form the surface - Uses
Point2Das the parametric input for surface generation
§Methods
get_points(): Retrieves all points in the surfacefrom_vector(): Constructs a surface from a vector of pointsconstruct(): Creates a surface using different construction methods
§Error Handling
Uses SurfaceError for various error conditions, including:
- Empty point collections
- Invalid construction parameters
- Errors during parametric function evaluation