Super Shape in 3D

Super Shape in 3D

Couple of days before I stumbled upon Andre Michelle Super Ellipse example. You can think – nothing special but it is like magic how fast it performs and deforming in different 3D shapes. Next thing after Super Ellipse is Super Shape. It is a lot more complex in computation and I thought Flash would stack with it. But after some test it turns to be possible.
You can find a lot more info on subject at Paul Bourke website.
I have created a demo application that shows basic usage of Super Shape class. Hype project was used for Sound Spectrum control and options adjustments upon sound change. This is a very dirty 3D rendering using built in Flash methods with very very primitive triangle Z sorting.

Here is the source for the class
Demo Application

Simple code example:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
// create instance with resolution 24
var ss3d:SuperShape3d = new SuperShape3D(24);
 
// update shape by applying 2 Super Shapes parameters
ss3d.update(1.0, 1.0, 7.0, 0.2, 1.7, 1.7,
			1.0, 1.0, 7.0, 0.2, 1.7, 1.7);
 
var proj:PerspectiveProjection = new PerspectiveProjection();
proj.fieldOfView = 75;
var matrix:Matrix3D = new Matrix3D();
matrix.appendScale(64, 64, 64);
matrix.appendTranslation( 0, 0, 128);
matrix.append(proj.toMatrix3D());
 
Utils3D.projectVectors(matrix, ss3d.wVerts, ss3d.projectedVerts, ss3d.uvts);
 
this.graphics.clear();
ss3d.draw(this.graphics, 1, 0x333333, 0);