The tests are working, if they finish in time ...

This commit is contained in:
Nico Kruithof 2006-10-26 18:57:24 +00:00
parent b09c1ff0de
commit 49e37f31b8
6 changed files with 35 additions and 35 deletions

View File

@ -15,7 +15,7 @@
typedef CGAL::Exact_predicates_inexact_constructions_kernel K; typedef CGAL::Exact_predicates_inexact_constructions_kernel K;
typedef CGAL::Skin_surface_traits_3<K> Traits; typedef CGAL::Skin_surface_traits_3<K> Traits;
typedef CGAL::Skin_surface_3<Traits> Skin_surface_3; typedef CGAL::Skin_surface_3<Traits> Skin_surface_3;
typedef Skin_surface_3::RT RT; typedef Skin_surface_3::FT FT;
typedef Skin_surface_3::Weighted_point Weighted_point; typedef Skin_surface_3::Weighted_point Weighted_point;
typedef Weighted_point::Point Bare_point; typedef Weighted_point::Point Bare_point;
typedef CGAL::Polyhedron_3<K, typedef CGAL::Polyhedron_3<K,
@ -28,7 +28,7 @@ int main(int argc, char *argv[]) {
} }
std::list<Weighted_point> l; std::list<Weighted_point> l;
RT shrinkfactor = 0.5; FT shrinkfactor = 0.5;
Weighted_point wp; Weighted_point wp;
std::ifstream in(argv[1]); std::ifstream in(argv[1]);
@ -47,7 +47,7 @@ int main(int argc, char *argv[]) {
std::cout << "Is closed: " << (p.is_closed() ? "Yes" : "No") << std::endl; std::cout << "Is closed: " << (p.is_closed() ? "Yes" : "No") << std::endl;
std::ofstream out("mesh.off"); std::ofstream out("mesh.off");
write_polyhedron_with_normals(p, skin_surface, out); write_polyhedron_with_normals(skin_surface, p, out);
// out << p; // out << p;
return 0; return 0;

View File

@ -256,6 +256,7 @@ private:
return CMCT_Cell(); return CMCT_Cell();
} }
public:
Simplex locate_mixed(const Bare_point &p, Simplex locate_mixed(const Bare_point &p,
const Simplex &start = Simplex()) const; const Simplex &start = Simplex()) const;
@ -545,6 +546,7 @@ private:
// NGHK: Make adaptive // NGHK: Make adaptive
return 1; return 1;
} }
public:
const Regular &get_regular_triangulation() const { const Regular &get_regular_triangulation() const {
return regular; return regular;
} }

View File

