CGAL Examples: CGAL_assertion -> assert

This commit is contained in:
Andreas Fabri 2022-01-24 10:19:04 +00:00
parent ad08f020b6
commit 79a38d5cb9
50 changed files with 124 additions and 131 deletions

View File

@ -6,7 +6,6 @@
#include <CGAL/Delaunay_triangulation_2.h>
#include <CGAL/algorithm.h>
#include <CGAL/assertions.h>
#include <fstream>
#include <iostream>

View File

@ -7,6 +7,7 @@
#include <fstream>
#include <iostream>
#include <cassert>
typedef CGAL::Simple_cartesian<double> K;
typedef CGAL::Surface_mesh<K::Point_3> SM;
@ -39,7 +40,7 @@ int main(int argc, char** argv)
// Extract the part n°0 of the partition into a new, independent mesh
typedef CGAL::Face_filtered_graph<SM> Filtered_graph;
Filtered_graph filtered_sm(sm, 0 /*id of th part*/, face_pid_map);
CGAL_assertion(filtered_sm.is_selection_valid());
assert(filtered_sm.is_selection_valid());
SM part_sm;
CGAL::copy_face_graph(filtered_sm, part_sm);

View File

@ -8,6 +8,7 @@
#include <CGAL/function_objects.h>
#include <CGAL/Join_input_iterator.h>
#include <CGAL/Counting_iterator.h>
#include <cassert>
using namespace CGAL;
@ -41,16 +42,16 @@ int main() {
Count_iterator t2_end( t2, 50);
std::copy( t2_begin, t2_end, std::back_inserter(segs));
CGAL_assertion( segs.size() == 100);
assert( segs.size() == 100);
for ( Vector::iterator i = segs.begin(); i != segs.end(); i++){
CGAL_assertion( i->source().x() <= 250);
CGAL_assertion( i->source().x() >= -250);
CGAL_assertion( i->source().y() <= 250);
CGAL_assertion( i->source().y() >= -250);
CGAL_assertion( i->target().x() <= 250);
CGAL_assertion( i->target().x() >= -250);
CGAL_assertion( i->target().y() <= 250);
CGAL_assertion( i->target().y() >= -250);
assert( i->source().x() <= 250);
assert( i->source().x() >= -250);
assert( i->source().y() <= 250);
assert( i->source().y() >= -250);
assert( i->target().x() <= 250);
assert( i->target().x() >= -250);
assert( i->target().y() <= 250);
assert( i->target().y() >= -250);
}
return 0;
}

View File

@ -1,6 +1,7 @@
#include <CGAL/HalfedgeDS_items_2.h>
#include <CGAL/HalfedgeDS_default.h>
#include <CGAL/IO/Color.h>
#include <cassert>
// A face type with a color member variable.
template <class Refs>
@ -30,6 +31,6 @@ int main() {
HDS hds;
Face_handle f = hds.faces_push_back( Face( CGAL::IO::red()));
f->color = CGAL::IO::blue();
CGAL_assertion( f->color == CGAL::IO::blue());
assert( f->color == CGAL::IO::blue());
return 0;
}

View File

@ -2,6 +2,7 @@
#include <CGAL/HalfedgeDS_vector.h>
#include <CGAL/HalfedgeDS_decorator.h>
#include <cstddef>
#include <cassert>
// Define a new halfedge class. We assume that the Halfedge_handle can
// be created from a pointer (e.g. the HalfedgeDS is based here on the
@ -55,15 +56,15 @@ public:
(nxt & (~ std::ptrdiff_t(1))));
}
void set_opposite( Halfedge_handle h) {
CGAL_precondition(( &* h - 1 == &* HDS::halfedge_handle(this)) ||
( &* h + 1 == &* HDS::halfedge_handle(this)));
assert(( &* h - 1 == &* HDS::halfedge_handle(this)) ||
( &* h + 1 == &* HDS::halfedge_handle(this)));
if ( &* h - 1 == &* HDS::halfedge_handle(this))
nxt |= 1;
else
nxt &= (~ std::ptrdiff_t(1));
}
void set_next( Halfedge_handle h) {
CGAL_precondition( ((std::ptrdiff_t)(&*h) & 1) == 0);
assert( ((std::ptrdiff_t)(&*h) & 1) == 0);
nxt = ((std::ptrdiff_t)(&*h)) | (nxt & 1);
}
private: // Support for the Vertex_handle.
@ -99,6 +100,6 @@ int main() {
HDS hds(1,2,2);
Decorator decorator(hds);
decorator.create_loop();
CGAL_assertion( decorator.is_valid());
assert( decorator.is_valid());
return 0;
}

View File

