Skip to Content.
Sympa Menu

cgal-discuss - Re: [cgal-discuss] How to read .OFF file color information ?

Subject: CGAL users discussion list

List archive

Re: [cgal-discuss] How to read .OFF file color information ?


Chronological Thread 
  • From: Maxime Gimeno <>
  • To:
  • Subject: Re: [cgal-discuss] How to read .OFF file color information ?
  • Date: Mon, 27 Jan 2020 09:05:31 +0100
  • Authentication-results: mail3-smtp-sop.national.inria.fr; spf=None ; spf=Pass ; spf=None
  • Ironport-phdr: 9a23:pel0PBImSypGsIiYCNmcpTZWNBhigK39O0sv0rFitYgeLfjxwZ3uMQTl6Ol3ixeRBMOHsq4C0LOd6vm9ESxYuNDd6StEKMQNHzY+yuwu1zQ6B8CEDUCpZNXLVAcdWPp4aVl+4nugOlJUEsutL3fbo3m18CJAUk6nbVk9Kev6AJPdgNqq3O6u5ZLTfx9IhD2gar9uMRm6twrcutQZjId4JKs91xTFrmZVd+lW2GhkIU6fkwvm6sq/4ZJu/T5ct+49+8JFTK73Y7k2QbtEATo8Lms7/tfrtR7NTQuO4nsTTGAbmQdWDgbG8R/3QI7/vjP1ueRh1iaaO9b2Ta0vVjS586hrUh7ohzwZODM/7Wral9Z/jKNfoBKmuhx/34vZa5ybOfZiYq/Qe84RSGxcVchTSiNBGJuxYIQBD+UDPehWoYrzqUYQoxSiHgSjHv/jxyVSi3PqwaE30eIsGhzG0gw6GNIOtWzZotLvO6YdUOC1ybfHxijCYfNX3Dfy9o7Ichc8qvyLWLJ/a8XQyUgqFwzblFmQpo3lPzaL2eQLtGiW9OVgVee1hG4mrwF9uCSgxsApioTQgI8e117K9SJ8wIkvJN24TlZ2Yd+iEJtKtiGVLZF6Qs04Q21wtiY60aAGtYSlcycX1ZQqwQPUZf+fc4WQ/B7vSOKcLS17iX9lYr6zmQu+/VS6xuDzVcS51ktBoDBfndnWrH8N0gTe6siZRft5+UeswTOP2BrS6uFAOEw0krbbJ4M4zr4+mZcesl7PHiDxmEXxg6+Wclsr9vK05OTgZ7Xqvp6cN4lqhQHiKqkihNCzDOAiPgUNX2WX4/qw2KD/8UHjT7hHjeU6kqzDv5DbIcQbqLS5AwhQ0os77hawFTin0NUdnXYZNl5FdxOHj433NFHIJ/D1Fvi/g1G2nzdqw/DKJKHuApLILnTbirfuYa5961JAyAo01d1Q+51UBasFIP7qR0DxtcfYAQMkMwyv2ObqE85914MbWWKXGKCVKqLSsVmS5uIuOeaAfoEVuCyuY8Uj/OPk2H8lhUcGL+7uxooScHn+H/J8Ikzfb2CrmcYECW5NvwwwS6vhh1SGFDJSfH2vRLlv2jZuA42vCcLPR5umnaea9Ca9BJxfIG5cWX6WFnK9UoyUWvIBIA2TJ8JnlXRQULGxSooskx6vsQL8zJJoK+PV/msTspe1h4s93PHaiRxnrW88NM+ayWzYFzglzFNNfCc/2eVEmWI4z16C1aZihPkBTI5c4vpIVkExMpuOlrUmWeC3YRrIe5KycHjjWs+vWGhjQdc4wttIaEF4SY3700LzmhGyCrpQrISlQZw59qWGgir0Lsd5jnHajewv0wlgTcxIOmmrwKV48lqLCg==

I told you the name must also become f:color instead of v:color.

Le sam. 25 janv. 2020 à 11:07, J. Scheurich <> a écrit :

> Your test data does not have any color per vertex, they are all per
> face. In the SO message you refer to, it is written
> "[...] If there are colors per face you can access it similarly but by
> searching for the property map called "f:color". [...]"
>
> So you should use a property map like that :
>   SurfaceMesh::Property_map<SurfaceMesh::Face_index, CGAL::Color>
> fcolors =
>         mesh->property_map<SurfaceMesh::Face_index, CGAL::Color >
>         ("f:color").first;

I changed the test program to Face_Index, but still get "color do not
exist" 8-(

$ 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::Face_index, CGAL::Color>
    vcolors =
             mesh->property_map<SurfaceMesh::Face_index, CGAL::Color >
             ("v:color").first;

         bool colorExists = mesh->property_map
             <SurfaceMesh::Face_index, CGAL::Color>("v:color").second;
         if (colorExists )
             printf("color exists\n");
         else
             printf("color do not exist\n");
    }

Any idears ?

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





Archive powered by MHonArc 2.6.18.

Top of Page