pub struct Placement<S> {
pub geometry_id: String,
pub instance: usize,
pub position: Vec<S>,
pub rotation: Vec<S>,
pub boundary_index: usize,
pub mirrored: bool,
pub rotation_index: Option<usize>,
}Expand description
Represents the placement of a geometry within a boundary.
Fields§
§geometry_id: StringThe ID of the placed geometry.
instance: usizeInstance index (0-based) when multiple copies exist.
position: Vec<S>Position coordinates (x, y for 2D; x, y, z for 3D).
rotation: Vec<S>Rotation angle(s) in radians.
- 2D: single angle
[θ] - 3D: Euler angles
[rx, ry, rz]or quaternion components
boundary_index: usizeIndex of the boundary this geometry is placed in (for multi-bin scenarios).
mirrored: boolWhether the geometry was mirrored/flipped.
rotation_index: Option<usize>The rotation option index used (if discrete rotations).
Implementations§
Source§impl<S> Placement<S>
impl<S> Placement<S>
Sourcepub fn new_2d(
geometry_id: String,
instance: usize,
x: S,
y: S,
angle: S,
) -> Placement<S>
pub fn new_2d( geometry_id: String, instance: usize, x: S, y: S, angle: S, ) -> Placement<S>
Creates a new 2D placement.
Sourcepub fn new_3d(
geometry_id: String,
instance: usize,
x: S,
y: S,
z: S,
rx: S,
ry: S,
rz: S,
) -> Placement<S>
pub fn new_3d( geometry_id: String, instance: usize, x: S, y: S, z: S, rx: S, ry: S, rz: S, ) -> Placement<S>
Creates a new 3D placement.
Sourcepub fn with_boundary(self, index: usize) -> Placement<S>
pub fn with_boundary(self, index: usize) -> Placement<S>
Sets the boundary index.
Sourcepub fn with_mirrored(self, mirrored: bool) -> Placement<S>
pub fn with_mirrored(self, mirrored: bool) -> Placement<S>
Sets the mirrored flag.
Sourcepub fn with_rotation_index(self, index: usize) -> Placement<S>
pub fn with_rotation_index(self, index: usize) -> Placement<S>
Sets the rotation index.
Source§impl<S> Placement<S>
impl<S> Placement<S>
Sourcepub fn to_transform_2d(&self) -> Transform2D<S>
pub fn to_transform_2d(&self) -> Transform2D<S>
Converts a 2D placement to a Transform2D.
Sourcepub fn from_transform_2d(
geometry_id: String,
instance: usize,
transform: &Transform2D<S>,
) -> Placement<S>
pub fn from_transform_2d( geometry_id: String, instance: usize, transform: &Transform2D<S>, ) -> Placement<S>
Creates a 2D placement from a Transform2D.
Sourcepub fn to_transform_3d(&self) -> Transform3D<S>
pub fn to_transform_3d(&self) -> Transform3D<S>
Converts a 3D placement to a Transform3D.
Sourcepub fn from_transform_3d(
geometry_id: String,
instance: usize,
transform: &Transform3D<S>,
) -> Placement<S>
pub fn from_transform_3d( geometry_id: String, instance: usize, transform: &Transform3D<S>, ) -> Placement<S>
Creates a 3D placement from a Transform3D.
Trait Implementations§
Auto Trait Implementations§
impl<S> Freeze for Placement<S>
impl<S> RefUnwindSafe for Placement<S>where
S: RefUnwindSafe,
impl<S> Send for Placement<S>where
S: Send,
impl<S> Sync for Placement<S>where
S: Sync,
impl<S> Unpin for Placement<S>where
S: Unpin,
impl<S> UnwindSafe for Placement<S>where
S: UnwindSafe,
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
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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>
Converts
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>
Converts
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 moreSource§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
The inverse inclusion map: attempts to construct
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
Checks if
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
Use with care! Same as
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
The inclusion map: converts
self to the equivalent element of its superset.