C# Class Axiom.Math.Vector2

Show file Open project: WolfgangSt/axiom Class Usage Examples

Public Properties

Property Type Description
x Real

Public Methods

Method Description
Add ( Vector2 left, Vector2 right ) : Vector2

Used when a Vector2 is added to another Vector2.

Cross ( Vector2 vector ) : Real

Calculates the 2 dimensional cross-product of 2 vectors, which results in a Real value which is 2 times the area of the triangle defined by the two vectors. It also is the magnitude of the 3D vector that is perpendicular to the 2D vectors if the 2D vectors are projected to 3D space.

Dot ( Vector2 vector ) : Real

Calculates the 2 dimensional dot-product of 2 vectors, which is equal to the cosine of the angle between the vectors, times the lengths of each of the vectors. A.Dot(B) == |A| * |B| * cos(fi)

Equals ( object obj ) : bool
GetHashCode ( ) : int
Multiply ( Real scalar, Vector2 right ) : Vector2

Used when a scalar value is multiplied by a Vector2.

Multiply ( Vector2 left, Real scalar ) : Vector2

Used when a Vector2 is multiplied by a scalar value.

Negate ( Vector2 left ) : Vector2

Used to negate the elements of a vector.

Normalize ( ) : Real

Normalizes the vector.

This method normalises the vector such that it's length / magnitude is 1. The result is called a unit vector.

This function will not crash for zero-sized vectors, but there will be no changes made to their components.

Parse ( string s ) : Vector2
Subtract ( Vector2 left, Vector2 right ) : Vector2

Used to subtract a Vector2 from another Vector2.

ToNormalized ( ) : Vector2

Gets a normalized (unit length) vector of this vector

ToString ( ) : string
Vector2 ( Real x, Real y ) : System

Constructor.

operator ( ) : Vector2

Used when a Vector2 is added to another Vector2.

operator ( ) : bool

Method Details

Add() public static method

Used when a Vector2 is added to another Vector2.
public static Add ( Vector2 left, Vector2 right ) : Vector2
left Vector2
right Vector2
return Vector2

Cross() public method

Calculates the 2 dimensional cross-product of 2 vectors, which results in a Real value which is 2 times the area of the triangle defined by the two vectors. It also is the magnitude of the 3D vector that is perpendicular to the 2D vectors if the 2D vectors are projected to 3D space.
public Cross ( Vector2 vector ) : Real
vector Vector2
return Real

Dot() public method

Calculates the 2 dimensional dot-product of 2 vectors, which is equal to the cosine of the angle between the vectors, times the lengths of each of the vectors. A.Dot(B) == |A| * |B| * cos(fi)
public Dot ( Vector2 vector ) : Real
vector Vector2
return Real

Equals() public method

public Equals ( object obj ) : bool
obj object
return bool

GetHashCode() public method

public GetHashCode ( ) : int
return int

Multiply() public static method

Used when a scalar value is multiplied by a Vector2.
public static Multiply ( Real scalar, Vector2 right ) : Vector2
scalar Real
right Vector2
return Vector2

Multiply() public static method

Used when a Vector2 is multiplied by a scalar value.
public static Multiply ( Vector2 left, Real scalar ) : Vector2
left Vector2
scalar Real
return Vector2

Negate() public static method

Used to negate the elements of a vector.
public static Negate ( Vector2 left ) : Vector2
left Vector2
return Vector2

Normalize() public method

Normalizes the vector.
This method normalises the vector such that it's length / magnitude is 1. The result is called a unit vector.

This function will not crash for zero-sized vectors, but there will be no changes made to their components.

public Normalize ( ) : Real
return Real

Parse() public method

public Parse ( string s ) : Vector2
s string
return Vector2

Subtract() public static method

Used to subtract a Vector2 from another Vector2.
public static Subtract ( Vector2 left, Vector2 right ) : Vector2
left Vector2
right Vector2
return Vector2

ToNormalized() public method

Gets a normalized (unit length) vector of this vector
public ToNormalized ( ) : Vector2
return Vector2

ToString() public method

public ToString ( ) : string
return string

Vector2() public method

Constructor.
public Vector2 ( Real x, Real y ) : System
x Real X position.
y Real Y position
return System

operator() public static method

Used when a Vector2 is added to another Vector2.
public static operator ( ) : Vector2
return Vector2

operator() public static method

public static operator ( ) : bool
return bool

Property Details

x public property

public Real x
return Real