Re: 3-d equation

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

Hi Jesse
Here's a pretty simple function that will project a point located in
the 3d space behind the screen onto the screen. The sequence "eye"
holds the coordinates of the viewer's viewpoint. The sequence "thing"
holds the coordinates of the point to be projected on the screen.
Bye
Martin
>>Euphoria code starts
constant X=1
constant Y=2
constant Z=3
sequence thing, eye
eye = {100,100,-100}
thing={50,50,100}

function perspective (sequence thing, sequence eye)
sequence t, i
atom r
    r=thing[Z]/(thing[Z]-eye[Z])
    t=thing[X..Y] i=eye[X..Y]
    return (t+r*(i-t))
end function

?perspective(thing, eye)
?perspective(thing+10, eye)
?perspective(thing+20, eye)
?perspective(thing+{0,0,100}, eye)
>>Euphoria code ends

> Could someone please give me an equation or an algorithm to display a =
> set of 3-d points on a x-y coordinate system? I will give a registered =
> copy of a program I'm making with it to who gives me the one I'll use.
> Thank you=20
> Jesse

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

Search



Quick Links

User menu

Not signed in.

Misc Menu