pub struct Shape { /* private fields */ }Expand description
A shape: a topology node, a placement, and an orientation.
Cheap to copy (a key, a small chain and an enum), so it is passed by value everywhere.
Implementations§
Source§impl Shape
impl Shape
Sourcepub const fn new(
node: TShapeId,
location: Location,
orientation: Orientation,
) -> Self
pub const fn new( node: TShapeId, location: Location, orientation: Orientation, ) -> Self
A shape from its three parts.
Sourcepub const fn orientation(&self) -> Orientation
pub const fn orientation(&self) -> Orientation
The orientation.
Sourcepub fn moved(&self, outer: &Location) -> Self
pub fn moved(&self, outer: &Location) -> Self
This shape moved by outer, applied before its own placement.
The operation traversal uses on descent: a child’s placement within the world is its parent’s composed with its own.
Sourcepub fn oriented(&self, orientation: Orientation) -> Self
pub fn oriented(&self, orientation: Orientation) -> Self
This shape with a different orientation.
Sourcepub fn composed(&self, outer: Orientation) -> Self
pub fn composed(&self, outer: Orientation) -> Self
This shape’s orientation composed under outer.
The other half of what traversal does on descent.
Sourcepub fn transform(&self, store: &DatumStore) -> OgeomResult<Transform>
pub fn transform(&self, store: &DatumStore) -> OgeomResult<Transform>
Sourcepub fn is_partner(&self, other: &Self) -> bool
pub fn is_partner(&self, other: &Self) -> bool
Whether two shapes share a topology node, ignoring placement and orientation.
“Is this the same underlying topology, anywhere, any way round?”: the question to ask when relating a shape to another instance of itself elsewhere in an assembly.
Sourcepub fn is_same(&self, other: &Self) -> bool
pub fn is_same(&self, other: &Self) -> bool
Whether two shapes share a node and a placement, ignoring orientation.
The common case, and the one most algorithms want: an edge and its reverse are the same edge in the same place, and a set of edges should hold one of them, not two.
Sourcepub fn is_equal(&self, other: &Self) -> bool
pub fn is_equal(&self, other: &Self) -> bool
Whether two shapes agree in all three parts.
Exact identity. An edge and its reverse are not equal, which is what makes a wire’s direction of travel expressible.
Sourcepub fn is_same_position(
&self,
other: &Self,
store: &DatumStore,
tol: Tolerances,
) -> OgeomResult<bool>
pub fn is_same_position( &self, other: &Self, store: &DatumStore, tol: Tolerances, ) -> OgeomResult<bool>
Whether two shapes occupy the same place, comparing composed transforms rather than chains.
Costlier than Shape::is_same and answers a different question: two
placements built by different routes can land in the same position.
§Errors
Trait Implementations§
impl Eq for Shape
Source§impl PartialEq for Shape
Equality by Shape::is_equal: node, placement and orientation.
impl PartialEq for Shape
Equality by Shape::is_equal: node, placement and orientation.
The strictest of the three, chosen as the derive-shaped default so that a
plain == never silently means something looser than the reader expects.
Code that wants a weaker equivalence says so, through SameKey or
PartnerKey.
Auto Trait Implementations§
impl Freeze for Shape
impl RefUnwindSafe for Shape
impl Send for Shape
impl Sync for Shape
impl Unpin for Shape
impl UnsafeUnpin for Shape
impl UnwindSafe for Shape
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.