mirror of https://github.com/CGAL/cgal
Improved readability of Skin_surface_3
Only indentation and whitespace is changed. Almost like a skin (sur)facelift !
This commit is contained in:
parent
fa4e541637
commit
4f6796731b
|
|
@ -22,27 +22,22 @@ typedef CGAL::Polyhedron_3<K> Polyhedron;
|
|||
#include "skin_surface_writer.h"
|
||||
#include "include/extract_balls_from_pdb.h"
|
||||
|
||||
|
||||
int main(int argc, char *argv[]) {
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
const char *filename;
|
||||
if (argc == 2) {
|
||||
filename = argv[1];
|
||||
} else {
|
||||
filename = "data/4lfq.pdb";
|
||||
}
|
||||
|
||||
|
||||
|
||||
std::list<Weighted_point> l;
|
||||
double shrinkfactor = 0.5;
|
||||
//Container for molecular system
|
||||
std::vector<System> systems;
|
||||
|
||||
|
||||
|
||||
|
||||
// Retrieve input balls:
|
||||
extract_balls_from_pdb<K>(filename,systems,std::back_inserter(l));
|
||||
|
||||
|
||||
|
||||
// Construct skin surface:
|
||||
std::cout << "Constructing skin surface..." <<std::endl;
|
||||
|
|
|
|||
|
|
@ -4,16 +4,17 @@
|
|||
#include <CGAL/mesh_skin_surface_3.h>
|
||||
#include <list>
|
||||
|
||||
typedef CGAL::Exact_predicates_inexact_constructions_kernel K;
|
||||
typedef CGAL::Skin_surface_traits_3<K> Traits;
|
||||
typedef CGAL::Skin_surface_3<Traits> Skin_surface_3;
|
||||
typedef Skin_surface_3::FT FT;
|
||||
typedef Skin_surface_3::Weighted_point Weighted_point;
|
||||
typedef Weighted_point::Point Bare_point;
|
||||
typedef CGAL::Exact_predicates_inexact_constructions_kernel K;
|
||||
typedef CGAL::Skin_surface_traits_3<K> Traits;
|
||||
typedef CGAL::Skin_surface_3<Traits> Skin_surface_3;
|
||||
typedef Skin_surface_3::FT FT;
|
||||
typedef Skin_surface_3::Weighted_point Weighted_point;
|
||||
typedef Weighted_point::Point Bare_point;
|
||||
typedef CGAL::Skin_surface_polyhedral_items_3<Skin_surface_3> Polyhedral_items;
|
||||
typedef CGAL::Polyhedron_3<K, Polyhedral_items> Polyhedron;
|
||||
typedef CGAL::Polyhedron_3<K, Polyhedral_items> Polyhedron;
|
||||
|
||||
int main() {
|
||||
int main()
|
||||
{
|
||||
std::list<Weighted_point> l;
|
||||
FT shrinkfactor = 0.5;
|
||||
|
||||
|
|
|
|||
|
|
@ -7,7 +7,8 @@ typedef K::Point_3 Bare_point;
|
|||
typedef K::Weighted_point_3 Weighted_point;
|
||||
typedef CGAL::Polyhedron_3<K> Polyhedron;
|
||||
|
||||
int main() {
|
||||
int main()
|
||||
{
|
||||
std::list<Weighted_point> l;
|
||||
double shrinkfactor = 0.5;
|
||||
|
||||
|
|
|
|||
|
|
@ -16,7 +16,8 @@ typedef Weighted_point::Point Bare_point;
|
|||
typedef CGAL::Polyhedron_3<K,
|
||||
CGAL::Skin_surface_polyhedral_items_3<Skin_surface_3> > Polyhedron;
|
||||
|
||||
int main() {
|
||||
int main()
|
||||
{
|
||||
std::list<Weighted_point> l;
|
||||
FT shrinkfactor = 0.5;
|
||||
|
||||
|
|
|
|||
|
|
@ -17,7 +17,8 @@ typedef Weighted_point::Point Bare_point;
|
|||
typedef CGAL::Skin_surface_polyhedral_items_3<Skin_surface_3> Polyhedral_items;
|
||||
typedef CGAL::Polyhedron_3<K, Polyhedral_items> Polyhedron;
|
||||
|
||||
int main() {
|
||||
int main()
|
||||
{
|
||||
std::list<Weighted_point> l;
|
||||
FT shrinkfactor = 0.5;
|
||||
|
||||
|
|
|
|||
|
|
@ -9,8 +9,8 @@
|
|||
template <class SkinSurface, class Polyhedron>
|
||||
/// Write polyhedron with normals:
|
||||
void write_polyhedron_with_normals(SkinSurface &skin,
|
||||
Polyhedron &p,
|
||||
std::ostream &out)
|
||||
Polyhedron &p,
|
||||
std::ostream &out)
|
||||
{
|
||||
typedef typename Polyhedron::Vertex_iterator Vertex_iterator;
|
||||
typedef typename Polyhedron::Facet_iterator Facet_iterator;
|
||||
|
|
@ -26,8 +26,6 @@ void write_polyhedron_with_normals(SkinSurface &skin,
|
|||
<< " " << p.size_of_halfedges()
|
||||
<< std::endl;
|
||||
|
||||
|
||||
|
||||
// Write vertices
|
||||
for (Vertex_iterator vit = p.vertices_begin();
|
||||
vit != p.vertices_end(); vit ++) {
|
||||
|
|
@ -38,7 +36,7 @@ void write_polyhedron_with_normals(SkinSurface &skin,
|
|||
|
||||
// Write faces
|
||||
CGAL::Inverse_index<Vertex_handle> index(p.vertices_begin(),
|
||||
p.vertices_end());
|
||||
p.vertices_end());
|
||||
for(Facet_iterator fi = p.facets_begin();
|
||||
fi != p.facets_end(); ++fi) {
|
||||
HFC hc = fi->facet_begin();
|
||||
|
|
|
|||
|
|
@ -11,7 +11,8 @@ typedef Union_of_balls_3::Weighted_point Weighted_point;
|
|||
typedef Weighted_point::Point Bare_point;
|
||||
typedef CGAL::Polyhedron_3<K> Polyhedron;
|
||||
|
||||
int main() {
|
||||
int main()
|
||||
{
|
||||
std::list<Weighted_point> l;
|
||||
|
||||
l.push_front(Weighted_point(Bare_point(0,0,0), 1));
|
||||
|
|
|
|||
|
|
@ -13,9 +13,10 @@ typedef CGAL::Union_of_balls_3<Traits> Union_of_balls_3;
|
|||
typedef Union_of_balls_3::Weighted_point Weighted_point;
|
||||
typedef Weighted_point::Point Bare_point;
|
||||
typedef CGAL::Polyhedron_3<K,
|
||||
CGAL::Skin_surface_polyhedral_items_3<Union_of_balls_3> > Polyhedron;
|
||||
CGAL::Skin_surface_polyhedral_items_3<Union_of_balls_3> > Polyhedron;
|
||||
|
||||
int main() {
|
||||
int main()
|
||||
{
|
||||
std::list<Weighted_point> l;
|
||||
|
||||
l.push_front(Weighted_point(Bare_point( 1,-1,-1), 1.25));
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@
|
|||
//
|
||||
// $URL$
|
||||
// $Id$
|
||||
//
|
||||
//
|
||||
//
|
||||
// Author(s) : Nico Kruithof <Nico@cs.rug.nl>
|
||||
|
||||
|
|
@ -36,12 +36,12 @@ public:
|
|||
typedef RegularTriangulation_3 Regular_triangulation;
|
||||
typedef typename Regular_triangulation::Geom_traits Geom_traits;
|
||||
typedef typename Geom_traits::Weighted_point_3 Weighted_point;
|
||||
|
||||
|
||||
typedef typename RegularTriangulation_3::Vertex_handle Vertex_handle;
|
||||
typedef typename RegularTriangulation_3::Cell_handle Cell_handle;
|
||||
typedef typename RegularTriangulation_3::Facet Facet;
|
||||
typedef typename RegularTriangulation_3::Edge Edge;
|
||||
|
||||
|
||||
typedef typename RegularTriangulation_3::Finite_vertices_iterator Finite_vertices_iterator;
|
||||
typedef typename RegularTriangulation_3::Finite_edges_iterator Finite_edges_iterator;
|
||||
typedef typename RegularTriangulation_3::Finite_facets_iterator Finite_facets_iterator;
|
||||
|
|
@ -51,23 +51,28 @@ public:
|
|||
|
||||
typedef typename std::list<Simplex>::iterator Simplex_iterator;
|
||||
|
||||
Compute_anchor_3(const RegularTriangulation_3 ®) : reg(reg) {
|
||||
}
|
||||
Compute_anchor_3(const RegularTriangulation_3 ®) : reg(reg) { }
|
||||
|
||||
Simplex anchor_del( const Vertex_handle v ) {
|
||||
Simplex anchor_del( const Vertex_handle v )
|
||||
{
|
||||
equiv_anchors.clear();
|
||||
return v;
|
||||
}
|
||||
|
||||
Simplex anchor_del( const Edge &e ) {
|
||||
return compute_anchor_del(e);
|
||||
}
|
||||
|
||||
Simplex anchor_del( const Facet &f ) {
|
||||
return compute_anchor_del(f);
|
||||
}
|
||||
|
||||
Simplex anchor_del( const Cell_handle ch ) {
|
||||
return compute_anchor_del(ch);
|
||||
}
|
||||
Simplex anchor_del( const Simplex &s ) {
|
||||
|
||||
Simplex anchor_del( const Simplex &s )
|
||||
{
|
||||
int dim = s.dimension();
|
||||
if (dim == 0) {
|
||||
Vertex_handle vh = s;
|
||||
|
|
@ -85,16 +90,21 @@ public:
|
|||
CGAL_error();
|
||||
return Simplex();
|
||||
}
|
||||
|
||||
Simplex anchor_vor( const Vertex_handle v ) {
|
||||
return compute_anchor_vor(v);
|
||||
}
|
||||
|
||||
Simplex anchor_vor( const Edge &e ) {
|
||||
return compute_anchor_vor(e);
|
||||
}
|
||||
|
||||
Simplex anchor_vor( const Facet &f ) {
|
||||
return compute_anchor_vor(f);
|
||||
}
|
||||
Simplex anchor_vor( const Cell_handle ch ) {
|
||||
|
||||
Simplex anchor_vor( const Cell_handle ch )
|
||||
{
|
||||
equiv_anchors.clear();
|
||||
for (int i=0; i<4; i++) {
|
||||
Cell_handle ch2 = ch->neighbor(i);
|
||||
|
|
@ -110,7 +120,9 @@ public:
|
|||
}
|
||||
return ch;
|
||||
}
|
||||
Simplex anchor_vor( const Simplex &s ) {
|
||||
|
||||
Simplex anchor_vor( const Simplex &s )
|
||||
{
|
||||
int dim = s.dimension();
|
||||
if (dim == 0) {
|
||||
return anchor_vor(Vertex_handle(s));
|
||||
|
|
@ -127,12 +139,15 @@ public:
|
|||
bool is_degenerate() {
|
||||
return !equiv_anchors.empty();
|
||||
}
|
||||
|
||||
Simplex_iterator equivalent_anchors_begin() {
|
||||
return equiv_anchors.begin();
|
||||
}
|
||||
|
||||
Simplex_iterator equivalent_anchors_end() {
|
||||
return equiv_anchors.end();
|
||||
}
|
||||
|
||||
private:
|
||||
///////////////////////////////
|
||||
// Anchor functions
|
||||
|
|
@ -140,28 +155,35 @@ private:
|
|||
Simplex compute_anchor_del( Edge const &e );
|
||||
Simplex compute_anchor_del( Facet const &f );
|
||||
Simplex compute_anchor_del( Cell_handle const ch );
|
||||
|
||||
|
||||
Simplex compute_anchor_vor( Vertex_handle const v );
|
||||
Simplex compute_anchor_vor( Edge const &e );
|
||||
Simplex compute_anchor_vor( Facet const &f );
|
||||
|
||||
// Test whether the anchor of edge (wp1,wp2) and wp2 are equal
|
||||
Sign test_anchor(Weighted_point &wp1, Weighted_point &wp2) {
|
||||
Sign test_anchor(Weighted_point &wp1, Weighted_point &wp2)
|
||||
{
|
||||
return enum_cast<Sign>(
|
||||
-reg.geom_traits().power_side_of_bounded_power_sphere_3_object()(wp1, wp2));
|
||||
-reg.geom_traits().power_side_of_bounded_power_sphere_3_object()(wp1, wp2));
|
||||
}
|
||||
Sign test_anchor(Weighted_point const& wp1, Weighted_point const& wp2,
|
||||
Weighted_point const& wp3) {
|
||||
|
||||
Sign test_anchor(Weighted_point const& wp1, Weighted_point const& wp2,
|
||||
Weighted_point const& wp3)
|
||||
{
|
||||
return enum_cast<Sign>(
|
||||
- reg.geom_traits().power_side_of_bounded_power_sphere_3_object()(wp1, wp2, wp3));
|
||||
- reg.geom_traits().power_side_of_bounded_power_sphere_3_object()(wp1, wp2, wp3));
|
||||
}
|
||||
Sign test_anchor(Weighted_point const& wp1, Weighted_point const& wp2,
|
||||
Weighted_point const& wp3, Weighted_point const& wp4) {
|
||||
|
||||
Sign test_anchor(Weighted_point const& wp1, Weighted_point const& wp2,
|
||||
Weighted_point const& wp3, Weighted_point const& wp4)
|
||||
{
|
||||
return enum_cast<Sign>(
|
||||
-reg.geom_traits().power_side_of_bounded_power_sphere_3_object()(wp1, wp2, wp3, wp4));
|
||||
-reg.geom_traits().power_side_of_bounded_power_sphere_3_object()(wp1, wp2, wp3, wp4));
|
||||
}
|
||||
|
||||
// Test whether the anchor of e and anchor of e.first->vertex(i) are equal
|
||||
Sign test_anchor(Edge e, int i) {
|
||||
Sign test_anchor(Edge e, int i)
|
||||
{
|
||||
CGAL_assertion(!reg.is_infinite(e));
|
||||
CGAL_assertion(e.second == i || e.third == i);
|
||||
Weighted_point wp1, wp2;
|
||||
|
|
@ -170,9 +192,11 @@ private:
|
|||
ch->vertex(e.second+e.third-i)->point(),
|
||||
ch->vertex(i)->point());
|
||||
}
|
||||
|
||||
// Test whether the anchor of f and anchor of the edge f - f.first->vertex(i)
|
||||
// are equal
|
||||
Sign test_anchor(Facet f, int i){
|
||||
Sign test_anchor(Facet f, int i)
|
||||
{
|
||||
CGAL_assertion(!reg.is_infinite(f));
|
||||
CGAL_assertion(f.second != i);
|
||||
CGAL_assertion(0<=f.second && f.second<4);
|
||||
|
|
@ -198,12 +222,12 @@ private:
|
|||
CGAL_error();
|
||||
}
|
||||
return enum_cast<Sign>(
|
||||
-reg.geom_traits().power_side_of_bounded_power_sphere_3_object()(wp1, wp2, wp3));
|
||||
-reg.geom_traits().power_side_of_bounded_power_sphere_3_object()(wp1, wp2, wp3));
|
||||
}
|
||||
|
||||
|
||||
// Test whether the anchor of ch and anchor of the facet (ch,i) are equal
|
||||
Sign test_anchor(Cell_handle ch, int i) {
|
||||
Sign test_anchor(Cell_handle ch, int i)
|
||||
{
|
||||
CGAL_assertion(!reg.is_infinite(ch));
|
||||
|
||||
return enum_cast<Sign>(
|
||||
|
|
@ -213,7 +237,9 @@ private:
|
|||
ch->vertex((i+3)&3)->point(),
|
||||
ch->vertex(i)->point()));
|
||||
}
|
||||
Sign test_anchor(Cell_handle ch, Cell_handle ch2) {
|
||||
|
||||
Sign test_anchor(Cell_handle ch, Cell_handle ch2)
|
||||
{
|
||||
CGAL_assertion(!reg.is_infinite(ch));
|
||||
CGAL_assertion(!reg.is_infinite(ch2));
|
||||
|
||||
|
|
@ -224,27 +250,28 @@ private:
|
|||
ch->vertex(1)->point(),
|
||||
ch->vertex(2)->point(),
|
||||
ch->vertex(3)->point(),
|
||||
ch2->vertex(index)->point()));
|
||||
ch2->vertex(index)->point()));
|
||||
}
|
||||
Sign test_anchor(
|
||||
Weighted_point const& wp1, Weighted_point const& wp2,
|
||||
Weighted_point const& wp3, Weighted_point const& wp4,
|
||||
Weighted_point const& wp5) {
|
||||
|
||||
Sign test_anchor(Weighted_point const& wp1, Weighted_point const& wp2,
|
||||
Weighted_point const& wp3, Weighted_point const& wp4,
|
||||
Weighted_point const& wp5)
|
||||
{
|
||||
return enum_cast<Sign>(
|
||||
-reg.geom_traits().power_side_of_bounded_power_sphere_3_object()(wp1, wp2, wp3, wp4, wp5));
|
||||
-reg.geom_traits().power_side_of_bounded_power_sphere_3_object()(wp1, wp2, wp3, wp4, wp5));
|
||||
}
|
||||
|
||||
const Regular_triangulation ®
|
||||
std::list<Simplex> equiv_anchors;
|
||||
};
|
||||
|
||||
|
||||
// compute_anchor_del
|
||||
|
||||
template < class RegularTriangulation3 >
|
||||
typename Compute_anchor_3<RegularTriangulation3>::Simplex
|
||||
Compute_anchor_3<RegularTriangulation3>::
|
||||
compute_anchor_del(Edge const &e) {
|
||||
compute_anchor_del(Edge const &e)
|
||||
{
|
||||
CGAL_assertion(!reg.is_infinite(e));
|
||||
equiv_anchors.clear();
|
||||
Sign result = test_anchor(e, e.second);
|
||||
|
|
@ -259,14 +286,15 @@ compute_anchor_del(Edge const &e) {
|
|||
return Simplex(e.first->vertex(e.second));
|
||||
} else if (result==ZERO) {
|
||||
equiv_anchors.push_back(Simplex(e.first->vertex(e.third)));
|
||||
}
|
||||
}
|
||||
return Simplex(e);
|
||||
}
|
||||
|
||||
template < class RegularTriangulation3 >
|
||||
typename Compute_anchor_3<RegularTriangulation3>::Simplex
|
||||
Compute_anchor_3<RegularTriangulation3>::
|
||||
compute_anchor_del(Facet const &f) {
|
||||
compute_anchor_del(Facet const &f)
|
||||
{
|
||||
CGAL_assertion(!reg.is_infinite(f));
|
||||
equiv_anchors.clear();
|
||||
|
||||
|
|
@ -282,15 +310,15 @@ compute_anchor_del(Facet const &f) {
|
|||
Edge(f.first, (f.second+(i==1?2:1))&3, (f.second+(i==3?2:3))&3));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (contains_center) {
|
||||
return Simplex(f);
|
||||
} else {
|
||||
i--;
|
||||
Edge e; e.first = f.first;
|
||||
if (i==1) e.second = ((f.second+2)&3);
|
||||
Edge e; e.first = f.first;
|
||||
if (i==1) e.second = ((f.second+2)&3);
|
||||
else e.second = ((f.second+1)&3);
|
||||
if (i==3) e.third = ((f.second+2)&3);
|
||||
if (i==3) e.third = ((f.second+2)&3);
|
||||
else e.third = ((f.second+3)&3);
|
||||
|
||||
Simplex s = anchor_del(e);
|
||||
|
|
@ -314,10 +342,11 @@ compute_anchor_del(Facet const &f) {
|
|||
template < class RegularTriangulation3 >
|
||||
typename Compute_anchor_3<RegularTriangulation3>::Simplex
|
||||
Compute_anchor_3<RegularTriangulation3>::
|
||||
compute_anchor_del(Cell_handle const ch) {
|
||||
compute_anchor_del(Cell_handle const ch)
|
||||
{
|
||||
CGAL_assertion(!reg.is_infinite(ch));
|
||||
equiv_anchors.clear();
|
||||
|
||||
|
||||
Simplex s;
|
||||
bool contains_center = true;
|
||||
Sign result;
|
||||
|
|
@ -364,7 +393,7 @@ compute_anchor_del(Cell_handle const ch) {
|
|||
}
|
||||
if (found) {
|
||||
equiv_anchors.clear();
|
||||
return s;
|
||||
return s;
|
||||
}
|
||||
found = true;
|
||||
s = tmp;
|
||||
|
|
@ -375,7 +404,8 @@ compute_anchor_del(Cell_handle const ch) {
|
|||
template < class RegularTriangulation3 >
|
||||
typename Compute_anchor_3<RegularTriangulation3>::Simplex
|
||||
Compute_anchor_3<RegularTriangulation3>::
|
||||
compute_anchor_vor (Vertex_handle const v) {
|
||||
compute_anchor_vor (Vertex_handle const v)
|
||||
{
|
||||
CGAL_assertion(!reg.is_infinite(v));
|
||||
CGAL_assertion(reg.is_vertex(v));
|
||||
|
||||
|
|
@ -388,13 +418,13 @@ compute_anchor_vor (Vertex_handle const v) {
|
|||
std::list<Vertex_handle> adj_vertices;
|
||||
typename std::list<Vertex_handle>::iterator adj_vertex;
|
||||
reg.incident_vertices(v, std::back_inserter(adj_vertices));
|
||||
|
||||
for (adj_vertex = adj_vertices.begin();
|
||||
|
||||
for (adj_vertex = adj_vertices.begin();
|
||||
(adj_vertex != adj_vertices.end()) && contains_center;
|
||||
adj_vertex++) {
|
||||
if (!reg.is_infinite(*adj_vertex)) {
|
||||
side = test_anchor(v->point(),(*adj_vertex)->point());
|
||||
if (side == NEGATIVE) {
|
||||
if (side == NEGATIVE) {
|
||||
contains_center = false;
|
||||
} else if (side == ZERO) {
|
||||
Edge e;
|
||||
|
|
@ -445,7 +475,7 @@ compute_anchor_vor (Vertex_handle const v) {
|
|||
if (s.dimension() == 1) {
|
||||
Edge e = s;
|
||||
Vertex_handle v_other = e.first->vertex(e.second+e.third-e.first->index(v));
|
||||
for (adj_vertex = adj_vertices.begin();
|
||||
for (adj_vertex = adj_vertices.begin();
|
||||
adj_vertex != adj_vertices.end();
|
||||
adj_vertex++) {
|
||||
if ((v_other != (*adj_vertex)) && (!reg.is_infinite(*adj_vertex))) {
|
||||
|
|
@ -462,7 +492,7 @@ compute_anchor_vor (Vertex_handle const v) {
|
|||
equiv_anchors.push_back(e2);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return s;
|
||||
}
|
||||
|
|
@ -473,7 +503,8 @@ compute_anchor_vor (Vertex_handle const v) {
|
|||
|
||||
template < class RegularTriangulation3 >
|
||||
typename Compute_anchor_3<RegularTriangulation3>::Simplex
|
||||
Compute_anchor_3<RegularTriangulation3>::compute_anchor_vor (Edge const &e) {
|
||||
Compute_anchor_3<RegularTriangulation3>::compute_anchor_vor (Edge const &e)
|
||||
{
|
||||
CGAL_assertion(!reg.is_infinite(e));
|
||||
|
||||
equiv_anchors.clear();
|
||||
|
|
@ -484,14 +515,14 @@ Compute_anchor_3<RegularTriangulation3>::compute_anchor_vor (Edge const &e) {
|
|||
bool contains_center = true;
|
||||
Sign side;
|
||||
Simplex s;
|
||||
|
||||
|
||||
Facet_circulator fcir, fstart;
|
||||
fstart = fcir = reg.incident_facets(e);
|
||||
|
||||
do {
|
||||
if (!reg.is_infinite(*fcir)) {
|
||||
int i = 6 - (*fcir).second -
|
||||
(*fcir).first->index(v0) - (*fcir).first->index(v1);
|
||||
(*fcir).first->index(v0) - (*fcir).first->index(v1);
|
||||
side = test_anchor(*fcir, i);
|
||||
if (side == NEGATIVE) {
|
||||
contains_center = false;
|
||||
|
|
@ -501,7 +532,7 @@ Compute_anchor_3<RegularTriangulation3>::compute_anchor_vor (Edge const &e) {
|
|||
}
|
||||
}
|
||||
} while (++fcir != fstart);
|
||||
|
||||
|
||||
if (contains_center) {
|
||||
s = Simplex(e);
|
||||
return s;
|
||||
|
|
@ -538,11 +569,11 @@ Compute_anchor_3<RegularTriangulation3>::compute_anchor_vor (Edge const &e) {
|
|||
do {
|
||||
if (!reg.is_infinite(*fcir)) {
|
||||
int index2 = 6 - (*fcir).second
|
||||
- (*fcir).first->index(v0)
|
||||
- (*fcir).first->index(v0)
|
||||
- (*fcir).first->index(v1);
|
||||
if (!(f.first->vertex(index) == (*fcir).first->vertex(index2))) {
|
||||
if (!(f.first->vertex(index) == (*fcir).first->vertex(index2))) {
|
||||
side = test_anchor(v0->point(), v1->point(),
|
||||
f.first->vertex(index)->point(),
|
||||
f.first->vertex(index)->point(),
|
||||
(*fcir).first->vertex(index2)->point());
|
||||
if (side == ZERO) {
|
||||
equiv_anchors.push_back(Facet(*fcir));
|
||||
|
|
@ -560,12 +591,13 @@ Compute_anchor_3<RegularTriangulation3>::compute_anchor_vor (Edge const &e) {
|
|||
|
||||
template < class RegularTriangulation3 >
|
||||
typename Compute_anchor_3<RegularTriangulation3>::Simplex
|
||||
Compute_anchor_3<RegularTriangulation3>::compute_anchor_vor (Facet const &f) {
|
||||
Compute_anchor_3<RegularTriangulation3>::compute_anchor_vor (Facet const &f)
|
||||
{
|
||||
CGAL_assertion(!reg.is_infinite(f));
|
||||
equiv_anchors.clear();
|
||||
|
||||
|
||||
Sign side;
|
||||
|
||||
|
||||
CGAL_assertion(f.first != Cell_handle());
|
||||
if (!reg.is_infinite(f.first)) {
|
||||
side = test_anchor(f.first, f.second);
|
||||
|
|
@ -592,7 +624,6 @@ Compute_anchor_3<RegularTriangulation3>::compute_anchor_vor (Facet const &f) {
|
|||
return Simplex(f);
|
||||
}
|
||||
|
||||
|
||||
} //namespace CGAL
|
||||
|
||||
#endif // CGAL_COMPUTE_ANCHOR_3_H
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@
|
|||
//
|
||||
// $URL$
|
||||
// $Id$
|
||||
//
|
||||
//
|
||||
//
|
||||
// Author(s) : Nico Kruithof <Nico@cs.rug.nl>
|
||||
|
||||
|
|
@ -28,34 +28,21 @@
|
|||
|
||||
namespace CGAL {
|
||||
|
||||
template <class Vertex_iterator,
|
||||
class Cell_iterator,
|
||||
class Polyhedron_3>
|
||||
class Marching_tetrahedra_observer_default_3 {
|
||||
template <class Vertex_iterator, class Cell_iterator, class Polyhedron_3>
|
||||
class Marching_tetrahedra_observer_default_3
|
||||
{
|
||||
public:
|
||||
typedef Polyhedron_3 Polyhedron;
|
||||
|
||||
|
||||
typedef Cell_iterator T_Cell_iterator;
|
||||
typedef typename Polyhedron::Vertex_handle Polyhedron_vertex_handle;
|
||||
typedef typename Polyhedron::Facet_handle Polyhedron_facet_handle;
|
||||
typedef typename Polyhedron::Vertex_handle Polyhedron_vertex_handle;
|
||||
typedef typename Polyhedron::Facet_handle Polyhedron_facet_handle;
|
||||
|
||||
Marching_tetrahedra_observer_default_3() {
|
||||
}
|
||||
|
||||
Marching_tetrahedra_observer_default_3(
|
||||
const Marching_tetrahedra_observer_default_3&) {
|
||||
}
|
||||
|
||||
void after_vertex_insertion(
|
||||
T_Cell_iterator, int, int,
|
||||
Polyhedron_vertex_handle) {
|
||||
}
|
||||
|
||||
void after_facet_insertion(
|
||||
T_Cell_iterator,
|
||||
Polyhedron_facet_handle) {
|
||||
}
|
||||
Marching_tetrahedra_observer_default_3() { }
|
||||
Marching_tetrahedra_observer_default_3(const Marching_tetrahedra_observer_default_3&) { }
|
||||
|
||||
void after_vertex_insertion(T_Cell_iterator, int, int, Polyhedron_vertex_handle) { }
|
||||
void after_facet_insertion(T_Cell_iterator, Polyhedron_facet_handle) { }
|
||||
};
|
||||
|
||||
} //namespace CGAL
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@
|
|||
//
|
||||
// $URL$
|
||||
// $Id$
|
||||
//
|
||||
//
|
||||
//
|
||||
// Author(s) : Nico Kruithof <Nico@cs.rug.nl>
|
||||
|
||||
|
|
@ -23,19 +23,19 @@
|
|||
|
||||
#include <CGAL/license/Skin_surface_3.h>
|
||||
|
||||
|
||||
#include <CGAL/Polyhedron_incremental_builder_3.h>
|
||||
#include <CGAL/Modifier_base.h>
|
||||
#include <CGAL/Cartesian_converter.h>
|
||||
|
||||
namespace CGAL {
|
||||
namespace CGAL {
|
||||
|
||||
/// NGHK: Is the converter needed or do we just use the Cartesian_converter
|
||||
template <class SkinSurface_3,
|
||||
class Vertex_iterator,
|
||||
class Cell_iterator,
|
||||
class HalfedgeDS>
|
||||
class Marching_tetrahedra_traits_skin_surface_3 {
|
||||
class Vertex_iterator,
|
||||
class Cell_iterator,
|
||||
class HalfedgeDS>
|
||||
class Marching_tetrahedra_traits_skin_surface_3
|
||||
{
|
||||
public:
|
||||
typedef HalfedgeDS Halfedge_DS;
|
||||
|
||||
|
|
@ -44,25 +44,28 @@ public:
|
|||
|
||||
typedef typename SkinSurface_3::Bare_point Skin_point;
|
||||
|
||||
Marching_tetrahedra_traits_skin_surface_3(const SkinSurface_3 &ss_3)
|
||||
: ss_3(ss_3) {}
|
||||
Marching_tetrahedra_traits_skin_surface_3(const SkinSurface_3 &ss_3)
|
||||
: ss_3(ss_3)
|
||||
{ }
|
||||
|
||||
// These two functions are required by the marching tetrahedra algorithm
|
||||
Sign sign(const Cell_iterator ch, int i) const {
|
||||
return ss_3.sign(ch->vertex(i));
|
||||
}
|
||||
HDS_point intersection(Cell_iterator const ch, int i, int j) const {
|
||||
|
||||
HDS_point intersection(Cell_iterator const ch, int i, int j) const
|
||||
{
|
||||
// Precondition: ch is not an infinite cell: their surface is not set
|
||||
Skin_point p;
|
||||
ss_3.intersect(ch, i, j, p);
|
||||
|
||||
return
|
||||
|
||||
return
|
||||
Cartesian_converter<typename Skin_point::R, typename HDS_point::R>()(p);
|
||||
}
|
||||
|
||||
const SkinSurface_3 &ss_3;
|
||||
};
|
||||
|
||||
} //namespace CGAL
|
||||
} //namespace CGAL
|
||||
|
||||
#endif // CGAL_MARCHING_TETRAHEDRA_TRAITS_SKIN_SURFACE_3_H
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@
|
|||
//
|
||||
// $URL$
|
||||
// $Id$
|
||||
//
|
||||
//
|
||||
//
|
||||
// Author(s) : Nico Kruithof <Nico@cs.rug.nl>
|
||||
|
||||
|
|
@ -23,18 +23,20 @@
|
|||
|
||||
#include <CGAL/license/Skin_surface_3.h>
|
||||
|
||||
|
||||
#include <CGAL/Skin_surface_base_3.h>
|
||||
#include <CGAL/triangulate_mixed_complex_3.h>
|
||||
#include <CGAL/FPU.h>
|
||||
|
||||
namespace CGAL {
|
||||
namespace CGAL {
|
||||
|
||||
template <class MixedComplexTraits_3>
|
||||
class Skin_surface_3
|
||||
: public Skin_surface_base_3<MixedComplexTraits_3>
|
||||
{
|
||||
typedef MixedComplexTraits_3 Gt;
|
||||
typedef Skin_surface_3<Gt> Self;
|
||||
typedef Skin_surface_base_3<Gt> Base;
|
||||
|
||||
template <class MixedComplexTraits_3>
|
||||
class Skin_surface_3 : public Skin_surface_base_3<MixedComplexTraits_3> {
|
||||
typedef MixedComplexTraits_3 Gt;
|
||||
typedef Skin_surface_3<Gt> Self;
|
||||
typedef Skin_surface_base_3<Gt> Base;
|
||||
public:
|
||||
typedef MixedComplexTraits_3 Geometric_traits;
|
||||
|
||||
|
|
@ -59,6 +61,7 @@ public:
|
|||
typedef typename Base::Cell_info Cell_info;
|
||||
|
||||
typedef typename Base::TMC TMC;
|
||||
|
||||
private:
|
||||
typedef typename Base::TMC_Vertex_iterator TMC_Vertex_iterator;
|
||||
typedef typename Base::TMC_Cell_iterator TMC_Cell_iterator;
|
||||
|
|
@ -71,14 +74,14 @@ public:
|
|||
using Base::geometric_traits;
|
||||
using Base::regular;
|
||||
using Base::triangulated_mixed_complex;
|
||||
|
||||
public:
|
||||
template < class WP_iterator >
|
||||
Skin_surface_3(WP_iterator begin, WP_iterator end,
|
||||
Skin_surface_3(WP_iterator begin, WP_iterator end,
|
||||
FT shrink,
|
||||
bool grow_balls = true,
|
||||
Gt gt_ = Gt(),
|
||||
bool _verbose = false
|
||||
);
|
||||
bool _verbose = false);
|
||||
|
||||
template <class Polyhedron_3>
|
||||
void mesh_skin_surface_3(Polyhedron_3 &p) const {
|
||||
|
|
@ -91,19 +94,19 @@ public:
|
|||
}
|
||||
};
|
||||
|
||||
template <class MixedComplexTraits_3>
|
||||
template <class MixedComplexTraits_3>
|
||||
template < class WP_iterator >
|
||||
Skin_surface_3<MixedComplexTraits_3>::
|
||||
Skin_surface_3(WP_iterator begin, WP_iterator end,
|
||||
Skin_surface_3(WP_iterator begin, WP_iterator end,
|
||||
FT shrink,
|
||||
bool grow_balls,
|
||||
Gt gt_,
|
||||
bool verbose_)
|
||||
: Base(begin, end, shrink, grow_balls, gt_, verbose_) {
|
||||
|
||||
bool verbose_)
|
||||
: Base(begin, end, shrink, grow_balls, gt_, verbose_)
|
||||
{
|
||||
// Construct the Triangulated_mixed_complex:
|
||||
Triangulated_mixed_complex_observer_3<TMC, Self> observer(shrink_factor());
|
||||
triangulate_mixed_complex_3(regular(), shrink_factor(),
|
||||
triangulate_mixed_complex_3(regular(), shrink_factor(),
|
||||
triangulated_mixed_complex(),
|
||||
observer, verbose_);
|
||||
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@
|
|||
//
|
||||
// $URL$
|
||||
// $Id$
|
||||
//
|
||||
//
|
||||
//
|
||||
// Author(s) : Nico Kruithof <Nico@cs.rug.nl>
|
||||
|
||||
|
|
@ -23,7 +23,6 @@
|
|||
|
||||
#include <CGAL/license/Skin_surface_3.h>
|
||||
|
||||
|
||||
#include <CGAL/Exact_predicates_exact_constructions_kernel.h>
|
||||
#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
|
||||
#include <CGAL/Simple_cartesian.h>
|
||||
|
|
@ -54,31 +53,33 @@
|
|||
#include <boost/mpl/if.hpp>
|
||||
#include <boost/mpl/identity.hpp>
|
||||
|
||||
namespace CGAL {
|
||||
namespace CGAL {
|
||||
|
||||
template <class MixedComplexTraits_3>
|
||||
class Skin_surface_base_3
|
||||
{
|
||||
typedef MixedComplexTraits_3 Gt;
|
||||
typedef Skin_surface_base_3<Gt> Self;
|
||||
|
||||
template <class MixedComplexTraits_3>
|
||||
class Skin_surface_base_3 {
|
||||
typedef MixedComplexTraits_3 Gt;
|
||||
typedef Skin_surface_base_3<Gt> Self;
|
||||
|
||||
public:
|
||||
typedef MixedComplexTraits_3 Geometric_traits;
|
||||
typedef MixedComplexTraits_3 Geometric_traits;
|
||||
|
||||
typedef typename Gt::Weighted_point_3 Weighted_point;
|
||||
typedef typename Gt::Weighted_point_3 Weighted_point;
|
||||
typedef typename boost::mpl::eval_if_c<
|
||||
internal::Has_nested_type_Bare_point<Gt>::value,
|
||||
typename internal::Bare_point_type<Gt>,
|
||||
boost::mpl::identity<typename Gt::Point_3>
|
||||
>::type Bare_point;
|
||||
>::type Bare_point;
|
||||
|
||||
typedef typename Gt::FT FT;
|
||||
typedef typename Gt::FT FT;
|
||||
// For normal
|
||||
typedef typename Gt::Vector_3 Vector;
|
||||
|
||||
typedef Regular_triangulation_3<Gt> Regular;
|
||||
typedef typename Gt::Vector_3 Vector;
|
||||
|
||||
typedef Regular_triangulation_3<Gt> Regular;
|
||||
|
||||
private:
|
||||
typedef Exact_predicates_inexact_constructions_kernel Filtered_kernel;
|
||||
|
||||
public:
|
||||
typedef Skin_surface_quadratic_surface_3<Filtered_kernel> Quadratic_surface;
|
||||
|
||||
|
|
@ -99,8 +100,8 @@ private:
|
|||
typedef typename Regular::Finite_cells_iterator Finite_cells_iterator;
|
||||
|
||||
public:
|
||||
typedef Anchor_point Vertex_info;
|
||||
typedef std::pair<Simplex, boost::shared_ptr<Quadratic_surface> > Cell_info;
|
||||
typedef Anchor_point Vertex_info;
|
||||
typedef std::pair<Simplex, boost::shared_ptr<Quadratic_surface> > Cell_info;
|
||||
|
||||
private:
|
||||
// Triangulated_mixed_complex:
|
||||
|
|
@ -108,6 +109,7 @@ private:
|
|||
typedef Triangulation_vertex_base_with_info_3<Vertex_info, FK> Vb;
|
||||
typedef Triangulation_cell_base_with_info_3<Cell_info, FK> Cb;
|
||||
typedef Triangulation_data_structure_3<Vb,Cb> Tds;
|
||||
|
||||
public:
|
||||
typedef Triangulation_3<FK, Tds> TMC;
|
||||
typedef typename TMC::Geom_traits TMC_Geom_traits;
|
||||
|
|
@ -117,59 +119,53 @@ public:
|
|||
typedef typename TMC::Cell_handle TMC_Cell_handle;
|
||||
typedef typename TMC::Point TMC_Point;
|
||||
|
||||
|
||||
// Constructor
|
||||
template < class WP_iterator >
|
||||
Skin_surface_base_3(WP_iterator begin, WP_iterator end, FT shrink,
|
||||
bool grow_balls = true,
|
||||
Gt gt_ = Gt(), bool _verbose = false);
|
||||
|
||||
|
||||
template <class Polyhedron_3>
|
||||
void mesh_surface_3(Polyhedron_3 &p) const;
|
||||
|
||||
template <class Polyhedron_3>
|
||||
void subdivide_mesh_3(Polyhedron_3 &p) const;
|
||||
|
||||
|
||||
|
||||
// Access functions:
|
||||
// Access functions:
|
||||
TMC &triangulated_mixed_complex();
|
||||
const FT shrink_factor() const { return shrink; }
|
||||
Geometric_traits &geometric_traits() const { return gt; }
|
||||
// TMC &triangulated_mixed_complex() { return _tmc; }
|
||||
// TMC &triangulated_mixed_complex() { return _tmc; }
|
||||
Regular ®ular() { return _regular; }
|
||||
|
||||
// Predicates and constructions
|
||||
Sign sign(TMC_Vertex_handle vit) const;
|
||||
|
||||
Sign sign(const Bare_point &p,
|
||||
|
||||
Sign sign(const Bare_point &p,
|
||||
const TMC_Cell_handle start = TMC_Cell_handle()) const;
|
||||
|
||||
Sign sign(const Bare_point &p,
|
||||
|
||||
Sign sign(const Bare_point &p,
|
||||
const Cell_info &info) const;
|
||||
|
||||
// Uses inexact computations to compute the sign
|
||||
Sign sign_inexact(const Bare_point &p,
|
||||
Sign sign_inexact(const Bare_point &p,
|
||||
const Cell_info &info) const;
|
||||
|
||||
|
||||
void intersect(TMC_Cell_handle ch, int i, int j, Bare_point &p) const;
|
||||
void intersect(Bare_point &p1, Bare_point &p2,
|
||||
void intersect(Bare_point &p1, Bare_point &p2,
|
||||
TMC_Cell_handle &s1, TMC_Cell_handle &s2,
|
||||
Bare_point &p) const;
|
||||
|
||||
void intersect_with_transversal_segment
|
||||
(Bare_point &p,
|
||||
const TMC_Cell_handle &start = TMC_Cell_handle()) const;
|
||||
|
||||
|
||||
void intersect_with_transversal_segment(
|
||||
Bare_point &p,
|
||||
const TMC_Cell_handle &start = TMC_Cell_handle()) const;
|
||||
|
||||
template <class Gt2>
|
||||
static
|
||||
typename Skin_surface_base_3<Gt2>::Bare_point
|
||||
get_weighted_circumcenter(const Simplex &s, Gt2 &traits);
|
||||
|
||||
Vector
|
||||
normal(const Bare_point &p,
|
||||
TMC_Cell_handle start = TMC_Cell_handle()) const;
|
||||
Vector normal(const Bare_point &p, TMC_Cell_handle start = TMC_Cell_handle()) const;
|
||||
|
||||
template <class Gt2>
|
||||
static
|
||||
|
|
@ -177,38 +173,36 @@ public:
|
|||
get_anchor_point(const Anchor_point &anchor, Gt2 &traits);
|
||||
|
||||
private:
|
||||
void construct_bounding_box();
|
||||
void construct_bounding_box();
|
||||
|
||||
template< class Traits >
|
||||
Skin_surface_quadratic_surface_3<Traits>
|
||||
construct_surface(
|
||||
const Simplex &sim,
|
||||
const Traits &traits = typename Geometric_traits::Kernel()) const;
|
||||
Skin_surface_quadratic_surface_3<Traits>
|
||||
construct_surface(const Simplex &sim,
|
||||
const Traits &traits = typename Geometric_traits::Kernel()) const;
|
||||
|
||||
Sign compare(Cell_info &info, const Bare_point &p1, const Bare_point &p2) const;
|
||||
Sign compare(Cell_info &info1, const Bare_point &p1,
|
||||
Sign compare(Cell_info &info1, const Bare_point &p1,
|
||||
Cell_info &info2, const Bare_point &p2) const;
|
||||
|
||||
TMC_Cell_handle
|
||||
locate_in_tmc(const Bare_point &p,
|
||||
TMC_Cell_handle start = TMC_Cell_handle()) const;
|
||||
|
||||
TMC_Cell_handle locate_in_tmc(const Bare_point &p,
|
||||
TMC_Cell_handle start = TMC_Cell_handle()) const;
|
||||
private:
|
||||
FT shrink;
|
||||
Geometric_traits gt;
|
||||
Regular _regular;
|
||||
// Triangulated mixed complex or Voronoi diagram:
|
||||
TMC _tmc;
|
||||
|
||||
|
||||
bool verbose;
|
||||
};
|
||||
|
||||
template <class MixedComplexTraits_3>
|
||||
template <class MixedComplexTraits_3>
|
||||
template < class WP_iterator >
|
||||
Skin_surface_base_3<MixedComplexTraits_3>::
|
||||
Skin_surface_base_3(WP_iterator begin, WP_iterator end, FT shrink_,
|
||||
bool grow_balls,
|
||||
Gt gt_, bool verbose_)
|
||||
: shrink(shrink_), gt(gt_), verbose(verbose_)
|
||||
Gt gt_, bool verbose_)
|
||||
: shrink(shrink_), gt(gt_), verbose(verbose_)
|
||||
{
|
||||
gt.set_shrink(shrink);
|
||||
CGAL_assertion(begin != end);
|
||||
|
|
@ -230,40 +224,42 @@ Skin_surface_base_3(WP_iterator begin, WP_iterator end, FT shrink_,
|
|||
}
|
||||
}
|
||||
|
||||
template <class MixedComplexTraits_3>
|
||||
template <class MixedComplexTraits_3>
|
||||
template <class Polyhedron_3>
|
||||
void
|
||||
Skin_surface_base_3<MixedComplexTraits_3>::
|
||||
mesh_surface_3(Polyhedron_3 &p) const {
|
||||
mesh_surface_3(Polyhedron_3 &p) const
|
||||
{
|
||||
typedef Polyhedron_3 Polyhedron;
|
||||
|
||||
typedef Marching_tetrahedra_traits_skin_surface_3<
|
||||
Self,
|
||||
TMC_Vertex_iterator,
|
||||
TMC_Cell_iterator,
|
||||
typename Polyhedron::HalfedgeDS> Traits;
|
||||
typename Polyhedron::HalfedgeDS> Traits;
|
||||
typedef Skin_surface_marching_tetrahedra_observer_3<
|
||||
TMC_Vertex_iterator,
|
||||
TMC_Cell_iterator,
|
||||
Polyhedron> Observer;
|
||||
Polyhedron> Observer;
|
||||
|
||||
// Extract the coarse mesh using marching_tetrahedra
|
||||
Traits marching_traits(*this);
|
||||
Observer marching_observer;
|
||||
marching_tetrahedra_3(_tmc.finite_vertices_begin(),
|
||||
_tmc.finite_vertices_end(),
|
||||
_tmc.finite_cells_begin(),
|
||||
_tmc.finite_cells_end(),
|
||||
p,
|
||||
marching_tetrahedra_3(_tmc.finite_vertices_begin(),
|
||||
_tmc.finite_vertices_end(),
|
||||
_tmc.finite_cells_begin(),
|
||||
_tmc.finite_cells_end(),
|
||||
p,
|
||||
marching_traits,
|
||||
marching_observer);
|
||||
}
|
||||
|
||||
template <class MixedComplexTraits_3>
|
||||
template <class MixedComplexTraits_3>
|
||||
template <class Polyhedron_3>
|
||||
void
|
||||
Skin_surface_base_3<MixedComplexTraits_3>::
|
||||
subdivide_mesh_3(Polyhedron_3 &p) const {
|
||||
subdivide_mesh_3(Polyhedron_3 &p) const
|
||||
{
|
||||
typedef Skin_surface_refinement_policy_3<Self, Polyhedron_3> Policy;
|
||||
typedef Skin_surface_sqrt3<Self, Polyhedron_3, Policy> Subdivider;
|
||||
|
||||
|
|
@ -280,11 +276,11 @@ triangulated_mixed_complex() {
|
|||
return _tmc;
|
||||
}
|
||||
|
||||
template <class MixedComplexTraits_3>
|
||||
template <class MixedComplexTraits_3>
|
||||
typename Skin_surface_base_3<MixedComplexTraits_3>::Vector
|
||||
Skin_surface_base_3<MixedComplexTraits_3>::
|
||||
normal(const Bare_point &p,
|
||||
TMC_Cell_handle start) const {
|
||||
normal(const Bare_point &p, TMC_Cell_handle start) const
|
||||
{
|
||||
if (start == TMC_Cell_handle()) {
|
||||
start = locate_in_tmc(p,start);
|
||||
}
|
||||
|
|
@ -292,10 +288,11 @@ normal(const Bare_point &p,
|
|||
return start->info().second->gradient(p);
|
||||
}
|
||||
|
||||
template <class MixedComplexTraits_3>
|
||||
Sign
|
||||
template <class MixedComplexTraits_3>
|
||||
Sign
|
||||
Skin_surface_base_3<MixedComplexTraits_3>::
|
||||
sign(TMC_Vertex_handle vit) const {
|
||||
sign(TMC_Vertex_handle vit) const
|
||||
{
|
||||
CGAL_assertion(!_tmc.is_infinite(vit));
|
||||
TMC_Cell_handle ch = vit->cell();
|
||||
if (_tmc.is_infinite(ch)) {
|
||||
|
|
@ -315,11 +312,11 @@ sign(TMC_Vertex_handle vit) const {
|
|||
// Protection is outside the try block as VC8 has the CGAL_CFG_FPU_ROUNDING_MODE_UNWINDING_VC_BUG
|
||||
Protect_FPU_rounding<true> P;
|
||||
try
|
||||
{
|
||||
Sign result = vit->cell()->info().second->sign(vit->point());
|
||||
if (is_certain(result))
|
||||
return result;
|
||||
}
|
||||
{
|
||||
Sign result = vit->cell()->info().second->sign(vit->point());
|
||||
if (is_certain(result))
|
||||
return result;
|
||||
}
|
||||
catch (Uncertain_conversion_exception) {}
|
||||
}
|
||||
CGAL_BRANCH_PROFILER_BRANCH(tmp);
|
||||
|
|
@ -336,11 +333,11 @@ sign(TMC_Vertex_handle vit) const {
|
|||
return construct_surface(vit->cell()->info().first, EK()).sign(p_exact);
|
||||
}
|
||||
|
||||
template <class MixedComplexTraits_3>
|
||||
Sign
|
||||
template <class MixedComplexTraits_3>
|
||||
Sign
|
||||
Skin_surface_base_3<MixedComplexTraits_3>::
|
||||
sign(const Bare_point &p,
|
||||
const TMC_Cell_handle start) const {
|
||||
sign(const Bare_point &p, const TMC_Cell_handle start) const
|
||||
{
|
||||
if (start == TMC_Cell_handle()) {
|
||||
return sign(p, locate_in_tmc(p,start)->info());
|
||||
} else {
|
||||
|
|
@ -348,52 +345,52 @@ sign(const Bare_point &p,
|
|||
}
|
||||
}
|
||||
|
||||
template <class MixedComplexTraits_3>
|
||||
Sign
|
||||
template <class MixedComplexTraits_3>
|
||||
Sign
|
||||
Skin_surface_base_3<MixedComplexTraits_3>::
|
||||
sign(const Bare_point &p, const Cell_info &info) const {
|
||||
sign(const Bare_point &p, const Cell_info &info) const
|
||||
{
|
||||
CGAL_BRANCH_PROFILER(std::string(" NGHK: failures/calls to : ") + std::string(CGAL_PRETTY_FUNCTION), tmp);
|
||||
{
|
||||
Protect_FPU_rounding<true> P;
|
||||
try
|
||||
{
|
||||
Sign result = sign_inexact(p,info);
|
||||
if (is_certain(result))
|
||||
return result;
|
||||
}
|
||||
catch (Uncertain_conversion_exception) {}
|
||||
{
|
||||
Sign result = sign_inexact(p,info);
|
||||
if (is_certain(result))
|
||||
return result;
|
||||
}
|
||||
catch (Uncertain_conversion_exception) {}
|
||||
}
|
||||
CGAL_BRANCH_PROFILER_BRANCH(tmp);
|
||||
Protect_FPU_rounding<false> P(CGAL_FE_TONEAREST);
|
||||
return construct_surface
|
||||
(info.first,
|
||||
Exact_predicates_exact_constructions_kernel()).sign(p);
|
||||
return construct_surface(info.first,
|
||||
Exact_predicates_exact_constructions_kernel()).sign(p);
|
||||
}
|
||||
|
||||
template <class MixedComplexTraits_3>
|
||||
Sign
|
||||
template <class MixedComplexTraits_3>
|
||||
Sign
|
||||
Skin_surface_base_3<MixedComplexTraits_3>::
|
||||
sign_inexact(const Bare_point &p, const Cell_info &info) const {
|
||||
return info.second->sign(p);
|
||||
}
|
||||
|
||||
template <class MixedComplexTraits_3>
|
||||
template <class MixedComplexTraits_3>
|
||||
void
|
||||
Skin_surface_base_3<MixedComplexTraits_3>::
|
||||
intersect(TMC_Cell_handle ch, int i, int j,
|
||||
Bare_point &p) const {
|
||||
intersect(TMC_Cell_handle ch, int i, int j, Bare_point &p) const
|
||||
{
|
||||
Cartesian_converter<FK, Gt> converter;
|
||||
|
||||
Bare_point p1 = gt.construct_point_3_object()(converter(ch->vertex(i)->point()));
|
||||
Bare_point p2 = gt.construct_point_3_object()(converter(ch->vertex(j)->point()));
|
||||
|
||||
return intersect(p1, p2, ch, ch, p);
|
||||
return intersect(p1, p2, ch, ch, p);
|
||||
}
|
||||
|
||||
template <class MixedComplexTraits_3>
|
||||
void
|
||||
template <class MixedComplexTraits_3>
|
||||
void
|
||||
Skin_surface_base_3<MixedComplexTraits_3>::
|
||||
intersect(Bare_point &p1, Bare_point &p2,
|
||||
intersect(Bare_point &p1, Bare_point &p2,
|
||||
TMC_Cell_handle &s1, TMC_Cell_handle &s2,
|
||||
Bare_point &p) const
|
||||
{
|
||||
|
|
@ -423,14 +420,13 @@ intersect(Bare_point &p1, Bare_point &p2,
|
|||
p = midpoint(p1, p2);
|
||||
}
|
||||
|
||||
template <class MixedComplexTraits_3>
|
||||
template <class MixedComplexTraits_3>
|
||||
void
|
||||
Skin_surface_base_3<MixedComplexTraits_3>::
|
||||
intersect_with_transversal_segment(
|
||||
Bare_point &p,
|
||||
const TMC_Cell_handle &start) const
|
||||
const TMC_Cell_handle &start) const
|
||||
{
|
||||
|
||||
typedef typename Geometric_traits::Kernel::Plane_3 Plane;
|
||||
typedef typename Geometric_traits::Kernel::Line_3 Line;
|
||||
|
||||
|
|
@ -438,7 +434,7 @@ intersect_with_transversal_segment(
|
|||
if (tet == TMC_Cell_handle()) {
|
||||
tet = locate_in_tmc(p, tet);
|
||||
}
|
||||
|
||||
|
||||
// get transversal segment:
|
||||
Bare_point p1, p2;
|
||||
|
||||
|
|
@ -503,10 +499,10 @@ intersect_with_transversal_segment(
|
|||
intersect(p1, p2, tet, tet, p);
|
||||
}
|
||||
|
||||
template <class MixedComplexTraits_3>
|
||||
void
|
||||
template <class MixedComplexTraits_3>
|
||||
void
|
||||
Skin_surface_base_3<MixedComplexTraits_3>::
|
||||
construct_bounding_box()
|
||||
construct_bounding_box()
|
||||
{
|
||||
typedef typename Regular::Finite_vertices_iterator Finite_vertices_iterator;
|
||||
|
||||
|
|
@ -525,42 +521,42 @@ construct_bounding_box()
|
|||
FT dx = bbox.xmax() - bbox.xmin();
|
||||
FT dy = bbox.ymax() - bbox.ymin();
|
||||
FT dz = bbox.zmax() - bbox.zmin();
|
||||
|
||||
Bare_point mid(bbox.xmin() + dx/2,
|
||||
bbox.ymin() + dy/2,
|
||||
bbox.zmin() + dz/2);
|
||||
FT dr =
|
||||
|
||||
Bare_point mid(bbox.xmin() + dx/2,
|
||||
bbox.ymin() + dy/2,
|
||||
bbox.zmin() + dz/2);
|
||||
FT dr =
|
||||
(dx+dy+dz+sqrt(CGAL::to_double(max_weight))+.001) / gt.get_shrink();
|
||||
|
||||
Weighted_point wp;
|
||||
wp = Weighted_point(Bare_point(mid.x()+dr,
|
||||
mid.y(),
|
||||
mid.z()),-1);
|
||||
mid.y(),
|
||||
mid.z()),-1);
|
||||
regular().insert(wp);
|
||||
wp = Weighted_point(Bare_point(mid.x()-dr,
|
||||
mid.y(),
|
||||
mid.z()),-1);
|
||||
mid.y(),
|
||||
mid.z()),-1);
|
||||
regular().insert(wp);
|
||||
wp = Weighted_point(Bare_point(mid.x(),
|
||||
mid.y()+dr,
|
||||
mid.z()),-1);
|
||||
mid.y()+dr,
|
||||
mid.z()),-1);
|
||||
regular().insert(wp);
|
||||
wp = Weighted_point(Bare_point(mid.x(),
|
||||
mid.y()-dr,
|
||||
mid.z()),-1);
|
||||
mid.y()-dr,
|
||||
mid.z()),-1);
|
||||
regular().insert(wp);
|
||||
wp = Weighted_point(Bare_point(mid.x(),
|
||||
mid.y(),
|
||||
mid.z()+dr),-1);
|
||||
mid.y(),
|
||||
mid.z()+dr),-1);
|
||||
regular().insert(wp);
|
||||
wp = Weighted_point(Bare_point(mid.x(),
|
||||
mid.y(),
|
||||
mid.z()-dr),-1);
|
||||
mid.y(),
|
||||
mid.z()-dr),-1);
|
||||
regular().insert(wp);
|
||||
}
|
||||
}
|
||||
|
||||
template <class MixedComplexTraits_3>
|
||||
template <class MixedComplexTraits_3>
|
||||
template <class Gt2>
|
||||
typename Skin_surface_base_3<Gt2>::Bare_point
|
||||
Skin_surface_base_3<MixedComplexTraits_3>::
|
||||
|
|
@ -572,9 +568,9 @@ get_anchor_point(const Anchor_point &anchor, Gt2 &traits)
|
|||
return traits.construct_anchor_point_3_object()(p_del,p_vor);
|
||||
}
|
||||
|
||||
template <class MixedComplexTraits_3>
|
||||
template <class MixedComplexTraits_3>
|
||||
template< class Traits >
|
||||
Skin_surface_quadratic_surface_3<Traits>
|
||||
Skin_surface_quadratic_surface_3<Traits>
|
||||
Skin_surface_base_3<MixedComplexTraits_3>::
|
||||
construct_surface(const Simplex &sim, const Traits &) const
|
||||
{
|
||||
|
|
@ -615,37 +611,34 @@ construct_surface(const Simplex &sim, const Traits &) const
|
|||
return Quadratic_surface();
|
||||
}
|
||||
|
||||
template <class MixedComplexTraits_3>
|
||||
template <class MixedComplexTraits_3>
|
||||
Sign
|
||||
Skin_surface_base_3<MixedComplexTraits_3>::
|
||||
compare(Cell_info &info,
|
||||
const Bare_point &p1,
|
||||
const Bare_point &p2) const {
|
||||
compare(Cell_info &info, const Bare_point &p1, const Bare_point &p2) const {
|
||||
return compare(info, p1, info, p2);
|
||||
}
|
||||
|
||||
template <class MixedComplexTraits_3>
|
||||
template <class MixedComplexTraits_3>
|
||||
Sign
|
||||
Skin_surface_base_3<MixedComplexTraits_3>::
|
||||
compare(Cell_info &info1,
|
||||
const Bare_point &p1,
|
||||
Cell_info &info2,
|
||||
const Bare_point &p2) const {
|
||||
compare(Cell_info &info1, const Bare_point &p1,
|
||||
Cell_info &info2, const Bare_point &p2) const
|
||||
{
|
||||
CGAL_BRANCH_PROFILER(std::string(" NGHK: failures/calls to : ") + std::string(CGAL_PRETTY_FUNCTION), tmp);
|
||||
{
|
||||
Protect_FPU_rounding<true> P;
|
||||
try
|
||||
{
|
||||
Sign result = CGAL_NTS sign(info1.second->value(p1) -
|
||||
info2.second->value(p2));
|
||||
if (is_certain(result))
|
||||
return result;
|
||||
}
|
||||
{
|
||||
Sign result = CGAL_NTS sign(info1.second->value(p1) -
|
||||
info2.second->value(p2));
|
||||
if (is_certain(result))
|
||||
return result;
|
||||
}
|
||||
catch (Uncertain_conversion_exception) {}
|
||||
}
|
||||
CGAL_BRANCH_PROFILER_BRANCH(tmp);
|
||||
Protect_FPU_rounding<false> P(CGAL_FE_TONEAREST);
|
||||
|
||||
|
||||
return CGAL_NTS sign(
|
||||
construct_surface(info1.first,
|
||||
Exact_predicates_exact_constructions_kernel()).value(p1) -
|
||||
|
|
@ -653,11 +646,11 @@ compare(Cell_info &info1,
|
|||
Exact_predicates_exact_constructions_kernel()).value(p2));
|
||||
}
|
||||
|
||||
template <class MixedComplexTraits_3>
|
||||
template <class MixedComplexTraits_3>
|
||||
typename Skin_surface_base_3<MixedComplexTraits_3>::TMC_Cell_handle
|
||||
Skin_surface_base_3<MixedComplexTraits_3>::
|
||||
locate_in_tmc(const Bare_point &p0,
|
||||
TMC_Cell_handle start) const {
|
||||
locate_in_tmc(const Bare_point &p0, TMC_Cell_handle start) const
|
||||
{
|
||||
Cartesian_converter<typename Bare_point::R, TMC_Geom_traits> converter_fk;
|
||||
TMC_Point p_inexact = converter_fk(p0);
|
||||
|
||||
|
|
@ -688,7 +681,7 @@ locate_in_tmc(const Bare_point &p0,
|
|||
|
||||
// For the remembering stochastic walk,
|
||||
// we need to start trying with a random index :
|
||||
boost::rand48 rng;
|
||||
boost::rand48 rng;
|
||||
boost::uniform_smallint<> four(0, 3);
|
||||
boost::variate_generator<boost::rand48&, boost::uniform_smallint<> > die4(rng, four);
|
||||
int i = die4();
|
||||
|
|
@ -707,28 +700,29 @@ locate_in_tmc(const Bare_point &p0,
|
|||
{
|
||||
Protect_FPU_rounding<true> P;
|
||||
try {
|
||||
o = TMC_Geom_traits().orientation_3_object()(*pts[0], *pts[1], *pts[2], *pts[3]);
|
||||
o = TMC_Geom_traits().orientation_3_object()(*pts[0], *pts[1],
|
||||
*pts[2], *pts[3]);
|
||||
} catch (Uncertain_conversion_exception) {
|
||||
Protect_FPU_rounding<false> P(CGAL_FE_TONEAREST);
|
||||
typedef Exact_predicates_exact_constructions_kernel EK;
|
||||
Cartesian_converter<typename Bare_point::R, EK> converter_ek;
|
||||
|
||||
Skin_surface_traits_3<EK> exact_traits(shrink_factor());
|
||||
|
||||
typename EK::Point_3 e_pts[4];
|
||||
|
||||
// We know that the 4 vertices of c are positively oriented.
|
||||
// So, in order to test if p is seen outside from one of c's facets,
|
||||
// we just replace the corresponding point by p in the orientation
|
||||
// test. We do this using the array below.
|
||||
for (int k=0; k<4; k++) {
|
||||
if (k != i) {
|
||||
e_pts[k] = get_anchor_point(c->vertex(k)->info(), exact_traits);
|
||||
} else {
|
||||
e_pts[k] = converter_ek(p0);
|
||||
}
|
||||
}
|
||||
o = orientation(e_pts[0], e_pts[1], e_pts[2], e_pts[3]);
|
||||
Protect_FPU_rounding<false> P(CGAL_FE_TONEAREST);
|
||||
typedef Exact_predicates_exact_constructions_kernel EK;
|
||||
Cartesian_converter<typename Bare_point::R, EK> converter_ek;
|
||||
|
||||
Skin_surface_traits_3<EK> exact_traits(shrink_factor());
|
||||
|
||||
typename EK::Point_3 e_pts[4];
|
||||
|
||||
// We know that the 4 vertices of c are positively oriented.
|
||||
// So, in order to test if p is seen outside from one of c's facets,
|
||||
// we just replace the corresponding point by p in the orientation
|
||||
// test. We do this using the array below.
|
||||
for (int k=0; k<4; k++) {
|
||||
if (k != i) {
|
||||
e_pts[k] = get_anchor_point(c->vertex(k)->info(), exact_traits);
|
||||
} else {
|
||||
e_pts[k] = converter_ek(p0);
|
||||
}
|
||||
}
|
||||
o = orientation(e_pts[0], e_pts[1], e_pts[2], e_pts[3]);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -744,16 +738,16 @@ locate_in_tmc(const Bare_point &p0,
|
|||
c = next;
|
||||
goto try_next_cell;
|
||||
}
|
||||
|
||||
|
||||
CGAL_assertion(c->vertex(0) != _tmc.infinite_vertex());
|
||||
CGAL_assertion(c->vertex(1) != _tmc.infinite_vertex());
|
||||
CGAL_assertion(c->vertex(2) != _tmc.infinite_vertex());
|
||||
CGAL_assertion(c->vertex(3) != _tmc.infinite_vertex());
|
||||
|
||||
|
||||
return c;
|
||||
}
|
||||
|
||||
template <class MixedComplexTraits_3>
|
||||
|
||||
template <class MixedComplexTraits_3>
|
||||
template <class Gt2>
|
||||
typename Skin_surface_base_3<Gt2>::Bare_point
|
||||
Skin_surface_base_3<MixedComplexTraits_3>::
|
||||
|
|
@ -771,40 +765,40 @@ get_weighted_circumcenter(const Simplex &s, Gt2 &traits)
|
|||
|
||||
Gt2_Bare_point result;
|
||||
switch(s.dimension()) {
|
||||
case 0:
|
||||
case 0:
|
||||
{
|
||||
vh = s;
|
||||
result = traits.construct_point_3_object()(converter(vh->point()));
|
||||
break;
|
||||
}
|
||||
case 1:
|
||||
case 1:
|
||||
{
|
||||
e = s;
|
||||
result = traits.construct_weighted_circumcenter_3_object()
|
||||
(converter(e.first->vertex(e.second)->point()),
|
||||
converter(e.first->vertex(e.third)->point()));
|
||||
(converter(e.first->vertex(e.second)->point()),
|
||||
converter(e.first->vertex(e.third)->point()));
|
||||
break;
|
||||
}
|
||||
case 2:
|
||||
case 2:
|
||||
{
|
||||
f = s;
|
||||
result = traits.construct_weighted_circumcenter_3_object()
|
||||
(converter(f.first->vertex((f.second+1)&3)->point()),
|
||||
converter(f.first->vertex((f.second+2)&3)->point()),
|
||||
converter(f.first->vertex((f.second+3)&3)->point()));
|
||||
(converter(f.first->vertex((f.second+1)&3)->point()),
|
||||
converter(f.first->vertex((f.second+2)&3)->point()),
|
||||
converter(f.first->vertex((f.second+3)&3)->point()));
|
||||
break;
|
||||
}
|
||||
case 3:
|
||||
case 3:
|
||||
{
|
||||
ch = s;
|
||||
result = traits.construct_weighted_circumcenter_3_object()
|
||||
(converter(ch->vertex(0)->point()),
|
||||
converter(ch->vertex(1)->point()),
|
||||
converter(ch->vertex(2)->point()),
|
||||
converter(ch->vertex(3)->point()));
|
||||
(converter(ch->vertex(0)->point()),
|
||||
converter(ch->vertex(1)->point()),
|
||||
converter(ch->vertex(2)->point()),
|
||||
converter(ch->vertex(3)->point()));
|
||||
break;
|
||||
}
|
||||
default:
|
||||
default:
|
||||
{
|
||||
CGAL_error();
|
||||
}
|
||||
|
|
@ -812,6 +806,6 @@ get_weighted_circumcenter(const Simplex &s, Gt2 &traits)
|
|||
return result;
|
||||
}
|
||||
|
||||
} //namespace CGAL
|
||||
} //namespace CGAL
|
||||
|
||||
#endif // CGAL_SKIN_SURFACE_BASE_3_H
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@
|
|||
//
|
||||
// $URL$
|
||||
// $Id$
|
||||
//
|
||||
//
|
||||
//
|
||||
// Author(s) : Nico Kruithof <Nico@cs.rug.nl>
|
||||
|
||||
|
|
@ -25,34 +25,30 @@
|
|||
|
||||
#include <CGAL/license/Skin_surface_3.h>
|
||||
|
||||
|
||||
#include <CGAL/basic.h>
|
||||
#include <CGAL/Skin_surface_traits_3.h>
|
||||
#include <CGAL/Filtered_predicate.h>
|
||||
|
||||
namespace CGAL {
|
||||
namespace CGAL {
|
||||
|
||||
template <class K>
|
||||
class Skin_surface_filtered_traits_3
|
||||
: public Skin_surface_traits_base_3<K>
|
||||
{
|
||||
// Exact traits is based on the exact kernel.
|
||||
typedef Skin_surface_traits_3<typename K::Exact_kernel>
|
||||
Exact_traits;
|
||||
typedef Skin_surface_traits_3<typename K::Exact_kernel> Exact_traits;
|
||||
// Filtering traits is based on the filtering kernel.
|
||||
typedef Skin_surface_traits_3<typename K::Approximate_kernel>
|
||||
Filtering_traits;
|
||||
typedef Skin_surface_traits_3<typename K::Approximate_kernel> Filtering_traits;
|
||||
|
||||
typedef typename K::C2E C2E;
|
||||
typedef typename K::C2F C2F;
|
||||
|
||||
typedef Skin_surface_traits_base_3<K> Base;
|
||||
public:
|
||||
typedef Filtered_predicate<
|
||||
typename Exact_traits::Side_of_mixed_cell_3,
|
||||
typename Filtering_traits::Side_of_mixed_cell_3,
|
||||
C2E,
|
||||
C2F > Side_of_mixed_cell_3;
|
||||
typedef Filtered_predicate<typename Exact_traits::Side_of_mixed_cell_3,
|
||||
typename Filtering_traits::Side_of_mixed_cell_3,
|
||||
C2E,
|
||||
C2F > Side_of_mixed_cell_3;
|
||||
|
||||
enum { Has_filtered_predicates=true };
|
||||
enum { Has_static_filters=false };
|
||||
|
|
@ -61,13 +57,12 @@ public:
|
|||
Skin_surface_filtered_traits_3(typename Base::FT s) : Base(s) {}
|
||||
|
||||
// Only make the predicates filtered, not the constructions:
|
||||
Side_of_mixed_cell_3
|
||||
side_of_mixed_cell_3_object() const
|
||||
{
|
||||
return Side_of_mixed_cell_3(Base::get_shrink());
|
||||
Side_of_mixed_cell_3
|
||||
side_of_mixed_cell_3_object() const
|
||||
{
|
||||
return Side_of_mixed_cell_3(Base::get_shrink());
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
} //namespace CGAL
|
||||
} // namespace CGAL
|
||||
#endif // CGAL_SKIN_SURFACE_FILTERED_TRAITS_3_H
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@
|
|||
//
|
||||
// $URL$
|
||||
// $Id$
|
||||
//
|
||||
//
|
||||
//
|
||||
// Author(s) : Nico Kruithof <Nico@cs.rug.nl>
|
||||
|
||||
|
|
@ -23,7 +23,6 @@
|
|||
|
||||
#include <CGAL/license/Skin_surface_3.h>
|
||||
|
||||
|
||||
#include <CGAL/Polyhedron_3.h>
|
||||
#include <CGAL/Marching_tetrahedra_observer_default_3.h>
|
||||
#include <CGAL/Skin_surface_polyhedral_items_3.h>
|
||||
|
|
@ -31,57 +30,52 @@
|
|||
namespace CGAL {
|
||||
|
||||
template <class Vertex_iterator,
|
||||
class Cell_iterator,
|
||||
class Polyhedron_3>
|
||||
class Cell_iterator,
|
||||
class Polyhedron_3>
|
||||
class Skin_surface_marching_tetrahedra_observer_3
|
||||
: public Marching_tetrahedra_observer_default_3
|
||||
<Vertex_iterator, Cell_iterator, Polyhedron_3>
|
||||
<Vertex_iterator, Cell_iterator, Polyhedron_3>
|
||||
{
|
||||
typedef Polyhedron_3 Polyhedron;
|
||||
typedef Polyhedron_3 Polyhedron;
|
||||
typedef Marching_tetrahedra_observer_default_3
|
||||
<Vertex_iterator, Cell_iterator, Polyhedron> Base;
|
||||
<Vertex_iterator, Cell_iterator, Polyhedron> Base;
|
||||
|
||||
public:
|
||||
Skin_surface_marching_tetrahedra_observer_3() : Base() {
|
||||
}
|
||||
|
||||
Skin_surface_marching_tetrahedra_observer_3() : Base() { }
|
||||
};
|
||||
|
||||
template <class Vertex_iterator,
|
||||
class Cell_iterator,
|
||||
class P_Traits,
|
||||
class SkinSurface_3>
|
||||
class Cell_iterator,
|
||||
class P_Traits,
|
||||
class SkinSurface_3>
|
||||
class Skin_surface_marching_tetrahedra_observer_3
|
||||
<Vertex_iterator, Cell_iterator,
|
||||
Polyhedron_3<P_Traits,
|
||||
Skin_surface_polyhedral_items_3<SkinSurface_3> > >
|
||||
: public Marching_tetrahedra_observer_default_3
|
||||
<Vertex_iterator, Cell_iterator,
|
||||
Polyhedron_3<P_Traits,
|
||||
Skin_surface_polyhedral_items_3<SkinSurface_3> > >
|
||||
<Vertex_iterator,
|
||||
Cell_iterator,
|
||||
Polyhedron_3<P_Traits,
|
||||
Skin_surface_polyhedral_items_3<SkinSurface_3> > >
|
||||
: public Marching_tetrahedra_observer_default_3
|
||||
<Vertex_iterator,
|
||||
Cell_iterator,
|
||||
Polyhedron_3<P_Traits,
|
||||
Skin_surface_polyhedral_items_3<SkinSurface_3> > >
|
||||
{
|
||||
public:
|
||||
typedef Polyhedron_3<P_Traits,
|
||||
Skin_surface_polyhedral_items_3<SkinSurface_3> >
|
||||
Polyhedron;
|
||||
typedef Polyhedron_3<P_Traits,
|
||||
Skin_surface_polyhedral_items_3<SkinSurface_3> > Polyhedron;
|
||||
typedef Marching_tetrahedra_observer_default_3
|
||||
<Vertex_iterator, Cell_iterator, Polyhedron> Base;
|
||||
<Vertex_iterator, Cell_iterator, Polyhedron> Base;
|
||||
|
||||
typedef Cell_iterator T_Cell_iterator;
|
||||
typedef typename Polyhedron::Vertex_handle Polyhedron_vertex_handle;
|
||||
typedef typename Polyhedron::Facet_handle Polyhedron_facet_handle;
|
||||
typedef typename Polyhedron::Vertex_handle Polyhedron_vertex_handle;
|
||||
typedef typename Polyhedron::Facet_handle Polyhedron_facet_handle;
|
||||
|
||||
Skin_surface_marching_tetrahedra_observer_3() : Base() {
|
||||
}
|
||||
Skin_surface_marching_tetrahedra_observer_3() : Base() { }
|
||||
|
||||
Skin_surface_marching_tetrahedra_observer_3(
|
||||
const Skin_surface_marching_tetrahedra_observer_3& traits2) : Base(traits2)
|
||||
{}
|
||||
|
||||
void after_facet_insertion(
|
||||
T_Cell_iterator ch,
|
||||
Polyhedron_facet_handle fh) {
|
||||
|
||||
void after_facet_insertion(T_Cell_iterator ch, Polyhedron_facet_handle fh) {
|
||||
fh->tmc_ch = ch;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@
|
|||
//
|
||||
// $URL$
|
||||
// $Id$
|
||||
//
|
||||
//
|
||||
//
|
||||
// Author(s) : Nico Kruithof <Nico@cs.rug.nl>
|
||||
|
||||
|
|
@ -23,7 +23,6 @@
|
|||
|
||||
#include <CGAL/license/Skin_surface_3.h>
|
||||
|
||||
|
||||
#include <CGAL/HalfedgeDS_face_base.h>
|
||||
#include <CGAL/Polyhedron_items_3.h>
|
||||
#include <CGAL/assertions.h>
|
||||
|
|
@ -31,23 +30,27 @@
|
|||
namespace CGAL {
|
||||
|
||||
template<class Refs, class SkinSurface3>
|
||||
struct Skin_Surface_polyhedral_face: public CGAL::HalfedgeDS_face_base<Refs> {
|
||||
struct Skin_Surface_polyhedral_face: public CGAL::HalfedgeDS_face_base<Refs>
|
||||
{
|
||||
typedef SkinSurface3 Skin_surface;
|
||||
typedef typename SkinSurface3::TMC::Cell_handle TMC_Cell_handle;
|
||||
typedef typename SkinSurface3::Simplex Simplex;
|
||||
|
||||
typename SkinSurface3::Simplex containing_simplex() {
|
||||
typename SkinSurface3::Simplex containing_simplex()
|
||||
{
|
||||
CGAL_assertion(tmc_ch != NULL);
|
||||
return tmc_ch->info().first;
|
||||
}
|
||||
|
||||
TMC_Cell_handle tmc_ch;
|
||||
};
|
||||
|
||||
template<class SkinSurface3>
|
||||
struct Skin_surface_polyhedral_items_3: public Polyhedron_items_3 {
|
||||
|
||||
struct Skin_surface_polyhedral_items_3: public Polyhedron_items_3
|
||||
{
|
||||
template<class Refs, class Traits>
|
||||
struct Face_wrapper {
|
||||
struct Face_wrapper
|
||||
{
|
||||
typedef Skin_Surface_polyhedral_face<Refs, SkinSurface3> Face;
|
||||
};
|
||||
};
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@
|
|||
//
|
||||
// $URL$
|
||||
// $Id$
|
||||
//
|
||||
//
|
||||
//
|
||||
// Author(s) : Nico Kruithof <Nico@cs.rug.nl>
|
||||
|
||||
|
|
@ -23,13 +23,13 @@
|
|||
|
||||
#include <CGAL/license/Skin_surface_3.h>
|
||||
|
||||
|
||||
#include <CGAL/Polyhedron_items_3.h>
|
||||
|
||||
namespace CGAL {
|
||||
|
||||
template <class Refs, class TriangulatedMixedComplex3>
|
||||
struct Skin_Surface_polyhedral_face : public CGAL::HalfedgeDS_face_base<Refs> {
|
||||
struct Skin_Surface_polyhedral_face : public CGAL::HalfedgeDS_face_base<Refs>
|
||||
{
|
||||
typedef typename TriangulatedMixedComplex3::Cell_handle Triang_Cell_handle;
|
||||
|
||||
Triang_Cell_handle triang_ch;
|
||||
|
|
@ -37,10 +37,11 @@ struct Skin_Surface_polyhedral_face : public CGAL::HalfedgeDS_face_base<Refs> {
|
|||
|
||||
template < class TriangulatedMixedComplex3 >
|
||||
class Skin_surface_polyhedral_items_with_face_information_3
|
||||
: public Polyhedron_items_3 {
|
||||
|
||||
: public Polyhedron_items_3
|
||||
{
|
||||
template <class Refs, class Traits>
|
||||
struct Face_wrapper {
|
||||
struct Face_wrapper
|
||||
{
|
||||
typedef Skin_Surface_polyhedral_face<Refs, TriangulatedMixedComplex3> Face;
|
||||
};
|
||||
};
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@
|
|||
//
|
||||
// $URL$
|
||||
// $Id$
|
||||
//
|
||||
//
|
||||
//
|
||||
// Author(s) : Nico Kruithof <Nico@cs.rug.nl>
|
||||
|
||||
|
|
@ -23,46 +23,48 @@
|
|||
|
||||
#include <CGAL/license/Skin_surface_3.h>
|
||||
|
||||
|
||||
#include <CGAL/Skin_surface_traits_3.h>
|
||||
|
||||
namespace CGAL {
|
||||
|
||||
template < class SkinSurfaceQuadraticSurfaceTraits_3 >
|
||||
class Skin_surface_quadratic_surface_3 {
|
||||
class Skin_surface_quadratic_surface_3
|
||||
{
|
||||
public:
|
||||
typedef SkinSurfaceQuadraticSurfaceTraits_3 K;
|
||||
typedef typename K::FT FT;
|
||||
typedef typename K::Point_3 Point;
|
||||
typedef typename K::Vector_3 Vector;
|
||||
typedef typename K::Segment_3 Segment;
|
||||
typedef typename K::Weighted_point_3 Weighted_point;
|
||||
typedef SkinSurfaceQuadraticSurfaceTraits_3 K;
|
||||
typedef typename K::FT FT;
|
||||
typedef typename K::Point_3 Point;
|
||||
typedef typename K::Vector_3 Vector;
|
||||
typedef typename K::Segment_3 Segment;
|
||||
typedef typename K::Weighted_point_3 Weighted_point;
|
||||
|
||||
Skin_surface_quadratic_surface_3()
|
||||
: dim(-1), p(0,0,0), c(0)
|
||||
: dim(-1), p(0,0,0), c(0)
|
||||
{
|
||||
for (int i=0; i<6; i++) Q[i] = 0;
|
||||
}
|
||||
|
||||
Skin_surface_quadratic_surface_3(FT Qinput[], Point p, FT c, int d)
|
||||
: dim(10+d), p(p), c(c)
|
||||
{
|
||||
for (int i=0; i<6; i++) Q[i] = Qinput[i];
|
||||
}
|
||||
int dim;
|
||||
|
||||
Skin_surface_quadratic_surface_3(Weighted_point wp0, FT s)
|
||||
: dim(0), p(wp0.point()), c(-s*(1-s)*wp0.weight())
|
||||
: dim(0), p(wp0.point()), c(-s*(1-s)*wp0.weight())
|
||||
{
|
||||
CGAL_PROFILER(std::string("Constructor : ") +
|
||||
std::string(CGAL_PRETTY_FUNCTION));
|
||||
CGAL_PROFILER(std::string("Constructor : ") +
|
||||
std::string(CGAL_PRETTY_FUNCTION));
|
||||
Q[1] = Q[3] = Q[4] = 0;
|
||||
Q[0] = Q[2] = Q[5] = (1-s);
|
||||
}
|
||||
Skin_surface_quadratic_surface_3(Weighted_point wp0,
|
||||
Weighted_point wp1,
|
||||
FT s) : dim(1)
|
||||
|
||||
Skin_surface_quadratic_surface_3(Weighted_point wp0,
|
||||
Weighted_point wp1,
|
||||
FT s) : dim(1)
|
||||
{
|
||||
CGAL_PROFILER(std::string("Constructor : ") +
|
||||
std::string(CGAL_PRETTY_FUNCTION));
|
||||
CGAL_PROFILER(std::string("Constructor : ") +
|
||||
std::string(CGAL_PRETTY_FUNCTION));
|
||||
|
||||
K k;
|
||||
p = k.construct_weighted_circumcenter_3_object()(wp0,wp1);
|
||||
|
|
@ -72,50 +74,50 @@ public:
|
|||
|
||||
FT den = t*t;
|
||||
Q[0] = (- t.x()*t.x()/den + (1-s));
|
||||
|
||||
|
||||
Q[1] = (-2*t.y()*t.x()/den);
|
||||
Q[2] = (- t.y()*t.y()/den + (1-s));
|
||||
|
||||
|
||||
Q[3] = (-2*t.z()*t.x()/den);
|
||||
Q[4] = (-2*t.z()*t.y()/den);
|
||||
Q[5] = (- t.z()*t.z()/den + (1-s));
|
||||
|
||||
}
|
||||
Skin_surface_quadratic_surface_3(Weighted_point wp0,
|
||||
Weighted_point wp1,
|
||||
Weighted_point wp2,
|
||||
FT s) : dim(2)
|
||||
|
||||
Skin_surface_quadratic_surface_3(Weighted_point wp0,
|
||||
Weighted_point wp1,
|
||||
Weighted_point wp2,
|
||||
FT s) : dim(2)
|
||||
{
|
||||
CGAL_PROFILER(std::string("Constructor : ") +
|
||||
std::string(CGAL_PRETTY_FUNCTION));
|
||||
CGAL_PROFILER(std::string("Constructor : ") +
|
||||
std::string(CGAL_PRETTY_FUNCTION));
|
||||
|
||||
K k;
|
||||
p = k.construct_weighted_circumcenter_3_object()(wp0,wp1,wp2);
|
||||
c = s*(1-s)*k.compute_squared_radius_smallest_orthogonal_sphere_3_object()(wp0,wp1,wp2);
|
||||
|
||||
|
||||
Vector t = K().construct_orthogonal_vector_3_object()(k.construct_point_3_object()(wp0),
|
||||
k.construct_point_3_object()(wp1),
|
||||
k.construct_point_3_object()(wp2));
|
||||
|
||||
FT den = t*t;
|
||||
Q[0] = -(- t.x()*t.x()/den + s);
|
||||
|
||||
|
||||
Q[1] = -(-2*t.y()*t.x()/den);
|
||||
Q[2] = -(- t.y()*t.y()/den + s);
|
||||
|
||||
|
||||
Q[3] = -(-2*t.z()*t.x()/den);
|
||||
Q[4] = -(-2*t.z()*t.y()/den);
|
||||
Q[5] = -(- t.z()*t.z()/den + s);
|
||||
|
||||
}
|
||||
Skin_surface_quadratic_surface_3(Weighted_point wp0,
|
||||
Weighted_point wp1,
|
||||
Weighted_point wp2,
|
||||
Weighted_point wp3,
|
||||
FT s) : dim(3)
|
||||
Skin_surface_quadratic_surface_3(Weighted_point wp0,
|
||||
Weighted_point wp1,
|
||||
Weighted_point wp2,
|
||||
Weighted_point wp3,
|
||||
FT s) : dim(3)
|
||||
{
|
||||
CGAL_PROFILER(std::string("Constructor : ") +
|
||||
std::string(CGAL_PRETTY_FUNCTION));
|
||||
CGAL_PROFILER(std::string("Constructor : ") +
|
||||
std::string(CGAL_PRETTY_FUNCTION));
|
||||
|
||||
K k;
|
||||
p = k.construct_weighted_circumcenter_3_object()(wp0,wp1,wp2,wp3);
|
||||
|
|
@ -125,27 +127,27 @@ public:
|
|||
}
|
||||
|
||||
template <class Input_point>
|
||||
FT value(Input_point const &x) const {
|
||||
FT value(Input_point const &x) const
|
||||
{
|
||||
typedef Cartesian_converter<typename Input_point::R, K> Converter;
|
||||
|
||||
|
||||
FT vx = Converter()(x.x()) - p.x();
|
||||
FT vy = Converter()(x.y()) - p.y();
|
||||
FT vz = Converter()(x.z()) - p.z();
|
||||
|
||||
return
|
||||
vx*(Q[0]*vx) +
|
||||
vy*(Q[1]*vx+Q[2]*vy) +
|
||||
vz*(Q[3]*vx+Q[4]*vy+Q[5]*vz) +
|
||||
c;
|
||||
return vx*(Q[0]*vx) +
|
||||
vy*(Q[1]*vx+Q[2]*vy) +
|
||||
vz*(Q[3]*vx+Q[4]*vy+Q[5]*vz) +
|
||||
c;
|
||||
}
|
||||
template <class Input_point>
|
||||
Sign sign(Input_point const &x) const {
|
||||
return CGAL_NTS sign(value(x));
|
||||
}
|
||||
|
||||
|
||||
template <class Input_point>
|
||||
typename Input_point::R::Vector_3 gradient(Input_point const &x) {
|
||||
typename Input_point::R::Vector_3 gradient(Input_point const &x)
|
||||
{
|
||||
// NGHK: We use the kernel trick again: DOCUMENT!!!!
|
||||
typedef Cartesian_converter<typename Input_point::R, K> Converter;
|
||||
typedef Cartesian_converter<K, typename Input_point::R> Inv_converter;
|
||||
|
|
@ -157,44 +159,47 @@ public:
|
|||
|
||||
/// Construct the intersection point with the segment (p0,p1)
|
||||
template <class Input_point>
|
||||
Input_point to_surface(const Input_point &p0, const Input_point &p1) {
|
||||
Input_point to_surface(const Input_point &p0, const Input_point &p1)
|
||||
{
|
||||
// NGHK: We use the kernel trick again: DOCUMENT!!!!
|
||||
typedef Cartesian_converter<typename Input_point::R, K> Converter;
|
||||
Converter conv;
|
||||
|
||||
Input_point pp0 = p0, pp1 = p1, mid;
|
||||
double sq_d = to_double(squared_distance(pp0,pp1));
|
||||
|
||||
|
||||
if (value(conv(pp1)) < value(conv(pp0))) {
|
||||
std::swap(pp0, pp1);
|
||||
}
|
||||
|
||||
|
||||
while (sq_d > 1.e-10) {
|
||||
mid = midpoint(pp0,pp1);
|
||||
if (value(conv(mid)) > 0) {
|
||||
pp1 = mid;
|
||||
pp1 = mid;
|
||||
} else {
|
||||
pp0 = mid;
|
||||
pp0 = mid;
|
||||
}
|
||||
sq_d /= 4;
|
||||
}
|
||||
return midpoint(pp0,pp1);
|
||||
}
|
||||
|
||||
private:
|
||||
//template <class Input_point>
|
||||
Vector compute_gradient(Point const &x) {
|
||||
|
||||
Vector compute_gradient(Point const &x)
|
||||
{
|
||||
FT vx = x.x() - p.x();
|
||||
FT vy = x.y() - p.y();
|
||||
FT vz = x.z() - p.z();
|
||||
|
||||
return Vector(2*Q[0]*vx + Q[1]*vy + Q[3]*vz,
|
||||
Q[1]*vx + 2*Q[2]*vy + Q[4]*vz,
|
||||
Q[3]*vx + Q[4]*vy + 2*Q[5]*vz);
|
||||
Q[1]*vx + 2*Q[2]*vy + Q[4]*vz,
|
||||
Q[3]*vx + Q[4]*vy + 2*Q[5]*vz);
|
||||
}
|
||||
|
||||
FT Q[6];
|
||||
Point p;
|
||||
|
||||
int dim;
|
||||
FT Q[6];
|
||||
Point p;
|
||||
FT c;
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@
|
|||
//
|
||||
// $URL$
|
||||
// $Id$
|
||||
//
|
||||
//
|
||||
//
|
||||
// Author(s) : Nico Kruithof <Nico@cs.rug.nl>
|
||||
|
||||
|
|
@ -23,7 +23,6 @@
|
|||
|
||||
#include <CGAL/license/Skin_surface_3.h>
|
||||
|
||||
|
||||
#include <CGAL/Cartesian.h>
|
||||
#include <CGAL/Cartesian_converter.h>
|
||||
|
||||
|
|
@ -33,7 +32,6 @@
|
|||
#include <CGAL/intersection_3_1.h>
|
||||
namespace CGAL {
|
||||
|
||||
|
||||
template <class SkinSurface_3, class Polyhedron_3>
|
||||
class Skin_surface_refinement_policy_3
|
||||
{
|
||||
|
|
@ -51,16 +49,15 @@ public:
|
|||
typedef typename P_traits::Vector_3 P_vector;
|
||||
typedef typename P_traits::Plane_3 P_plane;
|
||||
|
||||
Skin_surface_refinement_policy_3(Skin_surface const& skin) : ss_3(skin) {
|
||||
}
|
||||
|
||||
Skin_surface_refinement_policy_3(Skin_surface const& skin) : ss_3(skin) { }
|
||||
|
||||
P_point to_surface(P_vertex_handle vh) const
|
||||
{
|
||||
typename Skin_surface::Bare_point result =
|
||||
Cartesian_converter<P_traits,
|
||||
Cartesian_converter<P_traits,
|
||||
typename Skin_surface::Geometric_traits::Kernel>()(vh->point());
|
||||
ss_3.intersect_with_transversal_segment(result);
|
||||
return
|
||||
return
|
||||
Cartesian_converter
|
||||
<typename Skin_surface::Geometric_traits::Kernel, P_traits>()( result );
|
||||
}
|
||||
|
|
@ -69,25 +66,25 @@ public:
|
|||
{
|
||||
// Convert to and from the skin surface kernel
|
||||
typename Skin_surface::Bare_point p =
|
||||
Cartesian_converter<P_traits,
|
||||
typename Skin_surface::Geometric_traits::Kernel>()(vh->point());
|
||||
return Cartesian_converter<typename Skin_surface::Geometric_traits::Kernel,
|
||||
P_traits>()( ss_3.normal(p));
|
||||
Cartesian_converter<P_traits,
|
||||
typename Skin_surface::Geometric_traits::Kernel>()(vh->point());
|
||||
return Cartesian_converter<typename Skin_surface::Geometric_traits::Kernel,
|
||||
P_traits>()( ss_3.normal(p));
|
||||
}
|
||||
|
||||
protected:
|
||||
Skin_surface const &ss_3;
|
||||
const Skin_surface &ss_3;
|
||||
};
|
||||
|
||||
template <class SkinSurfaceBase_3, class P_Traits, class SkinSurface_3>
|
||||
class Skin_surface_refinement_policy_3<
|
||||
SkinSurfaceBase_3,
|
||||
Polyhedron_3<P_Traits,
|
||||
Skin_surface_polyhedral_items_3<SkinSurface_3> > >
|
||||
class Skin_surface_refinement_policy_3<SkinSurfaceBase_3,
|
||||
Polyhedron_3<P_Traits,
|
||||
Skin_surface_polyhedral_items_3<
|
||||
SkinSurface_3> > >
|
||||
{
|
||||
public:
|
||||
typedef SkinSurfaceBase_3 Skin_surface;
|
||||
typedef Polyhedron_3<P_Traits,
|
||||
typedef Polyhedron_3<P_Traits,
|
||||
Skin_surface_polyhedral_items_3<SkinSurface_3> > Polyhedron;
|
||||
typedef typename Polyhedron::Traits P_traits;
|
||||
|
||||
|
|
@ -103,30 +100,32 @@ public:
|
|||
Skin_surface_refinement_policy_3(Skin_surface const& skin) : ss_3(skin) {
|
||||
}
|
||||
|
||||
P_point to_surface(P_vertex_handle vh) const {
|
||||
P_point to_surface(P_vertex_handle vh) const
|
||||
{
|
||||
typename Skin_surface::Bare_point result =
|
||||
Cartesian_converter<P_traits,
|
||||
typename Skin_surface::Geometric_traits::Kernel>()(vh->point());
|
||||
Cartesian_converter<P_traits,
|
||||
typename Skin_surface::Geometric_traits::Kernel>()(vh->point());
|
||||
|
||||
ss_3.intersect_with_transversal_segment(result,
|
||||
vh->halfedge()->facet()->tmc_ch);
|
||||
vh->halfedge()->facet()->tmc_ch);
|
||||
|
||||
return
|
||||
Cartesian_converter
|
||||
<typename Skin_surface::Geometric_traits::Kernel, P_traits>()( result );
|
||||
return
|
||||
Cartesian_converter<typename Skin_surface::Geometric_traits::Kernel,
|
||||
P_traits>()( result );
|
||||
}
|
||||
|
||||
P_vector normal(P_vertex_handle vh) const {
|
||||
P_vector normal(P_vertex_handle vh) const
|
||||
{
|
||||
// Convert to and from the skin surface kernel
|
||||
typename Skin_surface::Bare_point p =
|
||||
Cartesian_converter<P_traits,
|
||||
Cartesian_converter<P_traits,
|
||||
typename Skin_surface::Geometric_traits::Kernel>()(vh->point());
|
||||
return
|
||||
Cartesian_converter
|
||||
<typename Skin_surface::Geometric_traits::Kernel,
|
||||
P_traits>()( ss_3.normal(p, vh->halfedge()->facet()->tmc_ch) );
|
||||
return
|
||||
Cartesian_converter<
|
||||
typename Skin_surface::Geometric_traits::Kernel,
|
||||
P_traits>()( ss_3.normal(p, vh->halfedge()->facet()->tmc_ch) );
|
||||
}
|
||||
|
||||
|
||||
protected:
|
||||
Skin_surface const &ss_3;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@
|
|||
//
|
||||
// $URL$
|
||||
// $Id$
|
||||
//
|
||||
//
|
||||
//
|
||||
// Author(s) : Nico Kruithof <Nico@cs.rug.nl>
|
||||
|
||||
|
|
@ -25,7 +25,7 @@
|
|||
|
||||
#include <CGAL/predicates/predicates_for_mixed_complex_3.h>
|
||||
|
||||
namespace CGAL {
|
||||
namespace CGAL {
|
||||
|
||||
/** Input: a list of n weighted points p_1...p_n and a query point x.
|
||||
There is a plane separating the mixed cell defined by p_1...p_n-1
|
||||
|
|
@ -35,47 +35,53 @@ namespace CGAL {
|
|||
opposite side (POSITIVE).
|
||||
**/
|
||||
template <class K>
|
||||
class Side_of_mixed_cell_3 {
|
||||
class Side_of_mixed_cell_3
|
||||
{
|
||||
public:
|
||||
typedef typename K::FT FT;
|
||||
typedef typename K::Bare_point Bare_point;
|
||||
typedef typename K::Weighted_point Weighted_point;
|
||||
|
||||
Side_of_mixed_cell_3(const FT &shrink) : s(shrink) {}
|
||||
|
||||
typedef CGAL::Sign result_type;
|
||||
|
||||
typedef CGAL::Sign result_type;
|
||||
|
||||
Side_of_mixed_cell_3(const FT &shrink) : s(shrink) { }
|
||||
|
||||
result_type operator()(const Weighted_point &p1,
|
||||
const Weighted_point &p2,
|
||||
const Bare_point &x) const {
|
||||
const Weighted_point &p2,
|
||||
const Bare_point &x) const
|
||||
{
|
||||
return side_of_mixed_cellC3(p1.x(),p1.y(),p1.z(),p1.weight(),
|
||||
p2.x(),p2.y(),p2.z(),p2.weight(),
|
||||
x.x(),x.y(),x.z(),
|
||||
s);
|
||||
p2.x(),p2.y(),p2.z(),p2.weight(),
|
||||
x.x(),x.y(),x.z(),
|
||||
s);
|
||||
}
|
||||
|
||||
result_type operator()(const Weighted_point &p1,
|
||||
const Weighted_point &p2,
|
||||
const Weighted_point &p3,
|
||||
const Bare_point &x) const {
|
||||
const Weighted_point &p2,
|
||||
const Weighted_point &p3,
|
||||
const Bare_point &x) const
|
||||
{
|
||||
return side_of_mixed_cellC3(p1.x(),p1.y(),p1.z(),p1.weight(),
|
||||
p2.x(),p2.y(),p2.z(),p2.weight(),
|
||||
p3.x(),p3.y(),p3.z(),p3.weight(),
|
||||
x.x(),x.y(),x.z(),
|
||||
s);
|
||||
p2.x(),p2.y(),p2.z(),p2.weight(),
|
||||
p3.x(),p3.y(),p3.z(),p3.weight(),
|
||||
x.x(),x.y(),x.z(),
|
||||
s);
|
||||
}
|
||||
|
||||
result_type operator()(const Weighted_point &p1,
|
||||
const Weighted_point &p2,
|
||||
const Weighted_point &p3,
|
||||
const Weighted_point &p4,
|
||||
const Bare_point &x) const {
|
||||
const Weighted_point &p2,
|
||||
const Weighted_point &p3,
|
||||
const Weighted_point &p4,
|
||||
const Bare_point &x) const
|
||||
{
|
||||
return side_of_mixed_cellC3(p1.x(),p1.y(),p1.z(),p1.weight(),
|
||||
p2.x(),p2.y(),p2.z(),p2.weight(),
|
||||
p3.x(),p3.y(),p3.z(),p3.weight(),
|
||||
p4.x(),p4.y(),p4.z(),p4.weight(),
|
||||
x.x(),x.y(),x.z(),
|
||||
s);
|
||||
p2.x(),p2.y(),p2.z(),p2.weight(),
|
||||
p3.x(),p3.y(),p3.z(),p3.weight(),
|
||||
p4.x(),p4.y(),p4.z(),p4.weight(),
|
||||
x.x(),x.y(),x.z(),
|
||||
s);
|
||||
}
|
||||
|
||||
|
||||
private:
|
||||
FT s;
|
||||
};
|
||||
|
|
@ -84,61 +90,61 @@ private:
|
|||
Computes the anchor point of a Delaunay center and a Voronoi center
|
||||
**/
|
||||
template <class K>
|
||||
class Construct_anchor_point_3 {
|
||||
class Construct_anchor_point_3
|
||||
{
|
||||
public:
|
||||
typedef typename K::FT FT;
|
||||
typedef typename K::Point_3 Bare_point;
|
||||
typedef typename K::Point_3 Bare_point;
|
||||
|
||||
typedef Bare_point result_type;
|
||||
|
||||
Construct_anchor_point_3(const FT &shrink) : s(shrink) {}
|
||||
|
||||
typedef Bare_point result_type;
|
||||
|
||||
|
||||
result_type operator()(const Bare_point &p_del,
|
||||
const Bare_point &p_vor) const {
|
||||
const Bare_point &p_vor) const
|
||||
{
|
||||
return Bare_point((1-s)*p_del.x() + s*p_vor.x(),
|
||||
(1-s)*p_del.y() + s*p_vor.y(),
|
||||
(1-s)*p_del.z() + s*p_vor.z());
|
||||
(1-s)*p_del.y() + s*p_vor.y(),
|
||||
(1-s)*p_del.z() + s*p_vor.z());
|
||||
}
|
||||
|
||||
|
||||
private:
|
||||
FT s;
|
||||
};
|
||||
|
||||
template <class K_>
|
||||
class Skin_surface_traits_base_3
|
||||
class Skin_surface_traits_base_3
|
||||
: public K_
|
||||
{
|
||||
public:
|
||||
typedef K_ Kernel;
|
||||
typedef Skin_surface_traits_base_3<Kernel> Self;
|
||||
typedef K_ Kernel;
|
||||
typedef Skin_surface_traits_base_3<Kernel> Self;
|
||||
|
||||
typedef typename Kernel::FT FT;
|
||||
typedef typename Kernel::FT FT;
|
||||
|
||||
typedef CGAL::Side_of_mixed_cell_3<Self> Side_of_mixed_cell_3;
|
||||
typedef CGAL::Construct_anchor_point_3<Self> Construct_anchor_point_3;
|
||||
|
||||
|
||||
|
||||
Skin_surface_traits_base_3() : s(-1) {
|
||||
}
|
||||
Skin_surface_traits_base_3(FT s) : s(s) {
|
||||
}
|
||||
void set_shrink(FT s_) {
|
||||
s = s_;
|
||||
typedef CGAL::Side_of_mixed_cell_3<Self> Side_of_mixed_cell_3;
|
||||
typedef CGAL::Construct_anchor_point_3<Self> Construct_anchor_point_3;
|
||||
|
||||
Skin_surface_traits_base_3() : s(-1) { }
|
||||
Skin_surface_traits_base_3(FT s) : s(s) { }
|
||||
|
||||
void set_shrink(FT s_) {
|
||||
s = s_;
|
||||
}
|
||||
|
||||
FT get_shrink() const {
|
||||
return s;
|
||||
}
|
||||
|
||||
|
||||
Side_of_mixed_cell_3
|
||||
side_of_mixed_cell_3_object() const {
|
||||
Side_of_mixed_cell_3 side_of_mixed_cell_3_object() const
|
||||
{
|
||||
CGAL_assertion((s>0) && (s<1));
|
||||
return Side_of_mixed_cell_3(get_shrink()); }
|
||||
return Side_of_mixed_cell_3(get_shrink());
|
||||
}
|
||||
|
||||
Construct_anchor_point_3
|
||||
construct_anchor_point_3_object() const
|
||||
{ return Construct_anchor_point_3(get_shrink()); }
|
||||
Construct_anchor_point_3 construct_anchor_point_3_object() const {
|
||||
return Construct_anchor_point_3(get_shrink());
|
||||
}
|
||||
|
||||
private:
|
||||
FT s;
|
||||
|
|
@ -166,24 +172,21 @@ public:
|
|||
#include <CGAL/Skin_surface_filtered_traits_3.h>
|
||||
#include <CGAL/Filtered_kernel.h>
|
||||
|
||||
|
||||
namespace CGAL {
|
||||
|
||||
// Just FK would be nicer, but VC 2005 messes it up with an "FK" in a base class when compiling degenerate_test.cpp
|
||||
template < typename Sst3FK >
|
||||
class Skin_surface_traits_3 < Sst3FK,true >
|
||||
class Skin_surface_traits_3 < Sst3FK, true >
|
||||
: public Skin_surface_filtered_traits_3 < Sst3FK >
|
||||
{
|
||||
typedef Skin_surface_filtered_traits_3 < Sst3FK > Base;
|
||||
|
||||
public:
|
||||
typedef Sst3FK Kernel;
|
||||
|
||||
|
||||
Skin_surface_traits_3() {}
|
||||
Skin_surface_traits_3(typename Base::FT s) : Base(s) {}
|
||||
|
||||
Skin_surface_traits_3(typename Base::FT s) : Base(s) { }
|
||||
};
|
||||
|
||||
|
||||
|
||||
} //namespace CGAL
|
||||
#endif // CGAL_SKIN_SURFACE_TRAITS_3_H
|
||||
|
|
|
|||
|
|
@ -23,7 +23,6 @@
|
|||
|
||||
#include <CGAL/license/Skin_surface_3.h>
|
||||
|
||||
|
||||
#include <CGAL/Skin_surface_quadratic_surface_3.h>
|
||||
#include <CGAL/Triangulation_simplex_3.h>
|
||||
|
||||
|
|
@ -40,9 +39,9 @@ struct SS_Dereference_type<T *> {
|
|||
typedef T value_type;
|
||||
};
|
||||
|
||||
template <class TriangulatedMixedComplex_3,
|
||||
class SkinSurface_3>
|
||||
class Triangulated_mixed_complex_observer_3 {
|
||||
template <class TriangulatedMixedComplex_3, class SkinSurface_3>
|
||||
class Triangulated_mixed_complex_observer_3
|
||||
{
|
||||
public:
|
||||
typedef SkinSurface_3 Skin_surface;
|
||||
typedef TriangulatedMixedComplex_3 Triangulated_mixed_complex;
|
||||
|
|
@ -50,9 +49,9 @@ public:
|
|||
typedef typename SkinSurface_3::Regular Regular;
|
||||
typedef typename Regular::Geom_traits Regular_traits;
|
||||
typedef typename Triangulated_mixed_complex::Geom_traits
|
||||
Triangulated_mixed_complex_traits;
|
||||
Triangulated_mixed_complex_traits;
|
||||
typedef typename Triangulated_mixed_complex::Triangulation_data_structure
|
||||
TMC_TDS;
|
||||
TMC_TDS;
|
||||
typedef typename SkinSurface_3::Quadratic_surface Quadratic_surface;
|
||||
|
||||
typedef typename Regular_traits::FT FT;
|
||||
|
|
@ -77,7 +76,7 @@ public:
|
|||
typedef typename Quadratic_surface::Vector Surface_vector;
|
||||
typedef typename Surface_traits::Weighted_point_3 Surface_weighted_point;
|
||||
|
||||
typedef
|
||||
typedef
|
||||
Cartesian_converter < typename Rt_Bare_point::R,
|
||||
typename Quadratic_surface::K > R2S_converter;
|
||||
Triangulated_mixed_complex_observer_3(FT shrink) :
|
||||
|
|
@ -89,7 +88,8 @@ public:
|
|||
vh->info() = typename SkinSurface_3::Vertex_info(sDel, sVor);
|
||||
}
|
||||
|
||||
void after_cell_insertion(Rt_Simplex const &s, TMC_Cell_handle &ch) {
|
||||
void after_cell_insertion(Rt_Simplex const &s, TMC_Cell_handle &ch)
|
||||
{
|
||||
if (!(s == prev_s)) {
|
||||
prev_s = s;
|
||||
Rt_Vertex_handle vh;
|
||||
|
|
@ -103,8 +103,8 @@ public:
|
|||
case 0: {
|
||||
vh = s;
|
||||
Surface_weighted_point wp = r2s_converter(vh->point());
|
||||
create_sphere(wp.point(),
|
||||
-wp.weight(),
|
||||
create_sphere(wp.point(),
|
||||
-wp.weight(),
|
||||
r2s_converter(shrink), 1);
|
||||
break;
|
||||
}
|
||||
|
|
@ -147,7 +147,7 @@ public:
|
|||
}
|
||||
case 3: {
|
||||
ch = s;
|
||||
const Surface_weighted_point pts[4] =
|
||||
const Surface_weighted_point pts[4] =
|
||||
{
|
||||
r2s_converter(ch->vertex(0)->point()),
|
||||
r2s_converter(ch->vertex(1)->point()),
|
||||
|
|
@ -180,7 +180,8 @@ public:
|
|||
void create_sphere(const Surface_point &c,
|
||||
const Surface_RT &w,
|
||||
const Surface_RT &s,
|
||||
const int orient) {
|
||||
const int orient)
|
||||
{
|
||||
if (s == 1) {
|
||||
// Dont multiply by (1-s) as this will zero the equation
|
||||
Q[1] = Q[3] = Q[4] = 0;
|
||||
|
|
@ -188,7 +189,7 @@ public:
|
|||
|
||||
surf = boost::shared_ptr<Quadratic_surface>(new Quadratic_surface(Q, c, s*w, (orient==1? 0 : 3)));
|
||||
} else {
|
||||
// Multiply with 1-s to make the function defining the
|
||||
// Multiply with 1-s to make the function defining the
|
||||
// skin surface implicitly continuous
|
||||
Q[1] = Q[3] = Q[4] = 0;
|
||||
Q[0] = Q[2] = Q[5] = orient*(1-s);
|
||||
|
|
@ -201,7 +202,8 @@ public:
|
|||
const Surface_RT &w,
|
||||
const Surface_vector &t,
|
||||
const Surface_RT &s,
|
||||
const int orient) {
|
||||
const int orient)
|
||||
{
|
||||
Surface_RT den = t*t;
|
||||
|
||||
Q[0] = orient*(- t.x()*t.x()/den + (1-s));
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@
|
|||
//
|
||||
// $URL$
|
||||
// $Id$
|
||||
//
|
||||
//
|
||||
//
|
||||
// Author(s) : Nico Kruithof <Nico@cs.rug.nl>
|
||||
|
||||
|
|
@ -23,7 +23,6 @@
|
|||
|
||||
#include <CGAL/license/Skin_surface_3.h>
|
||||
|
||||
|
||||
#include <CGAL/basic.h>
|
||||
#include <CGAL/Triangulation_data_structure_3.h>
|
||||
#include <CGAL/array.h>
|
||||
|
|
@ -34,7 +33,8 @@
|
|||
namespace CGAL {
|
||||
|
||||
template < class Triangulation_3 >
|
||||
class Triangulation_incremental_builder_3 {
|
||||
class Triangulation_incremental_builder_3
|
||||
{
|
||||
public:
|
||||
typedef Triangulation_3 T;
|
||||
typedef typename T::Vertex_handle Vertex_handle;
|
||||
|
|
@ -48,37 +48,40 @@ public:
|
|||
|
||||
~Triangulation_incremental_builder_3() {}
|
||||
|
||||
void begin_triangulation(int dim) {
|
||||
void begin_triangulation(int dim)
|
||||
{
|
||||
t.clear();
|
||||
t.tds().delete_cell(t.infinite_vertex()->cell());
|
||||
// t.infinite = add_vertex();
|
||||
t.tds().set_dimension(dim);
|
||||
t.tds().set_dimension(dim);
|
||||
}
|
||||
|
||||
void end_triangulation() {
|
||||
void end_triangulation()
|
||||
{
|
||||
construct_infinite_cells();
|
||||
CGAL_assertion(t.infinite_vertex()->cell() != Cell_handle());
|
||||
}
|
||||
|
||||
Vertex_handle add_vertex();
|
||||
Cell_handle add_cell(Vertex_handle vh0, Vertex_handle vh1,
|
||||
Vertex_handle vh2, Vertex_handle vh3);
|
||||
|
||||
Vertex_handle vh2, Vertex_handle vh3);
|
||||
|
||||
private:
|
||||
void construct_infinite_cells();
|
||||
Cell_handle add_infinite_cell(Cell_handle ch, int i);
|
||||
|
||||
|
||||
void glue_cells(Cell_handle ch0, int ind0, Cell_handle ch1, int ind1);
|
||||
|
||||
// Interior facets of the simplical cell:
|
||||
typedef std::pair < Vertex_handle, Vertex_handle > Vpair;
|
||||
typedef std::map < Vpair, Facet > MapPair;
|
||||
typedef typename MapPair::iterator MapPairIt;
|
||||
typedef cpp11::array < Vertex_handle, 3 > Vtriple;
|
||||
typedef std::map < Vtriple, Facet > MapTriple;
|
||||
typedef typename MapTriple::iterator MapTripleIt;
|
||||
|
||||
Vtriple facet(Vertex_handle vh1, Vertex_handle vh2, Vertex_handle vh3) {
|
||||
typedef std::pair < Vertex_handle, Vertex_handle > Vpair;
|
||||
typedef std::map < Vpair, Facet > MapPair;
|
||||
typedef typename MapPair::iterator MapPairIt;
|
||||
typedef cpp11::array < Vertex_handle, 3 > Vtriple;
|
||||
typedef std::map < Vtriple, Facet > MapTriple;
|
||||
typedef typename MapTriple::iterator MapTripleIt;
|
||||
|
||||
Vtriple facet(Vertex_handle vh1, Vertex_handle vh2, Vertex_handle vh3)
|
||||
{
|
||||
if (vh1 < vh2) {
|
||||
if (vh2 < vh3) {
|
||||
return CGAL::make_array(vh1,vh2,vh3);
|
||||
|
|
@ -100,15 +103,13 @@ private:
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
MapTriple facets;
|
||||
|
||||
T &t;
|
||||
bool m_verbose;
|
||||
};
|
||||
|
||||
|
||||
|
||||
template < class TDS_>
|
||||
typename Triangulation_incremental_builder_3< TDS_ >::Vertex_handle
|
||||
Triangulation_incremental_builder_3< TDS_ >::add_vertex() {
|
||||
|
|
@ -118,23 +119,22 @@ Triangulation_incremental_builder_3< TDS_ >::add_vertex() {
|
|||
template < class TDS_>
|
||||
typename Triangulation_incremental_builder_3< TDS_ >::Cell_handle
|
||||
Triangulation_incremental_builder_3< TDS_ >::add_cell(
|
||||
Vertex_handle vh0, Vertex_handle vh1, Vertex_handle vh2, Vertex_handle vh3)
|
||||
Vertex_handle vh0, Vertex_handle vh1, Vertex_handle vh2, Vertex_handle vh3)
|
||||
{
|
||||
CGAL_assertion(vh0 != NULL); CGAL_assertion(vh1 != NULL);
|
||||
CGAL_assertion(vh2 != NULL); CGAL_assertion(vh3 != NULL);
|
||||
CGAL_assertion(vh0 != vh1); CGAL_assertion(vh0 != vh2); CGAL_assertion(vh0 != vh3);
|
||||
CGAL_assertion(vh1 != vh2); CGAL_assertion(vh1 != vh3); CGAL_assertion(vh2 != vh3);
|
||||
|
||||
|
||||
Cell_handle ch = t.tds().create_cell(vh0, vh1, vh2, vh3);
|
||||
// Neighbors are by default set to NULL
|
||||
vh0->set_cell(ch); vh1->set_cell(ch);
|
||||
vh2->set_cell(ch); vh3->set_cell(ch);
|
||||
|
||||
for (int i=0; i<4; i++) {
|
||||
Vtriple vtriple=facet(
|
||||
ch->vertex((i+1)&3),
|
||||
ch->vertex((i+2)&3),
|
||||
ch->vertex((i+3)&3));
|
||||
Vtriple vtriple=facet(ch->vertex((i+1)&3),
|
||||
ch->vertex((i+2)&3),
|
||||
ch->vertex((i+3)&3));
|
||||
|
||||
std::pair<MapTripleIt,bool> res = facets.insert(std::make_pair(vtriple, Facet(ch, i)));
|
||||
if (! res.second) { // we found an element with this key
|
||||
|
|
@ -155,7 +155,7 @@ Triangulation_incremental_builder_3< TDS_ >::add_cell(
|
|||
template < class TDS_>
|
||||
typename Triangulation_incremental_builder_3< TDS_ >::Cell_handle
|
||||
Triangulation_incremental_builder_3< TDS_ >::add_infinite_cell(
|
||||
Cell_handle ch0, int i)
|
||||
Cell_handle ch0, int i)
|
||||
{
|
||||
CGAL_assertion(ch0->neighbor(i) == NULL);
|
||||
Vertex_handle vh[4];
|
||||
|
|
@ -200,12 +200,13 @@ Triangulation_incremental_builder_3< TDS_ >::glue_cells(
|
|||
// Adds infinite cells to the facets on the convex hull
|
||||
template < class TDS_>
|
||||
void
|
||||
Triangulation_incremental_builder_3< TDS_ >::construct_infinite_cells() {
|
||||
Triangulation_incremental_builder_3< TDS_ >::construct_infinite_cells()
|
||||
{
|
||||
MapTripleIt ch_facet_it;
|
||||
MapPair ch_edges;
|
||||
MapPairIt ch_edge_it;
|
||||
Vertex_handle vh1, vh2;
|
||||
|
||||
|
||||
for (ch_facet_it = facets.begin();
|
||||
ch_facet_it != facets.end();
|
||||
ch_facet_it ++) {
|
||||
|
|
@ -216,29 +217,29 @@ Triangulation_incremental_builder_3< TDS_ >::construct_infinite_cells() {
|
|||
// Index of ch1 is also ind0
|
||||
CGAL_assertion(ch0->neighbor(ind0) != NULL);
|
||||
CGAL_assertion(ch1->neighbor(ind0) != NULL);
|
||||
|
||||
|
||||
for (int i=1; i<4; i++) {
|
||||
int i1 = (i==1?2:1);
|
||||
int i2 = (i==3?2:3);
|
||||
if (ch1->vertex((ind0+i1)&3) < ch1->vertex((ind0+i2)&3)) {
|
||||
vh1 = ch1->vertex((ind0+i1)&3);
|
||||
vh2 = ch1->vertex((ind0+i2)&3);
|
||||
vh1 = ch1->vertex((ind0+i1)&3);
|
||||
vh2 = ch1->vertex((ind0+i2)&3);
|
||||
} else {
|
||||
vh1 = ch1->vertex((ind0+i2)&3);
|
||||
vh2 = ch1->vertex((ind0+i1)&3);
|
||||
vh1 = ch1->vertex((ind0+i2)&3);
|
||||
vh2 = ch1->vertex((ind0+i1)&3);
|
||||
}
|
||||
ch_edge_it = ch_edges.find(Vpair(vh1,vh2));
|
||||
if (ch_edge_it != ch_edges.end()) {
|
||||
Facet f_opp = (*ch_edge_it).second;
|
||||
glue_cells(f_opp.first, f_opp.second, ch1, (ind0+i)&3);
|
||||
ch_edges.erase(ch_edge_it);
|
||||
CGAL_assertion(f_opp.first->neighbor(f_opp.second) != NULL);
|
||||
CGAL_assertion(ch1->neighbor((ind0+i)&3) != NULL);
|
||||
Facet f_opp = (*ch_edge_it).second;
|
||||
glue_cells(f_opp.first, f_opp.second, ch1, (ind0+i)&3);
|
||||
ch_edges.erase(ch_edge_it);
|
||||
CGAL_assertion(f_opp.first->neighbor(f_opp.second) != NULL);
|
||||
CGAL_assertion(ch1->neighbor((ind0+i)&3) != NULL);
|
||||
} else {
|
||||
ch_edges[Vpair(vh1,vh2)] = Facet(ch1, (ind0+i)&3);
|
||||
CGAL_assertion(ch1->neighbor((ind0+i)&3) == NULL);
|
||||
ch_edges[Vpair(vh1,vh2)] = Facet(ch1, (ind0+i)&3);
|
||||
CGAL_assertion(ch1->neighbor((ind0+i)&3) == NULL);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
CGAL_assertion(ch_edges.empty());
|
||||
}
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@
|
|||
//
|
||||
// $URL$
|
||||
// $Id$
|
||||
//
|
||||
//
|
||||
//
|
||||
// Author(s) : Nico Kruithof <Nico@cs.rug.nl>
|
||||
|
||||
|
|
@ -27,13 +27,16 @@
|
|||
#include <CGAL/Skin_surface_base_3.h>
|
||||
#include <CGAL/triangulate_power_diagram_3.h>
|
||||
|
||||
namespace CGAL {
|
||||
namespace CGAL {
|
||||
|
||||
template <class MixedComplexTraits_3>
|
||||
class Union_of_balls_3
|
||||
: public Skin_surface_base_3<MixedComplexTraits_3>
|
||||
{
|
||||
typedef MixedComplexTraits_3 Gt;
|
||||
typedef Union_of_balls_3<Gt> Self;
|
||||
typedef Skin_surface_base_3<Gt> Base;
|
||||
|
||||
template <class MixedComplexTraits_3>
|
||||
class Union_of_balls_3 : public Skin_surface_base_3<MixedComplexTraits_3> {
|
||||
typedef MixedComplexTraits_3 Gt;
|
||||
typedef Union_of_balls_3<Gt> Self;
|
||||
typedef Skin_surface_base_3<Gt> Base;
|
||||
public:
|
||||
typedef MixedComplexTraits_3 Geometric_traits;
|
||||
|
||||
|
|
@ -69,12 +72,12 @@ private:
|
|||
using Base::geometric_traits;
|
||||
using Base::regular;
|
||||
using Base::triangulated_mixed_complex;
|
||||
|
||||
public:
|
||||
template < class WP_iterator >
|
||||
Union_of_balls_3(WP_iterator begin, WP_iterator end,
|
||||
Gt gt_ = Gt(),
|
||||
bool _verbose = false
|
||||
);
|
||||
Union_of_balls_3(WP_iterator begin, WP_iterator end,
|
||||
Gt gt_ = Gt(),
|
||||
bool _verbose = false);
|
||||
|
||||
template <class Polyhedron_3>
|
||||
void mesh_skin_surface_3(Polyhedron_3 &p) const {
|
||||
|
|
@ -86,14 +89,14 @@ public:
|
|||
}
|
||||
};
|
||||
|
||||
template <class MixedComplexTraits_3>
|
||||
template <class MixedComplexTraits_3>
|
||||
template < class WP_iterator >
|
||||
Union_of_balls_3<MixedComplexTraits_3>::
|
||||
Union_of_balls_3(WP_iterator begin, WP_iterator end,
|
||||
Union_of_balls_3(WP_iterator begin, WP_iterator end,
|
||||
Gt gt_,
|
||||
bool _verbose)
|
||||
: Base(begin, end, 1, false, gt_, _verbose) {
|
||||
|
||||
bool _verbose)
|
||||
: Base(begin, end, 1, false, gt_, _verbose)
|
||||
{
|
||||
// Construct the Triangulated_mixed_complex:
|
||||
Triangulated_mixed_complex_observer_3<TMC, Self> observer(shrink_factor());
|
||||
triangulate_power_diagram_3(regular(), triangulated_mixed_complex(), observer, _verbose);
|
||||
|
|
@ -102,7 +105,7 @@ Union_of_balls_3(WP_iterator begin, WP_iterator end,
|
|||
// { // NGHK: debug code:
|
||||
// CGAL_assertion(triangulated_mixed_complex().is_valid());
|
||||
// std::vector<TMC_Vertex_handle> ch_vertices;
|
||||
// triangulated_mixed_complex().incident_vertices(triangulated_mixed_complex().infinite_vertex(),
|
||||
// triangulated_mixed_complex().incident_vertices(triangulated_mixed_complex().infinite_vertex(),
|
||||
// std::back_inserter(ch_vertices));
|
||||
// for (typename std::vector<TMC_Vertex_handle>::iterator
|
||||
// vit = ch_vertices.begin(); vit != ch_vertices.end(); vit++) {
|
||||
|
|
@ -110,7 +113,6 @@ Union_of_balls_3(WP_iterator begin, WP_iterator end,
|
|||
// }
|
||||
// }
|
||||
}
|
||||
|
||||
|
||||
} //namespace CGAL
|
||||
|
||||
|
|
|
|||
|
|
@ -36,21 +36,20 @@ namespace CGAL {
|
|||
template <class WP_iterator,
|
||||
class Polyhedron_3>
|
||||
void make_skin_surface_mesh_3(Polyhedron_3 &p,
|
||||
WP_iterator begin, WP_iterator end,
|
||||
double shrink_factor=.5,
|
||||
int nSubdivisions=0,
|
||||
bool grow_balls=true)
|
||||
WP_iterator begin, WP_iterator end,
|
||||
double shrink_factor=.5,
|
||||
int nSubdivisions=0,
|
||||
bool grow_balls=true)
|
||||
{
|
||||
if (shrink_factor == 1) {
|
||||
make_union_of_balls_mesh_3(p,begin,end,nSubdivisions);
|
||||
}
|
||||
|
||||
|
||||
typedef typename WP_iterator::value_type Weighted_point;
|
||||
typedef typename WP_iterator::value_type Weighted_point;
|
||||
typedef typename Kernel_traits<Weighted_point>::Kernel K;
|
||||
|
||||
typedef Skin_surface_traits_3<K> Traits;
|
||||
typedef Skin_surface_3<Traits> Skin_surface;
|
||||
typedef Skin_surface_traits_3<K> Traits;
|
||||
typedef Skin_surface_3<Traits> Skin_surface;
|
||||
|
||||
Skin_surface skin_surface(begin, end, shrink_factor, grow_balls);
|
||||
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@
|
|||
//
|
||||
// $URL$
|
||||
// $Id$
|
||||
//
|
||||
//
|
||||
//
|
||||
// Author(s) : Nico Kruithof <Nico@cs.rug.nl>
|
||||
|
||||
|
|
@ -23,7 +23,6 @@
|
|||
|
||||
#include <CGAL/license/Skin_surface_3.h>
|
||||
|
||||
|
||||
#include <CGAL/Skin_surface_traits_3.h>
|
||||
#include <CGAL/Union_of_balls_3.h>
|
||||
#include <CGAL/mesh_union_of_balls_3.h>
|
||||
|
|
@ -33,18 +32,17 @@
|
|||
|
||||
namespace CGAL {
|
||||
|
||||
template <class WP_iterator,
|
||||
class Polyhedron_3>
|
||||
void make_union_of_balls_mesh_3(Polyhedron_3 &p,
|
||||
WP_iterator begin, WP_iterator end,
|
||||
int nSubdivisions=0)
|
||||
template <class WP_iterator, class Polyhedron_3>
|
||||
void make_union_of_balls_mesh_3(Polyhedron_3 &p,
|
||||
WP_iterator begin, WP_iterator end,
|
||||
int nSubdivisions=0)
|
||||
{
|
||||
typedef typename WP_iterator::value_type Weighted_point;
|
||||
typedef typename Kernel_traits<Weighted_point>::Kernel K;
|
||||
typedef typename WP_iterator::value_type Weighted_point;
|
||||
typedef typename Kernel_traits<Weighted_point>::Kernel K;
|
||||
|
||||
typedef Skin_surface_traits_3<K> Traits;
|
||||
typedef Union_of_balls_3<Traits> Union_of_balls;
|
||||
|
||||
typedef Skin_surface_traits_3<K> Traits;
|
||||
typedef Union_of_balls_3<Traits> Union_of_balls;
|
||||
|
||||
Union_of_balls union_of_balls(begin, end);
|
||||
|
||||
CGAL::mesh_union_of_balls_3(union_of_balls, p);
|
||||
|
|
@ -52,8 +50,6 @@ void make_union_of_balls_mesh_3(Polyhedron_3 &p,
|
|||
CGAL::subdivide_union_of_balls_mesh_3(union_of_balls, p, nSubdivisions);
|
||||
}
|
||||
|
||||
|
||||
|
||||
} //namespace CGAL
|
||||
|
||||
#endif // CGAL_MAKE_UNION_OF_BALLS_MESH_3_H
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@
|
|||
//
|
||||
// $URL$
|
||||
// $Id$
|
||||
//
|
||||
//
|
||||
//
|
||||
// Author(s) : Nico Kruithof <Nico@cs.rug.nl>
|
||||
|
||||
|
|
@ -23,7 +23,6 @@
|
|||
|
||||
#include <CGAL/license/Skin_surface_3.h>
|
||||
|
||||
|
||||
#include <CGAL/Cartesian_converter.h>
|
||||
#include <CGAL/marching_tetrahedra_3.h>
|
||||
#include <CGAL/Marching_tetrahedra_traits_skin_surface_3.h>
|
||||
|
|
@ -42,7 +41,7 @@ void mesh_skin_surface_3(SkinSurface_3 const &skin_surface, Polyhedron &p)
|
|||
//
|
||||
//template <class SkinSurface_3, class P_Traits>
|
||||
//void mesh_skin_surface_3
|
||||
//(SkinSurface_3 const &skin_surface,
|
||||
//(SkinSurface_3 const &skin_surface,
|
||||
// Polyhedron_3<P_Traits, Skin_surface_polyhedral_items_3<SkinSurface_3> > &p)
|
||||
//{
|
||||
// std::cout << "B" << std::endl;
|
||||
|
|
@ -50,7 +49,6 @@ void mesh_skin_surface_3(SkinSurface_3 const &skin_surface, Polyhedron &p)
|
|||
//}
|
||||
//
|
||||
|
||||
|
||||
} //namespace CGAL
|
||||
|
||||
#endif // CGAL_MESH_SKIN_SURFACE_3_H
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@
|
|||
//
|
||||
// $URL$
|
||||
// $Id$
|
||||
//
|
||||
//
|
||||
//
|
||||
// Author(s) : Nico Kruithof <Nico@cs.rug.nl>
|
||||
|
||||
|
|
@ -23,7 +23,6 @@
|
|||
|
||||
#include <CGAL/license/Skin_surface_3.h>
|
||||
|
||||
|
||||
#include <CGAL/mesh_skin_surface_3.h>
|
||||
|
||||
namespace CGAL {
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@
|
|||
//
|
||||
// $URL$
|
||||
// $Id$
|
||||
//
|
||||
//
|
||||
//
|
||||
// Author(s) : Nico Kruithof <Nico@cs.rug.nl>
|
||||
|
||||
|
|
@ -23,35 +23,34 @@
|
|||
|
||||
#include <CGAL/license/Skin_surface_3.h>
|
||||
|
||||
|
||||
#include <CGAL/Skin_surface_refinement_policy_3.h>
|
||||
#include <CGAL/Polyhedron_3.h>
|
||||
|
||||
namespace CGAL {
|
||||
|
||||
// This code is based on the Polyhedron tutorial
|
||||
// This code is based on the Polyhedron tutorial
|
||||
|
||||
template <class SkinSurface_3,
|
||||
class Polyhedron_3,
|
||||
class SubdivisionPolicy_3>
|
||||
class Polyhedron_3,
|
||||
class SubdivisionPolicy_3>
|
||||
class Skin_surface_sqrt3
|
||||
{
|
||||
typedef Polyhedron_3 Polyhedron;
|
||||
typedef SkinSurface_3 Skin_surface_3;
|
||||
// Projects points to the skin surface:
|
||||
typedef SubdivisionPolicy_3 Subdivision_policy;
|
||||
|
||||
|
||||
typedef typename Polyhedron::Traits Kernel;
|
||||
typedef typename Kernel::Point_3 Point;
|
||||
typedef typename Kernel::Vector_3 Vector;
|
||||
|
||||
|
||||
typedef typename Polyhedron::Vertex Vertex;
|
||||
typedef typename Polyhedron::Vertex_handle Vertex_handle;
|
||||
typedef typename Polyhedron::Vertex_iterator Vertex_iterator;
|
||||
typedef typename Polyhedron::Edge_iterator Edge_iterator;
|
||||
typedef typename Polyhedron::Halfedge_handle Halfedge_handle;
|
||||
typedef typename Polyhedron::Halfedge_iterator Halfedge_iterator;
|
||||
typedef typename Polyhedron::Halfedge_around_vertex_const_circulator
|
||||
typedef typename Polyhedron::Halfedge_around_vertex_const_circulator
|
||||
HV_circulator;
|
||||
typedef typename Polyhedron::Halfedge_around_facet_circulator
|
||||
HF_circulator;
|
||||
|
|
@ -61,10 +60,10 @@ class Skin_surface_sqrt3
|
|||
typedef typename Kernel::FT FT;
|
||||
|
||||
public:
|
||||
Skin_surface_sqrt3(const SkinSurface_3 &skin,
|
||||
Polyhedron &P,
|
||||
const SubdivisionPolicy_3 &policy)
|
||||
: P(P), ss(skin), policy(policy) {}
|
||||
Skin_surface_sqrt3(const SkinSurface_3 &skin,
|
||||
Polyhedron &P,
|
||||
const SubdivisionPolicy_3 &policy)
|
||||
: P(P), ss(skin), policy(policy) { }
|
||||
|
||||
//*********************************************
|
||||
// Subdivision
|
||||
|
|
@ -86,13 +85,12 @@ public:
|
|||
}
|
||||
|
||||
private:
|
||||
|
||||
|
||||
//*********************************************
|
||||
// Subdivide
|
||||
//*********************************************
|
||||
void do_subdivide()
|
||||
{
|
||||
|
||||
// We use that new vertices/halfedges/facets are appended at the end.
|
||||
Vertex_iterator last_v = P.vertices_end();
|
||||
-- last_v; // the last of the old vertices
|
||||
|
|
@ -107,7 +105,6 @@ private:
|
|||
split_halfedge(e);
|
||||
} while ( e++ != last_e);
|
||||
|
||||
|
||||
Vertex_iterator v = P.vertices_begin();
|
||||
do {
|
||||
Halfedge_handle h_cir, h_start;
|
||||
|
|
@ -145,10 +142,9 @@ private:
|
|||
};
|
||||
|
||||
template <class SkinSurface_3, class Polyhedron_3>
|
||||
void subdivide_skin_surface_mesh_3(
|
||||
const SkinSurface_3 &skin,
|
||||
Polyhedron_3 &p,
|
||||
int nSubdiv = 1) {
|
||||
void subdivide_skin_surface_mesh_3(const SkinSurface_3 &skin,
|
||||
Polyhedron_3 &p,
|
||||
int nSubdiv = 1) {
|
||||
while (nSubdiv > 0) {
|
||||
skin.subdivide_mesh_3(p);
|
||||
nSubdiv--;
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@
|
|||
//
|
||||
// $URL$
|
||||
// $Id$
|
||||
//
|
||||
//
|
||||
//
|
||||
// Author(s) : Nico Kruithof <Nico@cs.rug.nl>
|
||||
|
||||
|
|
@ -23,17 +23,16 @@
|
|||
|
||||
#include <CGAL/license/Skin_surface_3.h>
|
||||
|
||||
|
||||
#include <CGAL/Skin_surface_refinement_policy_3.h>
|
||||
#include <CGAL/Polyhedron_3.h>
|
||||
|
||||
namespace CGAL {
|
||||
|
||||
template <class UnionOfBalls_3, class Polyhedron_3>
|
||||
void subdivide_union_of_balls_mesh_3(
|
||||
const UnionOfBalls_3 &skin,
|
||||
Polyhedron_3 &p,
|
||||
int nSubdiv = 1) {
|
||||
void subdivide_union_of_balls_mesh_3(const UnionOfBalls_3 &skin,
|
||||
Polyhedron_3 &p,
|
||||
int nSubdiv = 1)
|
||||
{
|
||||
while (nSubdiv > 0) {
|
||||
skin.subdivide_mesh_3(p);
|
||||
nSubdiv--;
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load Diff
|
|
@ -14,7 +14,7 @@
|
|||
//
|
||||
// $URL$
|
||||
// $Id$
|
||||
//
|
||||
//
|
||||
//
|
||||
// Author(s) : Nico Kruithof <Nico@cs.rug.nl>
|
||||
|
||||
|
|
@ -36,36 +36,35 @@
|
|||
|
||||
namespace CGAL {
|
||||
|
||||
|
||||
template <
|
||||
template <
|
||||
class RegularTriangulation_3,
|
||||
class TriangulatedMixedComplex_3,
|
||||
class TriangulatedMixedComplexObserver_3 =
|
||||
Triangulated_mixed_complex_observer_3<TriangulatedMixedComplex_3,
|
||||
RegularTriangulation_3> >
|
||||
class Power_diagram_triangulator_3 {
|
||||
Triangulated_mixed_complex_observer_3<TriangulatedMixedComplex_3,
|
||||
RegularTriangulation_3> >
|
||||
class Power_diagram_triangulator_3
|
||||
{
|
||||
public:
|
||||
typedef typename RegularTriangulation_3::Geom_traits
|
||||
Regular_traits;
|
||||
typedef typename TriangulatedMixedComplex_3::Geom_traits
|
||||
Triangulated_mixed_complex_traits;
|
||||
typedef typename RegularTriangulation_3::Geom_traits Regular_traits;
|
||||
typedef typename TriangulatedMixedComplex_3::Geom_traits Triangulated_mixed_complex_traits;
|
||||
|
||||
typedef RegularTriangulation_3 Regular;
|
||||
typedef TriangulatedMixedComplex_3 Triangulated_mixed_complex;
|
||||
typedef RegularTriangulation_3 Regular;
|
||||
typedef TriangulatedMixedComplex_3 Triangulated_mixed_complex;
|
||||
typedef TriangulatedMixedComplexObserver_3
|
||||
Triangulated_mixed_complex_observer;
|
||||
|
||||
private:
|
||||
typedef typename Regular::Vertex_handle Rt_Vertex_handle;
|
||||
typedef typename Regular::Edge Rt_Edge;
|
||||
typedef typename Regular::Facet Rt_Facet;
|
||||
typedef typename Regular::Cell_handle Rt_Cell_handle;
|
||||
|
||||
|
||||
typedef typename Regular::Finite_vertices_iterator Rt_Finite_vertices_iterator;
|
||||
typedef typename Regular::Finite_edges_iterator Rt_Finite_edges_iterator;
|
||||
typedef typename Regular::Finite_facets_iterator Rt_Finite_facets_iterator;
|
||||
typedef typename Regular::All_cells_iterator Rt_All_cells_iterator;
|
||||
typedef typename Regular::Finite_cells_iterator Rt_Finite_cells_iterator;
|
||||
|
||||
|
||||
typedef typename Regular::Cell_circulator Rt_Cell_circulator;
|
||||
|
||||
typedef Triangulation_simplex_3<Regular> Rt_Simplex;
|
||||
|
|
@ -90,13 +89,13 @@ private:
|
|||
Tmc_Finite_cells_iterator;
|
||||
typedef typename Triangulated_mixed_complex::Cell_circulator
|
||||
Tmc_Cell_circulator;
|
||||
|
||||
|
||||
typedef typename TriangulatedMixedComplex_3::Geom_traits Tmc_traits;
|
||||
typedef typename Tmc_traits::Point_3 Tmc_Point;
|
||||
typedef typename Tmc_traits::RT Tmc_RT;
|
||||
|
||||
typedef Triangulation_incremental_builder_3<Triangulated_mixed_complex>
|
||||
Triangulation_incremental_builder;
|
||||
Triangulation_incremental_builder;
|
||||
|
||||
typedef Compute_anchor_3<Regular> Compute_anchor;
|
||||
typedef std::pair<Rt_Simplex,Rt_Simplex> Symb_anchor;
|
||||
|
|
@ -105,48 +104,47 @@ private:
|
|||
// struct Anchor_map_iterator_tmp;
|
||||
// typedef std::map<Rt_Simplex, Anchor_map_iterator_tmp> Anchor_map;
|
||||
// struct Anchor_map_iterator_tmp : Anchor_map::iterator {
|
||||
// Anchor_map_iterator_tmp()
|
||||
// Anchor_map_iterator_tmp()
|
||||
// : Anchor_map::iterator() {}
|
||||
// Anchor_map_iterator_tmp(typename Anchor_map::iterator const &it)
|
||||
// Anchor_map_iterator_tmp(typename Anchor_map::iterator const &it)
|
||||
// : Anchor_map::iterator(it) {}
|
||||
// };
|
||||
// typedef typename Anchor_map::iterator Anchor_map_iterator;
|
||||
|
||||
typedef Union_find<Rt_Simplex> Union_find_anchor;
|
||||
typedef std::map<Rt_Simplex,
|
||||
typename Union_find_anchor::handle> Simplex_UF_map;
|
||||
|
||||
typename Union_find_anchor::handle> Simplex_UF_map;
|
||||
|
||||
public:
|
||||
|
||||
|
||||
Power_diagram_triangulator_3(
|
||||
Regular ®ular,
|
||||
Triangulated_mixed_complex &triangulated_mixed_complex,
|
||||
Triangulated_mixed_complex_observer &observer,
|
||||
bool verbose)
|
||||
Power_diagram_triangulator_3(Regular ®ular,
|
||||
Triangulated_mixed_complex &triangulated_mixed_complex,
|
||||
Triangulated_mixed_complex_observer &observer,
|
||||
bool verbose)
|
||||
: regular(regular),
|
||||
_tmc(triangulated_mixed_complex),
|
||||
observer(observer),
|
||||
triangulation_incr_builder(triangulated_mixed_complex),
|
||||
triangulation_incr_builder(triangulated_mixed_complex),
|
||||
compute_anchor_obj(regular),
|
||||
verbose(verbose) {
|
||||
|
||||
verbose(verbose)
|
||||
{
|
||||
build();
|
||||
}
|
||||
|
||||
private:
|
||||
void build() {
|
||||
|
||||
void build()
|
||||
{
|
||||
triangulation_incr_builder.begin_triangulation(3);
|
||||
|
||||
if (verbose) std::cout << "Construct vertices" << std::endl;
|
||||
if (verbose)
|
||||
std::cout << "Construct vertices" << std::endl;
|
||||
construct_vertices();
|
||||
|
||||
if (verbose) std::cout << "Construct cells" << std::endl;
|
||||
if (verbose)
|
||||
std::cout << "Construct cells" << std::endl;
|
||||
construct_cells(); // mixed cells corresponding to regular vertices
|
||||
|
||||
triangulation_incr_builder.end_triangulation();
|
||||
|
||||
|
||||
anchors.clear();
|
||||
|
||||
CGAL_assertion(_tmc.is_valid());
|
||||
|
|
@ -156,61 +154,64 @@ private:
|
|||
// { // NGHK: debug code:
|
||||
// CGAL_assertion(_tmc.is_valid());
|
||||
// std::vector<Tmc_Vertex_handle> ch_vertices;
|
||||
// _tmc.incident_vertices(_tmc.infinite_vertex(),
|
||||
// std::back_inserter(ch_vertices));
|
||||
// _tmc.incident_vertices(_tmc.infinite_vertex(),
|
||||
// std::back_inserter(ch_vertices));
|
||||
// for (typename std::vector<Tmc_Vertex_handle>::iterator
|
||||
// vit = ch_vertices.begin(); vit != ch_vertices.end(); vit++) {
|
||||
// CGAL_assertion((*vit)->sign() == POSITIVE);
|
||||
// vit = ch_vertices.begin(); vit != ch_vertices.end(); vit++) {
|
||||
// CGAL_assertion((*vit)->sign() == POSITIVE);
|
||||
// }
|
||||
// }
|
||||
}
|
||||
|
||||
Tmc_Vertex_handle add_vertex(Rt_Simplex const &anchor);
|
||||
Tmc_Vertex_handle add_vertex(Rt_Simplex const &anchor);
|
||||
|
||||
Tmc_Cell_handle add_cell(Tmc_Vertex_handle vh[], int orient, Rt_Simplex s);
|
||||
|
||||
|
||||
Tmc_Vertex_handle get_vertex(Rt_Simplex &sVor);
|
||||
|
||||
|
||||
void construct_anchor_vor(Rt_Simplex const &sVor);
|
||||
|
||||
void construct_anchors();
|
||||
Rt_Simplex get_anchor_vor(Rt_Simplex const &sVor) {
|
||||
|
||||
Rt_Simplex get_anchor_vor(Rt_Simplex const &sVor)
|
||||
{
|
||||
typename Simplex_UF_map::iterator it = anchor_vor_map.find(sVor);
|
||||
CGAL_assertion(it != anchor_vor_map.end());
|
||||
return *anchor_vor_uf.find(it->second);
|
||||
}
|
||||
}
|
||||
|
||||
void construct_vertices();
|
||||
|
||||
|
||||
Tmc_Point get_orthocenter(Rt_Simplex const &s);
|
||||
|
||||
Tmc_Point get_anchor(Rt_Simplex const &sVor);
|
||||
|
||||
template <class Point>
|
||||
Point construct_anchor_point(const Point ¢er_vor) {
|
||||
return center_vor;
|
||||
}
|
||||
|
||||
|
||||
void construct_cells();
|
||||
|
||||
|
||||
void remove_small_edges();
|
||||
bool is_collapsible(Tmc_Vertex_handle vh,
|
||||
Tmc_Vertex_handle &vh_collapse_to,
|
||||
Tmc_RT sq_length);
|
||||
|
||||
bool is_collapsible(Tmc_Vertex_handle vh,
|
||||
Tmc_Vertex_handle &vh_collapse_to,
|
||||
Tmc_RT sq_length);
|
||||
void do_collapse(Tmc_Vertex_handle vh, Tmc_Vertex_handle vh_collapse_to);
|
||||
|
||||
|
||||
private:
|
||||
Regular const ®ular;
|
||||
Triangulated_mixed_complex &_tmc;
|
||||
Triangulated_mixed_complex_observer &observer;
|
||||
|
||||
Triangulation_incremental_builder triangulation_incr_builder;
|
||||
|
||||
typename Tmc_traits::Construct_weighted_circumcenter_3 orthocenter_obj;
|
||||
|
||||
typename Tmc_traits::Compute_squared_radius_smallest_orthogonal_sphere_3 orthoweight_obj;
|
||||
Compute_anchor_3<Regular> compute_anchor_obj;
|
||||
bool verbose;
|
||||
|
||||
Cartesian_converter<typename Rt_Bare_point::R,
|
||||
Triangulated_mixed_complex_traits > r2t_converter_object;
|
||||
Cartesian_converter<typename Rt_Bare_point::R,
|
||||
Triangulated_mixed_complex_traits > r2t_converter_object;
|
||||
|
||||
static const int edge_index[4][4];
|
||||
struct Index_c4 { Tmc_Vertex_handle V[4]; };
|
||||
|
|
@ -222,42 +223,37 @@ private:
|
|||
|
||||
// index to vertex
|
||||
Unique_hash_map < Rt_Cell_handle, Index_c4 > index_03;
|
||||
|
||||
|
||||
Union_find_anchor anchor_vor_uf;
|
||||
Simplex_UF_map anchor_vor_map;
|
||||
// Anchor_map anchor_vor2;
|
||||
std::map<Rt_Simplex, Tmc_Vertex_handle> anchors;
|
||||
// Anchor_map anchor_vor2;
|
||||
std::map<Rt_Simplex, Tmc_Vertex_handle> anchors;
|
||||
};
|
||||
|
||||
template <
|
||||
class RegularTriangulation_3,
|
||||
class TriangulatedMixedComplex_3,
|
||||
class TriangulatedMixedComplexObserver_3>
|
||||
const int Power_diagram_triangulator_3<
|
||||
RegularTriangulation_3,
|
||||
TriangulatedMixedComplex_3,
|
||||
TriangulatedMixedComplexObserver_3>::
|
||||
template <class RegularTriangulation_3,
|
||||
class TriangulatedMixedComplex_3,
|
||||
class TriangulatedMixedComplexObserver_3>
|
||||
const int Power_diagram_triangulator_3<RegularTriangulation_3,
|
||||
TriangulatedMixedComplex_3,
|
||||
TriangulatedMixedComplexObserver_3>::
|
||||
edge_index[4][4] = {{-1,0,1,2},{0,-1,3,4},{1,3,-1,5},{2,4,5,-1}};
|
||||
|
||||
|
||||
template <
|
||||
class RegularTriangulation_3,
|
||||
class TriangulatedMixedComplex_3,
|
||||
class TriangulatedMixedComplexObserver_3>
|
||||
template <class RegularTriangulation_3,
|
||||
class TriangulatedMixedComplex_3,
|
||||
class TriangulatedMixedComplexObserver_3>
|
||||
void
|
||||
Power_diagram_triangulator_3<
|
||||
RegularTriangulation_3,
|
||||
TriangulatedMixedComplex_3,
|
||||
TriangulatedMixedComplexObserver_3>::
|
||||
construct_anchor_vor(Rt_Simplex const &sVor) {
|
||||
Power_diagram_triangulator_3<RegularTriangulation_3,
|
||||
TriangulatedMixedComplex_3,
|
||||
TriangulatedMixedComplexObserver_3>::
|
||||
construct_anchor_vor(Rt_Simplex const &sVor)
|
||||
{
|
||||
Rt_Simplex s = compute_anchor_obj.anchor_vor(sVor);
|
||||
|
||||
|
||||
typename Union_find_anchor::handle sVor_handle, s_handle;
|
||||
sVor_handle = anchor_vor_uf.make_set(sVor);
|
||||
anchor_vor_map[sVor] = sVor_handle;
|
||||
|
||||
typename Simplex_UF_map::iterator s_it = anchor_vor_map.find(s);
|
||||
|
||||
typename Simplex_UF_map::iterator s_it = anchor_vor_map.find(s);
|
||||
CGAL_assertion(s_it != anchor_vor_map.end());
|
||||
|
||||
anchor_vor_uf.unify_sets(sVor_handle, s_it->second);
|
||||
|
|
@ -267,10 +263,10 @@ construct_anchor_vor(Rt_Simplex const &sVor) {
|
|||
typename Compute_anchor::Simplex_iterator degenerate_it;
|
||||
typename Simplex_UF_map::iterator deg_map_it;
|
||||
for (degenerate_it = compute_anchor_obj.equivalent_anchors_begin();
|
||||
degenerate_it != compute_anchor_obj.equivalent_anchors_end();
|
||||
degenerate_it != compute_anchor_obj.equivalent_anchors_end();
|
||||
degenerate_it++) {
|
||||
deg_map_it = anchor_vor_map.find(*degenerate_it);
|
||||
|
||||
deg_map_it = anchor_vor_map.find(*degenerate_it);
|
||||
|
||||
// Possibly not found for 2 Voronoi vertices with the same center,
|
||||
// If the first vertex is inserted and the second is already found.
|
||||
// see compute_anchor_obj.anchor_vor(Cell_handle)
|
||||
|
|
@ -281,22 +277,21 @@ construct_anchor_vor(Rt_Simplex const &sVor) {
|
|||
}
|
||||
}
|
||||
|
||||
template <
|
||||
class RegularTriangulation_3,
|
||||
class TriangulatedMixedComplex_3,
|
||||
class TriangulatedMixedComplexObserver_3>
|
||||
template <class RegularTriangulation_3,
|
||||
class TriangulatedMixedComplex_3,
|
||||
class TriangulatedMixedComplexObserver_3>
|
||||
void
|
||||
Power_diagram_triangulator_3<
|
||||
RegularTriangulation_3,
|
||||
TriangulatedMixedComplex_3,
|
||||
TriangulatedMixedComplexObserver_3>::
|
||||
construct_anchors() {
|
||||
Power_diagram_triangulator_3<RegularTriangulation_3,
|
||||
TriangulatedMixedComplex_3,
|
||||
TriangulatedMixedComplexObserver_3>::
|
||||
construct_anchors()
|
||||
{
|
||||
Rt_Finite_vertices_iterator vit;
|
||||
Rt_Finite_edges_iterator eit;
|
||||
Rt_Finite_facets_iterator fit;
|
||||
Rt_Finite_cells_iterator cit;
|
||||
Rt_Simplex s;
|
||||
|
||||
|
||||
// Compute anchor points:
|
||||
for (cit=regular.finite_cells_begin();
|
||||
cit!=regular.finite_cells_end(); cit++) {
|
||||
|
|
@ -325,18 +320,16 @@ construct_anchors() {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
// Constructs the vertices of the simplicial complex
|
||||
template <
|
||||
class RegularTriangulation_3,
|
||||
class TriangulatedMixedComplex_3,
|
||||
class TriangulatedMixedComplexObserver_3>
|
||||
template <class RegularTriangulation_3,
|
||||
class TriangulatedMixedComplex_3,
|
||||
class TriangulatedMixedComplexObserver_3>
|
||||
void
|
||||
Power_diagram_triangulator_3<
|
||||
RegularTriangulation_3,
|
||||
TriangulatedMixedComplex_3,
|
||||
TriangulatedMixedComplexObserver_3>::
|
||||
construct_vertices() {
|
||||
Power_diagram_triangulator_3<RegularTriangulation_3,
|
||||
TriangulatedMixedComplex_3,
|
||||
TriangulatedMixedComplexObserver_3>::
|
||||
construct_vertices()
|
||||
{
|
||||
Rt_All_cells_iterator acit;
|
||||
Rt_Finite_cells_iterator cit;
|
||||
Rt_Finite_facets_iterator fit;
|
||||
|
|
@ -375,7 +368,7 @@ construct_vertices() {
|
|||
CGAL_assertion(vh == get_vertex(sVor));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (verbose) std::cout << "2 ";
|
||||
// anchor dimDel=0, dimVor=1
|
||||
for (eit=regular.finite_edges_begin(); eit!=regular.finite_edges_end(); eit++) {
|
||||
|
|
@ -386,7 +379,7 @@ construct_vertices() {
|
|||
CGAL_assertion(vh == get_vertex(sVor));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (verbose) std::cout << "1 ";
|
||||
// anchor dimDel=0, dimVor=0
|
||||
for (vit=regular.finite_vertices_begin(); vit!=regular.finite_vertices_end(); vit++) {
|
||||
|
|
@ -401,99 +394,95 @@ construct_vertices() {
|
|||
|
||||
// Constructs the cells of the mixed complex corresponding
|
||||
// to Regular vertices
|
||||
template <
|
||||
class RegularTriangulation_3,
|
||||
class TriangulatedMixedComplex_3,
|
||||
class TriangulatedMixedComplexObserver_3>
|
||||
template <class RegularTriangulation_3,
|
||||
class TriangulatedMixedComplex_3,
|
||||
class TriangulatedMixedComplexObserver_3>
|
||||
void
|
||||
Power_diagram_triangulator_3<
|
||||
RegularTriangulation_3,
|
||||
TriangulatedMixedComplex_3,
|
||||
TriangulatedMixedComplexObserver_3>::
|
||||
construct_cells() {
|
||||
Power_diagram_triangulator_3<RegularTriangulation_3,
|
||||
TriangulatedMixedComplex_3,
|
||||
TriangulatedMixedComplexObserver_3>::
|
||||
construct_cells()
|
||||
{
|
||||
Rt_Simplex sVor_v, sVor_e, sVor_f, sVor_c;
|
||||
Tmc_Vertex_handle vh[4];
|
||||
|
||||
|
||||
for (Rt_Finite_vertices_iterator vit=regular.finite_vertices_begin();
|
||||
vit!=regular.finite_vertices_end(); vit++) {
|
||||
|
||||
|
||||
Rt_Simplex simplex(vit);
|
||||
sVor_v = get_anchor_vor(Rt_Simplex(vit));
|
||||
vh[0] = get_vertex(sVor_v);
|
||||
|
||||
|
||||
std::list<Rt_Cell_handle> adj_cells;
|
||||
typename std::list<Rt_Cell_handle>::iterator adj_cell;
|
||||
regular.incident_cells(vit, std::back_inserter(adj_cells));
|
||||
|
||||
|
||||
// Construct cells:
|
||||
for (adj_cell = adj_cells.begin();
|
||||
adj_cell != adj_cells.end();
|
||||
adj_cell ++) {
|
||||
adj_cell != adj_cells.end();
|
||||
adj_cell ++) {
|
||||
if (!regular.is_infinite(*adj_cell)) {
|
||||
sVor_c = get_anchor_vor(Rt_Simplex(*adj_cell));
|
||||
vh[3] = get_vertex(sVor_c);
|
||||
int index = (*adj_cell)->index(vit);
|
||||
for (int i=1; i<4; i++) {
|
||||
sVor_f = get_anchor_vor(
|
||||
Rt_Simplex(Rt_Facet(*adj_cell,(index+i)&3)));
|
||||
vh[2] = get_vertex(sVor_f);
|
||||
|
||||
for (int j=1; j<4; j++) {
|
||||
if (j!=i) {
|
||||
sVor_e = get_anchor_vor(
|
||||
Rt_Simplex(Rt_Edge(*adj_cell,index,(index+j)&3)));
|
||||
vh[1] = get_vertex(sVor_e);
|
||||
if ((vh[0] != vh[1]) && (vh[1] != vh[2]) && (vh[2] != vh[3])) {
|
||||
CGAL_assertion(sVor_v != sVor_e);
|
||||
CGAL_assertion(sVor_e != sVor_f);
|
||||
CGAL_assertion(sVor_f != sVor_c);
|
||||
// Tmc_Cell_handle ch =
|
||||
add_cell(vh,(index + (j==(i%3+1)? 1:0))&1,simplex);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
sVor_c = get_anchor_vor(Rt_Simplex(*adj_cell));
|
||||
vh[3] = get_vertex(sVor_c);
|
||||
int index = (*adj_cell)->index(vit);
|
||||
for (int i=1; i<4; i++) {
|
||||
sVor_f = get_anchor_vor(
|
||||
Rt_Simplex(Rt_Facet(*adj_cell,(index+i)&3)));
|
||||
vh[2] = get_vertex(sVor_f);
|
||||
|
||||
for (int j=1; j<4; j++) {
|
||||
if (j!=i) {
|
||||
sVor_e = get_anchor_vor(
|
||||
Rt_Simplex(Rt_Edge(*adj_cell,index,(index+j)&3)));
|
||||
vh[1] = get_vertex(sVor_e);
|
||||
if ((vh[0] != vh[1]) && (vh[1] != vh[2]) && (vh[2] != vh[3])) {
|
||||
CGAL_assertion(sVor_v != sVor_e);
|
||||
CGAL_assertion(sVor_e != sVor_f);
|
||||
CGAL_assertion(sVor_f != sVor_c);
|
||||
// Tmc_Cell_handle ch =
|
||||
add_cell(vh,(index + (j==(i%3+1)? 1:0))&1,simplex);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Adds a vertex to the simplicial complex
|
||||
template <
|
||||
class RegularTriangulation_3,
|
||||
class TriangulatedMixedComplex_3,
|
||||
class TriangulatedMixedComplexObserver_3>
|
||||
template <class RegularTriangulation_3,
|
||||
class TriangulatedMixedComplex_3,
|
||||
class TriangulatedMixedComplexObserver_3>
|
||||
typename Power_diagram_triangulator_3<
|
||||
RegularTriangulation_3,
|
||||
TriangulatedMixedComplex_3,
|
||||
TriangulatedMixedComplexObserver_3>::Tmc_Vertex_handle
|
||||
Power_diagram_triangulator_3<
|
||||
RegularTriangulation_3,
|
||||
TriangulatedMixedComplex_3,
|
||||
TriangulatedMixedComplexObserver_3>::
|
||||
add_vertex (Rt_Simplex const &anchor)
|
||||
Power_diagram_triangulator_3<RegularTriangulation_3,
|
||||
TriangulatedMixedComplex_3,
|
||||
TriangulatedMixedComplexObserver_3>::
|
||||
add_vertex(Rt_Simplex const &anchor)
|
||||
{
|
||||
Tmc_Vertex_handle vh;
|
||||
vh = triangulation_incr_builder.add_vertex();
|
||||
vh->point() = get_anchor(anchor);
|
||||
observer.after_vertex_insertion(anchor, anchor, vh);
|
||||
observer.after_vertex_insertion(anchor, anchor, vh);
|
||||
|
||||
return vh;
|
||||
}
|
||||
|
||||
// Gets a vertex from the simplicial complex based on the anchors
|
||||
template <
|
||||
class RegularTriangulation_3,
|
||||
class TriangulatedMixedComplex_3,
|
||||
class TriangulatedMixedComplexObserver_3>
|
||||
template <class RegularTriangulation_3,
|
||||
class TriangulatedMixedComplex_3,
|
||||
class TriangulatedMixedComplexObserver_3>
|
||||
typename Power_diagram_triangulator_3<
|
||||
RegularTriangulation_3,
|
||||
TriangulatedMixedComplex_3,
|
||||
TriangulatedMixedComplexObserver_3>::Tmc_Vertex_handle
|
||||
Power_diagram_triangulator_3<
|
||||
RegularTriangulation_3,
|
||||
TriangulatedMixedComplex_3,
|
||||
TriangulatedMixedComplexObserver_3>::get_vertex (Rt_Simplex &sVor)
|
||||
Power_diagram_triangulator_3<RegularTriangulation_3,
|
||||
TriangulatedMixedComplex_3,
|
||||
TriangulatedMixedComplexObserver_3>::
|
||||
get_vertex (Rt_Simplex &sVor)
|
||||
{
|
||||
Rt_Simplex sVor2 = get_anchor_vor(sVor);
|
||||
CGAL_assertion(sVor == sVor2);
|
||||
|
|
@ -503,19 +492,18 @@ Power_diagram_triangulator_3<
|
|||
}
|
||||
|
||||
// Adds a cell to the simplicial complex
|
||||
template <
|
||||
class RegularTriangulation_3,
|
||||
class TriangulatedMixedComplex_3,
|
||||
class TriangulatedMixedComplexObserver_3>
|
||||
template <class RegularTriangulation_3,
|
||||
class TriangulatedMixedComplex_3,
|
||||
class TriangulatedMixedComplexObserver_3>
|
||||
typename Power_diagram_triangulator_3<
|
||||
RegularTriangulation_3,
|
||||
TriangulatedMixedComplex_3,
|
||||
TriangulatedMixedComplexObserver_3>::Tmc_Cell_handle
|
||||
Power_diagram_triangulator_3<
|
||||
RegularTriangulation_3,
|
||||
TriangulatedMixedComplex_3,
|
||||
TriangulatedMixedComplexObserver_3>::
|
||||
add_cell(Tmc_Vertex_handle vh[], int orient, Rt_Simplex s) {
|
||||
Power_diagram_triangulator_3<RegularTriangulation_3,
|
||||
TriangulatedMixedComplex_3,
|
||||
TriangulatedMixedComplexObserver_3>::
|
||||
add_cell(Tmc_Vertex_handle vh[], int orient, Rt_Simplex s)
|
||||
{
|
||||
CGAL_assertion((orient==0) || (orient==1));
|
||||
CGAL_assertion(vh[0] != Tmc_Vertex_handle()); CGAL_assertion(vh[1] != Tmc_Vertex_handle());
|
||||
CGAL_assertion(vh[2] != Tmc_Vertex_handle()); CGAL_assertion(vh[3] != Tmc_Vertex_handle());
|
||||
|
|
@ -526,39 +514,36 @@ add_cell(Tmc_Vertex_handle vh[], int orient, Rt_Simplex s) {
|
|||
|
||||
if (orient) {
|
||||
if (orientation(vh[0]->point(), vh[1]->point(),
|
||||
vh[2]->point(), vh[3]->point()) != POSITIVE) {
|
||||
vh[2]->point(), vh[3]->point()) != POSITIVE) {
|
||||
std::cout << orientation(vh[0]->point(), vh[1]->point(),
|
||||
vh[2]->point(), vh[3]->point())<< std::endl;
|
||||
vh[2]->point(), vh[3]->point())<< std::endl;
|
||||
}
|
||||
CGAL_assertion(orientation(
|
||||
vh[0]->point(), vh[1]->point(),
|
||||
vh[2]->point(), vh[3]->point()) == POSITIVE);
|
||||
CGAL_assertion(orientation(vh[0]->point(), vh[1]->point(),
|
||||
vh[2]->point(), vh[3]->point()) == POSITIVE);
|
||||
ch = triangulation_incr_builder.add_cell(vh[0], vh[1], vh[2], vh[3]);
|
||||
} else {
|
||||
CGAL_assertion(orientation(
|
||||
vh[0]->point(), vh[1]->point(),
|
||||
vh[3]->point(), vh[2]->point()) == POSITIVE);
|
||||
CGAL_assertion(orientation(vh[0]->point(), vh[1]->point(),
|
||||
vh[3]->point(), vh[2]->point()) == POSITIVE);
|
||||
ch = triangulation_incr_builder.add_cell(vh[0], vh[1], vh[3], vh[2]);
|
||||
}
|
||||
observer.after_cell_insertion(s, ch);
|
||||
return ch;
|
||||
}
|
||||
|
||||
template <
|
||||
class RegularTriangulation_3,
|
||||
class TriangulatedMixedComplex_3,
|
||||
class TriangulatedMixedComplexObserver_3>
|
||||
template <class RegularTriangulation_3,
|
||||
class TriangulatedMixedComplex_3,
|
||||
class TriangulatedMixedComplexObserver_3>
|
||||
typename TriangulatedMixedComplex_3::Geom_traits::Point_3
|
||||
Power_diagram_triangulator_3<
|
||||
RegularTriangulation_3,
|
||||
TriangulatedMixedComplex_3,
|
||||
TriangulatedMixedComplexObserver_3>::
|
||||
get_orthocenter(Rt_Simplex const &s) {
|
||||
Power_diagram_triangulator_3<RegularTriangulation_3,
|
||||
TriangulatedMixedComplex_3,
|
||||
TriangulatedMixedComplexObserver_3>::
|
||||
get_orthocenter(Rt_Simplex const &s)
|
||||
{
|
||||
Rt_Vertex_handle vh;
|
||||
Rt_Edge e;
|
||||
Rt_Facet f;
|
||||
Rt_Cell_handle ch;
|
||||
|
||||
|
||||
Tmc_Point result;
|
||||
switch (s.dimension()) {
|
||||
case 0:
|
||||
|
|
@ -568,35 +553,34 @@ get_orthocenter(Rt_Simplex const &s) {
|
|||
case 1:
|
||||
e=s;
|
||||
result = orthocenter_obj(
|
||||
r2t_converter_object(e.first->vertex(e.second)->point()),
|
||||
r2t_converter_object(e.first->vertex(e.third)->point()));
|
||||
r2t_converter_object(e.first->vertex(e.second)->point()),
|
||||
r2t_converter_object(e.first->vertex(e.third)->point()));
|
||||
break;
|
||||
case 2:
|
||||
f=s;
|
||||
result = orthocenter_obj(
|
||||
r2t_converter_object(
|
||||
f.first->vertex((f.second+1)&3)->point()),
|
||||
r2t_converter_object(
|
||||
f.first->vertex((f.second+2)&3)->point()),
|
||||
r2t_converter_object(
|
||||
f.first->vertex((f.second+3)&3)->point()));
|
||||
r2t_converter_object(
|
||||
f.first->vertex((f.second+1)&3)->point()),
|
||||
r2t_converter_object(
|
||||
f.first->vertex((f.second+2)&3)->point()),
|
||||
r2t_converter_object(
|
||||
f.first->vertex((f.second+3)&3)->point()));
|
||||
break;
|
||||
case 3:
|
||||
ch=s;
|
||||
result = orthocenter_obj(
|
||||
r2t_converter_object(ch->vertex(0)->point()),
|
||||
r2t_converter_object(ch->vertex(1)->point()),
|
||||
r2t_converter_object(ch->vertex(2)->point()),
|
||||
r2t_converter_object(ch->vertex(3)->point()));
|
||||
r2t_converter_object(ch->vertex(0)->point()),
|
||||
r2t_converter_object(ch->vertex(1)->point()),
|
||||
r2t_converter_object(ch->vertex(2)->point()),
|
||||
r2t_converter_object(ch->vertex(3)->point()));
|
||||
break;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
template <
|
||||
class RegularTriangulation_3,
|
||||
class TriangulatedMixedComplex_3,
|
||||
class TriangulatedMixedComplexObserver_3>
|
||||
template <class RegularTriangulation_3,
|
||||
class TriangulatedMixedComplex_3,
|
||||
class TriangulatedMixedComplexObserver_3>
|
||||
typename TriangulatedMixedComplex_3::Geom_traits::Point_3
|
||||
Power_diagram_triangulator_3<
|
||||
RegularTriangulation_3,
|
||||
|
|
@ -607,15 +591,13 @@ get_anchor(Rt_Simplex const &sVor)
|
|||
return get_orthocenter(sVor);
|
||||
}
|
||||
|
||||
template <
|
||||
class RegularTriangulation_3,
|
||||
class TriangulatedMixedComplex_3,
|
||||
class TriangulatedMixedComplexObserver_3>
|
||||
template <class RegularTriangulation_3,
|
||||
class TriangulatedMixedComplex_3,
|
||||
class TriangulatedMixedComplexObserver_3>
|
||||
void
|
||||
Power_diagram_triangulator_3<
|
||||
RegularTriangulation_3,
|
||||
TriangulatedMixedComplex_3,
|
||||
TriangulatedMixedComplexObserver_3>::
|
||||
Power_diagram_triangulator_3<RegularTriangulation_3,
|
||||
TriangulatedMixedComplex_3,
|
||||
TriangulatedMixedComplexObserver_3>::
|
||||
remove_small_edges()
|
||||
{
|
||||
Bbox_3 bbox;
|
||||
|
|
@ -623,8 +605,8 @@ remove_small_edges()
|
|||
vit != _tmc.finite_vertices_end(); vit++) {
|
||||
bbox = bbox+vit->point().bbox();
|
||||
}
|
||||
// Tmc_RT sq_length = ((bbox.xmax()-bbox.xmin())*(bbox.xmax()-bbox.xmin()) +
|
||||
// (bbox.ymax()-bbox.ymin())*(bbox.ymax()-bbox.ymin()) +
|
||||
// Tmc_RT sq_length = ((bbox.xmax()-bbox.xmin())*(bbox.xmax()-bbox.xmin()) +
|
||||
// (bbox.ymax()-bbox.ymin())*(bbox.ymax()-bbox.ymin()) +
|
||||
// (bbox.zmax()-bbox.zmin())*(bbox.zmax()-bbox.zmin()))/100000000;
|
||||
|
||||
Tmc_RT sq_length = 1e-6;
|
||||
|
|
@ -644,18 +626,16 @@ remove_small_edges()
|
|||
std::cout << "Collapsed: " << nCollapsed << std::endl;
|
||||
}
|
||||
|
||||
template <
|
||||
class RegularTriangulation_3,
|
||||
class TriangulatedMixedComplex_3,
|
||||
class TriangulatedMixedComplexObserver_3>
|
||||
template <class RegularTriangulation_3,
|
||||
class TriangulatedMixedComplex_3,
|
||||
class TriangulatedMixedComplexObserver_3>
|
||||
bool
|
||||
Power_diagram_triangulator_3<
|
||||
RegularTriangulation_3,
|
||||
TriangulatedMixedComplex_3,
|
||||
TriangulatedMixedComplexObserver_3>::
|
||||
Power_diagram_triangulator_3<RegularTriangulation_3,
|
||||
TriangulatedMixedComplex_3,
|
||||
TriangulatedMixedComplexObserver_3>::
|
||||
is_collapsible(Tmc_Vertex_handle vh,
|
||||
Tmc_Vertex_handle &vh_collapse_to,
|
||||
Tmc_RT sq_length)
|
||||
Tmc_Vertex_handle &vh_collapse_to,
|
||||
Tmc_RT sq_length)
|
||||
{
|
||||
std::vector<Tmc_Cell_handle> incident_cells;
|
||||
CGAL_assertion(_tmc.is_vertex(vh));
|
||||
|
|
@ -663,65 +643,62 @@ is_collapsible(Tmc_Vertex_handle vh,
|
|||
_tmc.incident_cells(vh, std::back_inserter(incident_cells));
|
||||
|
||||
std::set<Tmc_Vertex_handle> incident_vertices;
|
||||
for(typename std::vector<Tmc_Cell_handle>::iterator
|
||||
cit = incident_cells.begin();
|
||||
for(typename std::vector<Tmc_Cell_handle>::iterator
|
||||
cit = incident_cells.begin();
|
||||
cit != incident_cells.end(); ++cit) {
|
||||
// Put all incident vertices in incident_vertices.
|
||||
for (int j=0; j<4; ++j)
|
||||
if ((*cit)->vertex(j) != vh)
|
||||
incident_vertices.insert((*cit)->vertex(j));
|
||||
incident_vertices.insert((*cit)->vertex(j));
|
||||
}
|
||||
|
||||
for (typename std::set<Tmc_Vertex_handle>::iterator
|
||||
it = incident_vertices.begin();
|
||||
|
||||
for (typename std::set<Tmc_Vertex_handle>::iterator
|
||||
it = incident_vertices.begin();
|
||||
it != incident_vertices.end(); it++) {
|
||||
if ((_tmc.geom_traits().compute_squared_distance_3_object()(vh->point(),
|
||||
(*it)->point())
|
||||
< sq_length) &&
|
||||
(vh->cell()->surf == (*it)->cell()->surf) &&
|
||||
(vh->sign() == (*it)->sign())) {
|
||||
(*it)->point())
|
||||
< sq_length) &&
|
||||
(vh->cell()->surf == (*it)->cell()->surf) &&
|
||||
(vh->sign() == (*it)->sign())) {
|
||||
bool ok = true;
|
||||
for (typename std::vector<Tmc_Cell_handle>::iterator
|
||||
cit = incident_cells.begin();
|
||||
ok && (cit != incident_cells.end()); cit++) {
|
||||
if (!(*cit)->has_vertex(*it)) {
|
||||
const Tmc_Point* pts[4] = { &((*cit)->vertex(0)->point()),
|
||||
&((*cit)->vertex(1)->point()),
|
||||
&((*cit)->vertex(2)->point()),
|
||||
&((*cit)->vertex(3)->point()) };
|
||||
pts[(*cit)->index(vh)] = &(*it)->point();
|
||||
|
||||
ok = (_tmc.geom_traits().orientation_3_object()
|
||||
(*pts[0],*pts[1],*pts[2],*pts[3]) == CGAL::POSITIVE);
|
||||
}
|
||||
for (typename std::vector<Tmc_Cell_handle>::iterator
|
||||
cit = incident_cells.begin();
|
||||
ok && (cit != incident_cells.end()); cit++) {
|
||||
if (!(*cit)->has_vertex(*it)) {
|
||||
const Tmc_Point* pts[4] = { &((*cit)->vertex(0)->point()),
|
||||
&((*cit)->vertex(1)->point()),
|
||||
&((*cit)->vertex(2)->point()),
|
||||
&((*cit)->vertex(3)->point()) };
|
||||
pts[(*cit)->index(vh)] = &(*it)->point();
|
||||
|
||||
ok = (_tmc.geom_traits().orientation_3_object()
|
||||
(*pts[0],*pts[1],*pts[2],*pts[3]) == CGAL::POSITIVE);
|
||||
}
|
||||
}
|
||||
if (ok) {
|
||||
vh_collapse_to = *it;
|
||||
return true;
|
||||
}
|
||||
vh_collapse_to = *it;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
template <
|
||||
class RegularTriangulation_3,
|
||||
class TriangulatedMixedComplex_3,
|
||||
class TriangulatedMixedComplexObserver_3>
|
||||
template <class RegularTriangulation_3,
|
||||
class TriangulatedMixedComplex_3,
|
||||
class TriangulatedMixedComplexObserver_3>
|
||||
void
|
||||
Power_diagram_triangulator_3<
|
||||
RegularTriangulation_3,
|
||||
TriangulatedMixedComplex_3,
|
||||
TriangulatedMixedComplexObserver_3>::
|
||||
do_collapse(Tmc_Vertex_handle vh,
|
||||
Tmc_Vertex_handle vh_collapse_to)
|
||||
Power_diagram_triangulator_3<RegularTriangulation_3,
|
||||
TriangulatedMixedComplex_3,
|
||||
TriangulatedMixedComplexObserver_3>::
|
||||
do_collapse(Tmc_Vertex_handle vh, Tmc_Vertex_handle vh_collapse_to)
|
||||
{
|
||||
std::vector<Tmc_Cell_handle> incident_cells;
|
||||
incident_cells.reserve(32);
|
||||
_tmc.incident_cells(vh, std::back_inserter(incident_cells));
|
||||
int i,i2;
|
||||
for (typename std::vector<Tmc_Cell_handle>::iterator
|
||||
it = incident_cells.begin(); it != incident_cells.end(); it++) {
|
||||
it = incident_cells.begin(); it != incident_cells.end(); it++) {
|
||||
i = (*it)->index(vh);
|
||||
if ((*it)->has_vertex(vh_collapse_to,i2)) {
|
||||
// This cell is collapsed, set neighbor information of the new facet
|
||||
|
|
@ -731,14 +708,14 @@ do_collapse(Tmc_Vertex_handle vh,
|
|||
ch1->set_neighbor(ch1->index((*it)), ch2);
|
||||
ch2->set_neighbor(ch2->index((*it)), ch1);
|
||||
for (int i=0; i<4; i++) {
|
||||
// Try to point to a cell with the same surface:
|
||||
if ((*it)->vertex(i)->cell() == (*it)) {
|
||||
if ((*it)->surf == ch1->surf) {
|
||||
(*it)->vertex(i)->set_cell(ch1);
|
||||
} else {
|
||||
(*it)->vertex(i)->set_cell(ch2);
|
||||
}
|
||||
}
|
||||
// Try to point to a cell with the same surface:
|
||||
if ((*it)->vertex(i)->cell() == (*it)) {
|
||||
if ((*it)->surf == ch1->surf) {
|
||||
(*it)->vertex(i)->set_cell(ch1);
|
||||
} else {
|
||||
(*it)->vertex(i)->set_cell(ch2);
|
||||
}
|
||||
}
|
||||
}
|
||||
_tmc.tds().delete_cell((*it));
|
||||
} else {
|
||||
|
|
@ -749,15 +726,14 @@ do_collapse(Tmc_Vertex_handle vh,
|
|||
_tmc.tds().delete_vertex(vh);
|
||||
}
|
||||
|
||||
template <
|
||||
class RegularTriangulation_3,
|
||||
class TriangulatedMixedComplex_3,
|
||||
class TriangulatedMixedComplexObserver_3>
|
||||
void
|
||||
template <class RegularTriangulation_3,
|
||||
class TriangulatedMixedComplex_3,
|
||||
class TriangulatedMixedComplexObserver_3>
|
||||
void
|
||||
triangulate_power_diagram_3(RegularTriangulation_3 &rt,
|
||||
TriangulatedMixedComplex_3 &tmc,
|
||||
TriangulatedMixedComplexObserver_3 &observer,
|
||||
bool verbose)
|
||||
TriangulatedMixedComplex_3 &tmc,
|
||||
TriangulatedMixedComplexObserver_3 &observer,
|
||||
bool verbose)
|
||||
{
|
||||
typedef Power_diagram_triangulator_3<
|
||||
RegularTriangulation_3,
|
||||
|
|
@ -766,18 +742,16 @@ triangulate_power_diagram_3(RegularTriangulation_3 &rt,
|
|||
Power_diagram_triangulator(rt, tmc, observer, verbose);
|
||||
}
|
||||
|
||||
|
||||
template <
|
||||
class RegularTriangulation_3,
|
||||
class TriangulatedMixedComplex_3>
|
||||
void
|
||||
triangulate_power_diagram_3(RegularTriangulation_3 const ®ular,
|
||||
TriangulatedMixedComplex_3 &tmc,
|
||||
bool verbose)
|
||||
template <class RegularTriangulation_3,
|
||||
class TriangulatedMixedComplex_3>
|
||||
void
|
||||
triangulate_power_diagram_3(RegularTriangulation_3 const ®ular,
|
||||
TriangulatedMixedComplex_3 &tmc,
|
||||
bool verbose)
|
||||
{
|
||||
Triangulated_mixed_complex_observer_3<
|
||||
TriangulatedMixedComplex_3, const RegularTriangulation_3>
|
||||
observer(1);
|
||||
TriangulatedMixedComplex_3, const RegularTriangulation_3> observer(1);
|
||||
|
||||
triangulate_power_diagram_3(regular, tmc, observer, verbose);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -23,7 +23,8 @@ typedef Regular::Facet Facet;
|
|||
typedef Regular::Cell_handle Cell_handle;
|
||||
typedef CGAL::Triangulation_simplex_3<Regular> Simplex;
|
||||
|
||||
void test_anchor_del() {
|
||||
void test_anchor_del()
|
||||
{
|
||||
Regular reg;
|
||||
CGAL::Compute_anchor_3<Regular> compute_anchor_obj(reg);
|
||||
Vertex_handle vh[4];
|
||||
|
|
@ -43,14 +44,14 @@ void test_anchor_del() {
|
|||
assert(Simplex(vh[i]) == compute_anchor_obj.anchor_vor(vh[i]));
|
||||
for (int j=i+1; j<4; j++) {
|
||||
assert(Simplex(Edge(ch,i,j)) ==
|
||||
compute_anchor_obj.anchor_del(Edge(ch,i,j)));
|
||||
compute_anchor_obj.anchor_del(Edge(ch,i,j)));
|
||||
assert(Simplex(Edge(ch,i,j)) ==
|
||||
compute_anchor_obj.anchor_vor(Edge(ch,i,j)));
|
||||
compute_anchor_obj.anchor_vor(Edge(ch,i,j)));
|
||||
}
|
||||
assert(Simplex(Facet(ch,i)) ==
|
||||
compute_anchor_obj.anchor_del(Facet(ch,i)));
|
||||
compute_anchor_obj.anchor_del(Facet(ch,i)));
|
||||
assert(Simplex(Facet(ch,i)) ==
|
||||
compute_anchor_obj.anchor_vor(Facet(ch,i)));
|
||||
compute_anchor_obj.anchor_vor(Facet(ch,i)));
|
||||
assert(Simplex(ch) == compute_anchor_obj.anchor_del(ch));
|
||||
assert(Simplex(ch) == compute_anchor_obj.anchor_vor(ch));
|
||||
}
|
||||
|
|
@ -67,14 +68,14 @@ void test_anchor_del() {
|
|||
assert(Simplex(vh[i]) == compute_anchor_obj.anchor_del(vh[i]));
|
||||
assert(Simplex(vh[i]) == compute_anchor_obj.anchor_vor(vh[i]));
|
||||
assert(Simplex(Facet(ch,i)) ==
|
||||
compute_anchor_obj.anchor_del(Facet(ch,i)));
|
||||
compute_anchor_obj.anchor_del(Facet(ch,i)));
|
||||
assert(Simplex(Facet(ch,i)) ==
|
||||
compute_anchor_obj.anchor_vor(Facet(ch,i)));
|
||||
compute_anchor_obj.anchor_vor(Facet(ch,i)));
|
||||
for (int j=i+1; j<4; j++) {
|
||||
assert(Simplex(Edge(ch,i,j)) ==
|
||||
compute_anchor_obj.anchor_del(Edge(ch,i,j)));
|
||||
compute_anchor_obj.anchor_del(Edge(ch,i,j)));
|
||||
assert(Simplex(Edge(ch,i,j)) ==
|
||||
compute_anchor_obj.anchor_vor(Edge(ch,i,j)));
|
||||
compute_anchor_obj.anchor_vor(Edge(ch,i,j)));
|
||||
}
|
||||
assert(Simplex(ch) == compute_anchor_obj.anchor_del(ch));
|
||||
assert(Simplex(ch) == compute_anchor_obj.anchor_vor(ch));
|
||||
|
|
@ -90,17 +91,17 @@ void test_anchor_del() {
|
|||
|
||||
// Anchor of a Delaunay edge/facet/cell on a vertex
|
||||
assert(Simplex(vh[0]) ==
|
||||
compute_anchor_obj.anchor_del(Edge(ch,index1,(index1+1)&3)));
|
||||
compute_anchor_obj.anchor_del(Edge(ch,index1,(index1+1)&3)));
|
||||
assert(Simplex(vh[0]) ==
|
||||
compute_anchor_obj.anchor_del(Edge(ch,index1,(index1+2)&3)));
|
||||
compute_anchor_obj.anchor_del(Edge(ch,index1,(index1+2)&3)));
|
||||
assert(Simplex(vh[0]) ==
|
||||
compute_anchor_obj.anchor_del(Edge(ch,index1,(index1+3)&3)));
|
||||
compute_anchor_obj.anchor_del(Edge(ch,index1,(index1+3)&3)));
|
||||
assert(Simplex(vh[0]) ==
|
||||
compute_anchor_obj.anchor_del(Facet(ch,(index1+1)&3)));
|
||||
compute_anchor_obj.anchor_del(Facet(ch,(index1+1)&3)));
|
||||
assert(Simplex(vh[0]) ==
|
||||
compute_anchor_obj.anchor_del(Facet(ch,(index1+2)&3)));
|
||||
compute_anchor_obj.anchor_del(Facet(ch,(index1+2)&3)));
|
||||
assert(Simplex(vh[0]) ==
|
||||
compute_anchor_obj.anchor_del(Facet(ch,(index1+3)&3)));
|
||||
compute_anchor_obj.anchor_del(Facet(ch,(index1+3)&3)));
|
||||
assert(Simplex(vh[0]) == compute_anchor_obj.anchor_del(ch));
|
||||
reg.clear();
|
||||
|
||||
|
|
@ -114,11 +115,11 @@ void test_anchor_del() {
|
|||
|
||||
// Anchor of a Delaunay facet/cell on an edge
|
||||
assert(Simplex(Edge(ch,index1,index2)) ==
|
||||
compute_anchor_obj.anchor_del(Facet(ch,ch->index(vh[2]))));
|
||||
compute_anchor_obj.anchor_del(Facet(ch,ch->index(vh[2]))));
|
||||
assert(Simplex(Edge(ch,index1,index2)) ==
|
||||
compute_anchor_obj.anchor_del(Facet(ch,ch->index(vh[3]))));
|
||||
compute_anchor_obj.anchor_del(Facet(ch,ch->index(vh[3]))));
|
||||
assert(Simplex(Edge(ch,index1,index2)) ==
|
||||
compute_anchor_obj.anchor_del(ch));
|
||||
compute_anchor_obj.anchor_del(ch));
|
||||
reg.clear();
|
||||
|
||||
vh[0] = reg.insert(Weighted_point(Point(0,0,0), 1));
|
||||
|
|
@ -129,14 +130,12 @@ void test_anchor_del() {
|
|||
index1 = ch->index(vh[0]);
|
||||
|
||||
// Anchor of a Delaunay cell on an facet
|
||||
assert(Simplex(Facet(ch,index1)) ==
|
||||
compute_anchor_obj.anchor_del(ch));
|
||||
assert(Simplex(Facet(ch,index1)) == compute_anchor_obj.anchor_del(ch));
|
||||
reg.clear();
|
||||
|
||||
}
|
||||
|
||||
int main(int, char **) {
|
||||
|
||||
int main(int, char **)
|
||||
{
|
||||
test_anchor_del();
|
||||
|
||||
// Regular regular;
|
||||
|
|
@ -159,11 +158,11 @@ int main(int, char **) {
|
|||
// yExtr[i] = y + (-1+2*i)*std::sqrt(w);
|
||||
// zExtr[i] = z + (-1+2*i)*std::sqrt(w);
|
||||
// }
|
||||
|
||||
|
||||
// while (in >> x >> y >> z >> w) {
|
||||
// //std::cerr << x << " " << y << " " << z << " " << w << std::endl;
|
||||
// regular.insert(Weighted_point(Point(x,y,z),w));
|
||||
|
||||
|
||||
// if (w<0) w=0.01;
|
||||
// xExtr[0] = std::min(xExtr[0], x - std::sqrt(w));
|
||||
// yExtr[0] = std::min(yExtr[0], y - std::sqrt(w));
|
||||
|
|
@ -177,14 +176,14 @@ int main(int, char **) {
|
|||
// double boxSize = 1 + 2.05/(shrink * (1-shrink))*
|
||||
// std::max((xExtr[1]-xExtr[0]),
|
||||
// std::max((yExtr[1]-yExtr[0]),(zExtr[1]-zExtr[0])));
|
||||
|
||||
|
||||
// regular.insert(Weighted_point(Point(xExtr[0]-boxSize,0,0),-1));
|
||||
// regular.insert(Weighted_point(Point(xExtr[1]+boxSize,0,0),-1));
|
||||
// regular.insert(Weighted_point(Point(0,yExtr[0]-boxSize,0),-1));
|
||||
// regular.insert(Weighted_point(Point(0,yExtr[1]+boxSize,0),-1));
|
||||
// regular.insert(Weighted_point(Point(0,0,zExtr[0]-boxSize),-1));
|
||||
// regular.insert(Weighted_point(Point(0,0,zExtr[1]+boxSize),-1));
|
||||
|
||||
|
||||
// assert( regular.is_valid() );
|
||||
// assert( regular.dimension() == 3 );
|
||||
// }
|
||||
|
|
@ -209,7 +208,7 @@ int main(int, char **) {
|
|||
// // subdivision engine
|
||||
// Sqrt3Method subdivider(simplicial, mesh);
|
||||
// subdivider.subdivide(2);
|
||||
|
||||
|
||||
// {
|
||||
// std::ofstream out("out/sqrt.off");
|
||||
// out << mesh;
|
||||
|
|
|
|||
|
|
@ -20,11 +20,14 @@ typedef Weighted_point::Point Bare_point;
|
|||
typedef CGAL::Exact_predicates_inexact_constructions_kernel IK;
|
||||
typedef CGAL::Polyhedron_3<IK> Polyhedron;
|
||||
|
||||
class Test_file {
|
||||
class Test_file
|
||||
{
|
||||
public:
|
||||
Test_file(double shrink) : s(shrink) {
|
||||
}
|
||||
void operator()(std::string filename) {
|
||||
|
||||
void operator()(std::string filename)
|
||||
{
|
||||
std::cout << filename << std::endl;
|
||||
|
||||
std::list<Weighted_point> l;
|
||||
|
|
@ -32,23 +35,23 @@ public:
|
|||
assert(in.is_open());
|
||||
Weighted_point wp;
|
||||
while (in >> wp) l.push_front(wp);
|
||||
|
||||
|
||||
Skin_surface_3 skin_surface(l.begin(), l.end(), s);
|
||||
|
||||
|
||||
Polyhedron p;
|
||||
CGAL::mesh_skin_surface_3(skin_surface, p);
|
||||
|
||||
|
||||
assert(p.is_valid() && p.is_closed());
|
||||
|
||||
//std::cout << p << std::endl;
|
||||
}
|
||||
|
||||
private:
|
||||
double s;
|
||||
};
|
||||
|
||||
|
||||
int main(int, char **) {
|
||||
|
||||
int main(int, char **)
|
||||
{
|
||||
std::vector<std::string> filenames;
|
||||
filenames.push_back("data/caffeine.cin");
|
||||
filenames.push_back("data/ball.cin");
|
||||
|
|
@ -64,7 +67,7 @@ int main(int, char **) {
|
|||
filenames.push_back("data/test9.cin");
|
||||
filenames.push_back("data/test10.cin");
|
||||
filenames.push_back("data/test11.cin");
|
||||
|
||||
|
||||
std::for_each(filenames.begin(), filenames.end(), Test_file(.5));
|
||||
std::for_each(filenames.begin(), filenames.end(), Test_file(.85));
|
||||
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@
|
|||
#include <fstream>
|
||||
#include <algorithm>
|
||||
|
||||
typedef CGAL::Exact_predicates_exact_constructions_kernel K;
|
||||
typedef CGAL::Exact_predicates_exact_constructions_kernel K;
|
||||
typedef CGAL::Skin_surface_traits_3<K> Traits;
|
||||
typedef CGAL::Skin_surface_3<Traits> Skin_surface_3;
|
||||
typedef Skin_surface_3::FT FT;
|
||||
|
|
@ -19,10 +19,12 @@ typedef Weighted_point::Point Bare_point;
|
|||
typedef CGAL::Exact_predicates_inexact_constructions_kernel IK;
|
||||
typedef CGAL::Polyhedron_3<IK> Polyhedron;
|
||||
|
||||
class Test_file {
|
||||
class Test_file
|
||||
{
|
||||
public:
|
||||
Test_file(double shrink) : s(shrink) {
|
||||
}
|
||||
|
||||
void operator()(std::string filename) {
|
||||
std::cout << filename << std::endl;
|
||||
|
||||
|
|
@ -34,23 +36,23 @@ public:
|
|||
while (in >> x >> y >> z >> w ) {
|
||||
l.push_front(Weighted_point(Bare_point(x,y,z),w));
|
||||
}
|
||||
|
||||
|
||||
Skin_surface_3 skin_surface(l.begin(), l.end(), s);
|
||||
|
||||
|
||||
Polyhedron p;
|
||||
CGAL::mesh_skin_surface_3(skin_surface, p);
|
||||
|
||||
|
||||
assert(p.is_valid() && p.is_closed());
|
||||
|
||||
//std::cout << p << std::endl;
|
||||
}
|
||||
|
||||
private:
|
||||
double s;
|
||||
};
|
||||
|
||||
|
||||
int main(int, char **) {
|
||||
|
||||
int main(int, char **)
|
||||
{
|
||||
std::vector<std::string> filenames;
|
||||
filenames.push_back("data/test1.cin");
|
||||
filenames.push_back("data/test2.cin");
|
||||
|
|
@ -63,7 +65,7 @@ int main(int, char **) {
|
|||
filenames.push_back("data/test9.cin");
|
||||
filenames.push_back("data/test10.cin");
|
||||
filenames.push_back("data/test11.cin");
|
||||
|
||||
|
||||
std::for_each(filenames.begin(), filenames.end(), Test_file(.5));
|
||||
std::for_each(filenames.begin(), filenames.end(), Test_file(.85));
|
||||
|
||||
|
|
|
|||
|
|
@ -22,7 +22,8 @@ typedef CGAL::Polyhedron_3<K,Poly_items_skin> Polyhedron_skin;
|
|||
|
||||
#include <fstream>
|
||||
|
||||
Skin_surface_3 create_skin_surface(std::string &filename, double shrink) {
|
||||
Skin_surface_3 create_skin_surface(std::string &filename, double shrink)
|
||||
{
|
||||
std::list<Weighted_point> l;
|
||||
std::ifstream in(filename.c_str());
|
||||
assert(in.is_open());
|
||||
|
|
@ -34,7 +35,7 @@ Skin_surface_3 create_skin_surface(std::string &filename, double shrink) {
|
|||
|
||||
template < class Skin_surface_3, class Polyhedron>
|
||||
void construct_and_subdivide_mesh(Skin_surface_3 &skin_surface,
|
||||
Polyhedron &polyhedron)
|
||||
Polyhedron &polyhedron)
|
||||
{
|
||||
CGAL::mesh_skin_surface_3(skin_surface, polyhedron);
|
||||
assert(polyhedron.is_valid() && polyhedron.is_closed());
|
||||
|
|
@ -43,29 +44,33 @@ void construct_and_subdivide_mesh(Skin_surface_3 &skin_surface,
|
|||
assert(polyhedron.is_valid() && polyhedron.is_closed());
|
||||
}
|
||||
|
||||
class Test_file {
|
||||
class Test_file
|
||||
{
|
||||
public:
|
||||
Test_file(double shrink) : s(shrink) {
|
||||
}
|
||||
void operator()(std::string &filename) {
|
||||
|
||||
void operator()(std::string &filename)
|
||||
{
|
||||
std::cout << filename << std::endl;
|
||||
|
||||
|
||||
Skin_surface_3 skin_surface = create_skin_surface(filename, .5);
|
||||
|
||||
|
||||
Polyhedron p;
|
||||
//construct_and_subdivide_mesh(skin_surface, p);
|
||||
//p.clear();
|
||||
|
||||
|
||||
Polyhedron_skin p_skin;
|
||||
construct_and_subdivide_mesh(skin_surface, p_skin);
|
||||
p_skin.clear();
|
||||
}
|
||||
|
||||
private:
|
||||
double s;
|
||||
};
|
||||
|
||||
int main(int, char **) {
|
||||
|
||||
int main(int, char **)
|
||||
{
|
||||
std::vector<std::string> filenames;
|
||||
filenames.push_back("data/caffeine.cin");
|
||||
filenames.push_back("data/ball.cin");
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ typedef CGAL::Polyhedron_3<Traits> Polyhedron;
|
|||
CGAL::Cartesian_converter<Exact_K,Inexact_K> e2i_converter;
|
||||
CGAL::Cartesian_converter<Inexact_K,Exact_K> i2e_converter;
|
||||
|
||||
// Triangulated_mixed_complex:
|
||||
// Triangulated_mixed_complex:
|
||||
typedef Skin_surface::TMC TMC;
|
||||
|
||||
typedef TMC::Vertex_iterator TMC_Vertex_iterator;
|
||||
|
|
@ -40,54 +40,57 @@ class Test_file {
|
|||
public:
|
||||
Test_file(double shrink) : s(shrink) {
|
||||
}
|
||||
void operator()(std::string & filename) {
|
||||
|
||||
void operator()(std::string & filename)
|
||||
{
|
||||
std::cout << s << " " << filename << std::endl;
|
||||
|
||||
|
||||
std::ifstream in(filename.c_str());
|
||||
|
||||
|
||||
std::list<Weighted_point> l;
|
||||
double x,y,z,w;
|
||||
while (in >> x >> y >> z >> w)
|
||||
while (in >> x >> y >> z >> w)
|
||||
l.push_front(Weighted_point(Bare_point(x,y,z),w));
|
||||
|
||||
|
||||
Skin_surface skin_surface(l.begin(), l.end(), s);
|
||||
|
||||
|
||||
TMC &tmc = skin_surface.triangulated_mixed_complex();
|
||||
// CGAL::Triangulated_mixed_complex_observer_3<TMC, Skin_surface>
|
||||
// observer(skin_surface.shrink_factor());
|
||||
// triangulate_mixed_complex_3(skin_surface.get_regular_triangulation(),
|
||||
// skin_surface.shrink_factor(),
|
||||
// tmc,
|
||||
// observer,
|
||||
// false);
|
||||
// CGAL::Triangulated_mixed_complex_observer_3<TMC, Skin_surface>
|
||||
// observer(skin_surface.shrink_factor());
|
||||
// triangulate_mixed_complex_3(skin_surface.get_regular_triangulation(),
|
||||
// skin_surface.shrink_factor(),
|
||||
// tmc,
|
||||
// observer,
|
||||
// false);
|
||||
|
||||
for (TMC_Finite_vertices_iterator vit = tmc.finite_vertices_begin();
|
||||
vit != tmc.finite_vertices_end(); vit++) {
|
||||
|
||||
vit != tmc.finite_vertices_end(); vit++) {
|
||||
|
||||
if (tmc.is_infinite(vit->cell())) {
|
||||
std::cerr << "ERROR: is_infinite (main)" << std::endl;
|
||||
std::cerr << "ERROR: is_infinite (main)" << std::endl;
|
||||
}
|
||||
Exact_K::FT val = vit->cell()->info().second->value(vit->point());
|
||||
std::list<TMC_Cell_handle> cells;
|
||||
tmc.incident_cells(vit, std::back_inserter(cells));
|
||||
for (std::list<TMC_Cell_handle>::iterator cell =
|
||||
cells.begin();
|
||||
cell != cells.end(); cell++) {
|
||||
if (!tmc.is_infinite(*cell)) {
|
||||
Exact_K::FT val2 = (*cell)->info().second->value(vit->point());
|
||||
// NGHK: Make exact:
|
||||
//assert(val == val2);
|
||||
assert(std::abs(CGAL::to_double(val-val2)) < 1e-8);
|
||||
}
|
||||
for (std::list<TMC_Cell_handle>::iterator cell =
|
||||
cells.begin();
|
||||
cell != cells.end(); cell++) {
|
||||
if (!tmc.is_infinite(*cell)) {
|
||||
Exact_K::FT val2 = (*cell)->info().second->value(vit->point());
|
||||
// NGHK: Make exact:
|
||||
//assert(val == val2);
|
||||
assert(std::abs(CGAL::to_double(val-val2)) < 1e-8);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private:
|
||||
double s;
|
||||
};
|
||||
|
||||
int main(int , char **) {
|
||||
int main(int , char **)
|
||||
{
|
||||
std::vector<std::string> filenames;
|
||||
filenames.push_back("data/test1.cin");
|
||||
filenames.push_back("data/test2.cin");
|
||||
|
|
@ -101,7 +104,7 @@ int main(int , char **) {
|
|||
filenames.push_back("data/test10.cin");
|
||||
filenames.push_back("data/test11.cin");
|
||||
filenames.push_back("data/degenerate.cin");
|
||||
|
||||
|
||||
std::for_each(filenames.begin(), filenames.end(), Test_file(.5));
|
||||
std::for_each(filenames.begin(), filenames.end(), Test_file(.85));
|
||||
|
||||
|
|
|
|||
|
|
@ -2,7 +2,8 @@
|
|||
#include <CGAL/Polyhedron_3.h>
|
||||
#include <CGAL/Union_of_balls_3.h>
|
||||
|
||||
int main(int, char *[]) {
|
||||
int main(int, char *[])
|
||||
{
|
||||
double pts[][3]={{3.3874, 3.3577, 2.86547},
|
||||
{4.20832, 3.04325, 3.05838},
|
||||
{3.63033, 2.62921, 2.50657},
|
||||
|
|
@ -20,13 +21,15 @@ int main(int, char *[]) {
|
|||
std::vector<Weighted_point> l(size);
|
||||
for (size_t i=0; i< size; ++i) {
|
||||
l[i]= Weighted_point(Bare_point(pts[i][0], pts[i][1], pts[i][2]),
|
||||
.9*.9);
|
||||
.9*.9);
|
||||
std::cout << ".color " << i << std::endl;
|
||||
std::cout << ".sphere " << pts[i][0] << " " << pts[i][1] << " " << pts[i][2] << " "
|
||||
<< .9 << std::endl;
|
||||
}
|
||||
|
||||
CGAL::Polyhedron_3<IKernel> p;
|
||||
CGAL::Union_of_balls_3<CGAL::Skin_surface_traits_3<IKernel> >
|
||||
skin_surface(l.begin(), l.end());
|
||||
skin_surface(l.begin(), l.end());
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,7 +2,8 @@
|
|||
#include <CGAL/Polyhedron_3.h>
|
||||
#include <CGAL/Union_of_balls_3.h>
|
||||
|
||||
int main(int, char *[]) {
|
||||
int main(int, char *[])
|
||||
{
|
||||
double pts[][3]={{3.3874, 3.3577, 2.86547},
|
||||
{4.20832, 3.04325, 3.05838},
|
||||
{3.63033, 2.62921, 2.50657},
|
||||
|
|
@ -20,13 +21,14 @@ int main(int, char *[]) {
|
|||
std::vector<Weighted_point> l(size);
|
||||
for (size_t i=0; i< size; ++i) {
|
||||
l[i]= Weighted_point(Bare_point(pts[i][0], pts[i][1], pts[i][2]),
|
||||
.9*.9);
|
||||
.9*.9);
|
||||
std::cout << ".color " << i << std::endl;
|
||||
std::cout << ".sphere " << pts[i][0] << " " << pts[i][1] << " " << pts[i][2] << " "
|
||||
<< .9 << std::endl;
|
||||
}
|
||||
|
||||
CGAL::Polyhedron_3<Kernel> p;
|
||||
CGAL::Union_of_balls_3<CGAL::Skin_surface_traits_3<Kernel> >
|
||||
skin_surface(l.begin(), l.end());
|
||||
skin_surface(l.begin(), l.end());
|
||||
return 0;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue