Quantum 2
2.1.9
Represents a 2D Vector More...
Public Member Functions | |
| FPVector2 (FP value) | |
| Creates a new FPVector2 instance. More... | |
| FPVector2 (FP x, FP y) | |
| Creates a new FPVector2 instance. More... | |
| bool | IsLeftOf (FPVector2 vector) |
| Returns true if this vector is on the left side of vector More... | |
| bool | IsRightOf (FPVector2 vector) |
| Returns true if this vector is on the right side of vector More... | |
Static Public Member Functions | |
| static FP | Angle (FPVector2 a, FPVector2 b) |
| Returns the angle in degrees between a and b . More... | |
| static FPVector2 | Barycentric (FPVector2 value1, FPVector2 value2, FPVector2 value3, FP t1, FP t2) |
| Equivalent of calling FPMath.Barycentric(FP, FP, FP, FP, FP) for each component. More... | |
| static FPVector2 | CalculateLeft (FPVector2 vector) |
| Returns vector rotated by 90 degrees counterclockwise. More... | |
| static FP | CalculatePolygonArea (FPVector2[] vertices) |
| Retruns an area of a polygon defined by vertices . More... | |
| static FPVector2 | CalculatePolygonCentroid (FPVector2[] vertices) |
| Returns a centroid of a polygon defined by vertices . More... | |
| static FP | CalculatePolygonInertiaFactor (FPVector2[] vertices) |
| Calculates the mass moment of inertia factor of a polygon defined by vertices . More... | |
| static FPVector2 | CalculatePolygonLocalSupport (FPVector2[] vertices, ref FPVector2 localDir) |
| Calculates the support point in a direction localDir of a polygon defined by vertices . More... | |
| static FPVector2[] | CalculatePolygonNormals (FPVector2[] vertices) |
| Calculates a normal for each edge of a polygon defined by vertices . More... | |
| static FP | CalculatePolygonRadius (FPVector2[] vertices) |
| Returns a radius of a centered polygon defined by vertices . More... | |
| static FPVector2 | CalculateRight (FPVector2 vector) |
| Returns vector rotated by 90 degrees clockwise. More... | |
| static FPVector2 | CatmullRom (FPVector2 value1, FPVector2 value2, FPVector2 value3, FPVector2 value4, FP t) |
| Equivalent of calling FPMath.CatmullRom(FP, FP, FP, FP, FP) for each component. More... | |
| static FPVector2 | Clamp (FPVector2 value, FPVector2 min, FPVector2 max) |
| Clamps each component of value to the range [min , max ] More... | |
| static FPVector2 | ClampMagnitude (FPVector2 vector, FP maxLength) |
| Clamps the magnitude of a vector More... | |
| static FP | Cross (FPVector2 a, FPVector2 b) |
| The perp-dot product (a 2D equivalent of the 3D cross product) of two vectors. More... | |
| static FP | Determinant (FPVector2 v1, FPVector2 v2) |
| Returns determinant of two 2d vectors which is handy to check the angle between them (method is identical to FPVector2.Cross). Determinant == 0 -> Vector1 and Vector2 are collinear Determinant less than 0 -> Vector1 is left of Vector2 Determinant greater than 0 -> Vector1 is right of Vector2 More... | |
| static FP | Distance (FPVector2 a, FPVector2 b) |
| Calculates the distance between two vectors More... | |
| static FP | DistanceSquared (FPVector2 a, FPVector2 b) |
| Calculates the squared distance between two vectors More... | |
| static FP | Dot (FPVector2 a, FPVector2 b) |
| Calculates the dot product of two vectors. More... | |
| static FPVector2 | Hermite (FPVector2 value1, FPVector2 tangent1, FPVector2 value2, FPVector2 tangent2, FP t) |
| Equivalent of callingFPMath.Hermite(FP, FP, FP, FP, FP) for each component. More... | |
| static Boolean | IsPolygonConvex (FPVector2[] vertices) |
| Returns true if the polygon defined by vertices is convex. More... | |
| static FPVector2 | Lerp (FPVector2 start, FPVector2 end, FP t) |
| Linearly interpolates between start and end by t . t is clamped to the range [0, 1] More... | |
| static FPVector2 | LerpUnclamped (FPVector2 start, FPVector2 end, FP t) |
| Linearly interpolates between start and end by t . More... | |
| static FPVector2 | Max (FPVector2 value1, FPVector2 value2) |
| Gets a vector with the maximum x and y values of both vectors. More... | |
| static FPVector2 | Max (params FPVector2[] vectors) |
| Gets a vector with the maximum x and y values of all the vectors. If vectors is null or empty, return Zero. More... | |
| static FPVector2 | Min (FPVector2 value1, FPVector2 value2) |
| Gets a vector with the minimum x and y values of both vectors. More... | |
| static FPVector2 | Min (params FPVector2[] vectors) |
| Gets a vector with the min x and y values of all the vectors. If vectors is null or empty, return Zero. More... | |
| static FPVector2 | MoveTowards (FPVector2 from, FPVector2 to, FP maxDelta) |
| Calculate a position between the points specified by from and to , moving no farther than the distance specified by maxDelta . More... | |
| static FPVector2 | Normalize (FPVector2 value) |
| Normalizes the given vector. If the vector is too short to normalize, Zero will be returned. More... | |
| static FPVector2 | Normalize (FPVector2 value, out FP magnitude) |
| Normalizes the given vector. If the vector is too short to normalize, Zero will be returned. More... | |
| static Boolean | operator!= (FPVector2 a, FPVector2 b) |
| Returns true if two vectors are not exactly equal. More... | |
| static FPVector2 | operator* (FP s, FPVector2 v) |
| Multiplies each component of v times s . More... | |
| static FPVector2 | operator* (FPVector2 v, FP s) |
| Multiplies each component of v times s . More... | |
| static FPVector2 | operator* (FPVector2 v, Int32 s) |
| Multiplies each component of v times s . More... | |
| static FPVector2 | operator* (Int32 s, FPVector2 v) |
| Multiplies each component of v times s . More... | |
| static FPVector2 | operator+ (FPVector2 a, FPVector2 b) |
| Adds two vectors. More... | |
| static FPVector2 | operator- (FPVector2 a, FPVector2 b) |
| Subtracts b from a More... | |
| static FPVector2 | operator- (FPVector2 v) |
| Negates each component of v vector. More... | |
| static FPVector2 | operator/ (FPVector2 v, FP s) |
| Divides each component of v by s . More... | |
| static FPVector2 | operator/ (FPVector2 v, Int32 s) |
| Divides each component of v by s . More... | |
| static Boolean | operator== (FPVector2 a, FPVector2 b) |
| Returns true if two vectors are exactly equal. More... | |
| static bool | PolygonNormalsAreValid (FPVector2[] vertices) |
| Returns true if all normals of a polygon defined by vertices are non-zeroed. More... | |
| static FP | Radians (FPVector2 a, FPVector2 b) |
| Returns radians between two vectors. More... | |
| static FP | RadiansSigned (FPVector2 a, FPVector2 b) |
| Returns radians between two vectors. The result will be a negative number if b is on the right side of a . More... | |
| static FP | RadiansSignedSkipNormalize (FPVector2 a, FPVector2 b) |
| Returns radians between two vectors. The result will be a negative number if b is on the right side of a . Vectors are assumed to be normalized. More... | |
| static FP | RadiansSkipNormalize (FPVector2 a, FPVector2 b) |
| Returns radians between two vectors. Vectors are assumed to be normalized. More... | |
| static FPVector2[] | RecenterPolygon (FPVector2[] vertices) |
| Shifts polygon defined by vertices so that (0,0) becomes its center. More... | |
| static FPVector2 | Reflect (FPVector2 vector, FPVector2 normal) |
| Reflects a vector off the line defined by a normal. More... | |
| static FPVector2 | Rotate (FPVector2 vector, FP radians) |
| Rotates vector by radians radians. More... | |
| static FPVector2 | Rotate (FPVector2 vector, FP sin, FP cos) |
| Rotates vector by an angle sin is the sine of and cos is the cosine of. More... | |
| static void | Rotate (FPVector2[] vectors, FP radians) |
| Rotates each vector of vectors by radians radians. More... | |
| static void | Rotate (FPVector2[] vectors, FP sin, FP cos) |
| Rotates each vector of vectors by an angle sin is the sine of and cos is the cosine of. More... | |
| static FPVector2 | Scale (FPVector2 a, FPVector2 b) |
| Multiplies each component of the vector by the same components of the provided vector. More... | |
| static FPVector2 | SmoothStep (FPVector2 start, FPVector2 end, FP t) |
| Interpolates between start and end with smoothing at the limits. Equivalent of calling FPMath.SmoothStep(FP, FP, FP) for each component pair. More... | |
Public Attributes | |
| FP | X |
| The X component of the vector. More... | |
| FP | Y |
| The Y component of the vector. More... | |
Static Public Attributes | |
| static FPVector2 | Zero => new FPVector2() |
| A vector with components (0,0); More... | |
Properties | |
| static FPVector2 | Down [get] |
| A vector with components (0,-1); More... | |
| static FPVector2 | Left [get] |
| A vector with components (-1,0); More... | |
| FP | Magnitude [get] |
| Gets the length of the vector. More... | |
| static FPVector2 | MaxValue [get] |
| A vector with components (FP.MaxValue,FP.MaxValue); More... | |
| static FPVector2 | MinValue [get] |
| A vector with components (FP.MinValue,FP.MinValue); More... | |
| FPVector2 | Normalized [get] |
| Gets a normalized version of the vector. More... | |
| static FPVector2 | One [get] |
| A vector with components (1,1); More... | |
| FPVector3 | OXY [get] |
| Returns vector (0, X, Y). More... | |
| static FPVector2 | Right [get] |
| A vector with components (1,0); More... | |
| FP | SqrMagnitude [get] |
| Gets the squared length of the vector. More... | |
| static FPVector2 | Up [get] |
| A vector with components (0,1); More... | |
| static FPVector2 | UseableMax [get] |
| A vector with components (FP.UseableMax,FP.UseableMax); More... | |
| static FPVector2 | UseableMin [get] |
| A vector with components (FP.UseableMin,FP.UseableMin); More... | |
| FPVector3 | XOY [get] |
| Returns vector (X, 0, Y). More... | |
| FPVector3 | XYO [get] |
| Returns vector (X, Y, 0). More... | |
Represents a 2D Vector
Creates a new FPVector2 instance.
| x | X component |
| y | Y component |
|
inline |
Creates a new FPVector2 instance.
| value | A value to be assigned to both components |
Normalizes the given vector. If the vector is too short to normalize, Zero will be returned.
| value | The vector which should be normalized. |
|
inlinestatic |
Normalizes the given vector. If the vector is too short to normalize, Zero will be returned.
| value | The vector which should be normalized. |
| magnitude | The original vector's magnitude. |
Calculates the distance between two vectors
| a | First vector |
| b | Second vector |
Calculates the squared distance between two vectors
| a | First vector |
| b | Second vector |
Calculates the dot product of two vectors.
| a | The first vector. |
| b | The second vector. |
|
inlinestatic |
Clamps the magnitude of a vector
| vector | Vector to clamp |
| maxLength | Max length of the supplied vector |
Rotates each vector of vectors by radians radians.
Rotation is counterclockwise.
| vectors | |
| radians |
|
inlinestatic |
Rotates vector by radians radians.
Rotation is counterclockwise.
| vector | |
| radians |
|
inlinestatic |
Rotates each vector of vectors by an angle sin is the sine of and cos is the cosine of.
Rotation is performed counterclockwise.
| vectors | |
| sin | |
| cos |
|
inlinestatic |
Rotates vector by an angle sin is the sine of and cos is the cosine of.
Rotation is performed counterclockwise.
| vector | |
| sin | |
| cos |
The perp-dot product (a 2D equivalent of the 3D cross product) of two vectors.
| a | The first vector. |
| b | The second vector. |
|
inlinestatic |
Reflects a vector off the line defined by a normal.
| vector | Vector to be reflected. |
| normal | Normal along which the vector is reflected. Expected to be normalized. |
|
inlinestatic |
Clamps each component of value to the range [min , max ]
| value | |
| min | |
| max |
|
inlinestatic |
Linearly interpolates between start and end by t . t is clamped to the range [0, 1]
| start | |
| end | |
| t |
|
inlinestatic |
Linearly interpolates between start and end by t .
| start | |
| end | |
| t |
|
inlinestatic |
Gets a vector with the maximum x and y values of both vectors.
| value1 | The first value. |
| value2 | The second value. |
Gets a vector with the maximum x and y values of all the vectors. If vectors is null or empty, return Zero.
| vectors |
|
inlinestatic |
Gets a vector with the minimum x and y values of both vectors.
| value1 | The first value. |
| value2 | The second value. |
Gets a vector with the min x and y values of all the vectors. If vectors is null or empty, return Zero.
| vectors |
Multiplies each component of the vector by the same components of the provided vector.
| a | |
| b |
Returns the angle in degrees between a and b .
See also: Radians,
, , ,
| a | |
| b |
Returns vector rotated by 90 degrees clockwise.
| vector |
Returns vector rotated by 90 degrees counterclockwise.
| vector |
|
inline |
Returns true if this vector is on the right side of vector
| vector |
|
inline |
Returns true if this vector is on the left side of vector
| vector |
Returns determinant of two 2d vectors which is handy to check the angle between them (method is identical to FPVector2.Cross). Determinant == 0 -> Vector1 and Vector2 are collinear Determinant less than 0 -> Vector1 is left of Vector2 Determinant greater than 0 -> Vector1 is right of Vector2
| v1 | Vector1 |
| v2 | Vector2 |
Returns radians between two vectors.
| a | |
| b |
|
inlinestatic |
Returns radians between two vectors. Vectors are assumed to be normalized.
| a | |
| b |
Returns radians between two vectors. The result will be a negative number if b is on the right side of a .
| a | |
| b |
|
inlinestatic |
Returns radians between two vectors. The result will be a negative number if b is on the right side of a . Vectors are assumed to be normalized.
| a | |
| b |
|
inlinestatic |
Interpolates between start and end with smoothing at the limits. Equivalent of calling FPMath.SmoothStep(FP, FP, FP) for each component pair.
| start | |
| end | |
| t |
|
inlinestatic |
Equivalent of callingFPMath.Hermite(FP, FP, FP, FP, FP) for each component.
| value1 | |
| tangent1 | |
| value2 | |
| tangent2 | |
| t |
|
inlinestatic |
Equivalent of calling FPMath.Barycentric(FP, FP, FP, FP, FP) for each component.
| value1 | |
| value2 | |
| value3 | |
| t1 | |
| t2 |
|
inlinestatic |
Equivalent of calling FPMath.CatmullRom(FP, FP, FP, FP, FP) for each component.
| value1 | |
| value2 | |
| value3 | |
| value4 | |
| t |
|
inlinestatic |
Returns true if the polygon defined by vertices is convex.
| vertices |
|
inlinestatic |
Calculates a normal for each edge of a polygon defined by vertices .
| vertices |
|
inlinestatic |
Returns true if all normals of a polygon defined by vertices are non-zeroed.
| vertices |
|
inlinestatic |
Shifts polygon defined by vertices so that (0,0) becomes its center.
| vertices |
Retruns an area of a polygon defined by vertices .
| vertices |
|
inlinestatic |
Returns a centroid of a polygon defined by vertices .
| vertices |
|
inlinestatic |
Calculates the mass moment of inertia factor of a polygon defined by vertices .
To compute a body mass moment of inertia, multiply the factor by the body mass.
| vertices | The 2D vertices that define the polygon. |
|
inlinestatic |
Calculates the support point in a direction localDir of a polygon defined by vertices .
A support point is the furthest point of a shape in a given direction.
Both support point and direction are expressed in the local space of the polygon.
The polygon vertices are expected to be counterclockwise.
| vertices | The 2D vertices that define the polygon. |
| localDir | The direction, in local space, in which the support point will be calculated. |
|
inlinestatic |
Returns a radius of a centered polygon defined by vertices .
| vertices |
|
inlinestatic |
Calculate a position between the points specified by from and to , moving no farther than the distance specified by maxDelta .
| from | |
| to | |
| maxDelta |
s
Returns true if two vectors are exactly equal.
| a | |
| b |
Returns true if two vectors are not exactly equal.
| a | |
| b |
Negates each component of v vector.
| v |
Adds two vectors.
| a | |
| b |
Subtracts b from a
| a | |
| b |
Multiplies each component of v times s .
| v | |
| s |
Multiplies each component of v times s .
| v | |
| s |
Multiplies each component of v times s .
| v | |
| s |
Multiplies each component of v times s .
| v | |
| s |
Divides each component of v by s .
| v | |
| s |
Divides each component of v by s .
| v | |
| s |
A vector with components (0,0);
| FP Photon.Deterministic.FPVector2.X |
The X component of the vector.
| FP Photon.Deterministic.FPVector2.Y |
The Y component of the vector.
|
staticget |
A vector with components (1,1);
|
staticget |
A vector with components (1,0);
|
staticget |
A vector with components (-1,0);
|
staticget |
A vector with components (0,1);
|
staticget |
A vector with components (0,-1);
|
staticget |
A vector with components (FP.MinValue,FP.MinValue);
|
staticget |
A vector with components (FP.MaxValue,FP.MaxValue);
|
staticget |
A vector with components (FP.UseableMin,FP.UseableMin);
|
staticget |
A vector with components (FP.UseableMax,FP.UseableMax);
|
get |
Gets the length of the vector.
|
get |
Gets the squared length of the vector.
|
get |
Gets a normalized version of the vector.
|
get |
Returns vector (X, 0, Y).
|
get |
Returns vector (X, Y, 0).
|
get |
Returns vector (0, X, Y).