Repository navigation
Transform
Home | API by Category | Complete API Index | API Status
| Field | Value |
|---|---|
| Full name | Electron2D.Transform |
| Namespace | Electron2D |
| Kind | struct |
| Category | API Core |
Represents a two-dimensional affine transformation as three column vectors.
public struct Electron2D.TransformElectron2D.Transform.X and Electron2D.Transform.Y form the two-by-two basis; Electron2D.Transform.Origin stores translation. The value can represent translation, clockwise rotation in screen coordinates, non-uniform scale, reflection, and skew. The zero-initialized value is a zero matrix, not Electron2D.Transform.Identity.
| Member | Kind | Summary |
|---|---|---|
public Transform(Electron2D.Vector2 xAxis, Electron2D.Vector2 yAxis, Electron2D.Vector2 origin) |
constructor | Initializes a transform from its three matrix columns. |
public Transform(System.Single rotation, Electron2D.Vector2 origin) |
constructor | Initializes a rotation and translation transform. |
public Transform(System.Single rotation, Electron2D.Vector2 scale, System.Single skew, Electron2D.Vector2 origin) |
constructor | Initializes a transform from rotation, scale, skew, and translation. |
public Transform(System.Single xx, System.Single xy, System.Single yx, System.Single yy, System.Single ox, System.Single oy) |
constructor | Initializes a transform from six column-major components. |
public Electron2D.Vector2 Origin |
field | Gets or sets the translation offset, which is matrix column two. |
public Electron2D.Vector2 X |
field | Gets or sets the basis X axis, which is matrix column zero. |
public Electron2D.Vector2 Y |
field | Gets or sets the basis Y axis, which is matrix column one. |
public Electron2D.Vector2 this[System.Int32 column] { get; set; } |
indexer | Gets or sets a complete matrix column. |
public System.Single this[System.Int32 column, System.Int32 row] { get; set; } |
indexer | Gets or sets one matrix component using column-major coordinates. |
public Electron2D.Transform AffineInverse() |
method | Returns the general affine inverse. |
public Electron2D.Vector2 BasisXform(Electron2D.Vector2 vector) |
method | Transforms a vector by the basis while ignoring translation. |
public Electron2D.Vector2 BasisXformInv(Electron2D.Vector2 vector) |
method | Transforms a vector by the transposed basis while ignoring translation. |
public System.Single Determinant() |
method | Returns the determinant of the two-by-two basis. |
public virtual System.Boolean Equals(Electron2D.Transform other) |
method | Tests all matrix components for exact equality. |
public override System.Boolean Equals(System.Object obj) |
method | Tests whether another object is an exactly equal transform. |
public override System.Int32 GetHashCode() |
method | Returns a hash code based on all three columns. |
public Electron2D.Transform InterpolateWith(Electron2D.Transform other, System.Single weight) |
method | Interpolates or extrapolates decomposed transform components. |
public Electron2D.Transform Inverse() |
method | Returns the fast inverse for an orthonormal basis. |
public System.Boolean IsConformal() |
method | Tests whether the basis preserves angles up to uniform scale and optional reflection. |
public System.Boolean IsEqualApprox(Electron2D.Transform other) |
method | Tests all three columns for scale-aware approximate equality. |
public System.Boolean IsFinite() |
method | Tests whether every matrix component is finite. |
public Electron2D.Transform LookingAt(Electron2D.Vector2 target = default) |
method | Returns a rotation-only transform turned toward a target through this transform's affine local space. |
public Electron2D.Transform Orthonormalized() |
method | Returns a transform with a Gram-Schmidt orthonormalized basis. |
public Electron2D.Transform Rotated(System.Single angle) |
method | Applies a rotation in the global or parent coordinate frame. |
public Electron2D.Transform RotatedLocal(System.Single angle) |
method | Applies a rotation in the local coordinate frame. |
public Electron2D.Transform Scaled(Electron2D.Vector2 scale) |
method | Applies componentwise scale in the global or parent coordinate frame. |
public Electron2D.Transform ScaledLocal(Electron2D.Vector2 scale) |
method | Applies scale in the local coordinate frame. |
public override System.String ToString() |
method | Formats the three columns using invariant culture. |
public System.String ToString(System.String format) |
method | Formats the three columns with a numeric format and invariant culture. |
public Electron2D.Transform Translated(Electron2D.Vector2 offset) |
method | Applies translation in the global or parent coordinate frame. |
public Electron2D.Transform TranslatedLocal(Electron2D.Vector2 offset) |
method | Applies translation in the local coordinate frame. |
public static Electron2D.Transform op_Division(Electron2D.Transform transform, System.Single scalar) |
operator | Divides every matrix component, including translation, by a scalar. |
public static System.Boolean op_Equality(Electron2D.Transform left, Electron2D.Transform right) |
operator | Tests all matrix components for exact equality. |
public static System.Boolean op_Inequality(Electron2D.Transform left, Electron2D.Transform right) |
operator | Tests whether any matrix component differs under exact equality. |
public static Electron2D.Rect2 op_Multiply(Electron2D.Rect2 rectangle, Electron2D.Transform transform) |
operator | Inverse-transforms a rectangle under an orthonormal-basis precondition. |
public static Electron2D.Rect2 op_Multiply(Electron2D.Transform transform, Electron2D.Rect2 rectangle) |
operator | Transforms a rectangle and returns the axis-aligned bounds of its four transformed corners. |
public static Electron2D.Transform op_Multiply(Electron2D.Transform left, Electron2D.Transform right) |
operator | Composes a parent transform with a child transform. |
public static Electron2D.Vector2 op_Multiply(Electron2D.Transform transform, Electron2D.Vector2 point) |
operator | Transforms a point by the basis and translation. |
public static Electron2D.Vector2[] op_Multiply(Electron2D.Transform transform, Electron2D.Vector2[] points) |
operator | Transforms every point into a newly allocated array. |
public static Electron2D.Transform op_Multiply(Electron2D.Transform transform, System.Single scalar) |
operator | Multiplies every matrix component, including translation, by a scalar. |
public static Electron2D.Vector2 op_Multiply(Electron2D.Vector2 point, Electron2D.Transform transform) |
operator | Applies the inverse orthonormal transform to a point. |
public static Electron2D.Vector2[] op_Multiply(Electron2D.Vector2[] points, Electron2D.Transform transform) |
operator | Inverse-transforms every point by an orthonormal transform into a newly allocated array. |
public static Electron2D.Transform FlipX { get; } |
property | Gets a transform that reflects across the vertical axis by negating horizontal coordinates. |
public static Electron2D.Transform FlipY { get; } |
property | Gets a transform that reflects across the horizontal axis by negating vertical coordinates. |
public static Electron2D.Transform Identity { get; } |
property | Gets the identity transform. |
public System.Single Rotation { get; } |
property | Gets the clockwise screen-space rotation in radians. |
public Electron2D.Vector2 Scale { get; } |
property | Gets the lengths of the basis axes with reflection encoded in the vertical component. |
public System.Single Skew { get; } |
property | Gets the angular skew between the basis axes in radians. |
Kind: constructor
public Transform(Electron2D.Vector2 xAxis, Electron2D.Vector2 yAxis, Electron2D.Vector2 origin)Initializes a transform from its three matrix columns.
-
xAxis: The basis X axis. -
yAxis: The basis Y axis. -
origin: The translation offset.
Kind: constructor
public Transform(System.Single rotation, Electron2D.Vector2 origin)Initializes a rotation and translation transform.
-
rotation: The clockwise screen-space angle in radians. -
origin: The translation offset.
Kind: constructor
public Transform(System.Single rotation, Electron2D.Vector2 scale, System.Single skew, Electron2D.Vector2 origin)Initializes a transform from rotation, scale, skew, and translation.
-
rotation: The clockwise screen-space rotation in radians. -
scale: The horizontal and vertical scale factors. -
skew: The angular skew in radians. -
origin: The translation offset.
Kind: constructor
public Transform(System.Single xx, System.Single xy, System.Single yx, System.Single yy, System.Single ox, System.Single oy)Initializes a transform from six column-major components.
-
xx: The X component of Electron2D.Transform.X. -
xy: The Y component of Electron2D.Transform.X. -
yx: The X component of Electron2D.Transform.Y. -
yy: The Y component of Electron2D.Transform.Y. -
ox: The X component of Electron2D.Transform.Origin. -
oy: The Y component of Electron2D.Transform.Origin.
Kind: field
public Electron2D.Vector2 OriginGets or sets the translation offset, which is matrix column two.
Kind: field
public Electron2D.Vector2 XGets or sets the basis X axis, which is matrix column zero.
Its length contributes the horizontal scale and its direction defines the transform rotation.
Kind: field
public Electron2D.Vector2 YGets or sets the basis Y axis, which is matrix column one.
Its length contributes the vertical scale and its direction relative to Electron2D.Transform.X defines skew.
Kind: indexer
public Electron2D.Vector2 this[System.Int32 column] { get; set; }Gets or sets a complete matrix column.
The selected column.
-
column: Zero for Electron2D.Transform.X, one for Electron2D.Transform.Y, or two for Electron2D.Transform.Origin.
-
T:System.ArgumentOutOfRangeException: column is outside zero through two.
Kind: indexer
public System.Single this[System.Int32 column, System.Int32 row] { get; set; }Gets or sets one matrix component using column-major coordinates.
The selected floating-point component.
-
column: The matrix column from zero through two. -
row: The matrix row, zero for X or one for Y.
-
T:System.ArgumentOutOfRangeException: column is outside zero through two, or row is outside zero through one.
Kind: method
public Electron2D.Transform AffineInverse()Returns the general affine inverse.
A transform that composes with this transform to produce the identity, within floating-point precision.
-
T:System.InvalidOperationException: The basis determinant is exactly zero.
Kind: method
public Electron2D.Vector2 BasisXform(Electron2D.Vector2 vector)Transforms a vector by the basis while ignoring translation.
The vector multiplied by the two-by-two basis.
-
vector: The vector to transform.
Kind: method
public Electron2D.Vector2 BasisXformInv(Electron2D.Vector2 vector)Transforms a vector by the transposed basis while ignoring translation.
This is the inverse basis transform only when the basis is orthonormal. For scaled or skewed transforms, use transform.AffineInverse().BasisXform(vector).
The vector multiplied by the transposed basis.
-
vector: The vector to transform.
Kind: method
public System.Single Determinant()Returns the determinant of the two-by-two basis.
Zero for a singular basis, a negative value for a reflected basis, or a positive value otherwise.
Kind: method
public virtual System.Boolean Equals(Electron2D.Transform other)Tests all matrix components for exact equality.
true when every corresponding component is exactly equal.
-
other: The transform to compare.
Kind: method
public override System.Boolean Equals(System.Object obj)Tests whether another object is an exactly equal transform.
true when obj is a transform with equal components.
-
obj: The object to compare.
Kind: method
public override System.Int32 GetHashCode()Returns a hash code based on all three columns.
The component hash code.
Kind: method
public Electron2D.Transform InterpolateWith(Electron2D.Transform other, System.Single weight)Interpolates or extrapolates decomposed transform components.
A transform built from shortest-path angle interpolation, linear scale, skew, and origin interpolation.
-
other: The destination transform. -
weight: The interpolation weight; values outside zero through one extrapolate.
Kind: method
public Electron2D.Transform Inverse()Returns the fast inverse for an orthonormal basis.
This method assumes rotation or reflection without scale or skew and does not validate that precondition. Use Electron2D.Transform.AffineInverse for a general invertible affine transform.
The transposed basis and corresponding inverse translation.
Kind: method
public System.Boolean IsConformal()Tests whether the basis preserves angles up to uniform scale and optional reflection.
true for approximately orthogonal axes of approximately equal length.
Kind: method
public System.Boolean IsEqualApprox(Electron2D.Transform other)Tests all three columns for scale-aware approximate equality.
true when every corresponding component is approximately equal.
-
other: The transform to compare.
Kind: method
public System.Boolean IsFinite()Tests whether every matrix component is finite.
true when no component is NaN or infinity.
Kind: method
public Electron2D.Transform LookingAt(Electron2D.Vector2 target = default)Returns a rotation-only transform turned toward a target through this transform's affine local space.
The target is inverse-transformed and compensated by the signed basis scale before its angle is added to the current rotation. For a skewed source this differs from using the raw global angle from the origin.
A transform with the same origin and adjusted rotation; scale and skew are removed.
-
target: The global target point; defaults to the zero vector.
-
T:System.InvalidOperationException: The basis determinant is exactly zero.
Kind: method
public Electron2D.Transform Orthonormalized()Returns a transform with a Gram-Schmidt orthonormalized basis.
A zero or linearly dependent axis normalizes to zero instead of producing non-finite components.
A copy with unit perpendicular axes and the original origin.
Kind: method
public Electron2D.Transform Rotated(System.Single angle)Applies a rotation in the global or parent coordinate frame.
The rotation transform multiplied on the left of this transform.
-
angle: The clockwise screen-space angle in radians.
Kind: method
public Electron2D.Transform RotatedLocal(System.Single angle)Applies a rotation in the local coordinate frame.
The rotation transform multiplied on the right of this transform.
-
angle: The clockwise screen-space angle in radians.
Kind: method
public Electron2D.Transform Scaled(Electron2D.Vector2 scale)Applies componentwise scale in the global or parent coordinate frame.
A copy whose basis rows and origin are scaled componentwise.
-
scale: The scale along global X and Y.
Kind: method
public Electron2D.Transform ScaledLocal(Electron2D.Vector2 scale)Applies scale in the local coordinate frame.
A copy whose X and Y columns are multiplied by their corresponding factors.
-
scale: The scale along the local basis axes.
Kind: method
public override System.String ToString()Formats the three columns using invariant culture.
A string containing the X axis, Y axis, and origin.
Kind: method
public System.String ToString(System.String format)Formats the three columns with a numeric format and invariant culture.
A string containing the X axis, Y axis, and origin.
-
format: A standard or custom numeric format, or null for the default format.
-
T:System.FormatException: format is invalid.
Kind: method
public Electron2D.Transform Translated(Electron2D.Vector2 offset)Applies translation in the global or parent coordinate frame.
A copy with the offset added directly to its origin.
-
offset: The global offset.
Kind: method
public Electron2D.Transform TranslatedLocal(Electron2D.Vector2 offset)Applies translation in the local coordinate frame.
A copy with the basis-transformed offset added to its origin.
-
offset: The offset expressed in the current basis.
Kind: operator
public static Electron2D.Transform op_Division(Electron2D.Transform transform, System.Single scalar)Divides every matrix component, including translation, by a scalar.
The IEEE 754 componentwise quotient.
-
transform: The transform to divide. -
scalar: The scalar divisor.
Kind: operator
public static System.Boolean op_Equality(Electron2D.Transform left, Electron2D.Transform right)Tests all matrix components for exact equality.
true when every corresponding component is exactly equal.
-
left: The first transform. -
right: The second transform.
Kind: operator
public static System.Boolean op_Inequality(Electron2D.Transform left, Electron2D.Transform right)Tests whether any matrix component differs under exact equality.
true when at least one corresponding component differs.
-
left: The first transform. -
right: The second transform.
Kind: operator
public static Electron2D.Rect2 op_Multiply(Electron2D.Rect2 rectangle, Electron2D.Transform transform)Inverse-transforms a rectangle under an orthonormal-basis precondition.
This operator is equivalent to transform.Inverse() * rectangle. For scale or skew, use transform.AffineInverse() * rectangle instead.
The axis-aligned bounds of the inverse-transformed rectangle corners.
-
rectangle: The rectangle in transformed coordinates. -
transform: The orthonormal transform to invert.
Kind: operator
public static Electron2D.Rect2 op_Multiply(Electron2D.Transform transform, Electron2D.Rect2 rectangle)Transforms a rectangle and returns the axis-aligned bounds of its four transformed corners.
Rotation, reflection, non-uniform scale, skew, zero size, and negative size are supported. The result is normalized even when rectangle has a negative size.
The smallest axis-aligned rectangle enclosing all four transformed corners.
-
transform: The affine transform to apply. -
rectangle: The rectangle to transform.
Kind: operator
public static Electron2D.Transform op_Multiply(Electron2D.Transform left, Electron2D.Transform right)Composes a parent transform with a child transform.
The composed transform.
-
left: The parent transform applied second. -
right: The child transform applied first.
Kind: operator
public static Electron2D.Vector2 op_Multiply(Electron2D.Transform transform, Electron2D.Vector2 point)Transforms a point by the basis and translation.
The transformed point.
-
transform: The transform to apply. -
point: The point in local coordinates.
Kind: operator
public static Electron2D.Vector2[] op_Multiply(Electron2D.Transform transform, Electron2D.Vector2[] points)Transforms every point into a newly allocated array.
A new array containing transformed points in the original order.
-
transform: The transform to apply. -
points: The source points.
-
T:System.ArgumentNullException: points is null.
Kind: operator
public static Electron2D.Transform op_Multiply(Electron2D.Transform transform, System.Single scalar)Multiplies every matrix component, including translation, by a scalar.
The componentwise product.
-
transform: The transform to scale. -
scalar: The scalar multiplier.
Kind: operator
public static Electron2D.Vector2 op_Multiply(Electron2D.Vector2 point, Electron2D.Transform transform)Applies the inverse orthonormal transform to a point.
For scale or skew, multiply the point by Electron2D.Transform.AffineInverse instead.
The point expressed in the transform's local coordinates.
-
point: The point in transformed coordinates. -
transform: The orthonormal transform to invert.
Kind: operator
public static Electron2D.Vector2[] op_Multiply(Electron2D.Vector2[] points, Electron2D.Transform transform)Inverse-transforms every point by an orthonormal transform into a newly allocated array.
For scale or skew, multiply the points by Electron2D.Transform.AffineInverse instead.
A new array containing inverse-transformed points in the original order.
-
points: The source points. -
transform: The orthonormal transform to invert.
-
T:System.ArgumentNullException: points is null.
Kind: property
public static Electron2D.Transform FlipX { get; }Gets a transform that reflects across the vertical axis by negating horizontal coordinates.
A transform with basis axes (-1, 0) and (0, 1).
Kind: property
public static Electron2D.Transform FlipY { get; }Gets a transform that reflects across the horizontal axis by negating vertical coordinates.
A transform with basis axes (1, 0) and (0, -1).
Kind: property
public static Electron2D.Transform Identity { get; }Gets the identity transform.
A transform with unit basis axes and zero origin.
Kind: property
public System.Single Rotation { get; }Gets the clockwise screen-space rotation in radians.
The angle of Electron2D.Transform.X, measured from positive X toward positive Y.
Kind: property
public Electron2D.Vector2 Scale { get; }Gets the lengths of the basis axes with reflection encoded in the vertical component.
Electron2D.Transform.X length and signed Electron2D.Transform.Y length. A negative determinant makes the vertical component negative; a zero or unordered determinant makes it zero.
Kind: property
public System.Single Skew { get; }Gets the angular skew between the basis axes in radians.
Zero for an orthogonal basis, with reflection accounted for by the determinant sign.