Rotation2D Type
A struct containing 2 floats, representing a 2D Counter Clockwise rotation. It can be applied in World X, Y or Z plane. Internally stored just as a Sine and Cosine value. For arbitrary rotations use Quaternions or 4x4 Matrix. However this module has much better performance than the more general Matrix4x4 or a Quaternion. Note: Never use the struct default constructor Rotation2D() as it will create an invalid zero Rotation2D. Use Rotation2D.createFromRadians, Rotation2D.createFromDegrees, or Rotation2D.createUnchecked instead.
Record fields
| Record Field |
Description
|
Full Usage:
Cos
Field type: float
|
The Cosine component of this rotation. The range of this field is -1.0 to +1.0
|
Full Usage:
Sin
Field type: float
|
The Sine component of this rotation. The range of this field is -1.0 to +1.0
|
Instance members
| Instance member |
Description
|
|
Create a new 2D Rotation that adds a 2D Rotation to the existing one.
|
|
Create a new 2D Rotation that adds a counter clockwise angle in Degrees to the existing one.
|
|
Create a new 2D Rotation that adds a counter clockwise angle in Radians to the existing one.
|
Full Usage:
this.AsFSharpCode
Returns: string
|
Format Rotation2D into an F# code string that can be used to recreate the rotation.
|
Full Usage:
this.AsString
Returns: string
|
Format rotation into string showing angle in Degrees as nicely formatted floating point number. But without type name as in r.ToString()
|
|
Returns half the 2D Rotation in the same direction.
|
Full Usage:
this.InDegrees
Returns: float
Modifiers: inline |
Returns the angle represented by this 2D Rotation in Degrees. The returned angle is in the range [-180°, +180°].
|
Full Usage:
this.InRadians
Returns: float
Modifiers: inline |
Returns the angle represented by this 2D Rotation in Radians. The returned angle is in the range [-π, π] (-180° to +180°).
|
|
Returns the 2D Rotation in the opposite direction.
|
Static members
| Static member |
Description
|
Full Usage:
Rotation2D.createFromCosine cos
Parameters:
float
Returns: Rotation2D
Modifiers: inline |
Construct a counter clockwise 2D Rotation from angle given in its cosine value. The input must be in the range [-1.0, +1.0]. Note: Only angles in the range [0°, 180°] can be created since acos returns values in [0, π].
|
Full Usage:
Rotation2D.createFromDegrees deg
Parameters:
float
Returns: Rotation2D
Modifiers: inline |
Construct a counter clockwise 2D Rotation from angle in Degrees. Use negative degrees for clockwise rotation.
|
Full Usage:
Rotation2D.createFromRadians rad
Parameters:
float
Returns: Rotation2D
Modifiers: inline |
Construct a counter clockwise 2D Rotation from angle in Radians. Use negative radians for clockwise rotation.
|
Full Usage:
Rotation2D.createFromSine sin
Parameters:
float
Returns: Rotation2D
Modifiers: inline |
Construct a counter clockwise 2D Rotation from angle given in its sine value. The input must be in the range [-1.0, +1.0]. Note: Only angles in the range [-90°, +90°] can be created since asin returns values in [-π/2, π/2].
|
|
Construct a 2D Rotation from two 2D vectors. The rotation represents the counter-clockwise angle from vector 'a' to vector 'b'. Normalizes both vectors internally and uses dot product for cosine and cross product for sine. Fails if either vector has near-zero length.
|
|
Construct a 2D Rotation from two unit vectors. The rotation represents the counter-clockwise angle from vector 'a' to vector 'b'. Uses the dot product for cosine and cross product for sine.
|
Full Usage:
Rotation2D.createUnchecked (sine, cosine)
Parameters:
float
cosine : float
Returns: Rotation2D
Modifiers: inline |
Construct 2D Rotation from sine and corresponding cosine directly. Input is unchecked and not validated.
|
Full Usage:
Rotation2D.equals tol a b
Parameters:
float
a : Rotation2D
b : Rotation2D
Returns: bool
Modifiers: inline |
Checks if two 2D Rotations are equal within tolerance. By comparing the fields Sin and Cos each with the given tolerance. The range of these fields is -1.0 to +1.0 Use a tolerance of 0.0 to check for an exact match.
|
Euclid