pub struct EdgeData {
pub tolerance: Tolerance,
pub representations: SmallVec<[EdgeRepr; 3]>,
pub degenerate: bool,
/* private fields */
}Expand description
An edge: a tolerance, a set of representations, and the flags that say whether they agree.
Fields§
§tolerance: ToleranceThe radius within which the edge lies.
representations: SmallVec<[EdgeRepr; 3]>Every way this edge is described. See the module documentation.
degenerate: boolWhether the edge has no length: a cone’s apex, a sphere’s pole.
A degenerate edge still bounds a face in parameter space even though it covers no distance in space, which is why it exists rather than being dropped.
Implementations§
Source§impl EdgeData
impl EdgeData
Sourcepub fn on_curve(curve: CurveId, location: Location, range: (f64, f64)) -> Self
pub fn on_curve(curve: CurveId, location: Location, range: (f64, f64)) -> Self
An edge on a curve in space.
Sourcepub fn add(&mut self, repr: EdgeRepr)
pub fn add(&mut self, repr: EdgeRepr)
Add a representation.
Adding one invalidates the EdgeData::same_parameter claim: the new
representation has not been shown to agree with the others. Re-establish
it deliberately, with EdgeData::assert_same_parameter.
Sourcepub const fn same_parameter(&self) -> bool
pub const fn same_parameter(&self) -> bool
Whether every representation agrees on parameterization.
The claim is that curve3d(t) and surface(pcurve(t)) are the same
point, within the edge’s tolerance, for the same t. It matters because
nearly every algorithm evaluates whichever representation is convenient
and assumes the answer is interchangeable.
It can be false (an imported edge whose pcurve was fitted independently of its 3D curve routinely is), which is why it is a flag to be checked rather than an invariant to be assumed.
Sourcepub const fn assert_same_parameter(&mut self, agrees: bool)
pub const fn assert_same_parameter(&mut self, agrees: bool)
Record that the representations have been checked and agree.
Only for a caller that has actually verified it: evaluate each representation at the same parameters and confirm they land within the edge’s tolerance of one another. Setting it without checking is how an edge ends up with a pcurve that does not follow its own curve, and nothing downstream will notice until a face fails to close.
Sourcepub fn curve3d(&self) -> Option<&EdgeRepr>
pub fn curve3d(&self) -> Option<&EdgeRepr>
The representation on a given curve in space, if any.
Sourcepub fn pcurve_on(&self, surface: SurfaceId) -> Option<&EdgeRepr>
pub fn pcurve_on(&self, surface: SurfaceId) -> Option<&EdgeRepr>
The representation in surface’s parameter space, if any.
Sourcepub fn pcurve_for(
&self,
surface: SurfaceId,
location: &Location,
) -> Option<&EdgeRepr>
pub fn pcurve_for( &self, surface: SurfaceId, location: &Location, ) -> Option<&EdgeRepr>
The representation in surface’s parameter space for an occurrence at
location.
One edge node can bound one face at more than one placement (the top and bottom of a prism are the same edge, moved), and those two occurrences run along different lines of the same parameter space. Asked by surface alone, the lookup returns whichever was attached first and both ends of the prism collapse onto one.
Falls back to a representation attached without a placement, which is what every unplaced edge has and what keeps the simple case simple.
Sourcepub fn parametric_surfaces(&self) -> Vec<SurfaceId> ⓘ
pub fn parametric_surfaces(&self) -> Vec<SurfaceId> ⓘ
Every surface this edge has a pcurve on.
Trait Implementations§
impl StructuralPartialEq for EdgeData
Auto Trait Implementations§
impl Freeze for EdgeData
impl RefUnwindSafe for EdgeData
impl Send for EdgeData
impl Sync for EdgeData
impl Unpin for EdgeData
impl UnsafeUnpin for EdgeData
impl UnwindSafe for EdgeData
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.