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

📄 octree.h

📁 用c++实现的八叉树建立
💻 H
字号:
#if !defined (OCTREE_H__INCLUDE_)
#define OCTREE_H__INCLUDE_


typedef double* Vec3;
extern Vec3 makeVec3( double x, double y, double z);

/* ------------------------------------------------------------------------ */
class pvex_nor
{
public:
	pvex_nor(double xx,double yy,double zz){x=xx;y=yy;z=zz;};
	double x,y,z;
	//CPtrList Vex,Normal;
};
typedef struct {
   Vec3 p[3];
} TRIANGLE;

typedef struct {
   Vec3 p[8];
   double val[8];
} GRIDCELL;

typedef struct _Octree
{
  
  Vec3 min;  /* bounds */
  Vec3 max;
  
  double value[8];
  int density;
  char at_max_depth;
  char not_fully_divided;
  CPtrList vex;
  CPtrList normal;
  struct _Octree** children;

} Octree;
extern Octree* make_octree( Vec3 min, Vec3 max );
extern void isoface(Octree* o);
extern int subdivide_octree( int min_depth, int max_depth, Octree* o );
extern int octree_needs_to_be_split( Octree* o );
void marchingcube(int depth,Octree *o);

/* the first function of interest is: 

   evaluatePoint( ) 
   
   which takes a 3d point and returns a double value indicating which feature 
   this point is nearet to.

   see the custom.c file for some examples

*/

extern double evaluate_point( Vec3 pos,Octree *o );
extern int evaluate1_point( Octree* o);
/* the other function of interest is: 

   octreeNeedToBeSplit( ) 
   
   which determines whether subdivision needs to take place.
   
   it should examine the 8 corner values and
   return 1 to subdivide and 0 to not subdivide.

   see the custom.c file for some examples

*/

extern int octree_needs_to_be_subdivided( Octree* o );


/* ------------------------------------------------------------------------ */

#endif

⌨️ 快捷键说明

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