shape_doc 0.1
marching_cube Struct Reference

#include <marching_cube.hpp>

List of all members.

Public Member Functions

Static Public Member Functions


Detailed Description

Definition at line 11 of file marching_cube.hpp.


Constructor & Destructor Documentation

marching_cube ( void  ) [inline]

Definition at line 15 of file marching_cube.hpp.

{};
~marching_cube ( void  ) [inline]

Definition at line 16 of file marching_cube.hpp.

{};

Member Function Documentation

bool centralise ( Mesh &  res,
const Cell &  grid 
) [static]

Definition at line 58 of file marching_cube.hpp.

References Face, mmx::shape::marching_cube_edge_table, and mmx::shape::marching_cube_tri_table.

Referenced by mesher3d_dual< C, V, Shape, Cell >::run().

                                                     {

  typedef typename Mesh::Point       Point;
  typedef typename Mesh::Face        Face;

  int CubeIndex=cell.mc_index();
  //  std::cout<<CubeIndex<<std::endl;
  if (marching_cube_edge_table[CubeIndex] == 0) return false;

  Point* CELL[12];

  if(cell.edge_point(CELL, marching_cube_edge_table[CubeIndex])) {
    Point* c=new Point(0,0,0); 
    unsigned ntr=0;
    for (int i=0;marching_cube_tri_table[CubeIndex][i]!=-1;i+=3)
      ntr++;
    ntr/=2;

    for(int j=0;j<3;j++) {
      Point* p=CELL[marching_cube_tri_table[CubeIndex][3*ntr+j]];
      c->x()+= p->x();
      c->y()+= p->y();
      c->z()+= p->z();
    }
    c->x()/=3.;
    c->y()/=3.;
    c->z()/=3.;
    //   c->x()=(cell.xmin()+cell.xmax())/2;
    //   c->y()=(cell.ymin()+cell.ymax())/2;
    //   c->z()=(cell.zmin()+cell.zmax())/2;
    //std::cout<<*c<<std::endl;
    res.insert(c);
    return true;
  } else
    return false;
}
bool polygonise ( Mesh &  res,
const Cell &  grid 
) [static]

Definition at line 29 of file marching_cube.hpp.

References Face, mmx::shape::marching_cube_edge_table, and mmx::shape::marching_cube_tri_table.

Referenced by cell3d_surface_algebraic< C, V >::polygonise(), and use< subdivision_def, with_tpl3d< K > >::process_regular().

                                                     {

  typedef typename Mesh::Point       Point;
  typedef typename Mesh::Face        Face;
  
  int CubeIndex=cell.mc_index();

  if (marching_cube_edge_table[CubeIndex] == 0) return false;

  Point* CELL[12];
  if(cell.edge_point(CELL, marching_cube_edge_table[CubeIndex])) {
    for (int i=0;marching_cube_tri_table[CubeIndex][i]!=-1;i+=3) {
      Face* F= new Face;
      for(int j=0;j<3;j++) {
        Point* p=CELL[marching_cube_tri_table[CubeIndex][i+j]];
        res.insert(p);
        F->insert(p);
      }
      res.insert(F);
    }
    return true;
  } else
    return false;
}

The documentation for this struct was generated from the following file: