C# Class OpenBveApi.Math.Vector2

Represents a two-dimensional vector.
ファイルを表示 Open project: leezer3/OpenBVE Class Usage Examples

Public Properties

Property Type Description
Down Vector2
Left Vector2
Null Vector2
Right Vector2
Up Vector2
X double
Y double

Public Methods

Method Description
Dot ( Vector2 a, Vector2 b ) : double

Gives the dot product of two vectors.

IsNullVector ( ) : bool

Checks whether the vector is a null vector.

IsNullVector ( Vector2 vector ) : bool

Checks whether a vector is a null vector.

IsNullVector ( double tolerance ) : bool

Checks whether the vector is considered a null vector.

Norm ( ) : double

Gets the euclidean norm.

Norm ( Vector2 vector ) : double

Gets the euclidean norm of the specified vector.

NormSquared ( ) : double

Gets the square of the euclidean norm.

NormSquared ( Vector2 vector ) : double

Gets the square of the euclidean norm of the specified vector.

Normalize ( Vector2 vector ) : Vector2

Normalizes a vector.

Normalize ( ) : void

Normalizes the vector.

Rotate ( Vector2 vector, double cosineOfAngle, double sineOfAngle ) : Vector2

Rotates a vector by a specified angle.

Rotate ( double cosineOfAngle, double sineOfAngle ) : void

Rotates the vector by the specified angle.

Scale ( Vector2 vector, Vector2 factor ) : Vector2

Scales a vector by a specified factor.

Scale ( Vector2 factor ) : void

Scales the vector by a specified factor.

ToString ( ) : string

Returns the representation of the vector in string format

Translate ( Vector2 vector, Vector2 offset ) : Vector2

Translates a vector by a specified offset.

Translate ( Vector2 offset ) : void

Translates the vector by a specified offset.

Vector2 ( double x, double y ) : System

Creates a new two-dimensional vector.

operator ( ) : Vector2

Adds two vectors.

operator ( ) : bool

Checks whether the two specified vectors are equal.

Method Details

Dot() public static method

Gives the dot product of two vectors.
public static Dot ( Vector2 a, Vector2 b ) : double
a Vector2 The first vector.
b Vector2 The second vector.
return double

IsNullVector() public method

Checks whether the vector is a null vector.
public IsNullVector ( ) : bool
return bool

IsNullVector() public static method

Checks whether a vector is a null vector.
public static IsNullVector ( Vector2 vector ) : bool
vector Vector2
return bool

IsNullVector() public method

Checks whether the vector is considered a null vector.
public IsNullVector ( double tolerance ) : bool
tolerance double The highest absolute value that each component of the vector may have before the vector is not considered a null vector.
return bool

Norm() public method

Gets the euclidean norm.
public Norm ( ) : double
return double

Norm() public static method

Gets the euclidean norm of the specified vector.
public static Norm ( Vector2 vector ) : double
vector Vector2 The vector.
return double

NormSquared() public method

Gets the square of the euclidean norm.
public NormSquared ( ) : double
return double

NormSquared() public static method

Gets the square of the euclidean norm of the specified vector.
public static NormSquared ( Vector2 vector ) : double
vector Vector2 The vector.
return double

Normalize() public static method

Normalizes a vector.
Raised when the vector is a null vector.
public static Normalize ( Vector2 vector ) : Vector2
vector Vector2 The vector.
return Vector2

Normalize() public method

Normalizes the vector.
Raised when the vector is a null vector.
public Normalize ( ) : void
return void

Rotate() public static method

Rotates a vector by a specified angle.
public static Rotate ( Vector2 vector, double cosineOfAngle, double sineOfAngle ) : Vector2
vector Vector2 The vector.
cosineOfAngle double The cosine of the angle.
sineOfAngle double The sine of the angle.
return Vector2

Rotate() public method

Rotates the vector by the specified angle.
public Rotate ( double cosineOfAngle, double sineOfAngle ) : void
cosineOfAngle double The cosine of the angle.
sineOfAngle double The sine of the angle.
return void

Scale() public static method

Scales a vector by a specified factor.
public static Scale ( Vector2 vector, Vector2 factor ) : Vector2
vector Vector2 The vector.
factor Vector2 The factor.
return Vector2

Scale() public method

Scales the vector by a specified factor.
public Scale ( Vector2 factor ) : void
factor Vector2 The factor.
return void

ToString() public method

Returns the representation of the vector in string format
public ToString ( ) : string
return string

Translate() public static method

Translates a vector by a specified offset.
public static Translate ( Vector2 vector, Vector2 offset ) : Vector2
vector Vector2 The vector.
offset Vector2 The offset.
return Vector2

Translate() public method

Translates the vector by a specified offset.
public Translate ( Vector2 offset ) : void
offset Vector2 The offset.
return void

Vector2() public method

Creates a new two-dimensional vector.
public Vector2 ( double x, double y ) : System
x double The x-coordinate.
y double The y-coordinate.
return System

operator() public static method

Adds two vectors.
public static operator ( ) : Vector2
return Vector2

operator() public static method

Checks whether the two specified vectors are equal.
public static operator ( ) : bool
return bool

Property Details

Down public_oe static_oe property

Represents a vector pointing down.
public static Vector2 Down
return Vector2

Left public_oe static_oe property

Represents a vector pointing left.
public static Vector2 Left
return Vector2

Null public_oe static_oe property

Represents a null vector.
public static Vector2 Null
return Vector2

Right public_oe static_oe property

Represents a vector pointing right.
public static Vector2 Right
return Vector2

Up public_oe static_oe property

Represents a vector pointing up.
public static Vector2 Up
return Vector2

X public_oe property

The x-coordinate.
public double X
return double

Y public_oe property

The y-coordinate.
public double Y
return double