dlsl.vector

dlsl.vector

Members

Aliases

isInfinity
alias isInfinity = isinf

query if any entry is inf

isNaN
alias isNaN = isnan

query if any entry is nan

isValid
alias isValid = isvalid

query if all entries are not nan and not inf

vec2
alias vec2 = Vector!(float, 2)

Pre-defined vector types

Functions

cross
genType cross(in genType a, in genType b)

Vector cross product

distance
genType.valueType distance(const genType a, const genType b)

Distance between two vectors

dot
genType.valueType dot(in genType a, in genType b)

Vector dot product

faceforward
genType faceforward(in genType N, in genType I, in genType Nref)

Flip the Vector N based on an incident vector I and a reference Vector Nref

length
auto length(in genType v)

Vector length floating point valueType

normalize
genType normalize(in genType v)

Vector normalize

reflect
genType reflect(in genType I, in genType N)

Reflect the Vector I on a plane with normal N The normal N must already to be normalized

refract
genType.valueType refract(genType I, genType N, genType.valueType eta)

For the incident vector I and surface normal N, and the ratio of indices of refraction eta, return the refraction vector The input parameters for the incident vector I and the surface normal N must already be normalized

Structs

Vector
struct Vector(type, int dim)

Base template for all vector-types.

Templates

isVector
template isVector(T)

If T is a vector, this evaluates to true, otherwise false

Meta

Authors

Peter Particle ( based on gl3n by David Herberth )

License

MIT

Note: All methods marked with pure are weakly pure since, they all access an instance member. All static methods are strongly pure.