pub struct Profile2D {
pub outer: Vec<Point2<f64>>,
pub holes: Vec<Vec<Point2<f64>>>,
}Expand description
2D Profile with optional holes
Fields§
§outer: Vec<Point2<f64>>Outer boundary (counter-clockwise)
holes: Vec<Vec<Point2<f64>>>Holes (clockwise)
Implementations§
Source§impl Profile2D
impl Profile2D
Sourcepub fn center_on_bbox(&mut self)
pub fn center_on_bbox(&mut self)
Translate the profile so the centre of its outer bounding box sits at the origin.
IFC parameterised profiles (I/U/L/T/C/Z/…) are defined centred on their
bounding box, and the swept-area Position placement is applied relative
to that centred origin. Some per-shape builders are easier to read when
written from a corner; centring them here in one place keeps every
parametric profile consistent with the spec. Holes are shifted by the same
offset so they stay aligned with the outer boundary. No-op for profiles
that are already centred.
Sourcepub fn make_outer_ccw(&mut self)
pub fn make_outer_ccw(&mut self)
Reverse outer when it winds clockwise, so the counter-clockwise
contract on outer holds however a builder listed
its points. Holes are untouched (their contract is clockwise and the
hollow builders emit them that way). The extrusion and earcut paths
each re-derive orientation and were right either way; the 2D drawing
path emits outer verbatim, and that is where a clockwise T or Z
showed.
Sourcepub fn triangulate(&self) -> Result<TriangulationOf<f64>>
pub fn triangulate(&self) -> Result<TriangulationOf<f64>>
Triangulate the profile using earcutr Returns triangle indices into the flattened vertex array
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Profile2D
impl RefUnwindSafe for Profile2D
impl Send for Profile2D
impl Sync for Profile2D
impl Unpin for Profile2D
impl UnwindSafe for Profile2D
Blanket Implementations§
§impl<U> As for U
impl<U> As for U
§fn as_<T>(self) -> Twhere
T: CastFrom<U>,
fn as_<T>(self) -> Twhere
T: CastFrom<U>,
self to type T. The semantics of numeric casting with the as operator are followed, so <T as As>::as_::<U> can be used in the same way as T as U for numeric conversions. Read moreSource§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> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more§impl<T> Pointable for T
impl<T> Pointable 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.