Skip to main content

EdgeData

Struct EdgeData 

Source
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: Tolerance

The radius within which the edge lies.

§representations: SmallVec<[EdgeRepr; 3]>

Every way this edge is described. See the module documentation.

§degenerate: bool

Whether 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

Source

pub fn new() -> Self

An edge with no representations yet.

Source

pub fn on_curve(curve: CurveId, location: Location, range: (f64, f64)) -> Self

An edge on a curve in space.

Source

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.

Source

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.

Source

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.

Source

pub fn curve3d(&self) -> Option<&EdgeRepr>

The representation on a given curve in space, if any.

Source

pub fn pcurve_on(&self, surface: SurfaceId) -> Option<&EdgeRepr>

The representation in surface’s parameter space, if any.

Source

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.

Source

pub fn parametric_surfaces(&self) -> Vec<SurfaceId> ⓘ

Every surface this edge has a pcurve on.

Source

pub fn widen(&mut self, to: Tolerance)

Widen this edge’s tolerance.

Trait Implementations§

Source§

impl Clone for EdgeData

Source§

fn clone(&self) -> EdgeData

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for EdgeData

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for EdgeData

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl PartialEq for EdgeData

Source§

fn eq(&self, other: &EdgeData) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl StructuralPartialEq for EdgeData

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> Scalar for T
where T: 'static + Clone + PartialEq + Debug,

§

impl<SS, SP> SupersetOf<SS> for SP
where SS: SubsetOf<SP>,

§

fn to_subset(&self) -> Option<SS>

The inverse inclusion map: attempts to construct self from the equivalent element of its superset. Read more
§

fn is_in_subset(&self) -> bool

Checks if self is actually part of its subset T (and can be converted to it).
§

fn to_subset_unchecked(&self) -> SS

Use with care! Same as self.to_subset but without any property checks. Always succeeds.
§

fn from_subset(element: &SS) -> SP

The inclusion map: converts self to the equivalent element of its superset.
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.