pub struct Deflection {
pub chord: f64,
pub angular: f64,
pub min_segments: usize,
pub max_segments: usize,
}Expand description
How finely to approximate a curve.
Fields§
§chord: f64The greatest allowed distance from the polyline to the curve.
angular: f64The greatest allowed turn in the tangent across one segment, in radians.
min_segments: usizeA floor on the number of segments for a curve that bends.
A closed curve needs at least three to enclose anything, and a nearly straight arc of one would otherwise collapse to a chord that misses the bulge entirely: the midpoint test is a sample, and one sample can be placed exactly where the curve happens to cross its own chord.
It does not apply to a straight curve, which is exactly represented by its endpoints. Splitting a line adds points that no tolerance asked for, and every one of them becomes a vertex in every face the edge bounds.
max_segments: usizeA ceiling, so a pathological curve cannot exhaust memory.
Reaching it is reported rather than passed off as success; see
Polyline::deflection_met.
Implementations§
Source§impl Deflection
impl Deflection
Sourcepub fn with_chord(chord: f64) -> OgeomResult<Self>
pub fn with_chord(chord: f64) -> OgeomResult<Self>
A deflection with a given chord tolerance and the default angular one.
§Errors
OgeomError::Construction if chord is
not finite and positive.
Sourcepub fn relative(size: f64, fraction: f64) -> OgeomResult<Self>
pub fn relative(size: f64, fraction: f64) -> OgeomResult<Self>
A deflection scaled to a model of the given size.
Relative tolerances are what a caller usually means: “a thousandth of the part” is a statement that survives the part being modelled in metres rather than millimetres, and an absolute default does not.
§Errors
OgeomError::Construction if size or
fraction is not finite and positive.
Sourcepub fn validate(&self) -> OgeomResult<()>
pub fn validate(&self) -> OgeomResult<()>
Check that the settings are usable.
§Errors
OgeomError::Construction if a tolerance
is not positive, or the segment bounds are inconsistent.
Trait Implementations§
Source§impl Clone for Deflection
impl Clone for Deflection
Source§fn clone(&self) -> Deflection
fn clone(&self) -> Deflection
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreimpl Copy for Deflection
Source§impl Debug for Deflection
impl Debug for Deflection
Source§impl Default for Deflection
impl Default for Deflection
Source§impl PartialEq for Deflection
impl PartialEq for Deflection
Source§fn eq(&self, other: &Deflection) -> bool
fn eq(&self, other: &Deflection) -> bool
self and other values to be equal, and is used by ==.impl StructuralPartialEq for Deflection
Auto Trait Implementations§
impl Freeze for Deflection
impl RefUnwindSafe for Deflection
impl Send for Deflection
impl Sync for Deflection
impl Unpin for Deflection
impl UnsafeUnpin for Deflection
impl UnwindSafe for Deflection
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.