
Mit den Drachen und Darts aus Teil 2 , erstellen Sie eine 3D-Oberfläche. Ein Teil des Scene3D-Codes wurde von einigen der Beispiele entlehnt, die mit JMP geliefert werden. Diese JSL wurde geschrieben, um den Videoclip zu erstellen. Darin vergraben sind einige Skalierungs- und Animationssteuerwerte, die optimiert wurden, um das Video genau richtig zu machen. Es gibt auch einen Pfad zu einem Verzeichnis auf dem Desktop, das mit nummerierten Bitmaps gefüllt wird. In Teil 4 wird erläutert, wie Sie andere Tools außerhalb von JMP verwenden, um die Bitmaps zu einem Video zusammenzusetzen.
Dieser Code erwartet, dass sich die Variablen aus Teil 2 noch im Speicher von JMP befinden.
scale = 50;//50;
sbscale = .5;//2;//.4;//1;
///////////////// 3D ///////////////////
fn = Function( {x, y},
x /= scale;
y /= scale;
(((1 + Cos( -Pi() + fraction * 2 * Pi() )) / 2) ^ .95) * scale * Sin( 100 * fraction * Pi() + Sqrt( x * x + y * y ) );
); // the function to plot. the sheet color assumes the result is between -1 and +1.
addvertex = Function( {a, b, c},
If(
af < 100, b[3] += Random Normal( 0, If( af <= 0, .1, 1 / Sqrt( 100 * af ) ) ),
af > nframes, b[3] += Random Normal( 0, .01 * Sqrt( af - nframes ) ),
0
);
// calculate the normal; this is the vector cross product of the two lines leaving b to a or c
qx = a[1] - b[1];
qy = a[2] - b[2];
qz = a[3] - b[3];
px = c[1] - b[1];
py = c[2] - b[2];
pz = c[3] - b[3];
nx = py * qz - pz * qy;
ny = pz * qx - px * qz;
nz = px * qy - py * qx;
// normalize the normal vector (sheet<<ENABLE>= nframes, ((nframes - af) / 10) - 15, af <= 0, (af / 10) - 15, -15 ) );
scene << enable( FOG );
scene << fog( FOG_END, 25 ); // fog ends 3 units away, 1 beyond origin
scene << fog( FOG_START, 20 ); // fog begins
scene << fog( FOG_MODE, LINEAR );
changeangle( af );//show(zangle);
scene << Rotate( xangle, 1.0, 0.0, 0.0 ); // spin around the X axis
scene << Rotate( yangle, 0.0, 1.0, 0.0 ); // and the Y axis
scene << Rotate( zangle, 0.0, 0.0, 1.0 ); // and the Z axis
scene << arcball( sheet, 8 );
scene << Update;
Wait( 0 );
// scene << savepicture( picdir || Right( Char( picno++ ), 6, "0" ) || ".png" );
);
</ENABLE>
Post zeigt auf Video