Skip to Content.
Sympa Menu

cgal-discuss - [cgal-discuss] CGAL exception while reading CNOFF file

Subject: CGAL users discussion list

List archive

[cgal-discuss] CGAL exception while reading CNOFF file


Chronological Thread 
  • From: "J. Scheurich" <>
  • To:
  • Subject: [cgal-discuss] CGAL exception while reading CNOFF file
  • Date: Fri, 31 Jan 2020 03:52:54 +0100
  • Authentication-results: mail2-smtp-roc.national.inria.fr; spf=None ; spf=Pass ; spf=None
  • Ironport-phdr: 9a23:4bIk4xXxWZodf6G1mdLTCRiidlPV8LGtZVwlr6E/grcLSJyIuqrYYxOBt8tkgFKBZ4jH8fUM07OQ7/m8HzdRqsrf+DBaKdoQDkRD0Z1X1yUbQ+e9QXXhK/DrayFoVO9jb3RCu0+BDE5OBczlbEfTqHDhpRQbGxH4KBYnbr+tQt2agMu4zf299IPOaAtUmjW9falyLBKrpgnNq8Uam4RvJrs+xxfTrHZFf+tayGxpKFmOmxrw+tq88IRs/ihNtf8t7dJMXbn/c68lUbFWETMqPnwv6sb2rxfDVwyP5nUdUmUSjBVFBhXO4Q/5UJnsrCb0r/Jx1yaGM8L4S7A0Qimi4LxwSBD0kicHNiU2/3/Rh8dtka9UuhOhpxh4w47JfIGYMed1c63Bcd8GQ2dKQ8BcXDFDDIyhdYsCF/QPM+ZFoYf+qVUBoxSxChWjCu701j9In2X70bEm3+kvEwzL2hErEdIUsHTTqdX4LKkeX+SvwKLV0DvMc/NW1ing6IjScxAuvfGMUbxtesfWzEkvCg3FjkmRqYD4Ij+YzeoMvHaA4OZ6SO2glXcqpgdsqTahwccsj5PGhoMTyl3c8iV53Zw1JcWiSE58Y96rDodftz2AO4txWMMiTGdlszs5xL0eoZO3YjUGxZY9yxPddfCLaZWE7xb9WOqLIzp1h2ppdbKlixqv/kWty/fwWtSw3VpUtCZJj9rBu34L2hfO8MaIUOF98V2k2TuX1wDc9OVEIUcsmKreLJ4h36IwmoAdsEvdBSD6glj5g7GOekUl/Oin9fjnb634qpOBNYJ4kAPzPro0lsCiBek0LBICUmqY9Oik0b3s50z5QLFEjv0slanZtYjXJcEGpq63Hw9V05sv5wukAjaoztsXhmMLI09bdx6flYjmJ0nOIOzkDfe4m1mjjDhryOrCPrH4H5rNL2PDn6v8fbZm8E5R0xEzzNBa55JMEL4NOvPzWknrtNzZFBA1KQK0w/y0QOl6g4gRUGbKDq6CO77JqneJ4PguKq+Cftw7ojH4frIHobbVhn80hEUcdqnjlc8SdX6kH60/C1qUazzgj4FSQi8xogMiQbmy2xW5WjlJaiPqBv9u1nQAEIujSLz7aMWtjbiGhXzpG5pLeiZZB1rKHXq6L9zVCcdJUzqbJ4paqhJBULGgT4E70hT+5hD3wfxrI7iNo3FKhdfYzNFwotbru1Qq7zUkXduQ2SeBQjMskw==

Hi,

When i run the following program under Ubuntu 18.04 (X86_64)...

// compile:   g++ -g -O0 readoff_vertexcolor.cpp -lCGAL
// test data:  https://wdune.ourproject.org/examples/test.off

#include <CGAL/Simple_cartesian.h>
typedef CGAL::Simple_cartesian<double> Kernel;
#include <CGAL/Exact_predicates_exact_constructions_kernel.h>
#include <CGAL/Surface_mesh.h>
#include <CGAL/Polygon_mesh_processing/corefinement.h>
#include <CGAL/Polygon_mesh_processing/self_intersections.h>
#include <CGAL/Polygon_mesh_processing/triangulate_faces.h>
#include <CGAL/boost/graph/dijkstra_shortest_paths.h>
#include <CGAL/exceptions.h>
#include <CGAL/IO/Color.h>
#include <boost/graph/prim_minimum_spanning_tree.hpp>
#include <boost/foreach.hpp>
typedef Kernel::Point_3 Point;
typedef CGAL::Surface_mesh<Point> Surface;
typedef CGAL::Surface_mesh<Point> SurfaceMesh;
typedef CGAL::Color Color;
typedef Surface::Vertex_index vertex_index;
typedef boost::graph_traits<Surface>::vertex_descriptor vertex_descriptor;
typedef boost::graph_traits<Surface>::face_descriptor face_descriptor;
typedef boost::graph_traits<Surface>::halfedge_descriptor
halfedge_descriptor;
std::vector<Point> verts;
std::vector<Color> cols;

int main(int argc, char **argv)
{
    const char *filename = "test.off";
    std::ifstream input(filename);
    SurfaceMesh *mesh = new SurfaceMesh();

    if (!input || !(input >> *mesh)) {
        perror(filename);
    }

   SurfaceMesh::Property_map<SurfaceMesh::Vertex_index, CGAL::Color>
vcolors =
        mesh->property_map<SurfaceMesh::Vertex_index, CGAL::Color >
        ("v:color").first;

    bool colorExists = mesh->property_map
        <SurfaceMesh::Vertex_index, CGAL::Color>("v:color").second;

    for (SurfaceMesh::Vertex_index vi : mesh->vertices()) {
        verts.push_back(mesh->point(vi));
        if (colorExists )
            cols.push_back(vcolors[vi]);
    }
}

I get:

$ ./a.out
terminate called after throwing an instance of 'CGAL::Assertion_exception'
  what():  CGAL ERROR: assertion violation!
Expr: n > 2
File: /usr/include/CGAL/boost/graph/Euler_operations.h
Line: 588
Aborted (core dumped)

What is wrong ?

so long
MUFTI





Archive powered by MHonArc 2.6.18.

Top of Page