3D Primitives -Cone ,Cube, Cylinder, Sphere & Sphere2
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller
3D Primitives -Cone ,Cube, Cylinder, Sphere & Sphere2
The smart math comes from Skytopia.
I just took basic Livecode graphic line objects, extruded the points into 3D space, or flipped them into 3D slpace?
For 3 Days I looked for a solution for the sphere, all kinds of gobbledeygook code that I broke trying to reconifigure for Livecode. You know how easy it was? Take a circle, copy its points, put the Y in the Z for the vertical cross section, put the X in the Z for the horizontal section, adjust a dangling points on the lines and you got yourself a flying sphere-ish thing. A full tri-mesh polygon sphere is still beyond my grasp.
Now a single function and handler pair manges the custom properties that define each objects origin state.
setXYZ takes a paramenter object, an X,Y, or Z index name, the position in the array, and finally the value ot stick in there.
Then it combines "xyz" & the object name & "Arrray" to identify the array to manage
Then it sticks the value in the X, Y or Z sub index
getXYZ gets the value back from the array in the same way: Object name, x,y or z, index number
Once the arrays custom properties are set, as they are now, they don't need to be reset, but if you move the scripts to a new stack, you'll need to run their Init<shape> code at least once...with the appropriate paired objects as seen in their Define...handlers.
Oh and tilde key ,ie the key to the left of the 1 key toggles the vertice identifying circles of the cube on and off.
Okay, have fun!
Re: 3D Primitives -Cone ,Cube, Cylinder, Sphere & Sphere2
There was an extra bracketed variable in the cylinder loop causing it not to draw correctly, stack updated in post above.