# Straight Skeleton - or how to draw a center line in a polygon or shape?

**URL:** <https://discourse.processing.org/t/straight-skeleton-or-how-to-draw-a-center-line-in-a-polygon-or-shape/17208>\
**Category:** Processing\
**Created:** [January 20, 2020, 4:30pm UTC](https://discourse.processing.org/t/straight-skeleton-or-how-to-draw-a-center-line-in-a-polygon-or-shape/17208 "2020-01-20T16:30:24Z")\
**Posts on this page:** 1\
**Showing post:** 22

<div class="post-metadata">

**Author:** ![micycle](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/micycle/32/201_2.png) [@micycle](https://discourse.processing.org/u/micycle)\
**Post date:** [March 21, 2022, 12:07pm UTC](https://discourse.processing.org/t/straight-skeleton-or-how-to-draw-a-center-line-in-a-polygon-or-shape/17208/22 "2022-03-21T12:07:10Z")

</div>

I’ve revisited this topic recently after unearthing a straight-skeleton [implementation](https://github.com/kendzi/kendzi-math/tree/master/kendzi-straight-skeleton) that is ~50x faster than camp-skeleton (however, it can produce malformed outputs). It will be [integrated](https://github.com/micycle1/PGS/blob/17a5d09f5554c84ab6b3e06427aa23d27dca10e9/src/main/java/micycle/pgs/PGS_Contour.java#L234) into the next version of [PGS](https://discourse.processing.org/t/processing-geometry-suite/29924).

Here are some illustrations of what can be done with PGS (namely the `PGS_Contour.straightSkeleton()`, `PGS_Coloring.colorMesh()` and `PGS_Contour.offsetCurvesInward()` methods).

 ![image](https://canada1.discourse-cdn.com/flex036/uploads/processingfoundation1/original/2X/7/7b8ba3d436f0c879ef1900bfb49bd6675d6de4a0.jpeg)

 ![image](https://canada1.discourse-cdn.com/flex036/uploads/processingfoundation1/original/2X/8/8880e0a23579d00e0706dfd969f6eff5d73c126d.jpeg)

 ![image](https://canada1.discourse-cdn.com/flex036/uploads/processingfoundation1/original/2X/5/5d0461201db4c0a1d9b92bb75b994c7c0fa19355.png)

---

_[View the full topic](https://discourse.processing.org/t/straight-skeleton-or-how-to-draw-a-center-line-in-a-polygon-or-shape/17208)._
