Subject: CGAL users discussion list
List archive
- From: Maxime Gimeno <>
- To:
- Subject: Re: [cgal-discuss] CGAL exception while reading CNOFF file
- Date: Fri, 31 Jan 2020 10:12:37 +0100
- Authentication-results: mail2-smtp-roc.national.inria.fr; spf=None ; spf=Pass ; spf=None
- Ironport-phdr: 9a23:TiYDKB+STqZt5f9uRHKM819IXTAuvvDOBiVQ1KB20OwcTK2v8tzYMVDF4r011RmVBNmdsKMP0rCM++C4ACpcuM3H6ChDOLV3FDY9wf0MmAIhBMPXQWbaF9XNKxIAIcJZSVV+9Gu6O0UGUOz3ZlnVv2HgpWVKQka3OgV6PPn6FZDPhMqrye+y54fTYwJVjzahfL9+Nhq7oRjeu8UMj4ZvLqk9xgbXrndWZu9awX9kKU+Jkxvz+8u98oRv/zhMt/4k6sVNTbj0c6MkQLJCET8oKXo15MrltRnCSQuA+H4RWXgInxRLHgbI8gj0Uo/+vSXmuOV93jKaPdDtQrAvRTui9aZrRwT2hyoBKjU07XvYis10jKJcvRKhuxlyyJPabY2JKPZzeL7WcNUHTmRDQ8lRTTRMDYyyb4QND+QPM+VWoZTjqVQSthaxHxWgCfn1xzNUmnP736s32PkhHwHc2wwgGsoDvnPOo9T6NacSVP66x7TJwzXCavNZxzH96I/VeR0mpPGDR71xccvUyUYxDQ/FgVSQqYn7MDOT0eQAqGeb7+96WuKuj24rsR1+oj+qxso1jITCm4wbylfB9SpjwYY1I8W1SElmYd6+CJtQrSaaN4loTcw+X2FkoiE6yqcJuZKjfSgKzo4nxx/FZPCdfYiI+ArvVOmPLjd/gXJlZrO/iAi88ES6ze38TMa03E5FripEjtnMtm0N2AfJ5sebTft9+0Gs0iuM2QDL8uxIP1w4mK7BJ5MiwrM8jIQfvVnfEiPsl0j7g6mbfVg+9Oey8eToeLDmq4ecN4BqjgH+NbwjmsmlDuQ5NggCRm+b+fih2LH68030T7pHguc5kqnet5DaKsAbqbCjDwBJ1YYj7g6zDzag0NsGgXkKNExJdA6DgoTzOFzDIOr0Aemij1iwijtmyP/LMqXkAprXL3jDlLnhfax6605Z0AczyMpQ5p1VCrEEPv3/QEDxtN3dDhAnNQy0xP3qCNp41owEWGKPBrWVP7/VsV+N/u4vOfWDZJcJuDbhLPgo/+LhjXAjll8ZZKWmwJoXaGukEfR7OEWZemHhgswBEGcPpgoxVvbmiFyEUT5JZna9Rbgw5j8hCNHuMIHYW4r4gKCdxDzpWdpNd2VeAxaNF23pfsOKQbAXeSeKK4hglDIDErOuQotk2RC1vxLh0OlbKb/f9SQc8J7iz9No/Pb7lBco9DUyAd7O/XuKSjRRl3MJQjJ+86F6rEp6ggOG2Lh5hvEeGt1W6vVOegg/PJ/Yied9DoahCUr6Yt6VRQP+EZ2dCjYrQ4dpmo5cUwNGA9ynyyv78W+vCr4RmaaMAcVtoK3Z1nn1Yc16ziSfjfVzvxwdWsJKcFaeqOtn7QGKXtzGlkyYk+ChcqFOhHeQplfG9nKHuQRjaCA1UajBWipCNE7frNC84V+bCrHyVfIoNQxOzcPEIaxPOIXk
Your input file is not following the standard, that is why it crashes in CGAL. If you use NOFF or CNOFF, normals are expected on the same line as their corresponding vertex, but they are not here. This messes the whole stream. I'm working on a fix to detect if the file is wrong and avoid a crash, but you won't be able to read your input file anywhere.
In CGAL we followed these rules to implement the OFF IO. I think you should have a look.
In CGAL we followed these rules to implement the OFF IO. I think you should have a look.
Created this issue to track the pb:
https://github.com/CGAL/cgal/issues/4499
Sebastien.
On 1/31/20 3:52 AM, J. Scheurich wrote:
> 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
>
>
>
--
You are currently subscribed to cgal-discuss.
To unsubscribe or access the archives, go to
https://sympa.inria.fr/sympa/info/cgal-discuss
- [cgal-discuss] CGAL exception while reading CNOFF file, J. Scheurich, 01/31/2020
- Re: [cgal-discuss] CGAL exception while reading CNOFF file, Sebastien Loriot (GeometryFactory), 01/31/2020
- Re: [cgal-discuss] CGAL exception while reading CNOFF file, Maxime Gimeno, 01/31/2020
- Re: [cgal-discuss] CGAL exception while reading CNOFF file, J. Scheurich, 01/31/2020
- Re: [cgal-discuss] CGAL exception while reading CNOFF file, Maxime Gimeno, 01/31/2020
- Re: [cgal-discuss] CGAL exception while reading CNOFF file, J. Scheurich, 01/31/2020
- Re: [cgal-discuss] CGAL exception while reading CNOFF file, Maxime Gimeno, 01/31/2020
- Re: [cgal-discuss] CGAL exception while reading CNOFF file, Sebastien Loriot (GeometryFactory), 01/31/2020
Archive powered by MHonArc 2.6.18.