zmath.vector
Defines a Vector of float point typefrom 2 to 4 dimension
-
Declaration
aliasVec2r= Vector!(real, 2LU).Vector;Alias of a 2d Vector with reals
-
Declaration
aliasVec3r= Vector!(real, 3LU).Vector;Alias of a 3d Vector with reals
-
Declaration
aliasVec4r= Vector!(real, 4LU).Vector;Alias of a 4d Vector with reals
-
Declaration
aliasVec2d= Vector!(double, 2LU).Vector;Alias of a 2d Vector with doubles
-
Declaration
aliasVec3d= Vector!(double, 3LU).Vector;Alias of a 3d Vector with doubles
-
Declaration
aliasVec4d= Vector!(double, 4LU).Vector;Alias of a 4d Vector with doubles
-
Declaration
aliasVec2f= Vector!(float, 2LU).Vector;Alias of a 2d Vector with floats
-
Declaration
aliasVec3f= Vector!(float, 3LU).Vector;Alias of a 3d Vector with floats
-
Declaration
aliasVec4f= Vector!(float, 4LU).Vector;Alias of a 4d Vector with floats
-
Declaration
structVector(T, size_t dim_) if (__traits(isFloating, T));N-Dimensional
Vectorover a FloatPoint type, where N must be 2,3 or 4-
Declaration
static enum size_tdim;Vector Dimension
-
Declaration
T[dim]coor;Vector coords like Array
-
Declaration
Tx;X coord
-
Declaration
aliasr= x;R component
-
Declaration
aliasroll= x;Euler
rollangle -
Declaration
aliasbank= x;Euler roll angle
-
Declaration
Ty;Y coord
-
Declaration
aliasg= y;G component
-
Declaration
aliaspitch= y;Euler pith angle
-
Declaration
aliasattidue= y;Euler pith angle
-
Declaration
Tz;Z coord
-
Declaration
aliasb= z;B component
-
Declaration
aliasyaw= z;Euler
yawangle -
Declaration
aliasheading= z;Euler yaw angle
-
Declaration
Tw;W coord
-
Declaration
aliasa= w;Alpha component
-
Declaration
static enum Vector!(T, 2)ZERO;Origin
-
Declaration
static enum Vector!(T, 2)X_AXIS;X Axis in R2
-
Declaration
static enum Vector!(T, 2)Y_AXIS;Y Axis in R2
-
Declaration
pure @nogc this(in Tx, in Ty= 0, in Tz= 0, in Tw= 1);Build a new Vector from a set of initial values If no there values for
zandw, will be set to 0Parameters
TxX coord
TyY coord
TzZ coord
TwW coord (scale factor in 3d math)
-
Declaration
pure this(in T[]xs);Build a new Vector from a array If no there values for y and z, will be set to 0. w sill beset to 1
Parameters
T[]xsArray with coords
-
Declaration
const pure @nogc TopIndex(size_ti);Returns
icoord of this vector -
Declaration
voidopIndexAssign(Tc, size_ti);Assigns a value to a
icoord -
Declaration
const pure @nogc @property Tlength();Returns the actual
lengthof this Vector -
Declaration
const pure @nogc @property Tsq_length();Returns the actual squared length of this Vector
-
Declaration
const pure @nogc boolopEquals()(auto ref const Vectorrhs);Define Equality
Parameters
VectorrhsVector at rigth of '=='
-
Declaration
const pure @nogc boolapproxEqual()(auto ref const Vectorrhs, TmaxRelDiff= 0.01, TmaxAbsDiff= 1e-05);Approximated equality with controlable precision
Parameters
VectorrhsVector to compare with this vector
TmaxRelDiffMaximun relative difference
TmaxAbsDiffMaximun absolute difference
See: std.math :
approxEqual -
Declaration
const pure @nogc VectoropUnary(string op)() if (op == "+" || op == "-");Define unary operators + and -
-
Declaration
const pure @nogc VectoropBinary(string op)(auto ref const Vectorrhs) if (op == "+" || op == "-");Define binary operator + and -
-
Declaration
const pure @nogc VectoropBinary(string op)(in Trhs) if (op == "*" || op == "/");Define Scalar multiplication
-
Declaration
const pure @nogc VectoropBinaryRight(string op)(in Trhs) if (op == "*" || op == "/");Define Scalar multiplication
-
Declaration
const pure @nogc TopBinary(string op)(auto ref const Vectorrhs) if (op == "*");Define Dot Product
-
Declaration
const pure @nogc VectoropBinary(string op)(auto ref const Vectorrhs) if (op == "&" && (dim == 3));Define Cross Product for R3 (operation c = a & b )
-
Declaration
const pure @nogc @property boolisUnit();It's a unitary vector (length == 1) Returns : True if length approxEqual to 1.0
-
Declaration
@nogc voidnormalize();Normalize this vector
-
Declaration
const pure @nogc @property Vectorunit();Returns the
unitvector of this vector -
Declaration
pure @nogc VectorprojectOnTo()(auto ref const Vectora, auto ref const Vectorb);Obtains the projection of two vectors
Parameters
VectoraVector to project
VectorbVector where project vector
aReturns : A Vector that it's projection of Vectoraover Vectorb -
Declaration
pure @nogc VectorprojectOnTo()(auto ref const Vectorb);Obtains the projection of this vector over other vector
Parameters
VectorbVector where project this vector Returns : A Vector that it's projection of this Vector over Vector
b -
Declaration
pure @nogc Tdistance()(auto ref const Vectorb);Calculate the
distancebetween two points pointed by this vector and other Params :b= Vector B Returns : Distance between the point pointed by this vector and other point -
Declaration
pure @nogc Tsq_distance()(auto ref const Vectorb);Calculate the squared distance between two points pointed by this vector and other Params :
b= Vector B Returns : Squared distance between the point pointed by this vector and other point -
Declaration
const pure @nogc Vectorrotate(realangle);Rotation in R2
Parameters
realangleRotation
angleReturns : A new vector that is the rotation of this vector -
Declaration
pure @nogc @property T*ptr();Return a pointer of the internal array
-
Declaration
const pure @nogc @property boolisOk();Checks that the vector not have a weird NaN value Returns : True if this vector not have a NaN value
-
Declaration
const pure @nogc @property boolisFinite();Checks that the vector have finite values Returns : True if this vector have finite values (not infinite value or NaNs)
-
Declaration
const pure @nogc ToutopCast(Tout)() if (isVector!Tout);Casting method to convert to other vector types
-
Declaration
const stringtoString();Returns a string representation of this vector
-
-
Declaration
immutable boolisVector(T);Say if a thing it's a Vector