Placement

Struct Placement 

Source
pub struct Placement<S> {
    pub geometry_id: GeometryId,
    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: GeometryId

The ID of the placed geometry.

§instance: usize

Instance 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: usize

Index of the boundary this geometry is placed in (for multi-bin scenarios).

§mirrored: bool

Whether the geometry was mirrored/flipped.

§rotation_index: Option<usize>

The rotation option index used (if discrete rotations).

Implementations§

Source§

impl<S: Copy + Default> Placement<S>

Source

pub fn new_2d( geometry_id: GeometryId, instance: usize, x: S, y: S, angle: S, ) -> Self

Creates a new 2D placement.

Source

pub fn new_3d( geometry_id: GeometryId, instance: usize, x: S, y: S, z: S, rx: S, ry: S, rz: S, ) -> Self

Creates a new 3D placement.

Source

pub fn with_boundary(self, index: usize) -> Self

Sets the boundary index.

Source

pub fn with_mirrored(self, mirrored: bool) -> Self

Sets the mirrored flag.

Source

pub fn with_rotation_index(self, index: usize) -> Self

Sets the rotation index.

Source

pub fn is_2d(&self) -> bool

Returns true if this is a 2D placement.

Source

pub fn is_3d(&self) -> bool

Returns true if this is a 3D placement.

Source

pub fn x(&self) -> S

Returns the x coordinate.

Source

pub fn y(&self) -> S

Returns the y coordinate.

Source

pub fn z(&self) -> Option<S>

Returns the z coordinate (for 3D placements).

Source

pub fn angle(&self) -> S

Returns the rotation angle (for 2D placements).

Source§

impl<S: RealField + Copy + Default> Placement<S>

Source

pub fn to_transform_2d(&self) -> Transform2D<S>

Converts a 2D placement to a Transform2D.

Source

pub fn from_transform_2d( geometry_id: GeometryId, instance: usize, transform: &Transform2D<S>, ) -> Self

Creates a 2D placement from a Transform2D.

Source

pub fn to_transform_3d(&self) -> Transform3D<S>

Converts a 3D placement to a Transform3D.

Source

pub fn from_transform_3d( geometry_id: GeometryId, instance: usize, transform: &Transform3D<S>, ) -> Self

Creates a 3D placement from a Transform3D.

Trait Implementations§

Source§

impl<S: Clone> Clone for Placement<S>

Source§

fn clone(&self) -> Placement<S>

Returns a duplicate of the value. Read more
1.0.0 · Source§

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

Performs copy-assignment from source. Read more
Source§

impl<S: Debug> Debug for Placement<S>

Source§

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

Formats the value using the given formatter. Read more

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> 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> IntoEither for T

Source§

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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

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 more
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

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

Source§

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

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

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

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

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.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V