29 #ifndef GEOMETRY_INCLUDED 30 #define GEOMETRY_INCLUDED 33 # pragma GCC system_header 36 #include <pcl/pcl_macros.h> 49 template<
class Real >
53 Point3D(
void ) { coords[0] = coords[1] = coords[2] =
Real(0); }
97 return sqrt(d[0]*d[0]+d[1]*d[1]);
106 double v1[3] , v2[3] , v[3];
107 for(
int d=0 ; d<3 ; d++ )
109 v1[d] = p[1][d] - p[0][d];
110 v2[d] = p[2][d] - p[0][d];
112 v[0] = v1[1]*v2[2] - v1[2]*v2[1];
113 v[1] = -v1[0]*v2[2] + v1[2]*v2[0];
114 v[2] = v1[0]*v2[1] - v1[1]*v2[0];
115 return sqrt( v[0]*v[0] + v[1]*v[1] + v[2]*v[2] ) / 2;
123 for(j=0;j<3;j++){d+=(p[(i+1)%3][j]-p[i][j])*(p[(i+1)%3][j]-p[i][j]);}
172 std::vector<TriangulationEdge>
edges;
175 int factor(
int tIndex,
int& p1,
int& p2,
int& p3);
177 double area(
int tIndex );
178 double area(
int p1 ,
int p2 ,
int p3 );
179 int flipMinimize(
int eIndex);
180 int addTriangle(
int p1 ,
int p2 ,
int p3 );
184 static long long EdgeIndex(
int p1 ,
int p2 );
203 virtual void resetIterator(
void ) = 0;
206 virtual int addPolygon(
const std::vector< CoredVertexIndex >& vertices ) = 0;
209 virtual int nextPolygon( std::vector< CoredVertexIndex >& vertices ) = 0;
211 virtual int outOfCorePointCount(
void)=0;
212 virtual int polygonCount(
void ) = 0;
231 value = ( p1[0] * p2[0] + p1[1] * p2[1] + p1[2] * p2[2] ) / ( p2[0] * p2[0] + p2[1] * p2[1] + p2[2] * p2[2] );
235 virtual void resetIterator(
void ) = 0;
237 virtual int addOutOfCorePoint(
const Vertex& v ) = 0;
238 virtual int addPolygon(
const std::vector< CoredVertexIndex >& vertices ) = 0;
240 virtual int nextOutOfCorePoint(
Vertex& v ) = 0;
241 virtual int nextPolygon( std::vector< CoredVertexIndex >& vertices ) = 0;
243 virtual int outOfCorePointCount(
void )=0;
244 virtual int polygonCount(
void ) = 0;
249 std::vector<Point3D<float> > oocPoints;
250 std::vector< std::vector< int > > polygons;
256 void resetIterator(
void);
259 int addPolygon(
const std::vector< CoredVertexIndex >& vertices );
262 int nextPolygon( std::vector< CoredVertexIndex >& vertices );
264 int outOfCorePointCount(
void);
265 int polygonCount(
void );
269 std::vector< CoredMeshData2::Vertex > oocPoints;
270 std::vector< std::vector< int > > polygons;
276 void resetIterator(
void);
279 int addPolygon(
const std::vector< CoredVertexIndex >& vertices );
282 int nextPolygon( std::vector< CoredVertexIndex >& vertices );
284 int outOfCorePointCount(
void );
285 int polygonCount(
void );
289 FILE *oocPointFile , *polygonFile;
290 int oocPoints , polygons;
295 void resetIterator(
void);
298 int addPolygon(
const std::vector< CoredVertexIndex >& vertices );
301 int nextPolygon( std::vector< CoredVertexIndex >& vertices );
303 int outOfCorePointCount(
void);
304 int polygonCount(
void );
308 FILE *oocPointFile , *polygonFile;
309 int oocPoints , polygons;
314 void resetIterator(
void );
317 int addPolygon(
const std::vector< CoredVertexIndex >& vertices );
320 int nextPolygon( std::vector< CoredVertexIndex >& vertices );
322 int outOfCorePointCount(
void );
323 int polygonCount(
void );
328 #include "geometry.hpp" 333 #endif // GEOMETRY_INCLUDED
double SquareLength(const Point3D< Real > &p)
Vertex(Point3D< float > s, Point3D< float > e, float v)
Point3D & operator-=(Point3D p)
double Length(void) const
double Length(const Point3D< Real > &p)
void CrossProduct(const Point3D< Real > &p1, const Point3D< Real > &p2, Point3D< Real > &p)
std::vector< TriangulationTriangle > triangles
Point3D< Real > RandomBallPoint(void)
Point3D & operator*=(Real r)
Vertex(Point3D< float > s, Point3D< float > e, Point3D< float > p)
void TriangleCollapse(const Real &edgeRatio, std::vector< TriangleIndex > &triangles, std::vector< Point3D< Real > > &positions, std::vector< Point3D< Real > > *normals)
Point3D & operator+=(Point3D p)
Point3D operator-(Point3D p) const
Point3D & operator/=(Real r)
double AspectRatio(void) const
double Distance(const Point3D< Real > &p1, const Point3D< Real > &p2)
std::vector< Point3D< Real > > points
Point3D operator/(Real r) const
std::vector< TriangulationEdge > edges
Point3D operator*(Real r) const
hash_map< long long, int > edgeMap
bool operator==(const PCLHeader &lhs, const PCLHeader &rhs)
void EdgeCollapse(const Real &edgeRatio, std::vector< TriangleIndex > &triangles, std::vector< Point3D< Real > > &positions, std::vector< Point3D< Real > > *normals)
Point3D< Real > RandomSpherePoint(void)
Point3D operator+(Point3D p) const
std::vector< Vertex > inCorePoints
std::vector< Point3D< float > > inCorePoints
double SquareDistance(const Point3D< Real > &p1, const Point3D< Real > &p2)