vec2

2 dimensional vector

Constructors

this
this(float v)

create with all components filled with specified value

this
this(float[2] v)
Undocumented in source.
this
this(float[] v)
Undocumented in source.
this
this(float* v)
Undocumented in source.
this
this(vec2 v)
Undocumented in source.
this
this(float x, float y)
Undocumented in source.

Members

Aliases

length
alias length = magnitude
Undocumented in source.
u
alias u = x
Undocumented in source.
v
alias v = y
Undocumented in source.

Functions

add
vec2 add(float v)

add value to all components of vector

add
vec2 add(vec2 v)

add components of another vector to corresponding components of this vector

clear
vec2 clear(float v)

fill all components of vector with specified value

crossProduct
float crossProduct(vec2 v2)

cross product of 2 vec2 is scalar in Z axis

div
vec2 div(float v)

divide all components of vector by value

div
vec2 div(vec2 v)

divide components of this vector by corresponding components of another vector

dot
float dot(vec2 v)

dot product (sum of by-component products of vector components)

mul
vec2 mul(float v)

multiply all components of vector by value

mul
vec2 mul(vec2 v)

multiply components of this vector by corresponding components of another vector

normalize
void normalize()

normalize vector: make its length == 1

opAssign
vec2 opAssign(float[2] v)
Undocumented in source. Be warned that the author may not have intended to support it.
opAssign
vec2 opAssign(vec2 v)
Undocumented in source. Be warned that the author may not have intended to support it.
opBinary
vec2 opBinary(float v)

add value to all components of vector

opBinary
vec2 opBinary(float v)

multiply all components of vector by value

opBinary
vec2 opBinary(float v)

subtract value from all components of vector

opBinary
vec2 opBinary(float v)

divide all components of vector by value

opBinary
vec2 opBinary(vec2 v)

add value to all components of vector

opBinary
vec2 opBinary(vec2 v)

subtract value from all components of vector

opBinary
float opBinary(vec3 v)

subtract value from all components of vector

opOpAssign
vec2 opOpAssign(float v)

add value to all components of vector

opOpAssign
vec2 opOpAssign(float v)

multiply all components of vector by value

opOpAssign
vec2 opOpAssign(float v)

subtract value from all components of vector

opOpAssign
vec2 opOpAssign(float v)

divide all components of vector by value

opOpAssign
vec2 opOpAssign(vec2 v)

by component add values of corresponding components of other vector

opOpAssign
vec2 opOpAssign(vec2 v)

by component multiply values of corresponding components of other vector

opOpAssign
vec2 opOpAssign(vec2 v)

by component subtract values of corresponding components of other vector

opOpAssign
vec2 opOpAssign(vec2 v)

by component divide values of corresponding components of other vector

opUnary
vec2 opUnary()

returns vector with all components which are negative of components for this vector

rotated90ccw
vec2 rotated90ccw()

returns vector rotated 90 degrees counter clockwise

rotated90cw
vec2 rotated90cw()

returns vector rotated 90 degrees clockwise

sub
vec2 sub(float v)

subtract value from all components of vector

sub
vec2 sub(vec2 v)

subtract components of another vector from corresponding components of this vector

Properties

magnitude
float magnitude [@property getter]

length of vector

magnitudeSquared
float magnitudeSquared [@property getter]

sum of squares of all vector components

normalized
vec2 normalized [@property getter]

returns normalized copy of this vector

Unions

__anonymous
union __anonymous
Undocumented in source.

Meta