Subject: CGAL users discussion list
List archive
- From: "J. Scheurich" <>
- To:
- Subject: [cgal-discuss] How to read .OFF file color information ?
- Date: Mon, 20 Jan 2020 11:51:15 +0100
- Authentication-results: mail2-smtp-roc.national.inria.fr; spf=None ; spf=Pass ; spf=None
- Ironport-phdr: 9a23:TMUdthH6AmB7fWZeAzpUoJ1GYnF86YWxBRYc798ds5kLTJ78rsSwAkXT6L1XgUPTWs2DsrQY0raQ6v2rADdIoc7Y9ixbK9oUD15NoP5VtjRoONSCB0z/IayiRA0BN+MGamVY+WqmO1NeAsf0ag6aiHSz6TkPBke3blItdaz6FYHIksu4yf259YHNbAVUnjq9Zq55IAmroQnLucQanIRvJrwsxhbJrXdEZupbzn5sKV6Pghrw/Mi98INt/ihKp/4t68tMWrjmcqolSrBVEC4oOH0v6s3xshnDQwqP5n8CXWgTjxFFHQvL4gzkU5noqif1ufZz1yecPc3tULA7Qi+i4LtxSB/pkygIKTg0+3zKh8NqjaJbpBWhpwFjw4PRfYqYOuZycr/bcNgHQ2dKQ8RfWDFbAo6kb4UBEvQPM+VWoYbzqFQBsRSwCBKwBOP20DJEmmP60KM43uknDArI3BYgH9ULsHnMotn7ML0eWv2owqbUzTXMce5W2S386IfUchAtr+yHULV1ccrMx0kvCwLFgkiNpYH+MTKayP8Cv3KG4OV+TO+ijXMspQ92ojiq3Mgsi4/Ji5oOylDY7yp23IU1JdqmSEFle96kHp9QtyaUNodsXswiRGRotD40yr0dpJ63ZjYFx4k6xxPZdveJcJCI7wr9WOqMPzt0nmxpdKy9ihqo7EStyPfwWtSq3FpSridJiMTAu38M2hDJ98SKTuVx8l281TuNyQze7PxPL1oumqrBMZEhx6Y9lpoNvkTHGS/7gED2jKiLdkU44OSp5froba78qpCBKYB4kgD+MqIwlcyjGek0LBUCU3aB9eiiyrHu/1f1TKhIg/Esj6XVrojWJcEBqa64Bw9V3Jwj6xG6Dzq+1dQYgHcHLE5EeB6akoTkIF/PL+7jAvulnlujji9nx+raMb35HpXNMn/Dna/9crZy8UFczBM/ws1e55JPFr4BPenzWlTqudzDDh45NhS0zPz9BNV80IMeQ2OPDbWDPKPcq1/brt4oduKDbYtQtDfmIOU+/Nbvi2U4kBkTZ/qHx5wSPTqaWLxdKEWUfGDtiddLWTMPowQiTbWzoEKPW3hfaiDhDOoH+jgnBdf+Xs/4TYe3jenZhXvpLthtfmlDT2u0PzLwbYzUCegBYmSeL505y21WZf2aU4YkkCqWmkr/wrtjIPDT/31Kqp/pktR4tbSKyEMCsAdsBsHY6FmjCmF5mmRRHG0z271j51NwwBGP3Pogjg==
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.