C# Class hyades.physics.VectorHelper

Mostrar archivo Open project: zfedoran/bubblebound Class Usage Examples

Public Methods

Method Description
IsCCW ( Vector2 a, Vector2 b ) : bool

is rotating from A to B Counter-clockwise?

LineIntersect ( Vector2 ptA, Vector2 ptB, Vector2 ptC, Vector2 ptD, Vector2 &hitPt ) : bool

see if 2 line segments intersect. (line AB collides with line CD) - simplified version

LineIntersect ( Vector2 ptA, Vector2 ptB, Vector2 ptC, Vector2 ptD, Vector2 &hitPt, float &Ua, float &Ub ) : bool

see if 2 line segments intersect. (line AB collides with line CD)

Perpendicular ( Vector2 vector ) : Vector2

get a vector perpendicular to this vector.

Perpendicular ( Vector2 &vector ) : void

make this vector perpendicular to itself

Perpendicular ( Vector2 &vectorIn, Vector2 &vectorOut ) : void

get a vector perpendicular to this vector (reference type version)

Rotate ( Vector2 vector, float radians ) : Vector2

rotate a vector by a given angle (in radians).

Rotate ( Vector2 &vector, float radians ) : void

rotate a given vector by a given angle (reference type version)

Rotate ( Vector2 &vectorIn, float radians, Vector2 &vectorOut ) : void

rotate a vector by a given angle (reference type version)

Vector3FromVector2 ( Vector2 vector ) : Vector3

turn a Vector2 into a Vector3 (sets Z component to zero)

Vector3FromVector2 ( Vector2 vector, float z ) : Vector3

turn a Vector2 into a Vector3, specifying the Z component to use.

Method Details

IsCCW() public static method

is rotating from A to B Counter-clockwise?
public static IsCCW ( Vector2 a, Vector2 b ) : bool
a Vector2
b Vector2
return bool

LineIntersect() public static method

see if 2 line segments intersect. (line AB collides with line CD) - simplified version
public static LineIntersect ( Vector2 ptA, Vector2 ptB, Vector2 ptC, Vector2 ptD, Vector2 &hitPt ) : bool
ptA Vector2 first point on line AB
ptB Vector2 second point on line AB
ptC Vector2 first point on line CD
ptD Vector2 second point on line CD
hitPt Vector2 resulting point of intersection
return bool

LineIntersect() public static method

see if 2 line segments intersect. (line AB collides with line CD)
public static LineIntersect ( Vector2 ptA, Vector2 ptB, Vector2 ptC, Vector2 ptD, Vector2 &hitPt, float &Ua, float &Ub ) : bool
ptA Vector2 first point on line AB
ptB Vector2 second point on line AB
ptC Vector2 first point on line CD
ptD Vector2 second point on line CD
hitPt Vector2 resulting point of intersection
Ua float distance along AB to intersection [0,1]
Ub float distance long CD to intersection [0,1]
return bool

Perpendicular() public static method

get a vector perpendicular to this vector.
public static Perpendicular ( Vector2 vector ) : Vector2
vector Vector2
return Vector2

Perpendicular() public static method

make this vector perpendicular to itself
public static Perpendicular ( Vector2 &vector ) : void
vector Vector2
return void

Perpendicular() public static method

get a vector perpendicular to this vector (reference type version)
public static Perpendicular ( Vector2 &vectorIn, Vector2 &vectorOut ) : void
vectorIn Vector2
vectorOut Vector2
return void

Rotate() public static method

rotate a vector by a given angle (in radians).
public static Rotate ( Vector2 vector, float radians ) : Vector2
vector Vector2
radians float
return Vector2

Rotate() public static method

rotate a given vector by a given angle (reference type version)
public static Rotate ( Vector2 &vector, float radians ) : void
vector Vector2
radians float
return void

Rotate() public static method

rotate a vector by a given angle (reference type version)
public static Rotate ( Vector2 &vectorIn, float radians, Vector2 &vectorOut ) : void
vectorIn Vector2
radians float
vectorOut Vector2
return void

Vector3FromVector2() public static method

turn a Vector2 into a Vector3 (sets Z component to zero)
public static Vector3FromVector2 ( Vector2 vector ) : Vector3
vector Vector2
return Vector3

Vector3FromVector2() public static method

turn a Vector2 into a Vector3, specifying the Z component to use.
public static Vector3FromVector2 ( Vector2 vector, float z ) : Vector3
vector Vector2
z float
return Vector3