source: OGRE/trunk/ogrenew/Tools/LightwaveConverter/include/Point.h @ 692

Revision 692, 1.8 KB checked in by mattausch, 18 years ago (diff)

adding ogre 1.2 and dependencies

Line 
1#ifndef _POINT_H_
2#define _POINT_H_
3
4#include "lwo.h"
5#include "Vector3.h"
6
7using namespace std;
8
9class Point3 {
10        public:
11                inline Point3() {}
12               
13                inline Point3(float nx, float ny, float nz) : x(nx), y(ny), z(nz) {}
14               
15                inline Point3& operator =(const Vector3& v)
16                {
17                        x = v.x;
18                        y = v.y;
19                        z = v.z;
20                        return (*this);
21                }
22               
23                inline Point3& operator *=(float t)
24                {
25                        x *= t;
26                        y *= t;
27                        z *= t;
28                        return (*this);
29                }
30               
31                inline Point3& operator /=(float t)
32                {
33                        float f = 1.0F / t;
34                        x *= f;
35                        y *= f;
36                        z *= f;
37                        return (*this);
38                }
39               
40        inline bool operator == ( const Point3& p ) const
41        {
42            return ( x == p.x && y == p.y && z == p.z );
43        }
44
45        inline bool operator != ( const Point3& p ) const
46        {
47            return ( x != p.x || y != p.y || z != p.z );
48        }
49
50                inline Point3 operator -(void) const
51                {
52                        return (Point3(-x, -y, -z));
53                }
54               
55                // Sum of point and vector (direction) is a point
56                inline Point3 operator +(const Vector3& v) const
57                {
58                        return (Point3(x + v.x, y + v.y, z + v.z));
59                }
60               
61                // Difference of point and vector (direction) is a point
62                inline Point3 operator -(const Vector3& v) const
63                {
64                        return (Point3(x - v.x, y - v.y, z - v.z));
65                }
66               
67                // Difference between to points is a vector (direction)
68                inline Vector3 operator -(const Point3& p) const
69                {
70                        return (Vector3(x - p.x, y - p.y, z - p.z));
71                }
72               
73                inline Point3 operator *(float t) const
74                {
75                        return (Point3(x * t, y * t, z * t));
76                }
77               
78                inline Point3 operator /(float t) const
79                {
80                        float f = 1.0F / t;
81                        return (Point3(x * f, y * f, z * f));
82                }
83               
84                // Dot product
85                inline float operator *(const Vector3& v) const
86                {
87                        return (x * v.x + y * v.y + z * v.z);
88                }
89
90                float x, y, z;
91};
92
93#endif // _POINT_H_
94
Note: See TracBrowser for help on using the repository browser.