marching_cubes_poisson.h
Go to the documentation of this file.
00001 /*
00002 Copyright (c) 2006, Michael Kazhdan and Matthew Bolitho
00003 All rights reserved.
00004 
00005 Redistribution and use in source and binary forms, with or without modification,
00006 are permitted provided that the following conditions are met:
00007 
00008 Redistributions of source code must retain the above copyright notice, this list of
00009 conditions and the following disclaimer. Redistributions in binary form must reproduce
00010 the above copyright notice, this list of conditions and the following disclaimer
00011 in the documentation and/or other materials provided with the distribution. 
00012 
00013 Neither the name of the Johns Hopkins University nor the names of its contributors
00014 may be used to endorse or promote products derived from this software without specific
00015 prior written permission. 
00016 
00017 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
00018 EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO THE IMPLIED WARRANTIES 
00019 OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
00020 SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
00021 INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
00022 TO, PROCUREMENT OF SUBSTITUTE  GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
00023 BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
00024 CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
00025 ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
00026 DAMAGE.
00027 */
00028 
00029 #ifndef MARCHING_CUBES_INCLUDED
00030 #define MARCHING_CUBES_INCLUDED
00031 #include <pcl/pcl_macros.h>
00032 #include <vector>
00033 #include "geometry.h"
00034 
00035 
00036 namespace pcl
00037 {
00038   namespace poisson
00039   {
00040 
00041     class PCL_EXPORTS Square
00042     {
00043       public:
00044         enum {  CORNERS=4,EDGES=4,NEIGHBORS=4 };
00045         static int  CornerIndex                 (int x,int y);
00046         static int  AntipodalCornerIndex(int idx);
00047         static void FactorCornerIndex   (int idx,int& x,int& y);
00048         static int  EdgeIndex                   (int orientation,int i);
00049         static void FactorEdgeIndex             (int idx,int& orientation,int& i);
00050 
00051         static int  ReflectCornerIndex  (int idx,int edgeIndex);
00052         static int  ReflectEdgeIndex    (int idx,int edgeIndex);
00053 
00054         static void EdgeCorners(int idx,int& c1,int &c2);
00055     };
00056 
00057     class PCL_EXPORTS Cube
00058     {
00059       public:
00060         enum { CORNERS=8,EDGES=12,NEIGHBORS=6 };
00061 
00062         static int  CornerIndex                 (int x,int y,int z);
00063         static void FactorCornerIndex   (int idx,int& x,int& y,int& z);
00064         static int  EdgeIndex                   (int orientation,int i,int j);
00065         static void FactorEdgeIndex             (int idx,int& orientation,int& i,int &j);
00066         static int  FaceIndex                   (int dir,int offSet);
00067         static int  FaceIndex                   (int x,int y,int z);
00068         static void FactorFaceIndex             (int idx,int& x,int &y,int& z);
00069         static void FactorFaceIndex             (int idx,int& dir,int& offSet);
00070 
00071         static int  AntipodalCornerIndex        (int idx);
00072         static int  FaceReflectCornerIndex      (int idx,int faceIndex);
00073         static int  FaceReflectEdgeIndex        (int idx,int faceIndex);
00074         static int      FaceReflectFaceIndex    (int idx,int faceIndex);
00075         static int      EdgeReflectCornerIndex  (int idx,int edgeIndex);
00076         static int      EdgeReflectEdgeIndex    (int edgeIndex);
00077 
00078         static int  FaceAdjacentToEdges (int eIndex1,int eIndex2);
00079         static void FacesAdjacentToEdge (int eIndex,int& f1Index,int& f2Index);
00080 
00081         static void EdgeCorners(int idx,int& c1,int &c2);
00082         static void FaceCorners(int idx,int& c1,int &c2,int& c3,int& c4);
00083     };
00084 
00085     class PCL_EXPORTS MarchingSquares
00086     {
00087         static double Interpolate(double v1,double v2);
00088         static void SetVertex(int e,const double values[Square::CORNERS],double iso);
00089       public:
00090         enum { MAX_EDGES=2 };
00091         static const int* edgeMask();
00092         static int edges(int i, int j);
00093         static double& vertexList(int i, int j);
00094 
00095         static int GetIndex(const double values[Square::CORNERS],double iso);
00096         static int IsAmbiguous(const double v[Square::CORNERS],double isoValue);
00097         static int AddEdges(const double v[Square::CORNERS],double isoValue,Edge* edges);
00098         static int AddEdgeIndices(const double v[Square::CORNERS],double isoValue,int* edges);
00099     };
00100 
00101     class PCL_EXPORTS MarchingCubes
00102     {
00103         static void SetVertex(int e,const double values[Cube::CORNERS],double iso);
00104         static int GetFaceIndex(const double values[Cube::CORNERS],double iso,int faceIndex);
00105 
00106         static void SetVertex(int e,const float values[Cube::CORNERS],float iso);
00107         static int GetFaceIndex(const float values[Cube::CORNERS],float iso,int faceIndex);
00108 
00109         static int GetFaceIndex(int mcIndex,int faceIndex);
00110       public:
00111         static double Interpolate(double v1,double v2);
00112         static float Interpolate(float v1,float v2);
00113         enum { MAX_TRIANGLES=5 };
00114         static const int* edgeMask();
00115         static int triangles(int i, int j);
00116         static const int* cornerMap();
00117         static double& vertexList(int i, int j);
00118 
00119         static int AddTriangleIndices(int mcIndex,int* triangles);
00120 
00121         static int GetIndex(const double values[Cube::CORNERS],double iso);
00122         static int IsAmbiguous(const double v[Cube::CORNERS],double isoValue,int faceIndex);
00123         static int HasRoots(const double v[Cube::CORNERS],double isoValue);
00124         static int HasRoots(const double v[Cube::CORNERS],double isoValue,int faceIndex);
00125         static int AddTriangles(const double v[Cube::CORNERS],double isoValue,Triangle* triangles);
00126         static int AddTriangleIndices(const double v[Cube::CORNERS],double isoValue,int* triangles);
00127 
00128         static int GetIndex(const float values[Cube::CORNERS],float iso);
00129         static int IsAmbiguous(const float v[Cube::CORNERS],float isoValue,int faceIndex);
00130         static int HasRoots(const float v[Cube::CORNERS],float isoValue);
00131         static int HasRoots(const float v[Cube::CORNERS],float isoValue,int faceIndex);
00132         static int AddTriangles(const float v[Cube::CORNERS],float isoValue,Triangle* triangles);
00133         static int AddTriangleIndices(const float v[Cube::CORNERS],float isoValue,int* triangles);
00134 
00135         static int IsAmbiguous(int mcIndex,int faceIndex);
00136         static int HasRoots(int mcIndex);
00137         static int HasFaceRoots(int mcIndex,int faceIndex);
00138         static int HasEdgeRoots(int mcIndex,int edgeIndex);
00139     };
00140   }
00141 }
00142 
00143 
00144 #endif //MARCHING_CUBES_INCLUDED


pcl
Author(s): Open Perception
autogenerated on Wed Aug 26 2015 15:25:26