# Geodesic Maths for OpenScad - v0.1

## by WilliamAAdams, published

## Thing Info

# Summary

A funny thing happened on my recent holiday. I built a nice 3V geodesic dome and covered it with a parachute, so me and the family could sleep mosquito free. Of course I used the Desert Domes calculator: http://www.desertdomes.com/ in order to calculate my chord factors so I could cut my wood dowels. But then I got to thinking...

The geodesic form of tesselation is certainly good for dome building, but it's probably also good for other modeling purposes as well.

This thing is a library of functions that will do geodesic calculations, written in OpenScad.

There's no pretty object to go with it. I'll have to use my handy dandy renderer and generate some domes. For now, it's the the raw routines.

First, there's some simple useful nuggets related to spherical coordinates:

sph(long, lat, radius)

sph_to_cart(s) - convert to cartesian

sph_from_cart(s) - create spherical from cartesian

sph_dist(c1, c2) - Calculate the chord distance of two points on a sphere

that right there is enough to do some fun geometry and GIS sorts of stuff. but wait, there's more!!

Pulling this book off the shelf: Geodesic Math and How to Use It

I went and created the following:

geo_freq()

geo_tri2_tri3()

octa_class1()

octa_class2()

icosa_class1()

icosa_class2()

tetra_class1()

class1_icosa_chord_factor()

These are the basics. The last one is what you really actually use to figure out chord factors, then you use those factors, multiply for your radius, and you're done. For those in the know of geodesics, it's relatively easy going from there. If you're not so familiar, a much more handy geodesic() module will be forthcoming in a subsequent release.

As usual, why bother with all this nonsense? The web based calculator at Desert Domes is perfectly usable after all... Well, that calculator generates domes based on the Icosahedron, Class 1, Method 1 style. That's not the only form in which a dome can be constructed. There are the octahedron, and tetrahedron base forms, and what about elliptical shapes, and who can forget triacons!!?

At any rate, I figure if there's a ready made public domain library to start from, people can make more interesting dome construction models, so here it is! I think it would be rather nifty if OpenScad had native support for geodesics...

Future additions will include more interesting methods/classes and things such as elliptical and 'free form' sorts of things. Then it will get really interesting.

UPDATE: 08082011

Added a blog entry to go with this:

http://williamaadams.wordpress.com/2011/08/08/geodesic-math-in-openscad-part-1-of-some/

UPDATE: 12082011

There is a bug in the 'clean()' function. So, if you're using the sph_to_cart() function, you'll get invalid numbers when you rotate past 90 degrees for your longitude. I'll update in a bit, but there's some other new functions coming as well.

# Instructions

1) Download maths_geodesic.scad

2) Download test_geodesic.scad

3) Fiddle about with the various test routines to generate interesting numbers

4) Use those numbers to cut pieces of material to size

5) Assemble something

6) Rejoice!

There are numerous references to Dome building on the internet. I so happen to have picked up this very old book "Geodesic Math and How to Use It" because it was written in Berkeley, and had a writing style that appealed to me. You can use that book, or any other book, to follow along what's going on here.

## Thing Info

## Liked By

View All## Tags

## Give a Shout Out

Hi, sounds like a very cool implementation. I dl'd both modules and they echo some numbers but no geometry was rendered and i didn't find any information on how to use the code, it runs without errors on the various tests and makes no geometry?

is it adaptive?

Dear Adam,

Two sites provide much better calculators than Desert Dome which was a fantastic pioneer.

Try http://simplydifferently.orgsimplydifferently.org for other geometeries than icoshedron as well as optimided versions of icosahedron.

Also try the site domearama for its array of dome calculating tools as well as many interesting things on domes.

Did you know Hugh Kenner was a proffesor of English Litterature at Berekly!

There is a silly bug in the 'clean()' function:

function clean(n) = (n

&

lt; 0) ? ((n

&

lt; -Cepsilon) ? 0 : n) :

`(n `

&

lt; Cepsilon) ? 0 : n;

Should be

function clean(n) = (n

&

lt; 0) ? ((n

&

lt; -Cepsilon) ? n : 0) :

`(n `

&

lt; Cepsilon) ? 0 : n;

Could you spot the change? At any rate, if you're using this function directly, you'll want to make this change.

Unfortunately I never got around to fully comprehend the math behind it, despite several attempts to do so. Thanks for sharing this!

Sometimes it's easier to just use the tools at hand than understanding how they're made. I hope these are such tools. Just enough to make interesting things without you having to understand how they're put together.

Although, once you look at how they're put together, the mystery might disappear.

Please Login to Comment