![]() |
Jypeli 4
The simple game programming library
|
This is the Vector Class. Lisää...
Julkiset jäsenfunktiot | |
| Vector2D (Scalar X, Scalar Y) | |
| Creates a New Vector2D Instance on the Stack. | |
| Vector2D (Scalar[] vals) | |
| Vector2D (Scalar[] vals, int index) | |
| Scalar[] | ToArray () |
| Copies the elements of the IAdvanceValueType to a new array of Scalar . | |
| void | CopyFrom (Scalar[] array, int index) |
| Copies all the elements, up to the Length of the IAdvanceValueType, of the specified one-dimensional Array to the IAdvanceValueType. | |
| void | CopyTo (Scalar[] array, int index) |
| Copies all the elements of the IAdvanceValueType to the specified one-dimensional Array of Scalar. | |
| Vector3D | ToVector3D (Scalar Z) |
| string | ToString (string format) |
| Converts the numeric value of this instance to its equivalent string representation, using the specified format. | |
| override string | ToString () |
| override int | GetHashCode () |
| Provides a unique hash code based on the member variables of this class. This should be done because the equality operators (==, !=) have been overriden by this class. The standard implementation is a simple XOR operation between all local member variables. | |
| override bool | Equals (object obj) |
| Compares this Vector to another object. This should be done because the equality operators (==, !=) have been overriden by this class. | |
| bool | Equals (Vector2D other) |
Staattiset julkiset jäsenfunktiot | |
| static void | Copy (ref Vector2D vector, Scalar[] destArray) |
| static void | Copy (ref Vector2D vector, Scalar[] destArray, int index) |
| static void | Copy (Scalar[] sourceArray, out Vector2D result) |
| static void | Copy (Scalar[] sourceArray, int index, out Vector2D result) |
| static void | Copy (ref Vector4D source, out Vector2D dest) |
| static void | Copy (ref Vector3D source, out Vector2D dest) |
| static Vector2D | Clamp (Vector2D value, Vector2D min, Vector2D max) |
| Binds a value to. | |
| static void | Clamp (ref Vector2D value, ref Vector2D min, ref Vector2D max, out Vector2D result) |
| static Vector2D | Lerp (Vector2D left, Vector2D right, Scalar amount) |
| static void | Lerp (ref Vector2D left, ref Vector2D right, ref Scalar amount, out Vector2D result) |
| static Vector2D | Lerp (Vector2D left, Vector2D right, Vector2D amount) |
| static void | Lerp (ref Vector2D left, ref Vector2D right, ref Vector2D amount, out Vector2D result) |
| static Scalar | Distance (Vector2D left, Vector2D right) |
| static void | Distance (ref Vector2D left, ref Vector2D right, out Scalar result) |
| static Scalar | DistanceSq (Vector2D left, Vector2D right) |
| static void | DistanceSq (ref Vector2D left, ref Vector2D right, out Scalar result) |
| static Vector2D | FromLengthAndAngle (Scalar length, Scalar radianAngle) |
| Creates a Vector2D With the given length (Magnitude) and the given Angle. | |
| static void | FromLengthAndAngle (ref Scalar length, ref Scalar radianAngle, out Vector2D result) |
| static Vector2D | Rotate (Scalar radianAngle, Vector2D source) |
| Rotates a Vector2D. | |
| static void | Rotate (ref Scalar radianAngle, ref Vector2D source, out Vector2D result) |
| static Vector2D | SetAngle (Vector2D source, Scalar radianAngle) |
| Sets the Angle of a Vector2D without changing the Magnitude. | |
| static void | SetAngle (ref Vector2D source, ref Scalar radianAngle, out Vector2D result) |
| static Scalar | GetAngle (Vector2D source) |
| Determines the current Angle in radians of the Vector2D and Returns it. | |
| static void | GetAngle (ref Vector2D source, out Scalar result) |
| static Vector2D | Add (Vector2D left, Vector2D right) |
| Adds 2 Vectors2Ds. | |
| static void | Add (ref Vector2D left, ref Vector2D right, out Vector2D result) |
| static Vector2D | Subtract (Vector2D left, Vector2D right) |
| Subtracts 2 Vector2Ds. | |
| static void | Subtract (ref Vector2D left, ref Vector2D right, out Vector2D result) |
| static Vector2D | Transform (Matrix3x3 matrix, Vector2D source) |
| Uses a matrix multiplication to Transform the vector. | |
| static void | Transform (ref Matrix3x3 matrix, ref Vector2D source, out Vector2D result) |
| static Vector2D | TransformNormal (Matrix3x3 matrix, Vector2D source) |
| static void | TransformNormal (ref Matrix3x3 matrix, ref Vector2D source, out Vector2D result) |
| static Vector2D | Transform (Matrix2x3 matrix, Vector2D source) |
| Uses a matrix multiplication to Transform the vector. | |
| static void | Transform (ref Matrix2x3 matrix, ref Vector2D source, out Vector2D result) |
| static Vector2D | TransformNormal (Matrix2x3 matrix, Vector2D source) |
| static void | TransformNormal (ref Matrix2x3 matrix, ref Vector2D source, out Vector2D result) |
| static Vector2D | Transform (Matrix2x2 matrix, Vector2D source) |
| Uses a matrix multiplication to Transform the vector. | |
| static void | Transform (ref Matrix2x2 matrix, ref Vector2D source, out Vector2D result) |
| static Vector2D | Multiply (Vector2D source, Scalar scalar) |
| Does Scaler Multiplication on a Vector2D. | |
| static void | Multiply (ref Vector2D source, ref Scalar scalar, out Vector2D result) |
| static Vector2D | Multiply (Scalar scalar, Vector2D source) |
| static void | Multiply (ref Scalar scalar, ref Vector2D source, out Vector2D result) |
| static Scalar | Dot (Vector2D left, Vector2D right) |
| Does a Dot Operation Also know as an Inner Product. | |
| static void | Dot (ref Vector2D left, ref Vector2D right, out Scalar result) |
| static Scalar | ZCross (Vector2D left, Vector2D right) |
| Does a "2D" Cross Product also know as an Outer Product. | |
| static void | ZCross (ref Vector2D left, ref Vector2D right, out Scalar result) |
| static Vector2D | ZCross (Scalar leftZ, Vector2D right) |
| Does a "2D" Cross Product also know as an Outer Product. | |
| static void | ZCross (ref Scalar leftZ, ref Vector2D right, out Vector2D result) |
| static Vector2D | ZCross (Vector2D left, Scalar rightZ) |
| Does a "2D" Cross Product also know as an Outer Product. | |
| static void | ZCross (ref Vector2D left, ref Scalar rightZ, out Vector2D result) |
| static Scalar | GetMagnitudeSq (Vector2D source) |
| Gets the Squared Magnitude of the Vector2D that is passed. | |
| static void | GetMagnitudeSq (ref Vector2D source, out Scalar result) |
| static Scalar | GetMagnitude (Vector2D source) |
| Gets the Magnitude of the Vector2D that is passed. | |
| static void | GetMagnitude (ref Vector2D source, out Scalar result) |
| static Vector2D | SetMagnitude (Vector2D source, Scalar magnitude) |
| Sets the Magnitude of a Vector2D without changing the Angle. | |
| static void | SetMagnitude (ref Vector2D source, ref Scalar magnitude, out Vector2D result) |
| static Vector2D | Negate (Vector2D source) |
| Negates a Vector2D. | |
| static void | Negate (ref Vector2D source) |
| static void | Negate (ref Vector2D source, out Vector2D result) |
| static Vector2D | Normalize (Vector2D source) |
| This returns the Normalized Vector2D that is passed. This is also known as a Unit Vector. | |
| static void | Normalize (ref Vector2D source, out Vector2D result) |
| static void | Normalize (ref Vector2D source) |
| static Vector2D | Normalize (Vector2D source, out Scalar magnitude) |
| This returns the Normalized Vector2D that is passed. This is also known as a Unit Vector. | |
| static void | Normalize (ref Vector2D source, out Scalar magnitude, out Vector2D result) |
| static Vector2D | Project (Vector2D left, Vector2D right) |
| Thie Projects the left Vector2D onto the Right Vector2D. | |
| static void | Project (ref Vector2D left, ref Vector2D right, out Vector2D result) |
| static Vector2D | GetRightHandNormal (Vector2D source) |
| Gets a Vector2D that is perpendicular(orthogonal) to the passed Vector2D while staying on the XY Plane. | |
| static void | GetRightHandNormal (ref Vector2D source, out Vector2D result) |
| static Vector2D | GetLeftHandNormal (Vector2D source) |
| Gets a Vector2D that is perpendicular(orthogonal) to the passed Vector2D while staying on the XY Plane. | |
| static void | GetLeftHandNormal (ref Vector2D source, out Vector2D result) |
| static Vector2D | Hermite (Vector2D value1, Vector2D tangent1, Vector2D value2, Vector2D tangent2, Scalar amount) |
| static void | Hermite (ref Vector2D value1, ref Vector2D tangent1, ref Vector2D value2, ref Vector2D tangent2, Scalar amount, out Vector2D result) |
| static Vector2D | CatmullRom (Vector2D value1, Vector2D value2, Vector2D value3, Vector2D value4, Scalar amount) |
| static void | CatmullRom (ref Vector2D value1, ref Vector2D value2, ref Vector2D value3, ref Vector2D value4, Scalar amount, out Vector2D result) |
| static Vector2D | Max (Vector2D value1, Vector2D value2) |
| static void | Max (ref Vector2D value1, ref Vector2D value2, out Vector2D result) |
| static Vector2D | Min (Vector2D value1, Vector2D value2) |
| static void | Min (ref Vector2D value1, ref Vector2D value2, out Vector2D result) |
| static Vector2D | operator+ (Vector2D left, Vector2D right) |
| Adds 2 Vectors2Ds. | |
| static Vector2D | operator- (Vector2D left, Vector2D right) |
| Subtracts 2 Vector2Ds. | |
| static Vector2D | operator* (Vector2D source, Scalar scalar) |
| Does Scaler Multiplication on a Vector2D. | |
| static Vector2D | operator* (Scalar scalar, Vector2D source) |
| Does Scaler Multiplication on a Vector2D. | |
| static Scalar | operator* (Vector2D left, Vector2D right) |
| Does a Dot Operation Also know as an Inner Product. | |
| static Vector2D | operator* (Matrix2x3 matrix, Vector2D source) |
| static Vector2D | operator* (Matrix3x3 matrix, Vector2D source) |
| static Vector2D | operator* (Matrix2x2 matrix, Vector2D source) |
| static Vector2D | operator- (Vector2D source) |
| Negates a Vector2D. | |
| static Scalar | operator^ (Vector2D left, Vector2D right) |
| Does a "2D" Cross Product also know as an Outer Product. | |
| static Vector2D | operator^ (Scalar leftZ, Vector2D right) |
| Does a "2D" Cross Product also know as an Outer Product. | |
| static Vector2D | operator^ (Vector2D left, Scalar rightZ) |
| Does a "2D" Cross Product also know as an Outer Product. | |
| static bool | operator== (Vector2D left, Vector2D right) |
| Specifies whether the Vector2Ds contain the same coordinates. | |
| static bool | operator!= (Vector2D left, Vector2D right) |
| Specifies whether the Vector2Ds do not contain the same coordinates. | |
| static | operator Vector2D (Vector3D source) |
| static bool | TryParse (string s, out Vector2D result) |
| static Vector2D | Parse (string s) |
| static bool | Equals (Vector2D left, Vector2D right) |
| static bool | Equals (ref Vector2D left, ref Vector2D right) |
Julkiset attribuutit | |
| const int | Count = 2 |
| The number of Scalar values in the class. | |
| const int | Size = sizeof(Scalar) * Count |
| The Size of the class in bytes;. | |
| Scalar | X |
| This is the X value. (Usually represents a horizontal position or direction.) | |
| Scalar | Y |
| This is the Y value. (Usually represents a vertical position or direction.) | |
Staattiset julkiset attribuutit | |
| static readonly Vector2D | One = new Vector2D(1,1) |
| Vector2D(1,1) | |
| static readonly Vector2D | Zero = new Vector2D() |
| Vector2D(0,0) | |
| static readonly Vector2D | XAxis = new Vector2D(1, 0) |
| Vector2D(1,0) | |
| static readonly Vector2D | YAxis = new Vector2D(0, 1) |
| Vector2D(0,1) | |
| static readonly Vector2D | XYAxis = new Vector2D((Scalar)0.7071067811865475244008443621052, (Scalar)0.7071067811865475244008443621052) |
| Vector2D(0.707...,0.707...) | |
Ominaisuudet | |
| Vector2D | RightHandNormal [get] |
| Gets A perpendicular(orthogonal) Vector2D using the Right Hand Rule. | |
| Vector2D | LeftHandNormal [get] |
| Gets A perpendicular(orthogonal) Vector2D using the Left Hand Rule. | |
| Scalar | Magnitude [get, set] |
| Gets or Sets the Magnitude (Length) of the Vector2D. | |
| Scalar | MagnitudeSq [get] |
| Gets the Squared Magnitude of the Vector2D. | |
| Scalar | Angle [get, set] |
| Gets or Sets the Angle in radians of the Vector2D. | |
| Vector2D | Normalized [get] |
| Gets the Normalized Vector2D. (Unit Vector) | |
| int IAdvanceValueType. | Count [get] |
| The Number of Variables accesable though the indexer. | |
This is the Vector Class.
| Vector2D | ( | Scalar | X, |
| Scalar | Y | ||
| ) | [inline] |
Creates a New Vector2D Instance on the Stack.
| X | The X value. |
| Y | The Y value. |
Binds a value to.
| value | |
| lower | |
| upper |
| void CopyFrom | ( | Scalar[] | array, |
| int | index | ||
| ) | [inline] |
Copies all the elements, up to the Length of the IAdvanceValueType, of the specified one-dimensional Array to the IAdvanceValueType.
| array | The one-dimensional Array that is the source of the elements copied to the IAdvanceValueType. |
| index | A 32-bit integer that represents the index in array at which copying begins. |
Toteuttaa luokan IAdvanceValueType.
| void CopyTo | ( | Scalar[] | array, |
| int | index | ||
| ) | [inline] |
Copies all the elements of the IAdvanceValueType to the specified one-dimensional Array of Scalar.
| array | The one-dimensional Array that is the destination of the elements copied from the IAdvanceValueType. |
| index | A 32-bit integer that represents the index in array at which copying begins. |
Toteuttaa luokan IAdvanceValueType.
| override bool Equals | ( | object | obj | ) | [inline] |
Compares this Vector to another object. This should be done because the equality operators (==, !=) have been overriden by this class.
| obj |
| static Vector2D FromLengthAndAngle | ( | Scalar | length, |
| Scalar | radianAngle | ||
| ) | [inline, static] |
Creates a Vector2D With the given length (Magnitude) and the given Angle.
| length | The length (Magnitude) of the Vector2D to be created |
| radianAngle | The angle of the from the (XAxis) in Radians |
FromLengthAndAngle(1,Math.PI/2)
would create a Vector2D equil to
new Vector2D(0,1)
. And
FromLengthAndAngle(1,0)
would create a Vector2D equil to
new Vector2D(1,0)
.
| static Scalar GetAngle | ( | Vector2D | source | ) | [inline, static] |
| override int GetHashCode | ( | ) | [inline] |
Provides a unique hash code based on the member variables of this class. This should be done because the equality operators (==, !=) have been overriden by this class. The standard implementation is a simple XOR operation between all local member variables.
| static Scalar GetMagnitude | ( | Vector2D | source | ) | [inline, static] |
| static Scalar GetMagnitudeSq | ( | Vector2D | source | ) | [inline, static] |
Does a "2D" Cross Product also know as an Outer Product.
| leftZ | The Z value of the left vector operand. |
| right | The right Vector2D operand. |
This 2D Cross Product is using a cheat. Since the Cross product (in 3D space) always generates a vector perpendicular (orthogonal) to the 2 vectors used as arguments. The cheat is that the only vector that can be perpendicular to two vectors in the XY Plane will parallel to the Z Axis. Since any vector that is parallel to the Z Axis will have zeros in both the X and Y Fields I can represent the cross product of 2 vectors in the XY plane as single scalar: Z. Also the Cross Product of and Vector on the XY plan and that of one ont on the Z Axis will result in a vector on the XY Plane. So the ZCross Methods were well thought out and can be trusted.
Does a "2D" Cross Product also know as an Outer Product.
This 2D Cross Product is using a cheat. Since the Cross product (in 3D space) always generates a vector perpendicular (orthogonal) to the 2 vectors used as arguments. The cheat is that the only vector that can be perpendicular to two vectors in the XY Plane will parallel to the Z Axis. Since any vector that is parallel to the Z Axis will have zeros in both the X and Y Fields I can represent the cross product of 2 vectors in the XY plane as single scalar: Z. Also the Cross Product of and Vector on the XY plan and that of one ont on the Z Axis will result in a vector on the XY Plane. So the ZCross Methods were well thought out and can be trusted.
Does a "2D" Cross Product also know as an Outer Product.
| left | The left Vector2D operand. |
| rightZ | The Z value of the right vector operand. |
This 2D Cross Product is using a cheat. Since the Cross product (in 3D space) always generates a vector perpendicular (orthogonal) to the 2 vectors used as arguments. The cheat is that the only vector that can be perpendicular to two vectors in the XY Plane will parallel to the Z Axis. Since any vector that is parallel to the Z Axis will have zeros in both the X and Y Fields I can represent the cross product of 2 vectors in the XY plane as single scalar: Z. Also the Cross Product of and Vector on the XY plan and that of one ont on the Z Axis will result in a vector on the XY Plane. So the ZCross Methods were well thought out and can be trusted.
| Scalar [] ToArray | ( | ) | [inline] |
Copies the elements of the IAdvanceValueType to a new array of Scalar .
Toteuttaa luokan IAdvanceValueType.
| string ToString | ( | string | format | ) | [inline] |
Converts the numeric value of this instance to its equivalent string representation, using the specified format.
| format | the format for each scaler in this Vector |
Toteuttaa luokan IAdvanceValueType.
Uses a matrix multiplication to Transform the vector.
| matrix | The Transformation matrix |
| source | The Vector to be transformed |
Uses a matrix multiplication to Transform the vector.
| matrix | The rotation matrix |
| source | The Vector to be transformed |
Uses a matrix multiplication to Transform the vector.
| matrix | The Transformation matrix |
| source | The Vector to be transformed |
Does a "2D" Cross Product also know as an Outer Product.
This 2D Cross Product is using a cheat. Since the Cross product (in 3D space) always generates a vector perpendicular (orthogonal) to the 2 vectors used as arguments. The cheat is that the only vector that can be perpendicular to two vectors in the XY Plane will parallel to the Z Axis. Since any vector that is parallel to the Z Axis will have zeros in both the X and Y Fields I can represent the cross product of 2 vectors in the XY plane as single scalar: Z. Also the Cross Product of and Vector on the XY plan and that of one ont on the Z Axis will result in a vector on the XY Plane. So the ZCross Methods were well thought out and can be trusted.
Does a "2D" Cross Product also know as an Outer Product.
| left | The left Vector2D operand. |
| rightZ | The Z value of the right vector operand. |
This 2D Cross Product is using a cheat. Since the Cross product (in 3D space) always generates a vector perpendicular (orthogonal) to the 2 vectors used as arguments. The cheat is that the only vector that can be perpendicular to two vectors in the XY Plane will parallel to the Z Axis. Since any vector that is parallel to the Z Axis will have zeros in both the X and Y Fields I can represent the cross product of 2 vectors in the XY plane as single scalar: Z. Also the Cross Product of and Vector on the XY plan and that of one ont on the Z Axis will result in a vector on the XY Plane. So the ZCross Methods were well thought out and can be trusted.
Does a "2D" Cross Product also know as an Outer Product.
| leftZ | The Z value of the left vector operand. |
| right | The right Vector2D operand. |
This 2D Cross Product is using a cheat. Since the Cross product (in 3D space) always generates a vector perpendicular (orthogonal) to the 2 vectors used as arguments. The cheat is that the only vector that can be perpendicular to two vectors in the XY Plane will parallel to the Z Axis. Since any vector that is parallel to the Z Axis will have zeros in both the X and Y Fields I can represent the cross product of 2 vectors in the XY plane as single scalar: Z. Also the Cross Product of and Vector on the XY plan and that of one ont on the Z Axis will result in a vector on the XY Plane. So the ZCross Methods were well thought out and can be trusted.
| const int Count = 2 |
The number of Scalar values in the class.
Toteuttaa luokan IAdvanceValueType.
| Scalar X |
This is the X value. (Usually represents a horizontal position or direction.)
readonly Vector2D XYAxis = new Vector2D((Scalar)0.7071067811865475244008443621052, (Scalar)0.7071067811865475244008443621052) [static] |
Vector2D(0.707...,0.707...)
| Scalar Y |
This is the Y value. (Usually represents a vertical position or direction.)
Scalar Angle [get, set] |
Gets or Sets the Angle in radians of the Vector2D.
If the Magnitude of the Vector is 1 then The Angles {0,Math.PI/2,Math.PI/2,3*Math.PI/2} would have the vectors {(1,0),(0,1),(-1,0),(0,-1)} respectively.
int IAdvanceValueType. Count [get] |
The Number of Variables accesable though the indexer.
Toteuttaa luokan IAdvanceValueType.
Scalar Magnitude [get, set] |
Gets or Sets the Magnitude (Length) of the Vector2D.
Toteuttaa luokan IVector< V >.
Scalar MagnitudeSq [get] |
Gets the Squared Magnitude of the Vector2D.
Toteuttaa luokan IVector< V >.
Vector2D Normalized [get] |
Gets the Normalized Vector2D. (Unit Vector)
Toteuttaa luokan IVector< V >.
1.7.4