FastMathAbout FastMath Units Class Hierarchy Classes, Interfaces, Objects and Records Types Variables Constants Functions and Procedures Identifiers License |
record TIVector2
Unit
Neslib.FastMath
Declaration
type TIVector2 = record
Description
A 2-dimensional vector that uses integer components instead of floating-point components.
TIVector2 is compatible with TPoint in the Delphi RTL. You can typecast between these two types or implicitly convert from one to the other through assignment (eg. MyIVector := MyPoint).
Overview
Fields
X: Integer |
Y: Integer |
R: Integer |
G: Integer |
S: Integer |
T: Integer |
C: array [0..1] of Integer |
Methods
Properties
property Components[constAIndex:Integer]: Integer read GetComponent write SetComponent; |
Description
Fields
X: Integer |
X and Y components of the vector. Aliases for C[0] and C[1].
|
Y: Integer |
X and Y components of the vector. Aliases for C[0] and C[1].
|
R: Integer |
Red and Green components of the vector. Aliases for C[0] and C[1].
|
G: Integer |
Red and Green components of the vector. Aliases for C[0] and C[1].
|
S: Integer |
S and T components of the vector. Aliases for C[0] and C[1].
|
T: Integer |
S and T components of the vector. Aliases for C[0] and C[1].
|
C: array [0..1] of Integer |
The two components of the vector.
|
Methods
procedure Init; overload; inline; |
Sets the two elements (X and Y) to 0.
|
procedure Init(const A: Integer); overload; inline; |
Sets the two elements (X and Y) to A.
Parameters
- A
- the value to set the two elements to.
|
procedure Init(const A1, A2: Integer); overload; inline; |
Sets the two elements (X and Y) to A1 and A2 respectively.
Parameters
- A1
- the value to set the first element to.
- A2
- the value to set the second element to.
|
class operator Implicit(const A: TPoint): TIVector2; inline; |
Implicitly converts a TPoint to a TIVector2.
|
class operator Implicit(const A: TIVector2): TPoint; inline; |
Implicitly converts a TQuaternion to a TPoint.
|
class operator Equal(const A, B: TIVector2): Boolean; inline; |
Checks two vectors for equality.
Returns
True if the two vectors match each other. |
class operator NotEqual(const A, B: TIVector2): Boolean; inline; |
Checks two vectors for inequality.
Returns
True if the two vectors are not equal. |
class operator Negative(const A: TIVector2): TIVector2; inline; |
Negates a vector.
Returns
The negative value of a vector (eg. (-A.X, -A.Y)) |
class operator Add(const A: TIVector2; const B: Integer): TIVector2; |
Adds a scalar value to a vector.
Returns
(A.X + B, A.Y + B) |
class operator Add(const A: Integer; const B: TIVector2): TIVector2; |
Adds a vector to a scalar value.
Returns
(A + B.X, A + B.Y) |
class operator Add(const A, B: TIVector2): TIVector2; |
Adds two vectors.
Returns
(A.X + B.X, A.Y + B.Y) |
class operator Subtract(const A: TIVector2; const B: Integer): TIVector2; |
Subtracts a scalar value from a vector.
Returns
(A.X - B, A.Y - B) |
class operator Subtract(const A: Integer; const B: TIVector2): TIVector2; |
Subtracts a vector from a scalar value.
Returns
(A - B.X, A - B.Y) |
class operator Subtract(const A, B: TIVector2): TIVector2; |
Subtracts two vectors.
Returns
(A.X - B.X, A.Y - B.Y) |
class operator Multiply(const A: TIVector2; const B: Integer): TIVector2; |
Multiplies a vector with a scalar value.
Returns
(A.X * B, A.Y * B) |
class operator Multiply(const A: Integer; const B: TIVector2): TIVector2; |
Multiplies a scalar value with a vector.
Returns
(A * B.X, A * B.Y) |
class operator Multiply(const A, B: TIVector2): TIVector2; |
Multiplies two vectors component-wise.
Returns
(A.X * B.X, A.Y * B.Y) |
class operator IntDivide(const A: TIVector2; const B: Integer): TIVector2; |
Divides a vector by a scalar value.
Returns
(A.X div B, A.Y div B) |
class operator IntDivide(const A: Integer; const B: TIVector2): TIVector2; |
Divides a scalar value by a vector.
Returns
(A div B.X, A div B.Y) |
class operator IntDivide(const A, B: TIVector2): TIVector2; |
Divides two vectors component-wise.
Returns
(A.X div B.X, A.Y div B.Y) |
function IsZero: Boolean; inline; |
Whether this is a zero vector.
Returns
True if X and Y are 0 |
Properties
property Components[constAIndex:Integer]: Integer read GetComponent write SetComponent; |
Returns the components of the vector. This is identical to accessing the C-field, but this property can be used as a default array property.
Parameters
- AIndex
- index of the component to return (0 or 1). Range is checked with an assertion.
|
Generated by PasDocEx, based on PasDoc 0.14.0.
|