SpherePackingScenarioGenerator
|
00001 /* 00002 * RegularPacking.h 00003 * 00004 * Created on: 2011-3-30 00005 * Author: Tan 00006 */ 00007 00008 #ifndef REGULARPACKING_H_ 00009 #define REGULARPACKING_H_ 00010 00011 #include <vector> 00012 #include <math.h> 00013 #include <fstream> 00014 #include <iostream> 00015 #include "algorithms/AbstractSpherePacking.h" 00016 00017 namespace algorithms { 00018 namespace regularpacking { 00019 class RegularPacking; 00020 } 00021 } 00022 struct SphereLayer{ 00023 double radius; 00024 double percent; 00025 double density; 00026 int number; 00027 }; 00028 struct BoundingBox{ 00029 double xlength; 00030 double ylength; 00031 double zlength; 00032 double distance; 00033 }; 00039 class algorithms::regularpacking::RegularPacking:public algorithms::AbstractSpherePacking { 00040 public: 00048 RegularPacking(double length,double radius,double distance); 00054 RegularPacking(double length,double radius); 00055 RegularPacking(BoundingBox &box,std::vector<SphereLayer> &configuration); 00056 RegularPacking(double length,double radius,double radius2,double density,double density2,double distance); 00057 RegularPacking(double length,std::vector<std::pair<double,double> > &configuration); 00061 RegularPacking(); 00065 virtual ~RegularPacking(); 00072 void addSphere(double x,double y,double z,double r); 00079 void insertSphereLayer(double x,double y,double z,double r); 00080 void insertSphereLayer(double x,double y,double z,double r,double rmax); 00081 void insertSphereLayer(double x,double y,double z,double r,double rmax,BoundingBox &box); 00088 void insertRowOfSpheres(double x,double y,double z,double r); 00089 void insertRowOfSpheres(double x,double y,double z,double r,double rmax); 00090 void insertRowOfSpheres(double x,double y,double z,double r,double rmax,BoundingBox &box); 00096 double getPositionX(unsigned int k) const; 00102 double getPositionY(unsigned int k) const; 00108 double getPositionZ(unsigned int k) const; 00113 double getRadius() const; 00118 double getLength() const; 00140 void generate(); 00141 void mixGenerate(double radius2,double density,double density2); 00142 void mixGenerate(std::vector<std::pair<double,double> > &configuration); 00143 void mixGenerate(BoundingBox &box,std::vector<SphereLayer> &configuration); 00144 00145 private: 00146 double _a;//length of the edge 00147 double _m;//minimal distance to the edge 00148 }; 00149 00150 #endif /* REGULARPACKING_H_ */