vect3d
- struct vect3d;
- Defines a point or vector in cartesian 3d space. Most binary math
operators shoould work
with both vect3d and real arguments, but only +, -, *, / and simple
assignment and equality are unit tested here. Note that operators
return the simple calculated results; dot product and vector product
are provided as discrete method calls.
Also provided are the common vector operations
vector_product,
dot_product,
magnitude,
range (distance between points),
and normalize (scales to magnitude 1.0).
- this(ref vect3d);
- blt copy override to avoid binding accidently.
- this(const(real[]) a);
- Construct from a real array. Only arrays of length 3 are acceptable.
- this(const(real) a);
- Construct from a single real. All three elements will be assigned the
same value.
- this(const(real) x, real y, real z);
- Construct from 3 reals. They are assigned in the order presented.
- vec values();
- returns an array containing copies of the coordinates.
- real magnitude();
- returns the length (the magnitude) of the vector
- real dot_product(in vect3d a);
- returns the dot product
- vect3d vector_product(in vect3d a);
- returns the vector product
- real range(in vect3d a);
- range returns the distance between two vect3d
- vect3d normalize();
- returns the normalized vector (scaled to length 1.0)
Page generated by Ddoc.