|
|
|
|
#1 |
|
Major Dude
Join Date: Apr 2004
Location: melbourne, australia
Posts: 654
|
rotation matricies for triangle ape
okay i need help with projecting a 2d square made with tl's triangle ape into 3d. i have the code for the square but i can't figure out how to 3d it.
anyone care to explain it/post up some code? cheers. |
|
|
|
|
|
#2 |
|
Major Dude
Join Date: Oct 2002
Location: The United Kingdom of Great Britain and Northern Ireland
Posts: 1,374
|
Assuming you already know how to describe a point in 3 dimensions, you simply need to extend that idea to describing the vertices of a triangle. That is, you need to define the three vertices of a triangle, then rotate and project each vertex independantly to get your final x1,y1 etc..
A simple framework for 3D triangles looks something like this: code: (xs1,ys1,zs1) and the like are vertices srot# = sin of rotation about # axis crot# = cos of rotation about # axis d = projection z offset (1 is fine) asp = aspect ratio (h/w or whatever) http://PAK-9.deviantart.com ...innit |
|
|
|
|
|
#3 |
|
Major Dude
Join Date: Apr 2004
Location: melbourne, australia
Posts: 654
|
so you do have to do the transformations for all three? i ended up doing that too i just wasn't sure if it was the most efficient way.
i came up with this code: were reg00-05 are cos/sin stuff and reg06 is aspect correction. |
|
|
|
|
|
#4 | |
|
Major Dude
Join Date: Oct 2002
Location: The United Kingdom of Great Britain and Northern Ireland
Posts: 1,374
|
Quote:
Often with complicated triangle presets I have a loop somewhere which calculates all the vertices for the model or shape, rotates and projects them then stores the final x,y for each vertex in the gmegabuf. That way in the triangle APE I can just loop through the gmegabuf spitting out vertices. For a simple square thats obviously a bit excessive but I imagine you had grander preset visions for the future. http://PAK-9.deviantart.com ...innit |
|
|
|
|
|
|
#5 |
|
Major Dude
Join Date: Apr 2004
Location: melbourne, australia
Posts: 654
|
thanks pak. the square was actually the last thing i added to a preset thats pretty much finished now. it'll be in v10 when thats released, which shouldn't be too far away cause i only need an intro preset and re-mixes. i'm bundling all the presets together into a zip tonight. if you want to see what i've been up to or even make a remix or two i can mail you the zip.
Last edited by Mr_Nudge; 26th April 2007 at 13:40. |
|
|
|
|
|
#6 |
|
Major Dude
Join Date: Oct 2002
Location: The United Kingdom of Great Britain and Northern Ireland
Posts: 1,374
|
Sure, mail it to me and I'll take a look (pak.nine on gmail)
http://PAK-9.deviantart.com ...innit |
|
|
|
![]() |
|
|||||||
| Thread Tools | Search this Thread |
| Display Modes | |
|
|