discuss@lists.openscad.org

OpenSCAD general discussion Mailing-list

View all threads

New Algorithm for Spheres

RP
Ronaldo Persiano
Tue, Apr 12, 2016 7:50 PM

Nice work, Jamie. The look of a geodesic sphere is more pleasant then the
OpenSCAD primitive one. I will play with it some day.

2016-04-12 4:48 GMT-03:00 Jamie_K vector76@gmail.com:

Sorry for resurrecting an old post but I think it's relevant.  I've
constructed a geodesic equivalent to sphere() as a module in OpenSCAD.  The
algorithm is hardly original, recursively subdividing an icosahedron, but I
feel the implementation is relatively simple.  This code also respects $fn,
$fa, and $fs with the intent of being a drop-in replacement for those cases
when you want the geodesic sphere instead of the default.

Since subdivision always quadruples the number of facets and cuts edge
length in half, there is a fair bit of quantization when choosing the
subdivision level, but it's fairly straightforward: compute the log base 2
of the requested side length or angle compared to the icosahedron starting
point, and round up to the next integer so the subdivision will be at least
as fine as implied by $fn, or by the coarser of $fa, or $fs.

I've also put this on thinigverse here:
http://www.thingiverse.com/thing:1484333

I got started on this because Google didn't seem to find any easy-to-use
geodesics in OpenSCAD, and because it's fun!

-Jamie

http://forum.openscad.org/file/n17062/geodesic_sphere.png

--
View this message in context:
http://forum.openscad.org/New-Algorithm-for-Spheres-tp13306p17062.html
Sent from the OpenSCAD mailing list archive at Nabble.com.


OpenSCAD mailing list
Discuss@lists.openscad.org
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org

Nice work, Jamie. The look of a geodesic sphere is more pleasant then the OpenSCAD primitive one. I will play with it some day. 2016-04-12 4:48 GMT-03:00 Jamie_K <vector76@gmail.com>: > Sorry for resurrecting an old post but I think it's relevant. I've > constructed a geodesic equivalent to sphere() as a module in OpenSCAD. The > algorithm is hardly original, recursively subdividing an icosahedron, but I > feel the implementation is relatively simple. This code also respects $fn, > $fa, and $fs with the intent of being a drop-in replacement for those cases > when you want the geodesic sphere instead of the default. > > Since subdivision always quadruples the number of facets and cuts edge > length in half, there is a fair bit of quantization when choosing the > subdivision level, but it's fairly straightforward: compute the log base 2 > of the requested side length or angle compared to the icosahedron starting > point, and round up to the next integer so the subdivision will be at least > as fine as implied by $fn, or by the coarser of $fa, or $fs. > > I've also put this on thinigverse here: > http://www.thingiverse.com/thing:1484333 > > I got started on this because Google didn't seem to find any easy-to-use > geodesics in OpenSCAD, and because it's fun! > > -Jamie > > <http://forum.openscad.org/file/n17062/geodesic_sphere.png> > > > > > > -- > View this message in context: > http://forum.openscad.org/New-Algorithm-for-Spheres-tp13306p17062.html > Sent from the OpenSCAD mailing list archive at Nabble.com. > > _______________________________________________ > OpenSCAD mailing list > Discuss@lists.openscad.org > http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org >