Main Page | Class List | File List

Point3D.h

00001 
00002 /*      Point class
00003 
00004         Last Modified   25/4/00
00005 */
00006 
00007 #ifndef __POINT3D_H_
00008 #define __POINT3D_H_
00009 
00010 #include "MathsStruct.h"
00011 
00012 class Vector3D;
00013 
00015 
00016 class   Point3D
00017 {
00018 private:
00019 
00020         float   x,y,z;          // x, y, z
00021 
00022 public:
00023 
00024         Point3D();
00025         Point3D(const float x, const float y, const float z);           // create a new point
00026 
00027 //      ~Point3D();
00028 
00030 
00031         void    Round();                                                                                                                                // round values within tolerance
00032 
00033         void    GetValues(float &x, float &y, float &z)                                         const;          // get the points
00034         void    SetValues(const float x, const float y, const float z);                                 // set the point
00035 
00037 
00038         void    Negate();                                                                                       // negate the point
00039 
00040         double  Distance(const Point3D &p)                              const;          // get the distance between the points
00041         double  DistanceSquared(const Point3D &p)               const;          // get distance SQUARED between the points
00042 
00043         void    Translate(const Vector3D &v);                                           // translate this point by vector
00044 
00046 
00047         // opengl
00048         void    glTranslate(void)                                               const;          // translate current matrix to this point
00049         void    glVertex(void)                                                  const;          // creates a opengl vertex of this point
00050 
00052 
00053         Point3D         operator+(const Point3D &p)                     const;
00054         Point3D         operator-(const Point3D &p)                     const;
00055         Point3D         operator*(const float s)                        const;          // scale point
00056         Point3D         operator-(void)                                         const;          // negation
00057 
00058         Point3D         operator+(const Vector3D &v)            const;          // translate by vector
00059         Point3D&        operator+=(const Vector3D &v);                                  // translate by vector
00060         
00061         Point3D&        operator=(const Point3D &p);                                    // copy constructor
00062         Point3D&        operator+=(const Point3D &p);
00063         Point3D&        operator-=(const Point3D &p);
00064         Point3D&        operator*=(const float s);
00065         
00066         int                     operator==(const Point3D &p)            const;          // equality operator
00067         int                     operator!=(const Point3D &p)            const;
00068 
00070 
00071         // debug
00072         void    Print(void);
00073 
00074 };      // end class Point3D
00075 
00077 
00078 #endif  // __POINT3D_H_

Generated on Mon Jan 26 22:13:13 2004 for fluid3 by doxygen 1.3.5