Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Code Snippets / Tetrahedron Function

Author
Message
TEH_CODERER
22
Years of Service
User Offline
Joined: 12th Nov 2003
Location: Right behind you!
Posted: 29th Apr 2005 06:17 Edited at: 29th Apr 2005 06:34
Here is a little function I made for someone to create a tetrahedron.


TEH_CODERER
22
Years of Service
User Offline
Joined: 12th Nov 2003
Location: Right behind you!
Posted: 29th Apr 2005 17:20
Damn! That was a pyramid not a tetrahedron! I'll edit later.

Kelebrindae
22
Years of Service
User Offline
Joined: 15th Sep 2003
Location: Where cheeses are scarier than dragons.
Posted: 29th Apr 2005 21:42 Edited at: 29th Apr 2005 21:44
( more infos on this topic here: http://forum.thegamecreators.com/?m=forum_view&t=53140&b=10 )

Try this: it writes a memblock which contains the mesh data, then creates the object from it. It can also create octahedron, isocahedron, and dodecahedron.

Just include "MakePlatonicSolid.dba" at the beginning of your code then use the function like this:
MakePlatonicSolid(Id,type$,size#)
(press the "download" button to get the file and a quick test program)

But I must admit your solution, Andrew, is more elegant and probably way faster for solids with few faces like the tetrahedron...

Ideas: memories of things which did not occur yet...
TEH_CODERER
22
Years of Service
User Offline
Joined: 12th Nov 2003
Location: Right behind you!
Posted: 30th Apr 2005 00:42
Thanks. Can't believe I made that mistake! Here is the new code:

I think something strange is going on with the normals.

ShadowCentaur 2
21
Years of Service
User Offline
Joined: 8th Apr 2005
Location: Free Country USA
Posted: 30th Apr 2005 05:30
thanks both of you for helping me out. i suspect this will be quite usefull, having 4 more primatives to work with. kelebrindae, you said (on that thread i started) youve got a nerdy facination with platonics. dont worry, its ok to be a math/programming geek. your amoung friends(i'm one).

5/12*(3+sqrt(5))*L^3=volume of a icosahedron

(15+7*sqrt(5))/4*l^3=volume of a dodecahedron

Truth suffers from too much analysis.
-Ancient Fremen Saying
Kelebrindae
22
Years of Service
User Offline
Joined: 15th Sep 2003
Location: Where cheeses are scarier than dragons.
Posted: 3rd May 2005 23:17
Three small bug fixes:
- fixed a "for i=1 to n: .... :next anythingbutnoti" in UV mapping. Don't know why it worked anyway...
- fixed the case when you give a something wrong as the name of the solid you want to create.
ex: "MakePlatonicSolid(1,"schmurtzahedron",1.0)
- fixed errors "memblock 255 already exists" and "mesh 65534 already exists".

I've put the corrected code in the Codebase, and under the "download" button.

Ideas: memories of things which did not occur yet...
Kelebrindae
22
Years of Service
User Offline
Joined: 15th Sep 2003
Location: Where cheeses are scarier than dragons.
Posted: 11th May 2005 21:31
Corrected the mistyped "icosahedron" (it was spelled "isocahedron").

Hit the "download" button to get the correct version.

(Thanks, ShadowCentaur 2)

Ideas: memories of things which did not occur yet...

Login to post a reply

Server time is: 2026-07-03 05:01:19
Your offset time is: 2026-07-03 05:01:19