Jevan
[ free music, drawings, writing and more ]
| 3D |
Art |
Blog | Engineering |
IT |
Music |
Photos |
Science |
Other |
IT - SuperQuadric
Tire in Colour
SuperQuadric is a formula used for generating 3D objects from a few numbers that, completely specify them.
Software code has been written using JiggleScript to implement the superquadric. The JiggleScript software can be downloaded here this zip archive includes my superquadric generator script and sample images generated using it.
The things which can be configured are:
- SuperQuadric Formula Coefficients a1, a2, a3, e1, e2 (respectively, keys 'qwert' to step increase, 'asdfg' to step decrease)
- Rotation above the X, Y and Z Planes (keys 'uio' to step increase, keys 'jkl' to step decrease)
- Calculation Resolution Step (x to increase, z to decrease)
- Reference Plane and Reference Point (b to show)
Comments:
- The reference plane and reference point, are not the origin
- Forming an Object Using the Mouse: Click the left mouse button, hold it down and drag left or right to adjust the coefficient, the value is shown up the top of the window and the 3D image will be seen to change as the mouse moves. When the mouse button is released, the object does not change shape anymore even if the mouse is moved. The next time the mouse is held down, will adjust the next coefficient, and so on through the 5 coefficients.
- An optimum strategy is to find an interesting object using the mouse, then use the keyboard for refinements of the coefficients. Then rotate the plane so that the viewpoint for the object looks interesting. Finally, decrease the calculation resolution step so that more detail is visible in the object - this is usually done last, since the calculation time is greater when there is more detail.
- The object is always displayed in full colour, the RGB (amount of red, green, blue) corresponds directly with the XYZ coordinate. This was found to show interesting colour shades and increases the effect of 3D without having to use light sources.
- JiggleScript is built on top of JavaScript, so the source code contains both JiggleScript (including Mouse Events, Window Handling, Access to the OpenGL Object) and JavaScript. OpenGL is the standard OpenGL available for PCs - it needs to be installed on the computer running the JiggleScript executable, for JiggleScript to work.
- Sample gif images are provided here, that were generated with the JiggleScript sourcecode. To generate these images, download the jigglescript superquadric software that was developed (superQuadric.jig), download and install the JiggleScript application, and ensure that OpenGL is installed (often it will be already, for example many common computer games require it).
- SuperQuadric: a1(cos(delta)^e1)cos(w)^e2), a2(cos(delta)^e1)sin(w)^e2), a3(sin(delta)^e1) where w ranges from -pi..pi, and delta from -pi/2 .. pi/2
Spinning Top
Tire
Bowl
Spider Web
JiggleScript Source-Code (Right-Click and save as superQuadric.jig)
Future Improvements
A moving spinning top, might be generated and made available as an AVI file for download. With JiggleScript and some computer graphics mathematics, this might be possible, more investigation would be needed.