Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

vuUDSphere.h

Go to the documentation of this file.
00001 
00007 #ifndef __vuUDSphere_H__
00008 #define __vuUDSphere_H__
00009 
00010 #include <math.h>
00011 
00012 class Point3d
00013 {
00014 public:
00015   Point3d() { fx = 0; fy = 0; fz = 0; }
00016   ~Point3d() {}
00017 
00018   void set(double xx, double yy, double zz)
00019     {
00020       x = xx;
00021       y = yy;
00022       z = zz;
00023       theta = atan2(y, x);
00024       phi = acos(z);
00025     }
00026 
00027   void reset(void)
00028     {
00029       theta = atan2(y, x);
00030       phi = acos(z);
00031     }
00032 
00033   bool operator==(Point3d& rhs) { return phi == rhs.phi; }
00034   bool operator<(Point3d& rhs)  { return phi < rhs.phi;  }
00035   bool operator>(Point3d& rhs)  { return phi > rhs.phi;  }
00036   bool operator<=(Point3d& rhs) { return phi <= rhs.phi; }
00037   bool operator>=(Point3d& rhs) { return phi >= rhs.phi; }
00038 
00039  public:
00040   // Rectangular coordinates
00041   double x,y,z;    // x,y,z
00042 
00043   // Spherical coordinates
00044   double phi;      // 0..pi
00045   double theta;    // 0..2*pi
00046 
00047   // Forces
00048   double fx, fy, fz;
00049 };
00050 
00051 class vuUDSphere
00052 {
00053  public:
00054   vuUDSphere(int _size=256);
00055   ~vuUDSphere(void);
00056 
00057   bool     advancePoints(void);
00058   bool     doesFileExist(void);
00059   void     writeToFile(void);
00060   void     readFromFile(void);
00061   int      getSize(void);
00062   Point3d  getPointAt(int idx);
00063   void     calculate(void);
00064   void     lazyCalculate(void); // trys to read from file, otherwise calculate
00065 
00066  private:
00067   Point3d* m_P;
00068   double   m_dt;
00069   double   m_Tolerance;
00070   int      m_Size;
00071 
00072   void makeRandomPoint(Point3d& p);
00073   void initPoints(void);
00074   void computeForces(Point3d& p0, Point3d& p1);
00075 };
00076 
00077 #endif /* __vuUDSphere_H__ */

Generated on Wed Dec 15 21:20:38 2004 for vuVolume by  doxygen 1.3.9.1