Minor cleanup.
[lsystem3d.git] / src / vector.h
CommitLineData
15c82487 1// Copyright (C) 2006 Erik Dahlberg
2//
1a372e99 3// This file is part of LSystem3D.
15c82487 4//
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.
9//
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.
14//
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
18
19
20
21
22#ifndef VECTOR_H
23#define VECTOR_H
24
25#include "coordinate.h"
26
27
28
29/**
1a372e99 30 * 3D vector
15c82487 31 */
32class Vector : public Coordinate
33{
34public:
68a7b857 35
15c82487 36 /**
37 * Constructor
38 * @param x the x-coordinate
39 * @param y the y-coordinate
40 * @param z the z-coordinate
41 */
42 Vector(double x = 0.0, double y = 1.0, double z = 0.0);
43
44 /**
45 * Destructor
46 */
47 ~Vector();
48
68a7b857 49
50 /**
51 * Normalize vector
52 */
53 void normalize();
54
15c82487 55 /**
56 * Rotate around another vector
57 * @param angle rotation angle
58 * @param vector arbitrary vector to rotate around
59 */
60 void rotate(double angle, Vector vector);
61
15c82487 62
63 /**
526db675 64 * Get scalar product of two vectors
15c82487 65 * @param vector arbitrary vector
66 * @return the scalar product
67 */
68 double getScalarProduct(Vector vector);
69
70 /**
526db675 71 * Get cross product of two vectors
15c82487 72 * @param vector arbitrary vector
73 * @return the cross product
74 */
75 Vector getCrossProduct(Vector vector);
76
77 /**
526db675 78 * Get angle between two vectors
15c82487 79 * @param vector the second (normalized) vector
80 * @return the angle, in degrees
81 */
82 double getAngle(Vector vector);
83};
84
85
86
87#endif