Core Library
A simple library for handling 3D scenes
Vector Class Reference

The Vector class represents a vector (x,y,z) in 3D space. More...

#include <vector.h>

Detailed Description

For the sake of simplicity, Vector is implemented as a typedef of Qt's QVector3D.

Example of use:

#include "point.h"
#include "vector.h"
// create two vectors
Vector u = Vector(0.0, 0.0, 0.0);
Vector v = Vector(1.0, 0.0, 0.0);
// get components
float x = u.x();
float y = u.y();
float z = u.z();
// set components
u.setX(2.0);
u.setY(4.0);
u.setZ(2.0);
// get length
float len = u.length();
// normalize (in place)
u.normalize();
// get normalized copy
v = u.normalized();
// common operations
w = u + v; // vector addition
w = u - v; // vector substraction
w = 2.0*u; // scalar multiplication
float dot = dotProduct(u, v); // dot product
w = crossProduct(u, v); // cross product