Dura2D  v0.1.0
An educational 2D game physics library
Loading...
Searching...
No Matches
d2Rot Struct Reference

Represents a rotation in 2D space. More...

#include <d2Math.h>

Public Member Functions

 d2Rot ()
 Default constructor.
 
 d2Rot (real angle)
 Constructor that initializes the rotation with given angle in radians.
 
 d2Rot (real s, real c)
 Constructor that initializes the rotation with given sine and cosine values.
 
void Set (real angle)
 Set the rotation angle from a given angle in radians.
 
void SetIdentity ()
 Set the rotation angle as identity.
 
real GetAngle () const
 Get the rotation angle in radians.
 
d2Vec2 GetXAxis () const
 Get the x-axis of the rotation.
 
d2Vec2 GetYAxis () const
 Get the y-axis of the rotation.
 
void Add (const d2Rot &other)
 Adds the rotation of another d2Rot object to this object.
 
d2Rot operator+ (const d2Rot &other) const
 
d2Rotoperator+= (const d2Rot &other)
 
d2Rotoperator+= (real angle)
 

Public Attributes

real s
 The sine of the rotation angle.
 
real c
 The cosine of the rotation angle.
 

Detailed Description

Represents a rotation in 2D space.

Constructor & Destructor Documentation

◆ d2Rot() [1/3]

d2Rot::d2Rot ( )
inline

Default constructor.

Initializes the rotation to identity.

◆ d2Rot() [2/3]

d2Rot::d2Rot ( real angle)
inlineexplicit

Constructor that initializes the rotation with given angle in radians.

Parameters
angleThe angle in radians.

◆ d2Rot() [3/3]

d2Rot::d2Rot ( real s,
real c )
inline

Constructor that initializes the rotation with given sine and cosine values.

Parameters
sThe sine of the rotation angle.
cThe cosine of the rotation angle.

Member Function Documentation

◆ Add()

void d2Rot::Add ( const d2Rot & other)
inline

Adds the rotation of another d2Rot object to this object.

Parameters
otherThe other d2Rot object whose rotation is to be added to this object.

◆ GetAngle()

real d2Rot::GetAngle ( ) const
inline

Get the rotation angle in radians.

Returns
The rotation angle in radians.

◆ GetXAxis()

d2Vec2 d2Rot::GetXAxis ( ) const
inline

Get the x-axis of the rotation.

Returns
The x-axis of the rotation.

◆ GetYAxis()

d2Vec2 d2Rot::GetYAxis ( ) const
inline

Get the y-axis of the rotation.

Returns
The y-axis of the rotation.

◆ operator+()

d2Rot d2Rot::operator+ ( const d2Rot & other) const
inline

◆ operator+=() [1/2]

d2Rot & d2Rot::operator+= ( const d2Rot & other)
inline

◆ operator+=() [2/2]

d2Rot & d2Rot::operator+= ( real angle)
inline

◆ Set()

void d2Rot::Set ( real angle)
inline

Set the rotation angle from a given angle in radians.

Parameters
angleThe angle in radians.

◆ SetIdentity()

void d2Rot::SetIdentity ( )
inline

Set the rotation angle as identity.

Member Data Documentation

◆ c

real d2Rot::c

The cosine of the rotation angle.

◆ s

real d2Rot::s

The sine of the rotation angle.


The documentation for this struct was generated from the following file: