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§
Source§impl<T> SimpleTransform<T>
impl<T> SimpleTransform<T>
Source§impl<T> SimpleTransform<T>
impl<T> SimpleTransform<T>
Sourcepub fn identity() -> SimpleTransform<T>
pub fn identity() -> SimpleTransform<T>
Get the identity transform.
Sourcepub fn translate<V>(v: V) -> SimpleTransform<T>
pub fn translate<V>(v: V) -> SimpleTransform<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.
Source§impl<T> SimpleTransform<T>
impl<T> SimpleTransform<T>
Sourcepub fn transform_distance(&self, d: T) -> T
pub fn transform_distance(&self, d: T) -> T
Transform a distance.
Source§impl<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§
Source§impl<T> Clone for SimpleTransform<T>where
T: Clone,
impl<T> Clone for SimpleTransform<T>where
T: Clone,
Source§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 moreSource§impl<T> Debug for SimpleTransform<T>where
T: Debug,
impl<T> Debug for SimpleTransform<T>where
T: Debug,
Source§impl<T> Default for SimpleTransform<T>where
T: CoordinateType,
impl<T> Default for SimpleTransform<T>where
T: CoordinateType,
Source§fn default() -> SimpleTransform<T>
fn default() -> SimpleTransform<T>
Source§impl<'de, T> Deserialize<'de> for SimpleTransform<T>where
T: Deserialize<'de>,
impl<'de, T> Deserialize<'de> for SimpleTransform<T>where
T: Deserialize<'de>,
Source§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>,
Source§impl<T> PartialEq for SimpleTransform<T>where
T: PartialEq,
impl<T> PartialEq for SimpleTransform<T>where
T: PartialEq,
Source§impl<T> Serialize for SimpleTransform<T>where
T: Serialize,
impl<T> Serialize for SimpleTransform<T>where
T: Serialize,
Source§fn 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,
Source§impl<T, Dst> TryCastCoord<T, Dst> for SimpleTransform<T>
impl<T, Dst> TryCastCoord<T, Dst> for SimpleTransform<T>
Source§type Output = SimpleTransform<Dst>
type Output = SimpleTransform<Dst>
Source§fn try_cast(
&self,
) -> Option<<SimpleTransform<T> as TryCastCoord<T, Dst>>::Output>
fn try_cast( &self, ) -> Option<<SimpleTransform<T> as TryCastCoord<T, Dst>>::Output>
impl<T> Copy for SimpleTransform<T>where
T: Copy,
impl<T> Eq for SimpleTransform<T>where
T: Eq,
impl<T> StructuralPartialEq for SimpleTransform<T>
Auto Trait Implementations§
impl<T> Freeze for SimpleTransform<T>where
T: Freeze,
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§
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
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>
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