# Store a polygon into a half edge data structure using CGAL Polyhedron_3 class

7 messages
Open this post in threaded view
|
Report Content as Inappropriate

## Store a polygon into a half edge data structure using CGAL Polyhedron_3 class

 Dear CGAL mailing list, I am a CGAL beginner and have few problems using Polyhedron_3 class. Problem description: I have a LoD2 3D CityGML building that has to be decomposed and stored in a topological data structure such like Half edge data structure. I was searching for an example CGAL program that takes the Polygon (Vertices) as an input and is able to store it into Half edge data structure. The LinearRing is consists of points which represent actually a polygon: for an example: (my polygon looks like following) 390839.695902067 5819139.47788488 33.8699989318848 390839.20858174 5819139.44457522 33.8699989318848 390838.722880716 5819139.49639365 33.8699989318848 390841.021950274 5819140.0657906 33.8699989318848 390840.616573399 5819139.79328419 33.8699989318848 Questions: Q1: How do I store these 3D points/vertices into a CGAL half edge data structure? Q2: How do I know from the data that which is the next half edge, previous half edge, incident vertex and etc Q3: I can make a triangle with three points and create a CGAL Polyhedron object. How can I combine all points and store into half edge data structure? I hope someone from this CGAL discussion group can help me to find the possible solution to my problem. It would be a great help if you can share some example code so that I can understand it easily. Thanks and regards, Nazmul
Open this post in threaded view
|
Report Content as Inappropriate

## Re: Store a polygon into a half edge data structure using CGAL Polyhedron_3 class

 If you want to stick to Polyhedron_3, the original mechanism was using the incremental builder: http://doc.cgal.org/latest/Polyhedron/classCGAL_1_1Polyhedron__incremental__builder__3.htmlIf you can switch to Surface_mesh, then you have function available doing exactly what you want: http://doc.cgal.org/latest/Surface_mesh/classCGAL_1_1Surface__mesh.html#ad2e8dedad669cb3637d6a7f8207caed5http://doc.cgal.org/latest/Surface_mesh/classCGAL_1_1Surface__mesh.html#a47c2561d1430def60b9e538482ea2adbIf you want to write code that does not depend on the data structure, you can use the BGL API: put(get(CGAL::vertex_point, sm), add_vertex(sm), point_coordinates); and use the helper function for creating a face: http://doc.cgal.org/latest/BGL/group__PkgBGLEulerOperations.html#gada1dd2320a083dbfe09ddacafdaf8b19Sebastien. On 03/18/2017 08:10 PM, hossan.nazmul wrote: > Dear CGAL mailing list, > > I am a CGAL beginner and have few problems using Polyhedron_3 class. > > Problem description: > I have a LoD2 3D CityGML building that has to be decomposed and stored in a > topological data structure such like Half edge data structure. I was > searching for an example CGAL program that takes the Polygon (Vertices) as > an input and is able to store it into Half edge data structure. The > LinearRing is consists of points which represent actually a polygon: > > for an example: (my polygon looks like following) > > > > 390839.695902067 5819139.47788488 > 33.8699989318848 390839.20858174 5819139.44457522 33.8699989318848 > 390838.722880716 5819139.49639365 33.8699989318848 390841.021950274 > 5819140.0657906 33.8699989318848 390840.616573399 5819139.79328419 > 33.8699989318848 > > > > > Questions: > Q1: How do I store these 3D points/vertices into a CGAL half edge data > structure? > Q2: How do I know from the data that which is the next half edge, previous > half edge, incident vertex and etc > Q3: I can make a triangle with three points and create a CGAL Polyhedron > object. How can I combine all points and store into half edge data > structure? > > I hope someone from this CGAL discussion group can help me to find the > possible solution to my problem. It would be a great help if you can share > some example code so that I can understand it easily. > > Thanks and regards, > Nazmul > > > > -- > View this message in context: http://cgal-discuss.949826.n4.nabble.com/Store-a-polygon-into-a-half-edge-data-structure-using-CGAL-Polyhedron-3-class-tp4662587.html> Sent from the cgal-discuss mailing list archive at Nabble.com. > -- You are currently subscribed to cgal-discuss. To unsubscribe or access the archives, go to https://sympa.inria.fr/sympa/info/cgal-discuss
Open this post in threaded view
|
Report Content as Inappropriate

## Re: Store a polygon into a half edge data structure using CGAL Polyhedron_3 class

Open this post in threaded view
|
Report Content as Inappropriate

## Re: Store a polygon into a half edge data structure using CGAL Polyhedron_3 class

Open this post in threaded view
|
Report Content as Inappropriate

## Re: Store a polygon into a half edge data structure using CGAL Polyhedron_3 class

 This post was updated on . Hello Sebastien, Can you please have a look at my data. CityGML_LoD2_building.gmlMy goal is to store this CityGML building geometry into a CGAL Halfedge Data Structure so that I can do some geometric operations. According to your suggestion, I am trying to use CGAL Surface_mesh to store the geometries according to vertices and faces. I can add vertices but I can not add vertices into that particular face. I tried with add_face function: e.g. {mesh.add_face(point1, point2, point3);} and {vertex_range range=mesh.vertices(); face_descriptor face=mesh.add_face(range);} but If you see my data, you will see that it has 7 different faces and the number of points in each face is not always same. I would like to add exactly those vertices into faces from the dataset. My question is, how can I add these arbitrary vertices into 7 different faces. or any idea how do I do that in CGAL? Would it be useful if I can convert my CityGML dataset to OFF(Object File Format)? Thank you so much for your time. Best, Nazmul
Open this post in threaded view
|
Report Content as Inappropriate