• Models
  • Contests
  • Slicer
  • Login
  • Start Here
    thingiverse-iconprintables-iconcults3d-iconmakerworld-iconmyminifactory-icon

    3D GO

    3D ModelsContestsCollectionsSaved ModelsOn a mobile device?

3D GO

Privacy Policy
Geodesic sphere with 3-axis polygon equators in OpenSCAD 3D Printer File Image 1
Geodesic sphere with 3-axis polygon equators in OpenSCAD 3D Printer File Thumbnail 1

Geodesic sphere with 3-axis polygon equators in OpenSCAD

Anachronist avatarAnachronist

February 12, 2024

printables-icon
DescriptionCommentsTags

Description

This is a geodesic sphere or hemisphere for OpenSCAD, using the same arguments as OpenSCAD's sphere(). It is based on my geodesic hemisphere, derived from the Geodesic Sphere (icosahedral sphere) by Jamie Kawabata.

Explanation

The default sphere in OpenSCAD is rendered as a circle rotated around a diameter. This results in a globe-shape with longitude and latitude edges, with many wasted facets concentrated at the poles. One can fix this problem by subdividing an icosahedron, resulting in a geodesic sphere with evenly-distributed faces. Such a sphere has no planar polygon equator, so it cannot be matched against other regular polygon shapes.

This code generates a geodesic sphere (or hemisphere) based on an octahedron. Unlike a sphere based on an icosahedron, using an octahedron results in flat equators in all three axis planes. These three equators are regular polygons that can match up with other regular polygon shapes (cylinders etc.).

Both the octahedral sphere and icosahedral sphere are limited in the number of sides available in the polygon equator if you cut it in half. An octahedral sphere equator has the correct size and can have 4×2^n sides (4, 8, 16, 32, 64, 128).

If you need a hemisphere with more flexibility in the number of sides, use my hemisphere() function instead, on which this octahedral version is based.

Usage

To use this, simply put this file in the directory where you keep .scad files, and include this line in your other .scad files:

use <octsphere.scad>

Modular syntax to make a sphere is exactly like OpenSCAD sphere():

octsphere(<radius|r=radius|d=diameter> [, <$fa|$fs|$fn>=number]);

Adding the parameter hemisphere=true creates a hemisphere instead. For example:

// geodesic sphere, radius 20, 32-side polygons on 3 axes
octsphere(r=20, $fn=32);

// same thing but a hemisphere, the top half of a sphere
octsphere(r=20, hemisphere=true, $fn=32);

Functional syntax: You may call octsphere() as a function, which returns an array of polyhedron vertices and faces, any of the following ways:

ph_array = octsphere(radius);
ph_array = octsphere(r=radius);
ph_array = octsphere(d=diameter);

Again, the parameter hemisphere=true can be included to create a hemisphere instead.

The above examples return an array with ph_array[0] being a list of 3D vertices and ph_array[1] being a list of faces. You can manipulate the vertices (saving everything in another vertex array) and call polyhedron(), passing the new vertex array and original face array as arguments. In this way you can create spheres with distortions.

The number of sides in the sphere's equator is controlled by the $fa, $fs, and $fn special variables; e.g. $fn=32 for a sphere with a 32-sided equator. It should not be necessary to go beyond $fn=128. Other values of $fn result in spheres having the nearest number of sides to 4, 8, 16, 32, 64, 128, ... 4×2^n.

 

Category: Math Art

License:

Creative Commons — Public Domain

Related Models

V29 preview image

V29

jzisa profile image

jzisa

81,474

Draw-A-Cat! Stencil for Feline Design preview image

Draw-A-Cat! Stencil for Feline Design

Studio Meshco profile image

Studio Meshco

107

STAND QRCODE/NFC CARD GOOGLE REVIEWS EDITABLE preview image

STAND QRCODE/NFC CARD GOOGLE REVIEWS EDITABLE

ARTIGIANO PAZZO profile image

ARTIGIANO PAZZO

1,776

Cute Mini Octopus preview image

Cute Mini Octopus

McGybeer profile image

McGybeer

75,877

Palestinian Map In Geometric Pattern Design - 2 Parts preview image

Palestinian Map In Geometric Pattern Design - 2 Parts

PALIprints3D profile image

PALIprints3D

20

Dual Text Illusion v2.0 preview image

Dual Text Illusion v2.0

neverland forge profile image

neverland forge

1,416

Modular Mounting System preview image

Modular Mounting System

HeyVye profile image

HeyVye

69,190

Design for a pipe in two pieces - UPDATED AGAIN preview image

Design for a pipe in two pieces - UPDATED AGAIN

Fergy7 profile image

Fergy7

1