record TIVector3

DescriptionHierarchyFieldsMethodsProperties

Unit

Declaration

type TIVector3 = record

Description

A 3-dimensional vector that uses integer components instead of floating-point components.

Overview

Fields

X: Integer
Y: Integer
Z: Integer
R: Integer
G: Integer
B: Integer
S: Integer
T: Integer
P: Integer
C: array [0..2] of Integer

Methods

procedure Init; overload; inline;
procedure Init(const A: Integer); overload; inline;
procedure Init(const A1, A2, A3: Integer); overload; inline;
class operator Equal(const A, B: TIVector3): Boolean; inline;
class operator NotEqual(const A, B: TIVector3): Boolean; inline;
class operator Negative(const A: TIVector3): TIVector3;
class operator Add(const A: TIVector3; const B: Integer): TIVector3;
class operator Add(const A: Integer; const B: TIVector3): TIVector3;
class operator Add(const A, B: TIVector3): TIVector3;
class operator Subtract(const A: TIVector3; const B: Integer): TIVector3;
class operator Subtract(const A: Integer; const B: TIVector3): TIVector3;
class operator Subtract(const A, B: TIVector3): TIVector3;
class operator Multiply(const A: TIVector3; const B: Integer): TIVector3;
class operator Multiply(const A: Integer; const B: TIVector3): TIVector3;
class operator Multiply(const A, B: TIVector3): TIVector3;
class operator IntDivide(const A: TIVector3; const B: Integer): TIVector3;
class operator IntDivide(const A: Integer; const B: TIVector3): TIVector3;
class operator IntDivide(const A, B: TIVector3): TIVector3;
function IsZero: Boolean; inline;

Properties

property Components[constAIndex:Integer]: Integer read GetComponent write SetComponent;

Description

Fields

X: Integer

X, Y and Z components of the vector. Aliases for C[0], C[1] and C[2].

Y: Integer

X, Y and Z components of the vector. Aliases for C[0], C[1] and C[2].

Z: Integer

X, Y and Z components of the vector. Aliases for C[0], C[1] and C[2].

R: Integer

Red, Green and Blue components of the vector. Aliases for C[0], C[1] and C[2].

G: Integer

Red, Green and Blue components of the vector. Aliases for C[0], C[1] and C[2].

B: Integer

Red, Green and Blue components of the vector. Aliases for C[0], C[1] and C[2].

S: Integer

S, T and P components of the vector. Aliases for C[0], C[1] and C[2].

T: Integer

S, T and P components of the vector. Aliases for C[0], C[1] and C[2].

P: Integer

S, T and P components of the vector. Aliases for C[0], C[1] and C[2].

C: array [0..2] of Integer

The three components of the vector.

Methods

procedure Init; overload; inline;

Sets the three elements (X, Y and Z) to 0.

procedure Init(const A: Integer); overload; inline;

Sets the three elements (X, Y and Z) to A.

Parameters
A
the value to set the three elements to.
procedure Init(const A1, A2, A3: Integer); overload; inline;

Sets the three elements (X, Y and Z) to A1, A2 and A3 respectively.

Parameters
A1
the value to set the first element to.
A2
the value to set the second element to.
A3
the value to set the third element to.
class operator Equal(const A, B: TIVector3): Boolean; inline;

Checks two vectors for equality.

Returns

True if the two vectors match each other exactly.

class operator NotEqual(const A, B: TIVector3): Boolean; inline;

Checks two vectors for inequality.

Returns

True if the two vectors are not equal.

class operator Negative(const A: TIVector3): TIVector3;

Negates a vector.

Returns

The negative value of a vector (eg. (-A.X, -A.Y, -A.Z))

class operator Add(const A: TIVector3; const B: Integer): TIVector3;

Adds a scalar value to a vector.

Returns

(A.X + B, A.Y + B, A.Z + B)

class operator Add(const A: Integer; const B: TIVector3): TIVector3;

Adds a vector to a scalar value.

Returns

(A + B.X, A + B.Y, A + B.Z)

class operator Add(const A, B: TIVector3): TIVector3;

Adds two vectors.

Returns

(A.X + B.X, A.Y + B.Y, A.Z + B.Z)

class operator Subtract(const A: TIVector3; const B: Integer): TIVector3;

Subtracts a scalar value from a vector.

Returns

(A.X - B, A.Y - B, A.Z - B)

class operator Subtract(const A: Integer; const B: TIVector3): TIVector3;

Subtracts a vector from a scalar value.

Returns

(A - B.X, A - B.Y, A - B.Z)

class operator Subtract(const A, B: TIVector3): TIVector3;

Subtracts two vectors.

Returns

(A.X - B.X, A.Y - B.Y, A.Z - B.Z)

class operator Multiply(const A: TIVector3; const B: Integer): TIVector3;

Multiplies a vector with a scalar value.

Returns

(A.X * B, A.Y * B, A.Z * B)

class operator Multiply(const A: Integer; const B: TIVector3): TIVector3;

Multiplies a scalar value with a vector.

Returns

(A * B.X, A * B.Y, A * B.Z)

class operator Multiply(const A, B: TIVector3): TIVector3;

Multiplies two vectors component-wise.

Returns

(A.X * B.X, A.Y * B.Y, A.Z * B.Z)

class operator IntDivide(const A: TIVector3; const B: Integer): TIVector3;

Divides a vector by a scalar value.

Returns

(A.X div B, A.Y div B, A.Z div B)

class operator IntDivide(const A: Integer; const B: TIVector3): TIVector3;

Divides a scalar value by a vector.

Returns

(A div B.X, A div B.Y, A div B.Z)

class operator IntDivide(const A, B: TIVector3): TIVector3;

Divides two vectors component-wise.

Returns

(A.X div B.X, A.Y div B.Y, A.Z div B.Z)

function IsZero: Boolean; inline;

Whether this is a zero vector.

Returns

True if X, Y and Z 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-2). Range is checked with an assertion.

Generated by PasDocEx, based on PasDoc 0.14.0.