pub enum Curve {
Line(LineCurve),
Circle(CircleCurve),
Ellipse(EllipseCurve),
Hyperbola(HyperbolaCurve),
Parabola(ParabolaCurve),
BSpline(BSplineCurve),
Helix(HelixCurve),
Trimmed(Box<TrimmedCurve>),
Offset(Box<OffsetCurve>),
OnSurface(Box<CurveOnSurface>),
}Expand description
A curve in space.
Variants§
Line(LineCurve)
A straight line.
Circle(CircleCurve)
A circle or arc.
Ellipse(EllipseCurve)
An ellipse or arc.
Hyperbola(HyperbolaCurve)
One branch of a hyperbola.
Parabola(ParabolaCurve)
A parabola.
BSpline(BSplineCurve)
A polynomial or rational B-spline.
Helix(HelixCurve)
A helix about an axis, the one transcendental the vocabulary keeps.
Trimmed(Box<TrimmedCurve>)
Another curve restricted to a sub-interval.
Offset(Box<OffsetCurve>)
A curve at a constant distance from another, offset in the plane perpendicular to a reference direction.
OnSurface(Box<CurveOnSurface>)
A surface curve: a pcurve composed with the surface it is drawn on.
Implementations§
Source§impl Curve
impl Curve
Sourcepub fn to_bspline(&self, tol: Tolerances) -> OgeomResult<BSplineCurve>
pub fn to_bspline(&self, tol: Tolerances) -> OgeomResult<BSplineCurve>
This curve as a B-spline, exactly, over [0, 1].
Exact rather than fitted: the result passes through the same points as the original at corresponding parameters, to rounding. The correspondence is not the identity; see the module documentation for why it cannot be.
§Errors
OgeomError::Construction if the curve’s
range is degenerate or its geometry cannot be evaluated.
Sourcepub fn to_bspline_over(
&self,
range: (f64, f64),
tol: Tolerances,
) -> OgeomResult<BSplineCurve>
pub fn to_bspline_over( &self, range: (f64, f64), tol: Tolerances, ) -> OgeomResult<BSplineCurve>
This curve as a B-spline over part of its range.
The span is what gets converted, rather than the whole curve being converted and then trimmed. For a conic those differ: trimming a rational quadratic needs knot insertion at a parameter that has to be solved for, while building the arc directly is a closed form.
§Errors
Source§impl Curve
A spline over [0, 1], whatever it was over.
impl Curve
A spline over [0, 1], whatever it was over.
Sourcepub fn fitted_bspline_over(
&self,
range: (f64, f64),
tolerance: f64,
tol: Tolerances,
) -> OgeomResult<Fitted<BSplineCurve>>
pub fn fitted_bspline_over( &self, range: (f64, f64), tolerance: f64, tol: Tolerances, ) -> OgeomResult<Fitted<BSplineCurve>>
This curve as a B-spline fitted over range to a stated
tolerance, at the curve’s own parameters.
The approximation Curve::to_bspline refuses to make silently:
a helix, an offset curve, a curve on a surface (anything with no
exact rational form) is sampled at its own parameters and fitted
through them, the fit measured against the curve between the
samples as well as at them, and the sampling doubled until the
tolerance is met or the budget runs out. The result is
same-parameter with the curve, so every chart already speaking the
curve’s parameter still does, and its error is what was measured,
not what was asked.
§Errors
OgeomError::Construction if
the range is empty or the tolerance is not a distance; as
fit::fit_points_at.
Source§impl Curve
impl Curve
Sourcepub fn general_transformed(
&self,
t: &GeneralTransform,
tol: Tolerances,
) -> OgeomResult<BSplineCurve>
pub fn general_transformed( &self, t: &GeneralTransform, tol: Tolerances, ) -> OgeomResult<BSplineCurve>
This curve carried through a general affine transform.
A shear or an uneven scale is not a placement: it carries a circle to an ellipse, and an ellipse to a conic with no analytic name here. So the curve is converted to its exact B-spline form first and the control points are moved, which an affine map does exactly: a B-spline is an affine combination of its control points, so transforming them and transforming every point of the curve are the same thing.
The result is a B-spline whatever went in, and its parameterization is
the converted one rather than the original. That is the price of a
transform the analytic types cannot express, and it is why
transformed takes only a
Transform: a placement keeps the type, and only
this does not.
§Errors
As Curve::to_bspline, plus
OgeomError::Construction if the
transform collapses the curve to a point.
Trait Implementations§
Source§impl Curve3d for Curve
impl Curve3d for Curve
Source§fn d1_at(&self, u: f64, tol: Tolerances) -> OgeomResult<Vector>
fn d1_at(&self, u: f64, tol: Tolerances) -> OgeomResult<Vector>
u. Read moreSource§fn continuity(&self) -> Continuity
fn continuity(&self) -> Continuity
Source§fn is_periodic(&self) -> bool
fn is_periodic(&self) -> bool
Source§fn tangent_at(&self, u: f64, tol: Tolerances) -> OgeomResult<Direction>
fn tangent_at(&self, u: f64, tol: Tolerances) -> OgeomResult<Direction>
u. Read moreSource§impl From<BSplineCurve> for Curve
impl From<BSplineCurve> for Curve
Source§fn from(c: BSplineCurve) -> Self
fn from(c: BSplineCurve) -> Self
Source§impl From<CircleCurve> for Curve
impl From<CircleCurve> for Curve
Source§fn from(c: CircleCurve) -> Self
fn from(c: CircleCurve) -> Self
Source§impl From<EllipseCurve> for Curve
impl From<EllipseCurve> for Curve
Source§fn from(c: EllipseCurve) -> Self
fn from(c: EllipseCurve) -> Self
Source§impl From<HelixCurve> for Curve
impl From<HelixCurve> for Curve
Source§fn from(c: HelixCurve) -> Self
fn from(c: HelixCurve) -> Self
Source§impl From<HyperbolaCurve> for Curve
impl From<HyperbolaCurve> for Curve
Source§fn from(c: HyperbolaCurve) -> Self
fn from(c: HyperbolaCurve) -> Self
Source§impl From<ParabolaCurve> for Curve
impl From<ParabolaCurve> for Curve
Source§fn from(c: ParabolaCurve) -> Self
fn from(c: ParabolaCurve) -> Self
Source§impl From<TrimmedCurve> for Curve
impl From<TrimmedCurve> for Curve
Source§fn from(c: TrimmedCurve) -> Self
fn from(c: TrimmedCurve) -> Self
Source§impl Reversible for Curve
impl Reversible for Curve
impl StructuralPartialEq for Curve
Source§impl Transformable for Curve
impl Transformable for Curve
Source§fn transformed(&self, t: &Transform, tol: Tolerances) -> OgeomResult<Self>
fn transformed(&self, t: &Transform, tol: Tolerances) -> OgeomResult<Self>
t. Read moreAuto Trait Implementations§
impl Freeze for Curve
impl RefUnwindSafe for Curve
impl Send for Curve
impl Sync for Curve
impl Unpin for Curve
impl UnsafeUnpin for Curve
impl UnwindSafe for Curve
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> Scalar for T
§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self from the equivalent element of its
superset. Read more§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).§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset but without any property checks. Always succeeds.§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self to the equivalent element of its superset.