bugfix on triangulation package

This commit is contained in:
Miguel Granados 2003-12-17 15:41:44 +00:00
parent fc4310b341
commit c8de8bb80c
4 changed files with 39 additions and 28 deletions

View File

@ -22,6 +22,10 @@
#ifndef CGAL_SNC_DECORATOR_H
#define CGAL_SNC_DECORATOR_H
//#define CGAL_NEF3_SM_VISUALIZOR
//#define CGAL_NEF3_DUMP_SPHERE_MAPS
//#define CGAL_NEF3_DUMP_SNC_OPERATORS
#include <CGAL/basic.h>
#include <CGAL/Nef_3/Normalizing.h>
#include <CGAL/Unique_hash_map.h>
@ -43,7 +47,6 @@
#endif // CGAL_NEF3_SM_VISUALIZOR
#undef _DEBUG
#define _DEBUG 19
//#define CGAL_NEF3_DUMP_SPHERE_MAPS
#include <CGAL/Nef_3/debug.h>
CGAL_BEGIN_NAMESPACE
@ -205,7 +208,7 @@ public:
/* Halffacet queries */
using(point);
// using(tmp_point);
using(tmp_point);
// using(calc_point);
using(segment);
@ -331,7 +334,7 @@ public:
ep.hw().eval_at(1000));
}
Sphere_point tmp_point(Halfedge_handle e) const
const Sphere_point& tmp_point(Halfedge_handle e) const
{ return e->tmp_point(); }
Sphere_point calc_point(Halfedge_handle e) const
{ CGAL_nef3_assertion(twin(e)!=Halfedge_handle());
@ -807,6 +810,7 @@ public:
TRACEN(v0->debug());
TRACEN(v1->debug());
IO0.debug(); IO1.debug();
IO0.print(); IO1.print();
#endif // CGAL_NEF3_DUMP_SPHERE_MAPS
CGAL_assertion( point(v0) == point(v1));
Vertex_handle v01 = rsnc.new_vertex( point(v0), BOP( mark(v0),mark(v1)));
@ -986,9 +990,9 @@ public:
CGAL_nef3_assertion( result.is_empty());
CGAL_nef3_assertion( pl1 != NULL);
// Progress_indicator_cout v_qualifying
// (sncp()->number_of_vertices()+snc1i.number_of_vertices(),
// "binary_operator: qualifying vertices...");
Progress_indicator_clog v_qualifying
(sncp()->number_of_vertices()+snc1i.number_of_vertices(),
"binary_operator: qualifying vertices...");
Unique_hash_map<Vertex_handle, bool> ignore(false);
Vertex_iterator v0, v1;
@ -997,19 +1001,20 @@ public:
// SETDTHREAD(19*131*43);
TRACEN("=> binary operation");
/*
#ifdef CGAL_NEF3_DUMP_SNC_OPERATORS
TRACEN("=> first operand:");
SNC_io_parser<SNC_structure> O0(std::cout, *sncp());
O0.print();
TRACEN("=> second operand:");
SNC_io_parser<SNC_structure> O1(std::cout, snc1i);
O1.print();
*/
#endif // CGAL_NEF3_DUMP_SNC_OPERATORS
TRACEN("\nnumber of vertices (so far...) = "<<result.number_of_vertices());
TRACEN("=> for all v0 in snc0, qualify v0 with respect snc1");
CGAL_nef3_forall_vertices( v0, *sncp()) {
// v_qualifying++;
v_qualifying++;
CGAL_nef3_assertion(!ignore[v0]);
Point_3 p0(point(v0));
Vertex_handle v;
@ -1054,7 +1059,7 @@ public:
TRACEN("=> for all v1 in snc1, qualify v1 with respect snc0");
CGAL_nef3_forall_vertices( v1, snc1i) {
// v_qualifying++;
v_qualifying++;
if(ignore[v1]) continue;
Point_3 p1(point(v1));
Vertex_handle v;
@ -1102,9 +1107,9 @@ public:
Halfedge_iterator e0, e1;
// Progress_indicator_cout ee_intersections
// (sncp()->number_of_edges(),
// "binary_operator: finding edge-edge intersections...");
Progress_indicator_clog ee_intersections
(sncp()->number_of_edges(),
"binary_operator: finding edge-edge intersections...");
Intersection_call_back<Selection> call_back0
( *sncp(), snc1i, BOP, result);
@ -1113,26 +1118,26 @@ public:
TRACEN("=> finding edge-edge intersections...");
CGAL_nef3_forall_edges( e0, *sncp()) {
// ee_intersections++;
ee_intersections++;
pl1->intersect_with_edges( e0, call_back0);
}
TRACEN("\nnumber of vertices (so far...) = "<<result.number_of_vertices());
// Progress_indicator_cout ef_intersections
// (sncp()->number_of_edges()+snc1i.number_of_edges(),
// "binary_operator: finding edge-facet intersections...");
Progress_indicator_clog ef_intersections
(sncp()->number_of_edges()+snc1i.number_of_edges(),
"binary_operator: finding edge-facet intersections...");
TRACEN("number of vertices (so far...) = "<<result.number_of_vertices());
TRACEN("=> finding edge0-facet1 intersections...");
CGAL_nef3_forall_edges( e0, *sncp()) {
// ef_intersections++;
ef_intersections++;
pl1->intersect_with_facets( e0, call_back0);
}
TRACEN("\nnumber of vertices (so far...) = "<<result.number_of_vertices());
TRACEN("=> finding edge1-facet0 intersections...");
CGAL_nef3_forall_edges( e1, snc1i) {
// ef_intersections++;
ef_intersections++;
pl()->intersect_with_facets( e1, call_back1);
}
TRACEN("\nnumber of vertices (so far...) = "<<result.number_of_vertices());
@ -1141,6 +1146,7 @@ public:
CGAL_nef3_forall_vertices( v0, result) TRACEN(&*v0<<" "<<point(v0));
result.vertex_simplification(NO_SNC);
TRACEN("\nnumber of vertices (so far...) = "<<result.number_of_vertices());
TRACEN("=> resultant vertices (after simplification): ");
CGAL_nef3_forall_vertices( v0, result) TRACEN(&*v0<<" "<<point(v0));

View File

@ -35,7 +35,6 @@
#include <CGAL/Nef_polyhedron_3.h>
#include <CGAL/Nef_3/SNC_intersection.h>
#include <CGAL/Timer.h>
#include <fstream>
template<typename Kernel>
@ -150,8 +149,9 @@ private:
Nef_polyhedron load_off( char* name) {
Polyhedron poly;
std::ifstream in(name);
in >> poly;
std::ifstream off_file(name);
CGAL_assertion(off_file != NULL);
off_file >> poly;
Nef_polyhedron N(poly);
return N;
}
@ -903,7 +903,7 @@ private:
CGAL_assertion(N.is_valid(0,0));
CGAL_assertion(does_nef3_equals_file(N,"cube_created_from_halfspaces.nef3.SH"));
}
Nef_polyhedron N,N2,P,R,S,T;
N = load_off("data/centered_cube.off");
CGAL_assertion(N.is_valid(0,0));
@ -1052,11 +1052,12 @@ template<typename Kernel>
const char* test<Kernel>::datadir="data/";
int main() {
typedef CGAL::Gmpz NT;
typedef CGAL::Simple_homogeneous<NT> SH_Kernel;
typedef CGAL::Extended_homogeneous_3<NT> EH_Kernel;
//std::cin>>debugthread;
CGAL::Timer t;
t.start();

View File

@ -51,10 +51,10 @@ class Partition_traits_2 : public Partition_traits_2_base<Kernel_>
typedef CGAL::Polygon_2<Poly_Traits, Container> Polygon_2;
typedef typename Kernel::Less_yx_2 Less_yx_2;
typedef typename Kernel::Less_xy_2 Less_xy_2;
typedef typename Kernel::Left_turn_2 Left_turn_2;
typedef typename Kernel::Left_turn_2 Left_turn_2;
typedef typename Kernel::Orientation_2 Orientation_2;
typedef typename Kernel::Compare_y_2 Compare_y_2;
typedef typename Kernel::Compare_x_2 Compare_x_2;
typedef CGAL::Is_convex_2<Self> Is_convex_2;
typedef CGAL::Is_y_monotone_2<Self> Is_y_monotone_2;

View File

@ -89,9 +89,13 @@ Partition_y_mono_vertex_type partition_y_mono_vertex_type(
<< " c " << *c << " next " << *next << std::endl;
#endif
typename Traits::Compare_y_2 compare_y_2 = traits.compare_y_2_object();
typename Traits::Collinear_are_ordered_along_line_2
collinear_are_ordered_along_line_2
= traits.collinear_are_ordered_along_line_2_object();
if (compare_y_2(*previous, *c) == EQUAL &&
compare_y_2(*next, *c) == EQUAL)
compare_y_2(*next, *c) == EQUAL &&
collinear_are_ordered_along_line_2( *previous, *c, *next))
return PARTITION_Y_MONO_COLLINEAR_VERTEX;
typename Traits::Less_yx_2 less_yx = traits.less_yx_2_object();
@ -470,7 +474,7 @@ void partition_y_monotone_2( InputIterator first, InputIterator beyond,
#ifdef CGAL_PARTITION_Y_MONOTONE_DEBUG
std::cout << "Initial vertex list: ";
for(std::vector<Circulator>::const_iterator it = circulators.begin();
for( typename std::vector<Circulator>::const_iterator it = circulators.begin();
it != circulators.end();
it++){
std::cout << **it << " " ;