Record TGenericVector2
Unit
Declaration
type TGenericVector2 = record
Description
Vector of 2 floating-point values.
See also
- TGenericVector3
- Vector of 3 floating-point values.
Overview
Nested Types
![]() |
TIndex = 0..1; |
Fields
![]() |
var Data: array [TIndex] of TGenericScalar; |
Methods
![]() |
class operator + (const A, B: TGenericVector2): TGenericVector2; inline; |
![]() |
class operator - (const A, B: TGenericVector2): TGenericVector2; inline; |
![]() |
class operator - (const V: TGenericVector2): TGenericVector2; inline; |
![]() |
class operator * (const V: TGenericVector2; const Scalar: TGenericScalar): TGenericVector2; inline; |
![]() |
class operator * (const Scalar: TGenericScalar; const V: TGenericVector2): TGenericVector2; inline; |
![]() |
class operator * (const V1, V2: TGenericVector2): TGenericVector2; inline; |
![]() |
class operator / (const V: TGenericVector2; const Scalar: TGenericScalar): TGenericVector2; inline; |
![]() |
procedure Init(const X, Y: TGenericScalar); inline; |
![]() |
function ToString: string; |
![]() |
function ToRawString: string; |
![]() |
function Normalize: TGenericVector2; inline; |
![]() |
procedure NormalizeMe; inline; |
![]() |
function Length: TGenericScalar; inline; |
![]() |
function LengthSqr: TGenericScalar; inline; |
![]() |
function AdjustToLength(const NewLength: TGenericScalar): TGenericVector2; inline; |
![]() |
class function DotProduct(const V1, V2: TGenericVector2): TGenericScalar; static; inline; |
![]() |
function Abs: TGenericVector2; inline; |
![]() |
function IsZero: boolean; overload; inline; |
![]() |
function IsZero(const Epsilon: TGenericScalar): boolean; overload; inline; |
![]() |
function IsPerfectlyZero: boolean; |
![]() |
class function Equals(const V1, V2: TGenericVector2): boolean; overload; inline; static; |
![]() |
class function Equals(const V1, V2: TGenericVector2; const Epsilon: TGenericScalar): boolean; overload; inline; static; |
![]() |
class function PerfectlyEquals(const V1, V2: TGenericVector2): boolean; static; inline; |
![]() |
class function Lerp(const A: TGenericScalar; const V1, V2: TGenericVector2): TGenericVector2; static; inline; |
![]() |
class function Zero: TGenericVector2; static; inline; |
Properties
![]() |
property Items [constIndex:TIndex]: TGenericScalar read GetItems write SetItems; |
![]() |
property X: TGenericScalar index 0 read GetItemsInt write SetItemsInt; |
![]() |
property Y: TGenericScalar index 1 read GetItemsInt write SetItemsInt; |
![]() |
class property One [constIndex:TIndex]: TGenericVector2 read GetOne; |
Description
Nested Types
![]() |
TIndex = 0..1; |
Fields
![]() |
var Data: array [TIndex] of TGenericScalar; |
Methods
![]() |
class operator + (const A, B: TGenericVector2): TGenericVector2; inline; |
![]() |
class operator - (const A, B: TGenericVector2): TGenericVector2; inline; |
![]() |
class operator - (const V: TGenericVector2): TGenericVector2; inline; |
![]() |
class operator * (const V: TGenericVector2; const Scalar: TGenericScalar): TGenericVector2; inline; |
![]() |
class operator * (const Scalar: TGenericScalar; const V: TGenericVector2): TGenericVector2; inline; |
![]() |
class operator * (const V1, V2: TGenericVector2): TGenericVector2; inline; |
|
Vector * vector makes a component-wise multiplication. This is consistent with GLSL and other vector APIs. | |
![]() |
class operator / (const V: TGenericVector2; const Scalar: TGenericScalar): TGenericVector2; inline; |
![]() |
procedure Init(const X, Y: TGenericScalar); inline; |
![]() |
function ToString: string; |
![]() |
function Normalize: TGenericVector2; inline; |
![]() |
procedure NormalizeMe; inline; |
![]() |
function Length: TGenericScalar; inline; |
![]() |
function LengthSqr: TGenericScalar; inline; |
|
Vector length squared. This is slightly faster than Length as it avoids calculating a square root along the way. (But, please remember to not optimize your code without a need. Optimize only parts that are proven bottlenecks, otherwise don't make the code less readable for the sake of speed.) | |
![]() |
function AdjustToLength(const NewLength: TGenericScalar): TGenericVector2; inline; |
|
Calculate a new vector scaled so that it has length equal to NewLength. NewLength may be negative, in which case we'll negate the vector and then adjust it's length to Abs(NewLength). | |
![]() |
class function DotProduct(const V1, V2: TGenericVector2): TGenericScalar; static; inline; |
|
Dot product of two vectors. See https://en.wikipedia.org/wiki/Dot_product . | |
![]() |
function Abs: TGenericVector2; inline; |
|
Absolute value on all components. | |
![]() |
function IsZero: boolean; overload; inline; |
|
Are all components equal to zero (within some epsilon margin). | |
![]() |
function IsZero(const Epsilon: TGenericScalar): boolean; overload; inline; |
|
Are all components equal to zero (within Epsilon margin). | |
![]() |
function IsPerfectlyZero: boolean; |
![]() |
class function Equals(const V1, V2: TGenericVector2): boolean; overload; inline; static; |
|
Compare two vectors, with epsilon to tolerate slightly different floats. | |
![]() |
class function Equals(const V1, V2: TGenericVector2; const Epsilon: TGenericScalar): boolean; overload; inline; static; |
![]() |
class function PerfectlyEquals(const V1, V2: TGenericVector2): boolean; static; inline; |
|
Compare two vectors using exact comparison (like the "=" operator to compare floats). | |
![]() |
class function Lerp(const A: TGenericScalar; const V1, V2: TGenericVector2): TGenericVector2; static; inline; |
|
Linear interpolation between two vector values. See also
| |
![]() |
class function Zero: TGenericVector2; static; inline; |
Properties
![]() |
property Items [constIndex:TIndex]: TGenericScalar read GetItems write SetItems; |
![]() |
property X: TGenericScalar index 0 read GetItemsInt write SetItemsInt; |
![]() |
property Y: TGenericScalar index 1 read GetItemsInt write SetItemsInt; |
![]() |
class property One [constIndex:TIndex]: TGenericVector2 read GetOne; |
Generated by PasDoc 0.16.0.
