1 // Copyright (C) 2006 Erik Dahlberg
3 // This file is part of LSystem3D.
5 // LSystem3D is free software; you can redistribute it and/or
6 // modify it under the terms of the GNU General Public License
7 // as published by the Free Software Foundation; either version 2
8 // of the License, or (at your option) any later version.
10 // LSystem3D is distributed in the hope that it will be useful,
11 // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 // GNU General Public License for more details.
15 // You should have received a copy of the GNU General Public License
16 // along with LSystem3D; if not, write to the Free Software
17 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
25 #include "coordinate.h"
32 class Vector
: public Coordinate
38 * @param x the x-coordinate
39 * @param y the y-coordinate
40 * @param z the z-coordinate
42 Vector(double x
= 0.0, double y
= 1.0, double z
= 0.0);
56 * Rotate around another vector
57 * @param angle rotation angle
58 * @param vector arbitrary vector to rotate around
60 void rotate(double angle
, Vector vector
);
64 * Get scalar product of two vectors
65 * @param vector arbitrary vector
66 * @return the scalar product
68 double getScalarProduct(Vector vector
);
71 * Get cross product of two vectors
72 * @param vector arbitrary vector
73 * @return the cross product
75 Vector
getCrossProduct(Vector vector
);
78 * Get angle between two vectors
79 * @param vector the second (normalized) vector
80 * @return the angle, in degrees
82 double getAngle(Vector vector
);