Subject: CGAL users discussion list
List archive
- From: "Sebastien Loriot (GeometryFactory)" <>
- To:
- Subject: Re: [cgal-discuss] How to read .OFF file color information ?
- Date: Tue, 21 Jan 2020 21:35:02 +0100
- Authentication-results: mail2-smtp-roc.national.inria.fr; spf=None ; spf=Pass ; spf=None
- Ironport-phdr: 9a23:HmI7WRf/FcJtIa/eG0h1xamSlGMj4u6mDksu8pMizoh2WeGdxcW4Yx7h7PlgxGXEQZ/co6odzbaP7+a5CSdZusrJ8ChbNsAVDFld0YRetjdjKfbNMVf8Iv/uYn5yN+V5f3ghwUuGN1NIEt31fVzYry76xzcTHhLiKVg9fbytScbdgMutyu+95YDYbRlWizqhe7NyKwi9oRnMusUMjoZuN6k8xgHUrnZLdOha2G1lKF2OlBr4+su84YRv/itNt/8v7cJMTbn2c6ElRrFEEToqNHw46tf2vhfZVwuP4XUcUmQSkhVWBgXO8Q/3UJTsvCbkr+RxwCaVM9H4QrAyQjSi8rxkSAT0hycdNj4263/Yh8pth69Guh2hphh/w4nJYIGJMfd1Y63Qcc8GSWdHQ81cUTFKDIGhYIsVF+cPIPhWr4f9qVUNoxWxCwajC+HzxTFHnXL2wa433v49HQ3a0gEtHdQDu2nUotXvM6cSVPi4wKfVwzrddPxZwyz96JTJch8/p/GHQLR+cc3LyUkuEAPFkkibpYjkMTyL0eQNtnaU7/Z6VeOvi2AosR1+oiSoxsc2iojFg4wZwU3D+CVixIY1Ise4SE98Yd64CpdQsiWaOpB5QsMnWW5ouSI6xqcatp68eSgH0ZIqzAPRZfyAdoiH+BPjVOCJLDdjmHJqYq6whxW18Ui+1OL8TMe00FJNritLiNXDqncN1xnL5siJUft9412t1iiS2ADO7OxPPEM6lbLDJpI/3rI9koAfvEfDEyPshUn6kqybel8r9+Wp8+jqbbTrqoWCO4NpiQzyKLkiltC/DOgiLAQCQmiW9OKh37P550L5Wq9Fjvgun6nZrp/aIcMbq7a8AwBP04Yj7w+zDjmj0NgFhHUHIl1IdROdg4jmPFHOJ//4DfOhjFi2jDhrwPXGMqXgApXLMHfDjK/scahh50NY0gY+ztBS64hJBr0fI///QED8ud3AAh88KQO0wuLnCNtn1oMZXGKCGrSZMKfVsV+S5+IvJPWMaJUQuDb5MPUl6PvugmU4mV8ZZ6WmwZwXaHWgEvR8P0qZeWbsgssGEWoSogU+Q/bliFmbXTFOZnayRL4z5iwgCIK9ForDXYCsgLmZ3CihBJFWZ2ZGCkqNEXjybYmEVe0MO2quJZpqnTUAELSgUIQ8zgqGtQngyrMhIPCH1DcfsMep79V/7vbPlBw0vRhzFcWazynNYGxzm24UXS4Y1atjplZsix3LhbN8hOZZEsAV4vdhXQIzNJqaxOt/XYOhEjndd8uEHQ71Cu6tBis8G4pon40+Jn1lEtDntSjtmjKwCuZMxbOODZ0wtKnb2iqpfpcv+zP9zKAkymIebI5KPGyiiLR48lGKVYHMmkSd0a2tcPZFhXOfxCK41WOL+XpgfktwXKHCBy1NY0LXqZHm4xqHQePwT7sgNQRFxIiJLa4YMtA=
OFF should be replaced by COFF according to the file format (or CNOFF if you have normals).
Sebastien.
On 1/20/20 11:51 AM, J. Scheurich wrote:
Hi,
How to read .OFF file color information via CGaL ?
I wrote the following test program accoording to
https://stackoverflow.com/questions/55955579/cgal-how-can-i-access-vertex-colors-after-loading-an-off-file
$ cat readoff.cpp
// compile: g++ -g -O0 readoff.cpp -lCGAL
// test data: https://people.sc.fsu.edu/~jburkardt/data/off/facecube.off
// output:
// $ ./a.out
// facecube.off: Success
// color do not exist
#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 = "facecube.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;
if (colorExists )
printf("color exists\n");
else
printf("color do not exist\n");
}
What is the problem ?
so long
MUFTI
- [cgal-discuss] How to read .OFF file color information ?, J. Scheurich, 01/20/2020
- Re: [cgal-discuss] How to read .OFF file color information ?, Sebastien Loriot (GeometryFactory), 01/21/2020
- Re: [cgal-discuss] How to read .OFF file color information ?, J. Scheurich, 01/22/2020
- Re: [cgal-discuss] How to read .OFF file color information ?, Maxime Gimeno, 01/24/2020
- Re: [cgal-discuss] How to read .OFF file color information ?, J. Scheurich, 01/25/2020
- Re: [cgal-discuss] How to read .OFF file color information ?, Maxime Gimeno, 01/27/2020
- Re: [cgal-discuss] How to read .OFF file color information ?, J. Scheurich, 01/25/2020
- Re: [cgal-discuss] How to read .OFF file color information ?, Sebastien Loriot (GeometryFactory), 01/21/2020
Archive powered by MHonArc 2.6.18.