Table of Contents

Struct b2Rot

Namespace
Gym.Box2D
Assembly
Gym.Environments.dll

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

Constructors

b2Rot(float)

The rotation by an angle in radians.

public b2Rot(float angle)

Parameters

angle float

The angle.

Fields

c

The cosine of the angle.

public float c

Field Value

float

s

The sine of the angle.

public float s

Field Value

float

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

float

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

angle float

The 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

q b2Rot

The rotation.

v b2Vec2

The vector.

Returns

b2Vec2

(q.c * v.x - q.s * v.y, q.s * v.x + q.c * v.y).