BGC Tools
Static Public Member Functions
BGC.Extensions.Vector2Extension Class Reference

Set of extensions for unity data structure Vector2 More...

Static Public Member Functions

static Vector2 Rotate (this Vector2 v, float degrees)
 Rotate a 2d vector by specified number of degrees More...
 
static float Min (this Vector2 v)
 get the minimum of the x or y values in the vector More...
 

Detailed Description

Set of extensions for unity data structure Vector2

Definition at line 8 of file Vector2Extensions.cs.

Member Function Documentation

◆ Min()

static float BGC.Extensions.Vector2Extension.Min ( this Vector2  v)
inlinestatic

get the minimum of the x or y values in the vector

Parameters
v
Returns

Definition at line 30 of file Vector2Extensions.cs.

31  {
32  return Mathf.Min(v.x, v.y);
33  }

◆ Rotate()

static Vector2 BGC.Extensions.Vector2Extension.Rotate ( this Vector2  v,
float  degrees 
)
inlinestatic

Rotate a 2d vector by specified number of degrees

Parameters
v
degreesangle to rotate by in degrees
Returns

Definition at line 16 of file Vector2Extensions.cs.

17  {
18  float radians = degrees * Mathf.Deg2Rad;
19  float sin = Mathf.Sin(radians);
20  float cos = Mathf.Cos(radians);
21 
22  return new Vector2(cos * v.x - sin * v.y, sin * v.x + cos * v.y);
23  }

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