## Personalities of the cubeBy Paul BourkeMay 2004 ## Generating rounded cube geometryWritten by Paul BourkeApril 2012
The following will briefly describe a way of creating a rounded cube shape, example code is supplied here: roundcube.c (Tab stops to 3 spaces for correct indenting). which created the shape and saves the result as an obj file with normals and texture coordinates. The code should be easy to modify to create the mesh geometry in other formats or for APIs such as OpenGL. The output from the code plus a sample texture map are given below. - The obj file: roundcube.obj.zip
- The mtl (material file): roundcube.mtl
- And the jpg texture: roundcube0.jpg
The roundedness of the cube is determined by the power the expressions in the polar coordinate calculation of the sphere. A power of 1 is a perfect sphere, smaller powers generate sharper and sharper cubes. The image below is a power of 0.5.
The normals are straightforward to calculate, they are just the vectors to the vertices of the roundcube centered at the origin. There are many options for the texture coordinates, the one chosen here is the projection of a sphere onto the rounded cube. These are computed by calculating the longitude and latitude of each vertex of the capsule and mapping those to (u,v) in the usual way. Examples given the texture map (spherical projection) given above is shown below for power of 0.2 and 0.1 respectively. power = 0.2
power = 0.1
Note that this is a less general formulation of the superelipsoid.
## Wiffle cubePaul BourkeMarch 1990
The wiffle cube is basically a rounded (soft) cube with the center sphere removed. The field function in 3 dimensions at a point p = (x,y,z) is given by the following where a is normally 1/2.3 and b = 1/2. ^{2} (x^{2} + y^{2} + z ^{2}) ]^{-6} -
[ b^{8} (x^{8} + y^{8} + z^{8}) ]^{6}
Isosurfaces of the above field function are wiffle cubes as shown below as wire frame and simple rendered form.
The following are slices along one axis (the other axes would be the same). The horizontal and vertical range is -2.5 to 2.5, the colour is a linear colour ramp from -20 (blue) to about 0.88 (red). Further rendered views varying the isosurface level.
The PovRay model that created the above: wiffle.pov, wiffle.ini.
## How to make the SGI logoWritten by Paul BourkeNovember 1992
The SGI logo is generated as follows:
In the example above l1 = 1 and l2 = 0.7 Turning the line segments into cylinder/sphere pairs is shown below with its geometric description in Radiance
The "logo" can be interlinked in each 3D direction, a few cells are shown below
| |||||||||||||||||||||||||||