Struct libreda_db::prelude::SimpleTransform
source · [−]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: bool
Mirror on the x-axis?
rotation: Angle
Rotation by a multiple of 90 degrees.
magnification: T
Enlargement.
displacement: Vector<T>
Translation.
Implementations
sourceimpl<T> SimpleTransform<T>
impl<T> SimpleTransform<T>
sourceimpl<T> SimpleTransform<T> where
T: Zero + One,
impl<T> SimpleTransform<T> where
T: Zero + One,
sourcepub fn identity() -> SimpleTransform<T>
pub fn identity() -> SimpleTransform<T>
Get the identity transform.
sourcepub 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.
sourcepub 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).
sourcepub fn rotate_ccw90() -> SimpleTransform<T>
pub fn rotate_ccw90() -> SimpleTransform<T>
Rotate 90 degrees counter-clock wise.
sourcepub fn rotate_cw90() -> SimpleTransform<T>
pub fn rotate_cw90() -> SimpleTransform<T>
Rotate 90 degrees counter-clock wise.
sourcepub fn mirror_x() -> SimpleTransform<T>
pub fn mirror_x() -> SimpleTransform<T>
Create a transformation that mirrors at the x-axis.
sourcepub fn mirror_y() -> SimpleTransform<T>
pub fn mirror_y() -> SimpleTransform<T>
Create a transformation that mirrors at the y-axis.
sourcepub fn scale(factor: T) -> SimpleTransform<T>
pub fn scale(factor: T) -> SimpleTransform<T>
Create a scaling by a factor.
sourceimpl<T> SimpleTransform<T> where
T: Copy + Mul<T, Output = T>,
impl<T> SimpleTransform<T> where
T: Copy + Mul<T, Output = T>,
sourcepub fn transform_distance(&self, d: T) -> T
pub fn transform_distance(&self, d: T) -> T
Transform a distance.
sourceimpl<T> SimpleTransform<T> where
T: CoordinateType,
impl<T> SimpleTransform<T> where
T: CoordinateType,
sourcepub 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.
sourcepub fn transform_point(&self, p: Point<T>) -> Point<T>
pub fn transform_point(&self, p: Point<T>) -> Point<T>
Transform a single point.
sourcepub 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.
sourcepub fn to_matrix_transform(&self) -> Matrix3dTransform<T>
pub fn to_matrix_transform(&self) -> Matrix3dTransform<T>
Convert to a matrix transformation.
sourcepub 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
sourceimpl<T> Clone for SimpleTransform<T> where
T: Clone,
impl<T> Clone for SimpleTransform<T> where
T: Clone,
sourcefn clone(&self) -> SimpleTransform<T>
fn clone(&self) -> SimpleTransform<T>
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
sourceimpl<T> Debug for SimpleTransform<T> where
T: Debug,
impl<T> Debug for SimpleTransform<T> where
T: Debug,
sourceimpl<T> Default for SimpleTransform<T> where
T: CoordinateType,
impl<T> Default for SimpleTransform<T> where
T: CoordinateType,
sourcefn default() -> SimpleTransform<T>
fn default() -> SimpleTransform<T>
Returns the “default value” for a type. Read more
sourceimpl<'de, T> Deserialize<'de> for SimpleTransform<T> where
T: Deserialize<'de>,
impl<'de, T> Deserialize<'de> for SimpleTransform<T> where
T: Deserialize<'de>,
sourcefn 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>,
Deserialize this value from the given Serde deserializer. Read more
sourceimpl<T> PartialEq<SimpleTransform<T>> for SimpleTransform<T> where
T: PartialEq<T>,
impl<T> PartialEq<SimpleTransform<T>> for SimpleTransform<T> where
T: PartialEq<T>,
sourcefn eq(&self, other: &SimpleTransform<T>) -> bool
fn eq(&self, other: &SimpleTransform<T>) -> bool
This method tests for self
and other
values to be equal, and is used
by ==
. Read more
sourcefn ne(&self, other: &SimpleTransform<T>) -> bool
fn ne(&self, other: &SimpleTransform<T>) -> bool
This method tests for !=
.
sourceimpl<T> Serialize for SimpleTransform<T> where
T: Serialize,
impl<T> Serialize for SimpleTransform<T> where
T: Serialize,
sourcefn serialize<__S>(
&self,
__serializer: __S
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error> where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error> where
__S: Serializer,
Serialize this value into the given Serde serializer. Read more
sourceimpl<T, Dst> TryCastCoord<T, Dst> for SimpleTransform<T> where
T: CoordinateType + NumCast,
Dst: CoordinateType + NumCast,
impl<T, Dst> TryCastCoord<T, Dst> for SimpleTransform<T> where
T: CoordinateType + NumCast,
Dst: CoordinateType + NumCast,
type Output = SimpleTransform<Dst>
type Output = SimpleTransform<Dst>
Output type of the cast. This is likely the same geometrical type just with other coordinate types. Read more
sourcefn try_cast(
&self
) -> Option<<SimpleTransform<T> as TryCastCoord<T, Dst>>::Output>
fn try_cast(
&self
) -> Option<<SimpleTransform<T> as TryCastCoord<T, Dst>>::Output>
Try to cast to target data type. Read more
impl<T> Copy for SimpleTransform<T> where
T: Copy,
impl<T> StructuralPartialEq for SimpleTransform<T>
Auto Trait Implementations
impl<T> RefUnwindSafe for SimpleTransform<T> where
T: RefUnwindSafe,
impl<T> Send for SimpleTransform<T> where
T: Send,
impl<T> Sync for SimpleTransform<T> where
T: Sync,
impl<T> Unpin for SimpleTransform<T> where
T: Unpin,
impl<T> UnwindSafe for SimpleTransform<T> where
T: UnwindSafe,
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more