Make the point computation more CGAL like

This commit is contained in:
Le-Jeng Shiue 2006-03-08 06:10:58 +00:00
parent 204495706b
commit 5b35530823
1 changed files with 8 additions and 9 deletions

View File

@ -37,7 +37,7 @@ CGAL_BEGIN_NAMESPACE
template <class Poly> template <class Poly>
class PQQ_stencil_3 { class PQQ_stencil_3 {
public: public:
typedef Poly Polyhedron; typedef Poly Polyhedron;
typedef typename Polyhedron::Vertex_handle Vertex_handle; typedef typename Polyhedron::Vertex_handle Vertex_handle;
typedef typename Polyhedron::Halfedge_handle Halfedge_handle; typedef typename Polyhedron::Halfedge_handle Halfedge_handle;
@ -64,7 +64,7 @@ public:
template <class Poly> template <class Poly>
class Linear_mask_3 : public PQQ_stencil_3<Poly> { class Linear_mask_3 : public PQQ_stencil_3<Poly> {
public: public:
typedef Poly Polyhedron; typedef Poly Polyhedron;
typedef typename Polyhedron::Vertex_handle Vertex_handle; typedef typename Polyhedron::Vertex_handle Vertex_handle;
typedef typename Polyhedron::Halfedge_handle Halfedge_handle; typedef typename Polyhedron::Halfedge_handle Halfedge_handle;
@ -78,22 +78,21 @@ public:
typedef typename Polyhedron::Traits Traits; typedef typename Polyhedron::Traits Traits;
typedef typename Traits::Kernel Kernel; typedef typename Traits::Kernel Kernel;
typedef typename Kernel::FT FT; typedef typename Kernel::FT FT;
typedef typename Kernel::Point_3 Point; typedef typename Kernel::Point_3 Point;
typedef typename Kernel::Vector_3 Vector; typedef typename Kernel::Vector_3 Vector;
public: public:
// //
void facet_node(Facet_handle facet, Point& pt) { void facet_node(Facet_handle facet, Point& pt) {
Halfedge_around_facet_circulator hcir = facet->facet_begin(); Halfedge_around_facet_circulator hcir = facet->facet_begin();
int n = 0; int n = 0;
FT p[] = {0,0,0}; Point p(0,0,0);
do { do {
Point t = hcir->vertex()->point(); p = p + (hcir->vertex()->point() - ORIGIN);
p[0] += t[0], p[1] += t[1], p[2] += t[2];
++n; ++n;
} while (++hcir != facet->facet_begin()); } while (++hcir != facet->facet_begin());
pt = Point(p[0]/n, p[1]/n, p[2]/n); pt = ORIGIN + (p - ORIGIN)/FT(n);
} }
// //
void edge_node(Halfedge_handle edge, Point& pt) { void edge_node(Halfedge_handle edge, Point& pt) {