1 | /*
|
---|
2 | * ----------------------------------------------------------------------
|
---|
3 | * Vector3.h : Vector class with 3 components
|
---|
4 | *
|
---|
5 | * ======================================================================
|
---|
6 | * AUTHOR: Wei Qiao <qiaow@purdue.edu>
|
---|
7 | * Purdue Rendering and Perceptualization Lab (PURPL)
|
---|
8 | *
|
---|
9 | * Copyright (c) 2004-2006 Purdue Research Foundation
|
---|
10 | *
|
---|
11 | * See the file "license.terms" for information on usage and
|
---|
12 | * redistribution of this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
---|
13 | * ======================================================================
|
---|
14 | */
|
---|
15 | #ifndef _VECTOR3_H_
|
---|
16 | #define _VECTOR3_H_
|
---|
17 |
|
---|
18 | class Vector3{
|
---|
19 |
|
---|
20 | public:
|
---|
21 | float x, y, z;
|
---|
22 | Vector3(float _x, float _y, float _z);
|
---|
23 | Vector3();
|
---|
24 |
|
---|
25 | Vector3 operator +(Vector3 &op2);
|
---|
26 | Vector3 operator -(Vector3 &op2);
|
---|
27 | bool equal(Vector3 &op2);
|
---|
28 | //float operator *(Vector3 &op2); //dot product
|
---|
29 | float operator *(Vector3 &op2); //dot product
|
---|
30 | Vector3 operator *(float op2); //mul per component
|
---|
31 | Vector3 operator /(float op2); //mul per component
|
---|
32 | void operator <(Vector3 &op2); //assign
|
---|
33 | Vector3 operator ^(Vector3 &op2); //cross product
|
---|
34 | Vector3 normalize();
|
---|
35 | Vector3 rot_x(float degree); //rotation about x
|
---|
36 | Vector3 rot_y(float degree); //rotation about y
|
---|
37 | Vector3 rot_z(float degree); //rotation about z
|
---|
38 | void set(float newx, float newy, float newz);
|
---|
39 | void print();
|
---|
40 | float distance(Vector3 &another); //compute distance
|
---|
41 |
|
---|
42 | //fast version
|
---|
43 | Vector3 cross(Vector3 op2);
|
---|
44 | };
|
---|
45 |
|
---|
46 | #endif
|
---|