Vector

Vector structure with data accesible with [N] or swizzling

Constructors

this
this(T val)
this(T[N] vals)

Constructs Vector from components. If no components present vector will be filled with 0

Alias This

data

Alias to allow easy data access

Members

Aliases

VecType
alias VecType = Vector!(T, N)

Alias to vector type. Can be used to contruct vectors of same type

dataType
alias dataType = T

Alias to data type (e.g. float, int)

isNormalised
alias isNormalised = isNormalized

Returns true if vector is normalised

normalise
alias normalise = normalize

Normalises vector

Functions

abs
void abs()

Abs vector values

ceil
void ceil()

Ceils vector values

clamp
void clamp(VecType p_min, VecType p_max)

Clamps vector values

copyof
VecType copyof()

Returns copy of vector

distanceSquaredTo
T distanceSquaredTo(VecType b)

Returns squared distance from vector to b

distanceTo
T distanceTo(VecType b)

Calculates distance to vector b

dot
float dot(VecType b)

Performs dot product

floor
void floor()

Floors vector values

isClose
bool isClose(VecType v)

Is vector approximately close to v

isNormalized
bool isNormalized()

Returns true if vector is normalised

length
T length()

Returns vector length

lengthSquared
T lengthSquared()

Returns squared vector length

lerp
void lerp(VecType to, T weight)

Linear interpolates vector

limitLength
void limitLength(T p_len)

Limits vector length

max
void max(VecType b)

Clamps vector values to max

min
void min(VecType b)

Clamps vector values to min

normalize
void normalize()

Normalises vector

opBinary
auto opBinary(Vector!(R, N) b)
auto opBinary(R b)
opBinaryRight
auto opBinaryRight(Vector!(R, N) b)
auto opBinaryRight(R b)

opBinary x [+, -, *, /, %] y

opCmp
int opCmp(Vector!(R, N) b)

opCmp x [< > <= >=] y

opEquals
bool opEquals(Vector!(R, size) b)

opEquals x == y

opOpAssign
auto opOpAssign(Vector!(R, N) b)
auto opOpAssign(R b)

opOpAssign x [+, -, *, /, %]= y

opUnary
auto opUnary()

opUnary [-, +, --, ++] x

ptr
T* ptr()

Returns pointer to data

round
void round()

Rounds vector values

sign
void sign()

Signs current vector

snap
void snap(VecType p_step)

Snaps vector values

toHash
size_t toHash()

Returns hash

toString
string toString()

Returns string representation of vector: [1.00, 1.00,... , 1.00]

Mixins

__anonymous
mixin accessByString!(T, N, "data", AS)

Mixes in swizzle

Variables

data
T[N] data;

Vector data

size
enum size_t size;

Alias to vector size

Mixed In Members

From mixin accessByString!(T, N, "data", AS)

opDispatch
T opDispatch [@property getter]
Undocumented in source. Be warned that the author may not have intended to support it.
opDispatch
T opDispatch [@property getter]
Undocumented in source. Be warned that the author may not have intended to support it.
opDispatch
auto opDispatch [@property getter]
Undocumented in source. Be warned that the author may not have intended to support it.
opDispatch
U opDispatch [@property setter]
Undocumented in source. Be warned that the author may not have intended to support it.

Meta