29 #ifndef GEOMETRY_INCLUDED
30 #define GEOMETRY_INCLUDED
33 # pragma GCC system_header
39 #include <unordered_map>
49 template<
class Real >
73 double Length(
const Point3D<Real>& p);
79 double Distance(
const Point3D<Real>& p1,
const Point3D<Real>& p2);
82 double SquareDistance(
const Point3D<Real>& p1,
const Point3D<Real>& p2);
85 void CrossProduct(
const Point3D<Real>& p1,
const Point3D<Real>& p2,Point3D<Real>& p);
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 );
184 static long long EdgeIndex(
int p1 ,
int p2 );
208 virtual int addPolygon(
const std::vector< CoredVertexIndex >& vertices ) = 0;
211 virtual int nextPolygon( std::vector< CoredVertexIndex >& vertices ) = 0;
233 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] );
243 virtual int addPolygon(
const std::vector< CoredVertexIndex >& vertices ) = 0;
246 virtual int nextPolygon( std::vector< CoredVertexIndex >& vertices ) = 0;
254 std::vector<Point3D<float> > oocPoints;
255 std::vector< std::vector< int > > polygons;
264 int addPolygon(
const std::vector< CoredVertexIndex >& vertices );
274 std::vector< CoredMeshData2::Vertex > oocPoints;
275 std::vector< std::vector< int > > polygons;
284 int addPolygon(
const std::vector< CoredVertexIndex >& vertices );
294 FILE *oocPointFile , *polygonFile;
295 int oocPoints , polygons;
303 int addPolygon(
const std::vector< CoredVertexIndex >& vertices );
313 FILE *oocPointFile , *polygonFile;
314 int oocPoints , polygons;
322 int addPolygon(
const std::vector< CoredVertexIndex >& vertices );
333 #include "geometry.hpp"
int nextOutOfCorePoint(CoredMeshData2::Vertex &v)
int addPolygon(const std::vector< CoredVertexIndex > &vertices)
int outOfCorePointCount(void)
~CoredFileMeshData2(void)
int addOutOfCorePoint(const CoredMeshData2::Vertex &v)
int nextPolygon(std::vector< CoredVertexIndex > &vertices)
int nextOutOfCorePoint(Point3D< float > &p)
int nextPolygon(std::vector< CoredVertexIndex > &vertices)
int addPolygon(const std::vector< CoredVertexIndex > &vertices)
int addOutOfCorePoint(const Point3D< float > &p)
int outOfCorePointCount(void)
virtual int nextPolygon(std::vector< CoredVertexIndex > &vertices)=0
virtual int nextOutOfCorePoint(Vertex &v)=0
virtual void resetIterator(void)=0
virtual int addPolygon(const std::vector< CoredVertexIndex > &vertices)=0
virtual int addOutOfCorePoint(const Vertex &v)=0
std::vector< Vertex > inCorePoints
virtual int polygonCount(void)=0
virtual int outOfCorePointCount(void)=0
virtual ~CoredMeshData2()=default
virtual void resetIterator(void)=0
std::vector< Point3D< float > > inCorePoints
virtual int nextPolygon(std::vector< CoredVertexIndex > &vertices)=0
virtual int nextOutOfCorePoint(Point3D< float > &p)=0
virtual int addOutOfCorePoint(const Point3D< float > &p)=0
virtual int polygonCount(void)=0
virtual ~CoredMeshData()=default
virtual int outOfCorePointCount(void)=0
virtual int addPolygon(const std::vector< CoredVertexIndex > &vertices)=0
int outOfCorePointCount(void)
CoredVectorMeshData2(void)
int nextPolygon(std::vector< CoredVertexIndex > &vertices)
int addPolygon(const std::vector< CoredVertexIndex > &vertices)
int addOutOfCorePoint(const CoredMeshData2::Vertex &v)
int nextOutOfCorePoint(CoredMeshData2::Vertex &v)
int addPolygon(const std::vector< CoredVertexIndex > &vertices)
int nextPolygon(std::vector< CoredVertexIndex > &vertices)
int outOfCorePointCount(void)
CoredVectorMeshData(void)
int nextOutOfCorePoint(Point3D< float > &p)
int addOutOfCorePoint(const Point3D< float > &p)
double Length(void) const
double AspectRatio(void) const
int flipMinimize(int eIndex)
std::vector< TriangulationEdge > edges
std::unordered_map< long long, int > edgeMap
std::vector< TriangulationTriangle > triangles
static long long EdgeIndex(int p1, int p2)
std::vector< Point3D< Real > > points
int factor(int tIndex, int &p1, int &p2, int &p3)
int addTriangle(int p1, int p2, int p3)
double area(const Triangle &t)
TriangulationTriangle(void)
double Distance(const Point3D< Real > &p1, const Point3D< Real > &p2)
double SquareDistance(const Point3D< Real > &p1, const Point3D< Real > &p2)
void CrossProduct(const Point3D< Real > &p1, const Point3D< Real > &p2, Point3D< Real > &p)
Point3D< Real > RandomSpherePoint(void)
double SquareLength(const Point3D< Real > &p)
void TriangleCollapse(const Real &edgeRatio, std::vector< TriangleIndex > &triangles, std::vector< Point3D< Real > > &positions, std::vector< Point3D< Real > > *normals)
void EdgeCollapse(const Real &edgeRatio, std::vector< TriangleIndex > &triangles, std::vector< Point3D< Real > > &positions, std::vector< Point3D< Real > > *normals)
Point3D< Real > RandomBallPoint(void)
double Length(const Point3D< Real > &p)
bool operator==(const PCLHeader &lhs, const PCLHeader &rhs)
Defines all the PCL and non-PCL macros used.
Vertex(Point3D< float > s, Point3D< float > e, float v)
Vertex(Point3D< float > s, Point3D< float > e, Point3D< float > p)
Point3D & operator-=(Point3D p)
Point3D operator+(Point3D p) const
Point3D operator-(Point3D p) const
Point3D & operator+=(Point3D p)
Point3D & operator*=(Real r)
Point3D & operator/=(Real r)
Point3D operator/(Real r) const
Point3D operator*(Real r) const