Handy math functions for the collision module.
More...
#include <d3d11_2.h>
#include <dxgi1_3.h>
#include <DirectXMath.h>
#include "SimpleMath.h"
|
| #define | FailIf(x) if(x)return false; |
| |
| #define | sqr(x) ((x)*(x)) |
| | Handy squaring function. Compute the square of any number. More...
|
| |
◆ FailIf
| #define FailIf |
( |
|
x | ) |
if(x)return false; |
Fail by returning false if a given condition is true.
- Parameters
-
◆ sqr
| #define sqr |
( |
|
x | ) |
((x)*(x)) |
- Parameters
-
- Returns
- x squared.
◆ AngleToVector()
| Vector2 AngleToVector |
( |
const float |
a | ) |
|
Get a normalized vector at a given orientation.
- Parameters
-
- Returns
- Unit vector at orientation a.
◆ Normalize()
| Vector2 Normalize |
( |
Vector2 |
v | ) |
|
The DirectXTK doesn't have a function that returns a normalized vector, so here it is.
- Parameters
-
- Returns
- A unit vector that points in the direction of v.
◆ NormalizeAngle()
| float NormalizeAngle |
( |
float |
a | ) |
|
/brief Normalize angle to [0, 2PI).
- Parameters
-
- Returns
- Normalized angle, that is, in the range [0, 2PI).
◆ ParallelComponent()
| Vector2 ParallelComponent |
( |
const Vector2 & |
v0, |
|
|
const Vector2 & |
v1 |
|
) |
| |
Find the component of one vector parallel to another.
- Parameters
-
| v0 | Vector whose component we want. |
| v1 | Vector that the component must be parallel to. |
- Returns
- Component of v0 that is parallel to v1.
◆ perp()
| Vector2 perp |
( |
const Vector2 & |
v | ) |
|
Compute the perpendicular to a given vector in a counterclockwise direction.
- Parameters
-
- Returns
- The vector perpendicular to v in a counterclockwise direction.
◆ RotatePt()
| Vector2 RotatePt |
( |
Vector2 |
p, |
|
|
const Vector2 & |
q, |
|
|
const float |
a |
|
) |
| |
Rotate a point about an arbitrary center.
- Parameters
-
| p | Point to be rotated. |
| q | Center of rotation. |
| a | Angle of rotation in radians. |
- Returns
- Rotated point.