<p>A possible way to do this is tracing the <a href="https://en.wikipedia.org/wiki/Silhouette_edge" rel="nofollow noreferrer">silhouette edges</a> of the polyhedron and projecting them to a 2d polygon only at the end of the process.</p>

<p>A silhouette edge (in your context) is defined by its neighboring facets having one upwards and one downwards normal (i.e., one positive normal z-coordinate and one negative). This can be checked using Polyhedron_traits_with_normals_3 or you can compute the normals yourself on-the-fly.</p>

<p>If you only need the outside polygon, you can start with an extreme vertex (e.g., the one with minimal x-coordinate), circulate over its incident halfedges (using Halfedge_around_vertex_circulator), take the one that is a silhouette edge and continue tracing with its next vertex until you close the cycle.</p>

<p>If you also need inside (hole) polygons, a possible solution can be to gather the silhouette edges from all the polyhedron, and trace the cycles from this set.</p>

CC BY-SA 4.0
2018-05-21T10:14:55.670Z
2018-05-21T10:14:55.670Z
Iddo Hanniel
<p>I am trying to project a Polyhedron on the xy plane with CGAL, which should result in a (2D) polygon.</p>

<p>I wonder, if there is an elegant way to achieve it?</p>

<p>Of course, I can iterate over all surfaces and build 2D-Segments from the 3D-Segments by throwing away the z coordinate and then reassemble the polgon cycles.</p>

<p>But I feel, that somehow using <code>Projection_traits_xy_3</code> it should be possible to solve that task more elegant, however, I couldn't find a way. Is this possible?</p>

<computational-geometry><polygon>
Projection of a Polyhedron on xy Plane with CGAL
Ctx
# Projection of a Polyhedron on xy Plane with CGAL

(Asked by: username_0 on 2018-05-18)

I am trying to project a Polyhedron on the xy plane with CGAL, which should result in a (2D) polygon.

I wonder, if there is an elegant way to achieve it?

Of course, I can iterate over all surfaces and build 2D-Segments from the 3D-Segments by throwing away the z coordinate and then reassemble the polgon cycles.

But I feel, that somehow using `Projection_traits_xy_3` it should be possible to solve that task more elegant, however, I couldn't find a way. Is this possible?

**Tags:** computational-geometry, polygon


---

## 1 answers

### Answer by username_1 on 2018-05-21. Score: 2

A possible way to do this is tracing the [silhouette edges](https://en.wikipedia.org/wiki/Silhouette_edge) of the polyhedron and projecting them to a 2d polygon only at the end of the process.

A silhouette edge (in your context) is defined by its neighboring facets having one upwards and one downwards normal (i.e., one positive normal z-coordinate and one negative). This can be checked using Polyhedron\_traits\_with\_normals\_3 or you can compute the normals yourself on-the-fly.

If you only need the outside polygon, you can start with an extreme vertex (e.g., the one with minimal x-coordinate), circulate over its incident halfedges (using Halfedge\_around\_vertex\_circulator), take the one that is a silhouette edge and continue tracing with its next vertex until you close the cycle.

If you also need inside (hole) polygons, a possible solution can be to gather the silhouette edges from all the polyhedron, and trace the cycles from this set.


---

