Anvil
Anvil.API.NwMath Class Reference

Common math functions and constants. More...

Static Public Member Functions

static Vector2 AngleToVector2 (float angle)
 
static Vector3 AngleToVector3 (float angle)
 Converts the specified angle into a direction/heading vector. More...
 
static float VectorToAngle (Vector2 direction)
 
static float VectorToAngle (Vector3 direction)
 Converts the specified direction/heading vector to an angle. More...
 

Static Public Attributes

const float DegToRad = (float)(Math.PI * 2f / 360f)
 Constant value for converting degrees to radians. More...
 
const float FeetToMeters = 0.3048f
 Constant value for converting feet to meters. More...
 
const float MetersToFeet = 1f / FeetToMeters
 Constant value for converting meters to feet. More...
 
const float MetersToYards = 1f / YardsToMeters
 Constant value for converting meters to yards. More...
 
const float RadToDeg = 1f / DegToRad
 Constant value for converting radians to degrees. More...
 
const float YardsToMeters = 0.9144f
 Constant value for converting yards to meters. More...
 

Detailed Description

Common math functions and constants.

Member Function Documentation

◆ AngleToVector3()

static Vector3 Anvil.API.NwMath.AngleToVector3 ( float  angle)
inlinestatic

Converts the specified angle into a direction/heading vector.

Parameters
angleThe angle to convert.
Returns
A normalised direction vector for the specified angle.

◆ VectorToAngle()

static float Anvil.API.NwMath.VectorToAngle ( Vector3  direction)
inlinestatic

Converts the specified direction/heading vector to an angle.

Parameters
directionThe direction/heading vector to convert.
Returns
The angle, in degrees matching the direction of this vector.

Member Data Documentation

◆ DegToRad

const float Anvil.API.NwMath.DegToRad = (float)(Math.PI * 2f / 360f)
static

Constant value for converting degrees to radians.

float radians = 180f * DegToRad;.

◆ FeetToMeters

const float Anvil.API.NwMath.FeetToMeters = 0.3048f
static

Constant value for converting feet to meters.

float meters = 100f * FeetToMeters;.

◆ MetersToFeet

const float Anvil.API.NwMath.MetersToFeet = 1f / FeetToMeters
static

Constant value for converting meters to feet.

float feet = 100f * MetersToFeet;.

◆ MetersToYards

const float Anvil.API.NwMath.MetersToYards = 1f / YardsToMeters
static

Constant value for converting meters to yards.

float yards = 100f * MetersToYards;.

◆ RadToDeg

const float Anvil.API.NwMath.RadToDeg = 1f / DegToRad
static

Constant value for converting radians to degrees.

float degrees = 1.5708f * RadToDeg;.

◆ YardsToMeters

const float Anvil.API.NwMath.YardsToMeters = 0.9144f
static

Constant value for converting yards to meters.

float meters = 100f * YardsToMeters;.


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