@ -26,24 +26,24 @@ template < class SkinSurfaceQuadraticSurfaceTraits_3 >
class Skin_surface_quadratic_surface_3 { class Skin_surface_quadratic_surface_3 {
public: public:
typedef SkinSurfaceQuadraticSurfaceTraits_3 K; typedef SkinSurfaceQuadraticSurfaceTraits_3 K;
typedef typename K::RT RT; typedef typename K::FT FT;
typedef typename K::Point_3 Point; typedef typename K::Point_3 Point;
typedef typename K::Vector_3 Vector; typedef typename K::Vector_3 Vector;
typedef typename K::Segment_3 Segment; typedef typename K::Segment_3 Segment;
typedef Weighted_point<Point,RT> Weighted_point; typedef Weighted_point<Point,FT> Weighted_point;
Skin_surface_quadratic_surface_3() 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; for (int i=0; i<6; i++) Q[i] = 0;
} }
Skin_surface_quadratic_surface_3(RT Qinput[], Point p, RT c, int d) Skin_surface_quadratic_surface_3(FT Qinput[], Point p, FT c, int d)
: dim(10+d), p(p), c(c) : dim(10+d), p(p), c(c)
{ {
for (int i=0; i<6; i++) Q[i] = Qinput[i]; for (int i=0; i<6; i++) Q[i] = Qinput[i];
} }
int dim; int dim;
Skin_surface_quadratic_surface_3(Weighted_point wp0, RT s) 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 : ") + CGAL_PROFILER(std::string("Constructor : ") +
@ -53,7 +53,7 @@ public:
} }
Skin_surface_quadratic_surface_3(Weighted_point wp0, Skin_surface_quadratic_surface_3(Weighted_point wp0,
Weighted_point wp1, Weighted_point wp1,
RT s) : dim(1) FT s) : dim(1)
{ {
CGAL_PROFILER(std::string("Constructor : ") + CGAL_PROFILER(std::string("Constructor : ") +
std::string(CGAL_PRETTY_FUNCTION)); std::string(CGAL_PRETTY_FUNCTION));
@ -62,7 +62,7 @@ public:
c = s*(1-s)*reg_traits.compute_squared_radius_smallest_orthogonal_sphere_3_object()(wp0,wp1); c = s*(1-s)*reg_traits.compute_squared_radius_smallest_orthogonal_sphere_3_object()(wp0,wp1);
Vector t = wp0-wp1; Vector t = wp0-wp1;
RT den = t*t; FT den = t*t;
Q[0] = (- t.x()*t.x()/den + (1-s)); Q[0] = (- t.x()*t.x()/den + (1-s));
Q[1] = (-2*t.y()*t.x()/den); Q[1] = (-2*t.y()*t.x()/den);
@ -76,7 +76,7 @@ public:
Skin_surface_quadratic_surface_3(Weighted_point wp0, Skin_surface_quadratic_surface_3(Weighted_point wp0,
Weighted_point wp1, Weighted_point wp1,
Weighted_point wp2, Weighted_point wp2,
RT s) : dim(2) FT s) : dim(2)
{ {
CGAL_PROFILER(std::string("Constructor : ") + CGAL_PROFILER(std::string("Constructor : ") +
std::string(CGAL_PRETTY_FUNCTION)); std::string(CGAL_PRETTY_FUNCTION));
@ -86,7 +86,7 @@ public:
Vector t = K().construct_orthogonal_vector_3_object()(wp0,wp1,wp2); Vector t = K().construct_orthogonal_vector_3_object()(wp0,wp1,wp2);
RT den = t*t; FT den = t*t;
Q[0] = -(- t.x()*t.x()/den + s); Q[0] = -(- t.x()*t.x()/den + s);
Q[1] = -(-2*t.y()*t.x()/den); Q[1] = -(-2*t.y()*t.x()/den);
@ -101,7 +101,7 @@ public:
Weighted_point wp1, Weighted_point wp1,
Weighted_point wp2, Weighted_point wp2,
Weighted_point wp3, Weighted_point wp3,
RT s) : dim(3) FT s) : dim(3)
{ {
CGAL_PROFILER(std::string("Constructor : ") + CGAL_PROFILER(std::string("Constructor : ") +
std::string(CGAL_PRETTY_FUNCTION)); std::string(CGAL_PRETTY_FUNCTION));
@ -113,12 +113,12 @@ public:
} }
template <class Input_point> template <class Input_point>
RT value(Input_point const &x) const { FT value(Input_point const &x) const {
typedef Cartesian_converter<typename Input_point::R, K> Converter; typedef Cartesian_converter<typename Input_point::R, K> Converter;
RT vx = Converter()(x.x()) - p.x(); FT vx = Converter()(x.x()) - p.x();
RT vy = Converter()(x.y()) - p.y(); FT vy = Converter()(x.y()) - p.y();
RT vz = Converter()(x.z()) - p.z(); FT vz = Converter()(x.z()) - p.z();
return return
vx*(Q[0]*vx) + vx*(Q[0]*vx) +
@ -172,18 +172,18 @@ private:
//template <class Input_point> //template <class Input_point>
Vector compute_gradient(Point const &x) { Vector compute_gradient(Point const &x) {
RT vx = x.x() - p.x(); FT vx = x.x() - p.x();
RT vy = x.y() - p.y(); FT vy = x.y() - p.y();
RT vz = x.z() - p.z(); FT vz = x.z() - p.z();
return Vector(2*Q[0]*vx + Q[1]*vy + Q[3]*vz, return Vector(2*Q[0]*vx + Q[1]*vy + Q[3]*vz,
Q[1]*vx + 2*Q[2]*vy + Q[4]*vz, Q[1]*vx + 2*Q[2]*vy + Q[4]*vz,
Q[3]*vx + Q[4]*vy + 2*Q[5]*vz); Q[3]*vx + Q[4]*vy + 2*Q[5]*vz);
} }
RT Q[6]; FT Q[6];
Point p; Point p;
RT c; FT c;
}; };
CGAL_END_NAMESPACE CGAL_END_NAMESPACE

View File

@ -11,7 +11,7 @@
typedef CGAL::Exact_predicates_inexact_constructions_kernel K; typedef CGAL::Exact_predicates_inexact_constructions_kernel K;
typedef CGAL::Skin_surface_traits_3<K> Traits; typedef CGAL::Skin_surface_traits_3<K> Traits;
typedef CGAL::Skin_surface_3<Traits> Skin_surface_3; typedef CGAL::Skin_surface_3<Traits> Skin_surface_3;
typedef Skin_surface_3::RT RT; typedef Skin_surface_3::FT FT;
typedef Skin_surface_3::Weighted_point Weighted_point; typedef Skin_surface_3::Weighted_point Weighted_point;
typedef Weighted_point::Point Bare_point; typedef Weighted_point::Point Bare_point;
typedef CGAL::Polyhedron_3<K> Polyhedron; typedef CGAL::Polyhedron_3<K> Polyhedron;

View File

@ -11,7 +11,7 @@
typedef CGAL::Exact_predicates_inexact_constructions_kernel K; typedef CGAL::Exact_predicates_inexact_constructions_kernel K;
typedef CGAL::Skin_surface_traits_3<K> Traits; typedef CGAL::Skin_surface_traits_3<K> Traits;
typedef CGAL::Skin_surface_3<Traits> Skin_surface_3; typedef CGAL::Skin_surface_3<Traits> Skin_surface_3;
typedef Skin_surface_3::RT RT; typedef Skin_surface_3::FT FT;
typedef Skin_surface_3::Weighted_point Weighted_point; typedef Skin_surface_3::Weighted_point Weighted_point;
typedef Weighted_point::Point Bare_point; typedef Weighted_point::Point Bare_point;
typedef CGAL::Polyhedron_3<K> Polyhedron; typedef CGAL::Polyhedron_3<K> Polyhedron;
@ -38,7 +38,7 @@ void construct_and_subdivide_mesh(Skin_surface_3 &skin_surface,
CGAL::mesh_skin_surface_3(skin_surface, polyhedron); CGAL::mesh_skin_surface_3(skin_surface, polyhedron);
CGAL_assertion(polyhedron.is_valid() && polyhedron.is_closed()); CGAL_assertion(polyhedron.is_valid() && polyhedron.is_closed());
CGAL::subdivide_skin_surface_mesh_3(polyhedron, skin_surface); CGAL::subdivide_skin_surface_mesh_3(skin_surface, polyhedron);
CGAL_assertion(polyhedron.is_valid() && polyhedron.is_closed()); CGAL_assertion(polyhedron.is_valid() && polyhedron.is_closed());
} }

View File

@ -12,7 +12,7 @@ typedef CGAL::Exact_predicates_inexact_constructions_kernel Inexact_K;
typedef CGAL::Skin_surface_traits_3<Inexact_K> Traits; typedef CGAL::Skin_surface_traits_3<Inexact_K> Traits;
typedef CGAL::Skin_surface_3<Traits> Skin_surface_3; typedef CGAL::Skin_surface_3<Traits> Skin_surface_3;
typedef Skin_surface_3::Simplex Simplex; typedef Skin_surface_3::Simplex Simplex;
typedef Skin_surface_3::RT RT; typedef Skin_surface_3::FT FT;
typedef Skin_surface_3::Weighted_point Weighted_point; typedef Skin_surface_3::Weighted_point Weighted_point;
typedef Weighted_point::Point Bare_point; typedef Weighted_point::Point Bare_point;
typedef CGAL::Polyhedron_3<Traits> Polyhedron; typedef CGAL::Polyhedron_3<Traits> Polyhedron;
@ -22,12 +22,10 @@ typedef CGAL::Skin_surface_quadratic_surface_3<Exact_K> Quadratic_surface;
CGAL::Cartesian_converter<Exact_K,Inexact_K> e2i_converter; CGAL::Cartesian_converter<Exact_K,Inexact_K> e2i_converter;
CGAL::Cartesian_converter<Inexact_K,Exact_K> i2e_converter; CGAL::Cartesian_converter<Inexact_K,Exact_K> i2e_converter;
typedef CGAL::Triangulation_3< typedef CGAL::Triangulation_vertex_base_with_info_3<Simplex, Exact_K> Vb;
Exact_K, typedef CGAL::Triangulation_cell_base_with_info_3<Quadratic_surface *, Exact_K> Cb;
CGAL::Triangulation_data_structure_3 typedef CGAL::Triangulation_data_structure_3<Vb,Cb> Tds;
< CGAL::Triangulated_mixed_complex_vertex_3<Exact_K>, typedef CGAL::Triangulation_3<Exact_K, Tds> Triangulated_mixed_complex;
CGAL::Triangulated_mixed_complex_cell_3<Exact_K,Quadratic_surface> >
> Triangulated_mixed_complex;
//typedef Skin_surface_3::Triangulated_mixed_complex Triangulated_mixed_complex; //typedef Skin_surface_3::Triangulated_mixed_complex Triangulated_mixed_complex;
typedef Triangulated_mixed_complex::Vertex_handle Tmc_Vertex_handle; typedef Triangulated_mixed_complex::Vertex_handle Tmc_Vertex_handle;
typedef Triangulated_mixed_complex::Finite_vertices_iterator typedef Triangulated_mixed_complex::Finite_vertices_iterator
@ -63,14 +61,14 @@ public:
if (tmc.is_infinite(vit->cell())) { if (tmc.is_infinite(vit->cell())) {
std::cerr << "ERROR: is_infinite (main)" << std::endl; std::cerr << "ERROR: is_infinite (main)" << std::endl;
} }
Quadratic_surface::RT val = vit->cell()->surf->value(vit->point()); Quadratic_surface::FT val = vit->cell()->info()->value(vit->point());
std::list<Triangulated_mixed_complex::Cell_handle> cells; std::list<Triangulated_mixed_complex::Cell_handle> cells;
tmc.incident_cells(vit, std::back_inserter(cells)); tmc.incident_cells(vit, std::back_inserter(cells));
for (std::list<Triangulated_mixed_complex::Cell_handle>::iterator cell = for (std::list<Triangulated_mixed_complex::Cell_handle>::iterator cell =
cells.begin(); cells.begin();
cell != cells.end(); cell++) { cell != cells.end(); cell++) {
if (!tmc.is_infinite(*cell)) { if (!tmc.is_infinite(*cell)) {
Quadratic_surface::RT val2 = (*cell)->surf->value(vit->point()); Quadratic_surface::FT val2 = (*cell)->info()->value(vit->point());
CGAL_assertion(val == val2); CGAL_assertion(val == val2);
} }
} }
@ -84,9 +82,9 @@ public:
(cit->vertex(2)->point()-cit->vertex(0)->point())/4 + (cit->vertex(2)->point()-cit->vertex(0)->point())/4 +
(cit->vertex(3)->point()-cit->vertex(0)->point())/4); (cit->vertex(3)->point()-cit->vertex(0)->point())/4);
if (tmc.tetrahedron(cit).has_on_bounded_side(i2e_converter(baryc))) { if (tmc.tetrahedron(cit).has_on_bounded_side(i2e_converter(baryc))) {
Quadratic_surface::RT val1 = cit->surf->value(i2e_converter(baryc)); Quadratic_surface::FT val1 = cit->info()->value(i2e_converter(baryc));
Simplex s = skin_surface.locate_mixed(baryc); Simplex s = skin_surface.locate_mixed(baryc);
Quadratic_surface::RT val2 = Quadratic_surface::FT val2 =
skin_surface.construct_surface(s, Exact_K()).value(i2e_converter(baryc)); skin_surface.construct_surface(s, Exact_K()).value(i2e_converter(baryc));
// std::cout << val1 << " " << val2 << " " << val2-val1 << std::endl; // std::cout << val1 << " " << val2 << " " << val2-val1 << std::endl;
CGAL_assertion(val1==val2); CGAL_assertion(val1==val2);