Struct b2Rot
A rotation as its sine and cosine, float32, computed once by sinf/cosf when set from an angle.
public struct b2Rot
- Inherited Members
- Extension Methods
Remarks
Reference: Box2D/Common/b2Math.h.
Constructors
b2Rot(float)
The rotation by an angle in radians.
public b2Rot(float angle)
Parameters
anglefloatThe angle.
Fields
c
The cosine of the angle.
public float c
Field Value
s
The sine of the angle.
public float s
Field Value
Properties
angle
The angle in radians, atan2f(s, c) on read and sinf/cosf on write (pybox2d's angle).
public float angle { readonly get; set; }
Property Value
Methods
GetAngle()
The angle in radians, atan2f(s, c), in (-π, π].
public readonly float GetAngle()
Returns
- float
The angle.
GetXAxis()
The rotated x-axis, (c, s).
public readonly b2Vec2 GetXAxis()
Returns
- b2Vec2
The axis.
GetYAxis()
The rotated y-axis, (-s, c).
public readonly b2Vec2 GetYAxis()
Returns
- b2Vec2
The axis.
Set(float)
Sets the rotation from an angle in radians.
public void Set(float angle)
Parameters
anglefloatThe angle.
SetIdentity()
Sets this to the identity rotation.
public void SetIdentity()
Operators
operator *(b2Rot, b2Vec2)
Rotates a vector, as pybox2d's b2Rot.mul.
public static b2Vec2 operator *(b2Rot q, b2Vec2 v)
Parameters
Returns
- b2Vec2
(q.c * v.x - q.s * v.y, q.s * v.x + q.c * v.y).