pub struct BSplineCurve { /* private fields */ }Expand description
A B-spline curve, polynomial or rational.
Implementations§
Source§impl BSplineCurve
impl BSplineCurve
Sourcepub fn restricted_to_degree(
&self,
max_degree: usize,
tolerance: f64,
tol: Tolerances,
) -> OgeomResult<Fitted<Self>>
pub fn restricted_to_degree( &self, max_degree: usize, tolerance: f64, tol: Tolerances, ) -> OgeomResult<Fitted<Self>>
This curve at a degree no higher than max_degree, to a stated
tolerance: itself where it already is, and otherwise a fit at its
own parameters: what an exchange format with a degree limit needs
written. Same-parameter with the original, error measured.
§Errors
OgeomError::Construction if
max_degree is zero, the curve is periodic (a ring has no ends to
fit between), or the tolerance is not a distance.
Source§impl BSplineCurve
impl BSplineCurve
Sourcepub fn new(
knots: KnotVector,
control: Vec<Point>,
tol: Tolerances,
) -> OgeomResult<Self>
pub fn new( knots: KnotVector, control: Vec<Point>, tol: Tolerances, ) -> OgeomResult<Self>
A polynomial B-spline from a knot vector and control points.
§Errors
OgeomError::Dimension if the control point
count disagrees with the knot vector.
Sourcepub fn rational(
knots: KnotVector,
control: Vec<Weighted<Point>>,
) -> OgeomResult<Self>
pub fn rational( knots: KnotVector, control: Vec<Weighted<Point>>, ) -> OgeomResult<Self>
A rational B-spline from a knot vector and weighted control points.
§Errors
OgeomError::Dimension if the control point
count disagrees with the knot vector.
Sourcepub fn periodic(
control: &[Point],
degree: usize,
tol: Tolerances,
) -> OgeomResult<Self>
pub fn periodic( control: &[Point], degree: usize, tol: Tolerances, ) -> OgeomResult<Self>
A smoothly periodic B-spline through a ring of control points.
The ring is wrapped: the first degree controls repeat past the
end over a uniform knot vector, and evaluation wraps its parameter,
so the loop closes with degree - 1 continuous derivatives and no
clamped seam. The domain runs one knot step per ring point.
§Errors
OgeomError::Construction if the ring
has no more points than the degree, or the degree is zero.
Sourcepub fn periodic_from_parts(
knots: KnotVector,
control: Vec<Weighted<Point>>,
tol: Tolerances,
) -> OgeomResult<Self>
pub fn periodic_from_parts( knots: KnotVector, control: Vec<Weighted<Point>>, tol: Tolerances, ) -> OgeomResult<Self>
The exact periodic representation, as a reader restores it: wrapped knots and control, with the wrap verified rather than assumed.
§Errors
As BSplineCurve::rational, and additionally if the trailing
degree controls do not repeat the leading ones; an unwrapped ring
evaluated periodically would tear at the seam.
Sourcepub fn control_points(&self) -> &[Weighted<Point>]
pub fn control_points(&self) -> &[Weighted<Point>]
The weighted control points.
Sourcepub const fn is_rational(&self) -> bool
pub const fn is_rational(&self) -> bool
Whether the weights differ, so the curve is genuinely rational.
Sourcepub fn with_knot_inserted(
&self,
u: f64,
count: usize,
tol: Tolerances,
) -> OgeomResult<Self>
pub fn with_knot_inserted( &self, u: f64, count: usize, tol: Tolerances, ) -> OgeomResult<Self>
Sourcepub fn reseamed_at(&self, u: f64, tol: Tolerances) -> OgeomResult<Self>
pub fn reseamed_at(&self, u: f64, tol: Tolerances) -> OgeomResult<Self>
The same closed curve with its seam moved to u: what was the
stretch from u to the end now comes first, and the stretch from
the start to u follows it, joined where the old seam was. The
domain keeps its length and begins at u.
§Errors
OgeomError::Construction if the
curve is periodic (its seam is nowhere) or does not close, its
two ends apart by more than a thousand confusions; as
[bspline::split] if u is an end of the domain.
Sourcepub fn extended(
&self,
at_end: bool,
length: f64,
continuity: usize,
tol: Tolerances,
) -> OgeomResult<Self>
pub fn extended( &self, at_end: bool, length: f64, continuity: usize, tol: Tolerances, ) -> OgeomResult<Self>
This curve continued past one end by length in space: the
polynomial continuation of its own end derivatives to the order
continuity, joined on. A polynomial run of degree at most that
order continues as itself, and so does a rational arc’s homogeneous
polynomial: a circle arc continued at order two stays on its circle.
The continuation’s parameter span is solved until its arc length is
length. Extended at the start, the original run keeps its
parameters and the domain grows downward.
§Errors
OgeomError::Construction if the
curve is periodic (it has no end to continue from) or stands still
at that end; as [bspline::extend].
Sourcepub fn extended_to(
&self,
at_end: bool,
target: Point,
continuity: usize,
tol: Tolerances,
) -> OgeomResult<Self>
pub fn extended_to( &self, at_end: bool, target: Point, continuity: usize, tol: Tolerances, ) -> OgeomResult<Self>
This curve continued past one end to target: a piece carrying the
curve’s end derivatives to the order continuity and ending at the
point, joined on. Extended at the start, the original run keeps its
parameters and the domain grows downward.
§Errors
OgeomError::Construction if the
curve is periodic, stands still at that end, or already ends at
target; as [bspline::extend_to].
Trait Implementations§
Source§impl Clone for BSplineCurve
impl Clone for BSplineCurve
Source§fn clone(&self) -> BSplineCurve
fn clone(&self) -> BSplineCurve
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Curve3d for BSplineCurve
impl Curve3d for BSplineCurve
Source§fn continuity(&self) -> Continuity
fn continuity(&self) -> Continuity
Continuity across the whole curve.
A degree-p B-spline is C^(p - m) at an interior knot of multiplicity
m, and the worst interior knot governs the curve. With no interior
knots at all the curve is a single polynomial piece and so genuinely
smooth to every order.
Higher orders than C2 report as C2, which is the highest
Continuity names short of CInfinity. Reporting CInfinity for a
merely-C3 curve would be a claim that is false, and the distinction
above C2 is not one any algorithm here asks about.
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 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 Debug for BSplineCurve
impl Debug for BSplineCurve
Source§impl From<BSplineCurve> for Curve
impl From<BSplineCurve> for Curve
Source§fn from(c: BSplineCurve) -> Self
fn from(c: BSplineCurve) -> Self
Source§impl PartialEq for BSplineCurve
impl PartialEq for BSplineCurve
Source§fn eq(&self, other: &BSplineCurve) -> bool
fn eq(&self, other: &BSplineCurve) -> bool
self and other values to be equal, and is used by ==.impl StructuralPartialEq for BSplineCurve
Auto Trait Implementations§
impl Freeze for BSplineCurve
impl RefUnwindSafe for BSplineCurve
impl Send for BSplineCurve
impl Sync for BSplineCurve
impl Unpin for BSplineCurve
impl UnsafeUnpin for BSplineCurve
impl UnwindSafe for BSplineCurve
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.