Straight Skeleton of polygons in 3d

In the last blog ( https://sozvyezdami.wordpress.com/2013/04/06/straight-skeleton-into-svg/ ) I pasted some code for turning a geometric shape known as a ” CGAL Straight Skeleton ” into another format known as “svg” – the latter of which is useful for internet browsers and other graphics types of programs.

Now, the goal there was to work towards ‘surface subdivision’ for the ‘smoothing’ of blocky shapes in the OpenSCAD drawing program. I am not there yet. But where am i?

Behold,

Image

That was the SVG. The Three D is here, using “Mr Doob’s” three.js library:

Image

if you look very close (or click on the image to zoom it in) you can see that this polygon is not flat in the xy, yz, or xz plane. It is actually ’tilted’. Thus. 3d.

polygon body coordinates:

0 0 0
0 10 0
10 10 10
10 0 10

hole coordinates:

2 2 2
2 5 2
8 5 8
8 2 8

The code is too much to post here. It’s on github though:

https://github.com/donbright/skeleton_polygon3d

For quick starting on Ubuntu Linux:

git clone https://github.com/donbright/skeleton_polygon3d
sudo apt-get install build-essential libcgal-dev libboost-dev
cd skeleton_polygon3d
cmake . && make && ./skeleton_polygon3d
firefox skeleton_polygon3d.html
Advertisements

About donbright

https://patreon.com/donbright https://github.com/donbright http://dwitter.net/u/donbright
This entry was posted in Uncategorized. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s