⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 cog.hxx

📁 Delaunay三角形的网格剖分程序
💻 HXX
字号:
/* <<< COG >>> - Contravariant Geometry Description Package */#ifndef cog_hxx#define cog_hxx#include "cogtypes.hxx"const wzName cogVersion = "2.1";extern "C"{#include "cog.h"}class Cogeometry; // abstract basic class;// class cogeometry  is safe pointer to Cogeometry;class cogLine;class cogTriangle;class cogTetrahedron;class cogSquare;class cogCube;class cogFlag1;class cogFlag2;class cogFlag3;class cogError{};class cogErrorFaceLost: public cogError{public: cogErrorFaceLost(){;}};class cogErrorEdgeLost: public cogError{public: cogErrorEdgeLost(){;}};class Cogeometry: public virtual wzProxyTarget{public:  virtual cogIndex   Point(cogPoint& s) const;  virtual cogIndex   Line (cogFlag1& f,			   const cogLine& s) const;  virtual cogIndex   Triangle(cogFlag2& f, const cogFlag1& o,			      const cogTriangle& s) const;  virtual cogIndex   Tetrahedron(cogFlag3& f, const cogFlag2& o,                                 const cogTetrahedron& s) const;  virtual cogIndex   BoundaryCondition(cogFlag1& p0) const;  virtual void setDelta(cogFloat delta=1.e-4);  void	otherSide(cogFlag1& f, const cogFlag1& o) const;  void	otherSide(cogFlag2& f, const cogFlag2& o) const;  void	otherSide(cogFlag3& f, const cogFlag3& o) const;  void	nextFace (cogFlag2& f, const cogFlag2& o) const;  void	nextFace (cogFlag3& f, const cogFlag3& o) const;  void	otherLine(cogFlag3& f, const cogFlag3& o) const;  cogIndex Line (cogFlag1& f, const cogFlag1& o,		 const cogLine& s) const;  cogIndex Triangle(cogFlag2& f, const cogFlag2& o,		    const cogTriangle& s) const;  cogIndex Tetrahedron(cogFlag3& f, const cogFlag3& o,		       const cogTetrahedron& s) const;  cogIndex refine(cogFlag1& f,		  const cogLine& s) const;  cogIndex refine(cogFlag2& f, const cogFlag1& o,		  const cogTriangle& s) const;  cogIndex refine(cogFlag3& f, const cogFlag2& o,		  const cogTetrahedron& s) const;  cogIndex Square(cogFlag2& f, const cogFlag1& o,		  const cogSquare& s) const;  cogIndex Cube(cogFlag3& f, const cogFlag2& o,		const cogCube& s) const;  Cogeometry(cogFloat delta=1.e-4);  cogFloat  Delta;  cogFloat  ShiftDelta;  cogIndex  maximalSquareIterations;  virtual ~Cogeometry(){;}  const cogPoint* Startpoint;  void setStartpoint(const cogPoint& p) const	  {((Cogeometry*)this)->Startpoint = &p;}  wzRegion	DefaultRegion;  wzFace	DefaultFace;  void setDefaultRegion(wzRegion r) {DefaultRegion = r;}  void setDefaultFace  (wzFace   f) {DefaultFace = f;}  static wzRegion 	InitialDefaultRegion;  static wzFace		InitialDefaultFace;  wzIndex floatValues() const {return floatvalues;}protected:  wzIndex  floatvalues;private:  cogFloat Delta2D;  cogFloat Delta3D;  cogFloat singleIntersectionLimit2D;  cogIndex specialRefinement;};typedef wzProxy<Cogeometry> cogeometry;class CogeometryDecorator  :public Cogeometry{public:  cogeometry original;  CogeometryDecorator(cogeometry content);};// internal error classes:struct cogTriangleRoundTripFailed{  cogTriangleRoundTripFailed(){;}};struct cogTetrahedronRoundTripFailed{  cogTetrahedronRoundTripFailed(){;}};class cogLine{public:  cogPoint& c0;  cogPoint& c1;  cogLine(cogPoint& p0, cogPoint& p1)    :c1(p1),c0(p0){;}  cogFloat diameter() const;  void barycentre(cogPoint& p) const;  void print() const;};class cogTriangle{public:  cogPoint& c0;  cogPoint& c1;  cogPoint& c2;  cogTriangle(cogPoint& p0, cogPoint& p1, cogPoint& p2)    :c2(p2),c1(p1),c0(p0){;}  cogFloat diameter() const;  void barycentre(cogPoint& p) const;  void print() const;};class cogSquare{public:  cogPoint& c0;  cogPoint& c1;  cogPoint& c2;  cogPoint& c3;  cogSquare(cogPoint& p0, cogPoint& p1, cogPoint& p2, cogPoint& p3)    :c3(p3),c2(p2),c1(p1),c0(p0){;}  void print() const;  //cogFloat diameter() const;  //        void barycentre(cogPoint& p) const;};class cogCube{public:        cogPoint& c0;        cogPoint& c1;        cogPoint& c2;        cogPoint& c3;        cogPoint& c4;        cogPoint& c5;        cogPoint& c6;        cogPoint& c7;        cogCube(cogPoint& p0, cogPoint& p1, cogPoint& p2, cogPoint& p3,		cogPoint& p4, cogPoint& p5, cogPoint& p6, cogPoint& p7)	  :c7(p7),c6(p6),c5(p5),c4(p4),c3(p3),c2(p2),c1(p1),c0(p0){;}	cogFloat diameter() const;        void barycentre(cogPoint& p) const;};class cogTetrahedron{public:  cogPoint& c0;  cogPoint& c1;  cogPoint& c2;  cogPoint& c3;  cogTetrahedron(cogPoint& p0, cogPoint& p1, cogPoint& p2, cogPoint& p3)    :c3(p3),c2(p2),c1(p1),c0(p0){;}  cogFloat volume() const;  cogFloat diameter() const;  void barycentre(cogPoint& p) const;  void print() const;};class cogFlag1{public:  cogPoint& p1;  cogPoint& p0;  cogPoint& po;  cogFlag1(cogFlag1& f)    :p1(f.p1),p0(f.p0),po(f.po){;}  cogFlag1(cogPoint& i1, cogPoint& i0, cogPoint& io)    :p1(i1),p0(i0),po(io){;}  cogFlag1& operator=(const cogFlag1& i)  {p1=i.p1;p0=i.p0;po=i.po; return *this;}  void print() const;};class cogFlag2: public cogFlag1{public:  cogPoint& p2;  cogFlag2(cogPoint& i2, cogFlag1& f)    :p2(i2), cogFlag1(f){;}  cogFlag2(cogPoint& i2, cogPoint& i1, cogPoint& i0, cogPoint& io)    :p2(i2), cogFlag1(i1,i0,io){;}  cogFlag2& operator=(const cogFlag1& i)  {p1=i.p1;p0=i.p0;po=i.po; return *this;}  cogFlag2& operator=(const cogFlag2& i)  {p2=i.p2;p1=i.p1;p0=i.p0;po=i.po; return *this;}  void print() const;};class cogFlag3: public cogFlag2{public:  cogPoint& p3;  cogFlag3(cogPoint& i3, cogFlag2& f)    :p3(i3), cogFlag2(f){;}  cogFlag3(cogPoint& i3, cogPoint& i2, cogPoint& i1,	   cogPoint& i0, cogPoint& io)    :p3(i3), cogFlag2(i2,i1,i0,io){;}  cogFlag3& operator=(const cogFlag1& i)  {p1=i.p1;p0=i.p0;po=i.po; return *this;}  cogFlag3& operator=(const cogFlag2& i)  {p2=i.p2;p1=i.p1;p0=i.p0;po=i.po; return *this;}  cogFlag3& operator=(const cogFlag3& i)  {p3=i.p3;p2=i.p2;p1=i.p1;p0=i.p0;po=i.po; return *this;}  void print() const;};//               <<<	possible return values >>>// for all functions:const cogIndex   cogRCError		= 999;const cogIndex   cogRCRegionFound	= 998;const cogIndex   cogRCFaceFound		= 998;const cogIndex   cogRCFaceNotFound	= 0;const cogIndex   cogRCEdgeFound		= 998;const cogIndex   cogRCFaceFoundOn01     =  1;const cogIndex   cogRCFaceFoundOn12	= 12;const cogIndex   cogRCFaceFoundOn02     =  2;const cogIndex   cogRCFaceFoundOn23     = 23;const cogIndex   cogRCFaceFoundOn03     =  3;const cogIndex   cogRCVertexFound       = 998;const cogIndex   cogRCEdgeFoundOn012	=  12;const cogIndex   cogRCEdgeFoundOn013	=  13;const cogIndex   cogRCEdgeFoundOn023	=  23;const cogIndex   cogRCEdgeFoundOn123	= 123;const cogIndex   cogRCEdgeFoundOn0123	=  123;const cogIndex   cogRCEdgeFoundOn0145	=  145;const cogIndex   cogRCEdgeFoundOn0347	=  347;const cogIndex   cogRCEdgeFoundOn1256	= 1256;const cogIndex   cogRCEdgeFoundOn2367	= 2367;const cogIndex   cogRCEdgeFoundOn4567	= 4567;const cogIndex   cogRCConditionFound	= 998;inline cogFloat cogLine::diameter() const{return   ( ((c1.x()>c0.x())?(c1.x()-c0.x()):(c0.x()-c1.x()))    +((c1.y()>c0.y())?(c1.y()-c0.y()):(c0.y()-c1.y()))    +((c0.spaceDimension()==2)?0:      ((c1.z()>c0.z())?(c1.z()-c0.z()):(c0.z()-c1.z()))));}inline cogFloat cogTriangle::diameter() const{return   ((c2.x()>c0.x())?    ((c1.x()>c2.x())?(c1.x()-c0.x()):     ((c1.x()>c0.x())?(c2.x()-c0.x()):(c2.x()-c1.x()))):    ((c1.x()>c0.x())?(c1.x()-c2.x()):     ((c1.x()>c2.x())?(c0.x()-c2.x()):(c0.x()-c1.x()))))   + ((c2.y()>c0.y())?      ((c1.y()>c2.y())?(c1.y()-c0.y()):       ((c1.y()>c0.y())?(c2.y()-c0.y()):(c2.y()-c1.y()))):      ((c1.y()>c0.y())?(c1.y()-c2.y()):       ((c1.y()>c2.y())?(c0.y()-c2.y()):(c0.y()-c1.y()))))   + ((c0.spaceDimension()==2)?0:      ((c2.z()>c0.z())?       ((c1.z()>c2.z())?(c1.z()-c0.z()):        ((c1.z()>c0.z())?(c2.z()-c0.z()):(c2.z()-c1.z()))):       ((c1.z()>c0.z())?(c1.z()-c2.z()):        ((c1.z()>c2.z())?(c0.z()-c2.z()):(c0.z()-c1.z())))));}void cogLinkPrintCommands();#endif

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -