Struct libreda_db::layout::prelude::SimpleTransform
pub struct SimpleTransform<T> {
pub mirror: bool,
pub rotation: Angle,
pub magnification: T,
pub displacement: Vector<T>,
}Expand description
Describes a geometric transformation that consists of a optional mirroring along the x-axis followed by a rotation by a multiple of 90 degrees followed by a displacement.
Fields§
§mirror: boolMirror on the x-axis?
rotation: AngleRotation by a multiple of 90 degrees.
magnification: TEnlargement.
displacement: Vector<T>Translation.
Implementations§
§impl<T> SimpleTransform<T>
impl<T> SimpleTransform<T>
pub fn new(
mirror: bool,
rotation: Angle,
magnification: T,
displacement: Vector<T>
) -> SimpleTransform<T>
pub fn new( mirror: bool, rotation: Angle, magnification: T, displacement: Vector<T> ) -> SimpleTransform<T>
Create a new transformation.
§impl<T> SimpleTransform<T>where
T: Zero + One,
impl<T> SimpleTransform<T>where T: Zero + One,
pub fn identity() -> SimpleTransform<T>
pub fn identity() -> SimpleTransform<T>
Get the identity transform.
pub fn translate<V>(v: V) -> SimpleTransform<T>where
V: Into<Vector<T>>,
pub fn translate<V>(v: V) -> SimpleTransform<T>where V: Into<Vector<T>>,
Create a translation by a vector.
pub fn rotate90(angle: Angle) -> SimpleTransform<T>
pub fn rotate90(angle: Angle) -> SimpleTransform<T>
Create a rotation by an integer multiple of 90 degrees. Rotation center is (0, 0).
pub fn rotate_ccw90() -> SimpleTransform<T>
pub fn rotate_ccw90() -> SimpleTransform<T>
Rotate 90 degrees counter-clock wise.
pub fn rotate_cw90() -> SimpleTransform<T>
pub fn rotate_cw90() -> SimpleTransform<T>
Rotate 90 degrees counter-clock wise.
pub fn mirror_x() -> SimpleTransform<T>
pub fn mirror_x() -> SimpleTransform<T>
Create a transformation that mirrors at the x-axis.
pub fn mirror_y() -> SimpleTransform<T>
pub fn mirror_y() -> SimpleTransform<T>
Create a transformation that mirrors at the y-axis.
pub fn scale(factor: T) -> SimpleTransform<T>
pub fn scale(factor: T) -> SimpleTransform<T>
Create a scaling by a factor.
§impl<T> SimpleTransform<T>where
T: Copy + Mul<T, Output = T>,
impl<T> SimpleTransform<T>where T: Copy + Mul<T, Output = T>,
pub fn transform_distance(&self, d: T) -> T
pub fn transform_distance(&self, d: T) -> T
Transform a distance.
§impl<T> SimpleTransform<T>where
T: CoordinateType,
impl<T> SimpleTransform<T>where T: CoordinateType,
pub fn rotate90_around(
angle: Angle,
rotation_center: Point<T>
) -> SimpleTransform<T>
pub fn rotate90_around( angle: Angle, rotation_center: Point<T> ) -> SimpleTransform<T>
Create a rotation arount rotation_center by an integer multiple of 90 degrees.
pub fn transform_point(&self, p: Point<T>) -> Point<T>
pub fn transform_point(&self, p: Point<T>) -> Point<T>
Transform a single point.
pub fn inverse_transform_point(&self, p: Point<T>) -> Point<T>
pub fn inverse_transform_point(&self, p: Point<T>) -> Point<T>
Inverse-transform a single point.
pub fn to_matrix_transform(&self) -> Matrix3dTransform<T>
pub fn to_matrix_transform(&self) -> Matrix3dTransform<T>
Convert to a matrix transformation.
pub fn then(&self, t: &SimpleTransform<T>) -> SimpleTransform<T>
pub fn then(&self, t: &SimpleTransform<T>) -> SimpleTransform<T>
Return a new transformation that is equal to applying
first self then t.
Trait Implementations§
§impl<T> Clone for SimpleTransform<T>where
T: Clone,
impl<T> Clone for SimpleTransform<T>where T: Clone,
§fn clone(&self) -> SimpleTransform<T>
fn clone(&self) -> SimpleTransform<T>
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more§impl<T> Debug for SimpleTransform<T>where
T: Debug,
impl<T> Debug for SimpleTransform<T>where T: Debug,
§impl<T> Default for SimpleTransform<T>where
T: CoordinateType,
impl<T> Default for SimpleTransform<T>where T: CoordinateType,
§fn default() -> SimpleTransform<T>
fn default() -> SimpleTransform<T>
§impl<'de, T> Deserialize<'de> for SimpleTransform<T>where
T: Deserialize<'de>,
impl<'de, T> Deserialize<'de> for SimpleTransform<T>where T: Deserialize<'de>,
§fn deserialize<__D>(
__deserializer: __D
) -> Result<SimpleTransform<T>, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>( __deserializer: __D ) -> Result<SimpleTransform<T>, <__D as Deserializer<'de>>::Error>where __D: Deserializer<'de>,
§impl<T> PartialEq<SimpleTransform<T>> for SimpleTransform<T>where
T: PartialEq<T>,
impl<T> PartialEq<SimpleTransform<T>> for SimpleTransform<T>where T: PartialEq<T>,
§fn eq(&self, other: &SimpleTransform<T>) -> bool
fn eq(&self, other: &SimpleTransform<T>) -> bool
self and other values to be equal, and is used
by ==.