@ -2,6 +2,7 @@
#include <CGAL/HalfedgeDS_list.h>
#include <CGAL/HalfedgeDS_decorator.h>
#include <cstddef>
#include <cassert>
// Define a new halfedge class. We assume that the Halfedge_handle can
// be created from a pointer (e.g. the HalfedgeDS is based here on the
@ -54,15 +55,15 @@ public:
(~ std::ptrdiff_t(1))));
}
void set_opposite( Halfedge_handle h) {
CGAL_precondition(( &* h - 1 == &* HDS::halfedge_handle(this)) ||
( &* h + 1 == &* HDS::halfedge_handle(this)));
asseert(( &* h - 1 == &* HDS::halfedge_handle(this)) ||
( &* h + 1 == &* HDS::halfedge_handle(this)));
if ( &* h - 1 == &* HDS::halfedge_handle(this))
nxt |= 1;
else
nxt &= (~ std::ptrdiff_t(1));
}
void set_next( Halfedge_handle h) {
CGAL_precondition( ((std::ptrdiff_t)(&*h) & 1) == 0);
assert( ((std::ptrdiff_t)(&*h) & 1) == 0);
nxt = ((std::ptrdiff_t)(&*h)) | (nxt & 1);
}
private: // Support for the Vertex_handle.
@ -98,6 +99,6 @@ int main() {
HDS hds;
Decorator decorator(hds);
decorator.create_loop();
CGAL_assertion( decorator.is_valid());
assert( decorator.is_valid());
return 0;
}

View File

@ -1,5 +1,6 @@
#include <CGAL/HalfedgeDS_default.h>
#include <CGAL/HalfedgeDS_decorator.h>
#include <cassert>
struct Traits { typedef int Point_2; };
typedef CGAL::HalfedgeDS_default<Traits> HDS;
@ -9,6 +10,6 @@ int main() {
HDS hds;
Decorator decorator(hds);
decorator.create_loop();
CGAL_assertion( decorator.is_valid());
assert( decorator.is_valid());
return 0;
}

View File

@ -1,6 +1,7 @@
#include <CGAL/HalfedgeDS_default.h>
#include <CGAL/HalfedgeDS_decorator.h>
#include <CGAL/N_step_adaptor.h>
#include <cassert>
struct Traits { typedef int Point_2; };
typedef CGAL::HalfedgeDS_default<Traits> HDS;
@ -13,10 +14,10 @@ int main() {
Decorator decorator(hds);
decorator.create_loop();
decorator.create_segment();
CGAL_assertion( decorator.is_valid());
assert( decorator.is_valid());
int n = 0;
for ( Iterator e = hds.halfedges_begin(); e != hds.halfedges_end(); ++e)
++n;
CGAL_assertion( n == 2); // == 2 edges
assert( n == 2); // == 2 edges
return 0;
}

View File

@ -1,6 +1,7 @@
#include <CGAL/HalfedgeDS_min_items.h>
#include <CGAL/HalfedgeDS_default.h>
#include <CGAL/HalfedgeDS_decorator.h>
#include <cassert>
// no traits needed, argument can be arbitrary dummy.
typedef CGAL::HalfedgeDS_default<int, CGAL::HalfedgeDS_min_items> HDS;
@ -10,6 +11,6 @@ int main() {
HDS hds;
Decorator decorator(hds);
decorator.create_loop();
CGAL_assertion( decorator.is_valid());
assert( decorator.is_valid());
return 0;
}

View File

