Re: three angles and a particle...

new topic     » topic index » view thread      » older message » newer message

At 03:41  6/03/01 -0800, you wrote:
>Missed me?

Not Really.

>*sigh*

--<Massive Garbage Snippage>-----

>err...
>Let's talk Euphoria for a second ...

Praise the LORD!

>Does anyone have a routine wich draws a particle at
>x,y,z?
>like 'p3d(c,x,y,z)' or something simmiliar.

>You know, a colored square wich can be placed on the
>screen at a 3D position ...
>That's all ...

sequence angles       -- Rotation around each axis

atom d                -- Distance from View point to projection plane
                      -- (affects perspective as value gets smaller)

sequence sine,cosine

d=1000

angles= { 1.23 , 2.22, 0.123 } -- Radians

sine=sin(angles)
cosine=cos(angles)


function transform(sequence point)
    atom a,b,c
    a=point[1]*cosine[1]+point[2]*sine[1]
    b=point[2]*cosine[1]-point[1]*sine[1]
    c=point[3]*cosine[2]-a*sine[2]
    a=d-(a*cosine[2]+point[3]*sine[2])
    return {(b*cosine[3]+c*sine[3])*d/a,(c*cosine[3]-b*sine[3])*d/a}
end function


point2d=transform({11,23,-13})


You'll want to calculate the trig outside of the function
as I have done as you will no doubt want to do multiple
'particles' for a given set of rotations.


Graeme.

new topic     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu