Skip to Content.
Sympa Menu

cgal-discuss - [cgal-discuss] How to read Polyhedron vertex coordinates?

Subject: CGAL users discussion list

List archive

[cgal-discuss] How to read Polyhedron vertex coordinates?


Chronological Thread 
  • From: Samay Kumar <>
  • To:
  • Subject: [cgal-discuss] How to read Polyhedron vertex coordinates?
  • Date: Wed, 22 Oct 2008 05:04:56 -0700 (PDT)
  • Domainkey-signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=yahoo.com; h=X-YMail-OSG:Received:X-Mailer:Date:From:Subject:To:MIME-Version:Content-Type:Message-ID; b=Kf67CIWC1TARtD4K9gdZhjSdnq4Gy9FbDOqEKLuox7xjL6uRPBFaTofznmzkX/pxd4/PF+NvugnfLyj98ZQgewW1u85NWlsB4cqe/wEHUOFBgxs6oSANXoym6AnGiyIcLz2SmLORI95tqY+ny/Wsq6afYPAkEXlY/th8MsjDYt4=;

Hello friends,

So far, I could have been able to read the .off file but wandering how to read coordinates of vertex and also index of vertices per face. Here down I have attached the code.

Kindly provide some hint, how to access coordinates of read .off file. And also how to access index of vertex per face.

Kindly see the colored part of .cpp code.

*************************************************main.cpp************************************************************

#include <CGAL/Simple_cartesian.h>
#include <CGAL/Polyhedron_3.h>
#include <CGAL/IO/Polyhedron_iostream.h>
#include <CGAL/circulator.h>

#include <iostream>
#include <fstream>

#define X 0
#define Y 1
#define Z 2

typedef CGAL::Simple_cartesian<double>     Kernel;
typedef CGAL::Polyhedron_3<Kernel>         Polyhedron;

int main(){
    int i;                                                                // for loop iterators
    int numVerts, numFaces, numHalfedges;      // object boudary description
    float coordVertices[numVerts][3];                 // co-ordinates of object vertices

    std::ifstream myFile("/home/samay/Desktop/cube.off");
    Polyhedron P;
    myFile >> P;
    
    numVerts = P.size_of_vertices();
    numFaces = P.size_of_facets();
    numHalfedges = P.size_of_halfedges();

    std::cout << "numVerts = " << numVerts << "\n"
                  << "numFaces = " << numFaces << "\n"
                  << "numEdges = " << numHalfedges/2 << "\n"
                  << "numHalfedges = " << numHalfedges << "\n";

    for(i = 0; i < numVerts ; i++){        // i = Vertex index
        coordVertices[i][X] = ???
        coordVertices[i][Y] = ???
        coordVertices[i][Z] = ???
    }

    return 0;
}
********************************************************************************************************************

Greetings,
Samay



  • [cgal-discuss] How to read Polyhedron vertex coordinates?, Samay Kumar, 10/22/2008

Archive powered by MHonArc 2.6.16.

Top of Page