@ -1,6 +1,7 @@
#include <CGAL/HalfedgeDS_min_items.h>
#include <CGAL/HalfedgeDS_default.h>
#include <CGAL/HalfedgeDS_decorator.h>
#include <cassert>
// An items type using a halfedge with previous-pointer.
struct My_items : public CGAL::HalfedgeDS_min_items {
@ -22,6 +23,6 @@ int main() {
HDS hds;
Decorator decorator(hds);
decorator.create_loop();
CGAL_assertion( decorator.is_valid());
assert( decorator.is_valid());
return 0;
}

View File

@ -1,5 +1,6 @@
#include <CGAL/HalfedgeDS_default.h>
#include <CGAL/HalfedgeDS_decorator.h>
#include <cassert>
struct Traits { typedef int Point_2; };
typedef CGAL::HalfedgeDS_default<Traits> HDS;
@ -11,10 +12,10 @@ int main() {
Decorator decorator(hds);
decorator.create_loop();
decorator.create_segment();
CGAL_assertion( decorator.is_valid());
assert( decorator.is_valid());
int n = 0;
for ( Iterator i = hds.halfedges_begin(); i != hds.halfedges_end(); ++i )
++n;
CGAL_assertion( n == 4); // == 2 edges
assert( n == 4); // == 2 edges
return 0;
}

View File

@ -8,6 +8,7 @@
#include <CGAL/make_mesh_3.h>
#include <cstdlib>
#include <cassert>
// Domain
typedef CGAL::Exact_predicates_inexact_constructions_kernel K;
@ -54,8 +55,7 @@ const std::pair<int, int> incident_subdomains[] = {
int main()
{
const std::size_t nb_patches = sizeof(filenames) / sizeof(const char*);
CGAL_assertion(sizeof(incident_subdomains) ==
nb_patches * sizeof(std::pair<int, int>));
assert(sizeof(incident_subdomains) == nb_patches * sizeof(std::pair<int, int>));
std::vector<Polyhedron> patches(nb_patches);
for(std::size_t i = 0; i < nb_patches; ++i) {
std::ifstream input(CGAL::data_file_path(filenames[i]));

View File

@ -9,6 +9,7 @@
#include <CGAL/Polyhedral_complex_mesh_domain_3.h>
#include <CGAL/make_mesh_3.h>
#include <cstdlib>
#include <cassert>
// Domain
typedef CGAL::Exact_predicates_inexact_constructions_kernel K;
@ -63,8 +64,8 @@ int main()
#endif
const std::size_t nb_patches = sizeof(filenames) / sizeof(const char*);
CGAL_assertion(sizeof(incident_subdomains) ==
nb_patches * sizeof(std::pair<int, int>));
assert(sizeof(incident_subdomains) ==
nb_patches * sizeof(std::pair<int, int>));
std::vector<Face_graph> patches(nb_patches);
for(std::size_t i = 0; i < nb_patches; ++i) {
std::ifstream input(CGAL::data_file_path(filenames[i]));

View File

@ -1,6 +1,7 @@
#include <CGAL/Exact_integer.h>
#include <CGAL/Filtered_extended_homogeneous.h>
#include <CGAL/Nef_polyhedron_2.h>
#include <cassert>
typedef CGAL::Exact_integer RT;
typedef CGAL::Filtered_extended_homogeneous<RT> Extended_kernel;
@ -15,13 +16,13 @@ int main() {
Line l(2,4,2); // l : 2x + 4y + 2 = 0
Nef_polyhedron N2(l,Nef_polyhedron::INCLUDED);
Nef_polyhedron N3 = N2.complement();
CGAL_assertion(N1 == N2.join(N3));
assert(N1 == N2.join(N3));
Point p1(0,0), p2(10,10), p3(-20,15);
Point triangle[3] = { p1, p2, p3 };
Nef_polyhedron N4(triangle, triangle+3);
Nef_polyhedron N5 = N2.intersection(N4);
CGAL_assertion(N5 <= N2 && N5 <= N4);
assert(N5 <= N2 && N5 <= N4);
return 0;
}

View File

@ -1,6 +1,7 @@
#include <CGAL/Exact_integer.h>
#include <CGAL/Extended_homogeneous.h>
#include <CGAL/Nef_polyhedron_3.h>
#include <cassert>
typedef CGAL::Exact_integer NT;
typedef CGAL::Extended_homogeneous<NT> Kernel;
@ -12,16 +13,16 @@ int main() {
Nef_polyhedron N1(Plane_3(2,5,7,11), Nef_polyhedron::INCLUDED);
Nef_polyhedron N2(Plane_3(2,5,7,11), Nef_polyhedron::EXCLUDED);
CGAL_assertion(N1 >= N2);
CGAL_assertion(N2 <= N1);
CGAL_assertion(N1 != N2);
CGAL_assertion(N1 > N2);
CGAL_assertion(N2 < N1);
assert(N1 >= N2);
assert(N2 <= N1);
assert(N1 != N2);
assert(N1 > N2);
assert(N2 < N1);
N2 = N2.closure();
CGAL_assertion(N1==N2);
CGAL_assertion(N1>=N2);
CGAL_assertion(N1<=N2);
assert(N1==N2);
assert(N1>=N2);
assert(N1<=N2);
return 0;
}

View File

@ -1,6 +1,7 @@
#include <CGAL/Exact_integer.h>
#include <CGAL/Extended_homogeneous.h>
#include <CGAL/Nef_polyhedron_3.h>
#include <cassert>
typedef CGAL::Extended_homogeneous<CGAL::Exact_integer> Kernel;
typedef CGAL::Nef_polyhedron_3<Kernel> Nef_polyhedron;
@ -14,19 +15,19 @@ int main() {
Nef_polyhedron N4(Plane_3( 1, 2, 5,-1), Nef_polyhedron::INCLUDED);
Nef_polyhedron N5(Plane_3( 1, 2, 5,-1), Nef_polyhedron::EXCLUDED);
CGAL_assertion(N0 == N1);
CGAL_assertion(N3 == N4);
CGAL_assertion(N0 != N2);
CGAL_assertion(N3 != N5);
assert(N0 == N1);
assert(N3 == N4);
assert(N0 != N2);
assert(N3 != N5);
CGAL_assertion(N4 >= N5);
CGAL_assertion(N5 <= N4);
CGAL_assertion(N4 > N5);
CGAL_assertion(N5 < N4);
assert(N4 >= N5);
assert(N5 <= N4);
assert(N4 > N5);
assert(N5 < N4);
N5 = N5.closure();
CGAL_assertion(N4 >= N5);
CGAL_assertion(N4 <= N5);
assert(N4 >= N5);
assert(N4 <= N5);
return 0;
}

View File

@ -1,6 +1,7 @@
#include <CGAL/Exact_integer.h>
#include <CGAL/Homogeneous.h>
#include <CGAL/Nef_polyhedron_3.h>
#include <cassert>
typedef CGAL::Homogeneous<CGAL::Exact_integer> Kernel;
typedef CGAL::Nef_polyhedron_3<Kernel> Nef_polyhedron;
@ -9,7 +10,7 @@ int main() {
Nef_polyhedron N0(Nef_polyhedron::EMPTY);
Nef_polyhedron N1(Nef_polyhedron::COMPLETE);
CGAL_assertion (N0 == N1.complement());
CGAL_assertion (N0 != N1);
assert(N0 == N1.complement());
assert(N0 != N1);
return 0;
}

View File

@ -1,6 +1,7 @@
#include <CGAL/Exact_integer.h>
#include <CGAL/Extended_homogeneous.h>
#include <CGAL/Nef_polyhedron_3.h>
#include <cassert>
typedef CGAL::Extended_homogeneous<CGAL::Exact_integer> Kernel;
typedef CGAL::Nef_polyhedron_3<Kernel> Nef_polyhedron;
@ -22,11 +23,11 @@ int main() {
Cube1 *= !I3;
Nef_polyhedron Cube2 = N1 * N2 * N3 * N4 * N5 * N6;
CGAL_assertion(Cube1 == Cube2); // both are closed cube
CGAL_assertion(Cube1 == Cube1.closure());
CGAL_assertion(Cube1 == Cube1.regularization());
CGAL_assertion((N1 - N1.boundary()) == N1.interior());
CGAL_assertion(I1.closure() == I1.complement().interior().complement());
CGAL_assertion(I1.regularization() == I1.interior().closure());
assert(Cube1 == Cube2); // both are closed cube
assert(Cube1 == Cube1.closure());
assert(Cube1 == Cube1.regularization());
assert((N1 - N1.boundary()) == N1.interior());
assert(I1.closure() == I1.complement().interior().complement());
assert(I1.regularization() == I1.interior().closure());
return 0;
}

View File

@ -1,6 +1,7 @@
#include <CGAL/Exact_integer.h>
#include <CGAL/Extended_homogeneous.h>
#include <CGAL/Nef_polyhedron_3.h>
#include <cassert>
typedef CGAL::Exact_integer NT;
typedef CGAL::Extended_homogeneous<NT> Kernel;
@ -22,6 +23,6 @@ int main() {
Nef_polyhedron Cube1(I2 *!I1);
Cube1 *= !I3;
Nef_polyhedron Cube2 = N1 * N2 * N3 * N4 * N5 * N6;
CGAL_assertion (Cube1 == Cube2);
assert(Cube1 == Cube2);
return 0;
}

View File

@ -2,6 +2,7 @@
#include <CGAL/Homogeneous.h>
#include <CGAL/Nef_polyhedron_3.h>
#include <CGAL/IO/Nef_polyhedron_iostream_3.h>
#include <cassert>
typedef CGAL::Exact_integer NT;
typedef CGAL::Homogeneous<NT> Kernel;
@ -12,9 +13,9 @@ int main() {
Nef_polyhedron N;
std::cin >> N;
CGAL_assertion((N - N.boundary()) == N.interior());
CGAL_assertion(N.closure() == N.complement().interior().complement());
CGAL_assertion(N.regularization() == N.interior().closure());
assert((N - N.boundary()) == N.interior());
assert(N.closure() == N.complement().interior().complement());
assert(N.regularization() == N.interior().closure());
return 0;
}

View File

@ -2,6 +2,7 @@
#include <CGAL/Extended_homogeneous.h>
#include <CGAL/Nef_polyhedron_3.h>
#include <CGAL/IO/Nef_polyhedron_iostream_3.h>
#include <cassert>
typedef CGAL::Extended_homogeneous<CGAL::Exact_integer> Kernel;
@ -21,11 +22,11 @@ int main() {
Aff_transformation_3 scale(CGAL::SCALING, 3, 2);
N.transform(transl);
CGAL_assertion(N == Nef_polyhedron(Plane_3(0,1,0,-7)));
assert(N == Nef_polyhedron(Plane_3(0,1,0,-7)));
N.transform(rotx90);
CGAL_assertion(N == Nef_polyhedron(Plane_3(0,0,1,-7)));
assert(N == Nef_polyhedron(Plane_3(0,0,1,-7)));
N.transform(scale);
CGAL_assertion(N == Nef_polyhedron(Plane_3(0,0,2,-21)));
assert(N == Nef_polyhedron(Plane_3(0,0,2,-21)));
return 0;
}

View File

@ -1,6 +1,7 @@
#include <CGAL/Exact_integer.h>
#include <CGAL/Homogeneous.h>
#include <CGAL/Nef_polyhedron_S2.h>
#include <cassert>
typedef CGAL::Exact_integer RT;
typedef CGAL::Homogeneous<RT> Kernel;
@ -16,7 +17,7 @@ int main() {
Sphere_circle c(1,1,1); // c : x + y + z = 0
Nef_polyhedron N2(c, Nef_polyhedron::INCLUDED);
Nef_polyhedron N3(N2.complement());
CGAL_assertion(N1 == N2.join(N3));
assert(N1 == N2.join(N3));
Sphere_point p1(1,0,0), p2(0,1,0), p3(0,0,1);
Sphere_segment s1(p1,p2), s2(p2,p3), s3(p3,p1);
Sphere_segment triangle[3] = { s1, s2, s3 };
@ -24,7 +25,7 @@ int main() {
Nef_polyhedron N5;
N5 += N2;
N5 = N5.intersection(N4);
CGAL_assertion(N5 <= N2 && N5 != N4);
assert(N5 <= N2 && N5 != N4);
return 0;
}

View File

@ -23,7 +23,6 @@ int main(int argc, char* argv[])
{
while (ifs >> p)
{ T.insert(p); }
CGAL_assertion(T.is_valid());
if( T.is_triangulation_in_1_sheet())
{ T.convert_to_9_sheeted_covering(); }

View File

@ -31,8 +31,6 @@ int main()
Delaunay T;
T.insert( points.begin(), points.end() );
CGAL_assertion( T.number_of_vertices() == 6 );
// check that the info was correctly set.
Delaunay::Finite_vertices_iterator vit;
for (vit = T.finite_vertices_begin(); vit != T.finite_vertices_end(); ++vit)

View File

@ -46,8 +46,6 @@ int main()
T.insert( boost::make_transform_iterator(points.begin(), Auto_count()),
boost::make_transform_iterator(points.end(), Auto_count() ) );
CGAL_assertion( T.number_of_vertices() == 6 );
// check that the info was correctly set.
Delaunay::Finite_vertices_iterator vit;
for (vit = T.finite_vertices_begin(); vit != T.finite_vertices_end(); ++vit)

View File

@ -41,9 +41,6 @@ int main()
T.insert( boost::make_zip_iterator(boost::make_tuple( points.begin(), indices.begin() )),
boost::make_zip_iterator(boost::make_tuple( points.end(), indices.end() ) ) );
CGAL_assertion( T.number_of_vertices() == 6 );
// check that the info was correctly set.
Delaunay::Finite_vertices_iterator vit;
for (vit = T.finite_vertices_begin(); vit != T.finite_vertices_end(); ++vit)

View File

@ -10,6 +10,7 @@
#include <iostream>
#include <fstream>
#include <vector>
#include <cassert>
typedef CGAL::Exact_predicates_inexact_constructions_kernel Kernel;
@ -42,7 +43,7 @@ int main(int argc, char* argv[])
CGAL::parameters::vertex_point_map(get(CGAL::vertex_point, mesh))
.geom_traits(Kernel())));
CGAL_assertion(CGAL::is_valid_polygon_mesh(mesh));
assert(CGAL::is_valid_polygon_mesh(mesh));
std::cout << "* FILL HOLE NUMBER " << ++nb_holes << std::endl;
std::cout << " Number of facets in constructed patch: " << patch_facets.size() << std::endl;
@ -51,7 +52,7 @@ int main(int argc, char* argv[])
}
}
CGAL_assertion(CGAL::is_valid_polygon_mesh(mesh));
assert(CGAL::is_valid_polygon_mesh(mesh));
std::cout << std::endl;
std::cout << nb_holes << " holes have been filled" << std::endl;

View File

@ -5,6 +5,7 @@
#include <vector>
#include <iterator>
#include <cassert>
typedef CGAL::Exact_predicates_inexact_constructions_kernel Kernel;
typedef Kernel::Point_3 Point;
@ -44,7 +45,7 @@ int main()
std::vector<Triangle_int> patch_will_be_empty;
CGAL::Polygon_mesh_processing::triangulate_hole_polyline(polyline_collinear,
back_inserter(patch_will_be_empty));
CGAL_assertion(patch_will_be_empty.empty());
assert(patch_will_be_empty.empty());
return 0;
}

View File

@ -1,6 +1,7 @@
#include <CGAL/Simple_cartesian.h>
#include <CGAL/Polyhedron_incremental_builder_3.h>
#include <CGAL/Polyhedron_3.h>
#include <cassert>
// A modifier creating a triangle with the incremental builder.
template <class HDS>
@ -33,6 +34,6 @@ int main() {
Polyhedron P;
Build_triangle<HalfedgeDS> triangle;
P.delegate( triangle);
CGAL_assertion( P.is_triangle( P.halfedges_begin()));
assert( P.is_triangle( P.halfedges_begin()));
return 0;
}

View File

@ -26,7 +26,6 @@ int main() {
for ( Facet_iterator i = P.facets_begin(); i != P.facets_end(); ++i) {
Halfedge_facet_circulator j = i->facet_begin();
// Facets in polyhedral surfaces are at least triangles.
CGAL_assertion( CGAL::circulator_size(j) >= 3);
std::cout << CGAL::circulator_size(j) << ' ';
do {
std::cout << ' ' << std::distance(P.vertices_begin(), j->vertex());

View File

@ -5,6 +5,7 @@
#include <vector>
#include <cmath>
#include <fstream>
#include <cassert>
typedef CGAL::Simple_cartesian<double> Kernel;
typedef Kernel::Vector_3 Vector;
@ -27,7 +28,7 @@ void create_center_vertex( Polyhedron& P, Facet_iterator f) {
vec = vec + ( h->vertex()->point() - CGAL::ORIGIN);
++ order;
} while ( ++h != f->facet_begin());
CGAL_assertion( order >= 3); // guaranteed by definition of polyhedron
assert( order >= 3); // guaranteed by definition of polyhedron
Point center = CGAL::ORIGIN + (vec / static_cast<double>(order));
Halfedge_handle new_center = P.create_center_vertex( f->halfedge());
new_center->vertex()->point() = center;
@ -44,7 +45,7 @@ struct Smooth_old_vertex {
vec = vec + ( h->opposite()->vertex()->point() - CGAL::ORIGIN)
* alpha / static_cast<double>(degree);
++ h;
CGAL_assertion( h != v.vertex_begin()); // even degree guaranteed
assert( h != v.vertex_begin()); // even degree guaranteed
++ h;
} while ( h != v.vertex_begin());
return (CGAL::ORIGIN + vec);

View File

@ -7,6 +7,7 @@
#include <cctype>
#include <cmath>
#include <fstream>
#include <cassert>
typedef CGAL::Simple_cartesian<double> Kernel;
typedef Kernel::Vector_3 Vector;
@ -29,7 +30,7 @@ void create_center_vertex( Polyhedron& P, Facet_iterator f) {
vec = vec + ( h->vertex()->point() - CGAL::ORIGIN);
++ order;
} while ( ++h != f->facet_begin());
CGAL_assertion( order >= 3); // guaranteed by definition of polyhedron
assert( order >= 3); // guaranteed by definition of polyhedron
Point center = CGAL::ORIGIN + (vec / static_cast<double>(order));
Halfedge_handle new_center = P.create_center_vertex( f->halfedge());
new_center->vertex()->point() = center;
@ -55,7 +56,7 @@ struct Smooth_old_vertex {
vec = vec + ( h->opposite()->vertex()->point() - CGAL::ORIGIN)
* alpha / static_cast<double>(degree);
++ h;
CGAL_assertion( h != v.vertex_begin()); // even degree guaranteed
assert( h != v.vertex_begin()); // even degree guaranteed
++ h;
} while ( h != v.vertex_begin());
return (CGAL::ORIGIN + vec);
@ -101,11 +102,10 @@ void subdiv( Polyhedron& P) {
++e; // careful, incr. before flip since flip destroys current edge
flip_edge( P, h);
};
CGAL_postcondition( P.is_valid());
}
void trisect_border_halfedge( Polyhedron& P, Halfedge_handle e) {
CGAL_precondition( e->is_border());
assert( e->is_border());
// Create two new vertices on e.
e = e->prev();
P.split_vertex( e, e->next()->opposite());
@ -121,7 +121,7 @@ void trisect_border_halfedge( Polyhedron& P, Halfedge_handle e) {
template <class OutputIterator>
void smooth_border_vertices( Halfedge_handle e, OutputIterator out) {
CGAL_precondition( e->is_border());
assert( e->is_border());
// We know that the vertex at this edge is from the unrefined mesh.
// Get the locus vectors of the unrefined vertices in the neighborhood.
Vector v0 = e->prev()->prev()->opposite()->vertex()->point() -CGAL::ORIGIN;
@ -166,8 +166,6 @@ void subdiv_border( Polyhedron& P) {
e->next()->vertex()->point() = *i++;
}
} while ( e++ != last_e);
CGAL_assertion( i == pts.end());
CGAL_postcondition( P.is_valid());
}
using namespace std;

View File

@ -6,6 +6,7 @@
#include <algorithm>
#include <vector>
#include <fstream>
#include <cassert>
using std::cerr;
using std::endl;
@ -63,7 +64,7 @@ struct Intersect_facets {
}
if ( v != Halfedge_const_handle()) {
// found shared vertex:
CGAL_assertion( h->vertex() == v->vertex());
assert( h->vertex() == v->vertex());
// geomtric check if the opposite segments intersect the triangles
Triangle t1( h->vertex()->point(),
h->next()->vertex()->point(),

View File

@ -35,8 +35,6 @@ int main( int argc, char *argv[] ) {
// read the sites from the stream and insert them in the diagram
while ( ifs >> site ) {
sdg.insert( site );
CGAL_SDG_DEBUG( sdg.file_output_verbose(std::cout); );
CGAL_assertion( sdg.is_valid(false, 1) );
}
ifs.close();

View File

@ -32,8 +32,6 @@ int main( int argc, char *argv[] ) {
// read the sites from the stream and insert them in the diagram
while ( ifs >> site ) {
sdg.insert( site );
CGAL_SDG_DEBUG( sdg.file_output_verbose(std::cout); );
CGAL_assertion( sdg.is_valid(false, 1) );
}
ifs.close();

View File

@ -67,7 +67,6 @@ void iv_file_scanner( istream& in)
// point coordinate list starts here
offset = points.size();
in >> c;
CGAL_assertion( c == '[');
in >> c;
while ( in && ( c != ']')) {
in.putback( c);
@ -99,7 +98,6 @@ void iv_file_scanner( istream& in)
// indices start here
std::size_t face_offset = facets.size();
in >> c;
CGAL_assertion( c == '[');
facets.push_back( Facet());
Facet* facet = &facets.back();
in >> c;
@ -133,7 +131,6 @@ void iv_file_scanner( istream& in)
// indices start here
std::size_t face_offset = facets.size();
in >> c;
CGAL_assertion( c == '[');
facets.push_back( Facet());
Facet* facet = &facets.back();
in >> c;

View File

@ -20,6 +20,8 @@
#include <CGAL/Surface_mesh.h>
#include <CGAL/Random.h>
#include <cassert>
template<class SM>
class SimpleSurfaceMeshWithSmallFacesViewerQt : public CGAL::Basic_viewer_qt
{
@ -54,7 +56,7 @@ public:
bool exist;
typename SM::template Property_map<face_descriptor, FT> faces_size;
boost::tie(faces_size, exist)=sm.template property_map<face_descriptor, FT>("f:size");
CGAL_assertion(exist);
assert(exist);
m_min_size=faces_size[*(sm.faces().begin())];
m_max_size=m_min_size;
@ -84,7 +86,7 @@ protected:
bool exist;
typename SM::template Property_map<face_descriptor, FT> faces_size;
boost::tie(faces_size, exist)=sm.template property_map<face_descriptor, FT>("f:size");
CGAL_assertion(exist);
assert(exist);
// It it is smaller, color the face in red.
if (get(faces_size, fh)<m_min_size+((m_max_size-m_min_size)/(100-m_threshold)))

View File

@ -4,6 +4,7 @@
#include <CGAL/Polygon_mesh_processing/triangulate_faces.h>
#include <fstream>
#include <string>
#include <cassert>
#include "draw_surface_mesh_small_faces.h"
typedef CGAL::Simple_cartesian<double> K;
@ -28,7 +29,7 @@ int main(int argc, char* argv[])
Mesh::Property_map<face_descriptor, FT> faces_size;
bool created;
boost::tie(faces_size, created)=sm.add_property_map<face_descriptor, FT>("f:size",0.);
CGAL_assertion(created);
assert(created);
for(face_descriptor fd : sm.faces())
{ faces_size[fd]=CGAL::Polygon_mesh_processing::face_area(fd, sm); }
@ -39,4 +40,3 @@ int main(int argc, char* argv[])
return EXIT_SUCCESS;
}

View File

@ -14,6 +14,7 @@
#include <boost/unordered_set.hpp>
#include <utility>
#include <cassert>
namespace CGAL
{
@ -42,7 +43,7 @@ namespace Tetrahedral_remeshing
else
c->set_subdomain_index(2);
}
CGAL_assertion(tr.is_valid(true));
assert(tr.is_valid(true));
}
@ -66,7 +67,7 @@ namespace Tetrahedral_remeshing
for (typename Tr::Cell_handle c : tr.finite_cell_handles())
c->set_subdomain_index(1);
CGAL_assertion(tr.is_valid(true));
assert(tr.is_valid(true));
}
template<typename Tr>
@ -185,7 +186,7 @@ namespace Tetrahedral_remeshing
add_edge(v2, v6, tr, constraints);
add_edge(v3, v7, tr, constraints);
CGAL_assertion(tr.is_valid(true));
assert(tr.is_valid(true));
}
}
}
}

View File

@ -9,6 +9,7 @@
#include <iostream>
#include <utility>
#include <cassert>
#include "tetrahedral_remeshing_generate_input.h"
@ -45,8 +46,8 @@ public:
const key_type& k,
const bool b)
{
CGAL_assertion(map.m_set_ptr != nullptr);
CGAL_assertion(k.first < k.second);
assert(map.m_set_ptr != nullptr);
assert(k.first < k.second);
if (b) map.m_set_ptr->insert(k);
else map.m_set_ptr->erase(k);
}
@ -54,8 +55,8 @@ public:
friend value_type get(const Constrained_edges_property_map& map,
const key_type& k)
{
CGAL_assertion(map.m_set_ptr != nullptr);
CGAL_assertion(k.first < k.second);
assert(map.m_set_ptr != nullptr);
assert(k.first < k.second);
return (map.m_set_ptr->count(k) > 0);
}
};
@ -80,7 +81,6 @@ int main(int argc, char* argv[])
CGAL::Tetrahedral_remeshing::generate_input_cube(nbv, t3, constraints);
make_constraints_from_cube_edges(t3, constraints);
CGAL_assertion(t3.is_valid());
CGAL::tetrahedral_isotropic_remeshing(t3, target_edge_length,
CGAL::parameters::edge_is_constrained_map(
@ -89,4 +89,3 @@ int main(int argc, char* argv[])
return EXIT_SUCCESS;
}

View File

@ -3,6 +3,7 @@
#include <CGAL/Delaunay_triangulation_2.h>
#include <CGAL/point_generators_2.h>
#include <cassert>
typedef CGAL::Exact_predicates_inexact_constructions_kernel EPIC;
typedef CGAL::Exact_predicates_exact_constructions_kernel EPEC;
@ -44,5 +45,5 @@ int main()
dt2_epec.set_infinite_vertex(
dt2_epec.tds().copy_tds( dt2_epic.tds(),dt2_epic.infinite_vertex(), Convert_vertex(), Convert_face() ) );
CGAL_assertion( dt2_epec.is_valid() );
assert( dt2_epec.is_valid() );
}

View File

@ -24,8 +24,6 @@ int main()
Delaunay T;
T.insert( points.begin(),points.end() );
CGAL_assertion( T.number_of_vertices() == 6 );
// check that the info was correctly set.
Delaunay::Finite_vertices_iterator vit;
for (Vertex_handle v : T.finite_vertex_handles())

View File

@ -28,8 +28,6 @@ int main()
Regular rt;
rt.insert( points.begin(),points.end() );
CGAL_assertion( rt.number_of_vertices() == 6 );
// check that the info was correctly set.
for (Vertex_handle v : rt.finite_vertex_handles())
if( points[ v->info() ].first != v->point() ){

View File

@ -37,8 +37,6 @@ int main()
T.insert( boost::make_transform_iterator(points.begin(),Auto_count()),
boost::make_transform_iterator(points.end(), Auto_count() ) );
CGAL_assertion( T.number_of_vertices() == 6 );
// check that the info was correctly set.
Delaunay::Finite_vertices_iterator vit;
for (Vertex_handle v : T.finite_vertex_handles())

View File

@ -36,9 +36,6 @@ int main()
T.insert( boost::make_zip_iterator(boost::make_tuple( points.begin(),indices.begin() )),
boost::make_zip_iterator(boost::make_tuple( points.end(),indices.end() ) ) );
CGAL_assertion( T.number_of_vertices() == 6 );
// check that the info was correctly set.
for (Vertex_handle v : T.finite_vertex_handles())

View File

@ -3,6 +3,7 @@
#include <CGAL/Delaunay_triangulation_3.h>
#include <CGAL/point_generators_3.h>
#include <cassert>
typedef CGAL::Exact_predicates_inexact_constructions_kernel EPIC;
typedef CGAL::Exact_predicates_exact_constructions_kernel EPEC;
@ -43,5 +44,5 @@ int main()
dt3_epec.set_infinite_vertex(
dt3_epec.tds().copy_tds( dt3_epic.tds(),dt3_epic.infinite_vertex(), Convert_vertex(), Convert_cell() ) );
CGAL_assertion( dt3_epec.is_valid() );
assert( dt3_epec.is_valid() );
}

View File

@ -26,8 +26,6 @@ int main()
Delaunay T( points.begin(),points.end() );
CGAL_assertion( T.number_of_vertices() == 6 );
// check that the info was correctly set.
for (Delaunay::Vertex_handle v : T.finite_vertex_handles())
if( points[ v->info() ].first != v->point() ){

View File

@ -26,8 +26,6 @@ int main()
Regular rt( points.begin(),points.end() );
CGAL_assertion( rt.number_of_vertices() == 6 );
// check that the info was correctly set.
for (Regular::Vertex_handle v : rt.finite_vertex_handles())
if( points[ v->info() ].first != v->point() ){

View File

@ -38,8 +38,6 @@ int main()
Delaunay T( boost::make_transform_iterator(points.begin(),Auto_count()),
boost::make_transform_iterator(points.end(), Auto_count() ) );
CGAL_assertion( T.number_of_vertices() == 6 );
// check that the info was correctly set.
for (Delaunay::Vertex_handle v : T.finite_vertex_handles())
if( points[ v->info() ] != v->point() ){

View File

@ -37,8 +37,6 @@ int main()
Delaunay T( boost::make_zip_iterator(boost::make_tuple( points.begin(),indices.begin() )),
boost::make_zip_iterator(boost::make_tuple( points.end(),indices.end() ) ) );
CGAL_assertion( T.number_of_vertices() == 6 );
// check that the info was correctly set.
for (Delaunay::Vertex_handle v : T.finite_vertex_handles() )
if( points[ v->info() ] != v->point() ){