#include <GVector3.h>
Collaboration diagram for GCS::GVector3:

Public Member Functions | |
| GVector3 () | |
| GVector3 (const double d) | |
| GVector3 (const double x, const double y, const double z) | |
| GVector3 (const double *component) | |
| GVector3 (const GVector3 &original) | |
| GVector3 (const QString &values) | |
| double | length () const |
| double | lengthsq () const |
| GVector3 & | reset () |
| GVector3 & | set (double x, double y, double z) |
| GVector3 & | set (const GVector3 &original) |
| GVector3 & | normalize () |
| GVector3 & | scaleXYZ (const GVector3 &scale) |
| GVector3 & | scaleXYZ (double x, double y, double z) |
| GVector3 & | add (const GVector3 &right) |
| GVector3 & | sub (const GVector3 &right) |
| GVector3 & | mul (double scalar) |
| double | dot (const GVector3 &right) const |
| GVector3 | cross (const GVector3 &right) const |
| operator double * () | |
| GVector3 & | operator= (const GVector3 &original) |
| GVector3 | operator+ (const GVector3 &right) const |
| GVector3 | operator- (const GVector3 &right) const |
| GVector3 | operator * (double factor) const |
| GVector3 & | operator+= (const GVector3 &right) |
| GVector3 & | operator-= (const GVector3 &right) |
| bool | operator== (const GVector3 &comp) const |
| double | distanceTo (const GVector3 &p) const |
| double | angleTo (const GVector3 &v) const |
| GVector3 & | turnAroundAxis (const GVector3 &axis, double angle_rad) |
| GVector3 & | projectTo (const GVector3 &v) |
| QString | toString () const |
| void | fromString (const QString &string) |
Public Attributes | |
| union { | |
| struct { | |
| double x | |
| double y | |
| double z | |
| } | |
| struct { | |
| double u | |
| double v | |
| double w | |
| } | |
| double c [3] | |
| }; | |
| GCS::GVector3::GVector3 | ( | ) |
Default constructor initializes all components to 0.
| GCS::GVector3::GVector3 | ( | const double | d | ) |
Initializes all components to the given value.
| GCS::GVector3::GVector3 | ( | const double | x, | |
| const double | y, | |||
| const double | z | |||
| ) |
Initializes vector to given values.
| GCS::GVector3::GVector3 | ( | const double * | component | ) |
Initializes vector to given array.
| GCS::GVector3::GVector3 | ( | const GVector3 & | original | ) |
Copy constructor
| GCS::GVector3::GVector3 | ( | const QString & | values | ) |
Calls fromString() to initialize values.
Mathematically adds given vector to this vector.
| double GCS::GVector3::angleTo | ( | const GVector3 & | v | ) | const |
Calculates the angle (in radians!!) between two vectors.
If one of the involved vector's length is 0 then 0 is returned
Calculates the cross product and returns a new vector.
| double GCS::GVector3::distanceTo | ( | const GVector3 & | p | ) | const |
If a GVector3 is used as a point/position then this method can be used to calculate distances between two points.
| double GCS::GVector3::dot | ( | const GVector3 & | right | ) | const |
Calculates the dot product of this * right.
| void GCS::GVector3::fromString | ( | const QString & | string | ) |
Sets x, y and z according to values in the string. The format must be the same as provided by toString() (that is, a comma between the values)
| double GCS::GVector3::length | ( | ) | const |
Calculates the length of the vector.
| double GCS::GVector3::lengthsq | ( | ) | const |
Calculates the square-length of the vector.
| GVector3 & GCS::GVector3::mul | ( | double | scalar | ) |
Scales the vector by given scalar.
| GVector3 & GCS::GVector3::normalize | ( | ) |
Normalizes the vector to a length of 1. Be careful with vectors that have all components set to 0.
| GVector3 GCS::GVector3::operator * | ( | double | factor | ) | const |
Multiplies this vector with given scalar and returns the result.
| GCS::GVector3::operator double * | ( | ) |
Casting Operator
Adds this vector to given vector and returns a new vector as the result.
Subtracts this vector from given vector and returns a new vector as the result.
Subtracts given vector from this vector.
Copies all members from given vector.
| bool GCS::GVector3::operator== | ( | const GVector3 & | comp | ) | const |
Compares the given vector to this vector with an epsilon of 0.00001
Projects this vector onto given vector and returns this vector. If the length of the given vector is 0 then this vector is NOT projected and returned as is.
| GVector3 & GCS::GVector3::reset | ( | ) |
Resets the vector to x=y=z=0.
| GVector3 & GCS::GVector3::scaleXYZ | ( | double | x, | |
| double | y, | |||
| double | z | |||
| ) |
This can be used for asymetric scaling. Every component is multiplied with the corresponding given value.
Simply calls scaleXYZ(scale.x,scale.y,scale.z);
| GVector3 & GCS::GVector3::set | ( | double | x, | |
| double | y, | |||
| double | z | |||
| ) |
Sets the vector to given values.
Mathematically subtracts given vector from this vector.
| QString GCS::GVector3::toString | ( | ) | const |
Turns this vector around given vector for given angle;
| angle_rad | angle in radians |
| union { ... } |
Vector data
| double GCS::GVector3::c[3] |
Array of coordinates.
| double GCS::GVector3::u |
Texture coordinate u.
| double GCS::GVector3::v |
Texture coordinate v.
| double GCS::GVector3::w |
Texture coordinate w.
| double GCS::GVector3::x |
Point coordinate x.
| double GCS::GVector3::y |
Point coordinate y.
| double GCS::GVector3::z |
Point coordinate z.
1.4.7