1. 3-d equation
- Posted by jesse kint <jk2000 at PA.NET> Aug 26, 1998
- 481 views
------=_NextPart_000_0011_01BDD114.E73FA160 charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable 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 jk2000 DalNet on mirc in #double ------=_NextPart_000_0011_01BDD114.E73FA160 charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable <!DOCTYPE HTML PUBLIC "-//W3C//DTD W3 HTML//EN"> <HTML> <HEAD> <META content=3Dtext/html;charset=3Diso-8859-1 = http-equiv=3DContent-Type> <META content=3D'"MSHTML 4.72.3110.7"' name=3DGENERATOR> </HEAD> <BODY bgColor=3D#ffffff> <DIV><FONT color=3D#000000 size=3D2>Could someone please give me an = equation or an=20 algorithm to display a set of 3-d points on a x-y coordinate system? I = will give=20 a registered copy of a program I'm making with it to who gives me the = one I'll=20 use.</FONT></DIV> <DIV><FONT color=3D#000000 size=3D2>Thank you </FONT></DIV> <DIV><FONT color=3D#000000 size=3D2>Jesse</FONT></DIV> <DIV><FONT color=3D#000000 size=3D2>jk2000</FONT></DIV> <DIV><FONT color=3D#000000 size=3D2>DalNet on mirc in=20 ------=_NextPart_000_0011_01BDD114.E73FA160--
2. Re: 3-d equation
- Posted by Robert Craig <rds at EMAIL.MSN.COM> Aug 27, 1998
- 469 views
jesse kint writes: > could someone please give me an equation or an algorithm to > display a set of 3-d points on a x-y coordinate system? euphoria\demo\dos32\wire.ex takes a bunch of lines in 3-D (specified by their end-points) and maps them to the 2-D screen. It involves a bunch of fancy trigonometry (sin's and cos's) that I got out of a book on computer graphics. I sort of understood it when I wrote it, but please don't ask me any questions about it now. You can change the data from a block "E" to something else. Regards, Rob Craig Rapid Deployment Software http://members.aol.com/FilesEu/
3. Re: 3-d equation
- Posted by lithex <lithex at INTERGATE.BC.CA> Aug 27, 1998
- 453 views
- Last edited Aug 28, 1998
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
4. Re: 3-d equation
- Posted by "Graeme." <hmi at POWERUP.COM.AU> Aug 29, 1998
- 448 views
At 17:13 26/08/98 -0400, you wrote: >Could someone please give me an equation or an algorithm to >display a >set of 3-d points on a x-y coordinate system? function transform(sequence point,sequence angles, integer d) atom a,b,c sequence sine,cosine sine=sin(angles) cosine=cos(angles) 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 floor({((b*cosine[3]+c*sine[3])*d)/a, ((c*cosine[3]-b*sine[3])*d)/a}) end function This function will return a set of 2D co-ords from a 3D point and 3 rotation angles. the parameters are : point : {x,y,z} angles : {alpha, beta, gamma} in radians d : Distance between view point and projection plane The output will have to be scaled to fit your screen. i.e. constant scale={3,2} -- insert appropriate values here sequence p2d,p3d,ang p3d={28,9,18} ang={1.3,0.4,5.6} p2d=transform(p3d,ang,80)*scale The d parameter affects the severity of the perspective applied to the transformation, play around with it until you find a value you like. If you are transforming a lot of points at the same rotation angles (highly likely), you will want to remove the cos() and sin() calls from inside the function to avoid them being re-calculated for each point. Hope this helps. Graeme. ----------------------------------------------------
5. Re: 3-d equation
- Posted by Daniel Johnson <Lmailles at AOL.COM> Aug 31, 1998
- 490 views
Apologies if this has already been answered, I've been away for the weekend. > 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 think that what you are after is this : You have {x,y,z} and want to plot it on screen. Assuming that increasing Z represents a greater distance away from you, an accurate perpestive plot is achieved by dividing both x and y by z. {x/z,y/z} or {x,y}/z In euphoria code : function plot3d( coord3d xyz) coord2d xy xy = xyz[1..2]/xyz[3] return xy end function You now have a problem. If z is 0 you get a divide by zero error. This can be avoided by checking or objects that are behind you (z<=0) before plotting. All of this and much more is implemented in my 3d toolkit (FREEWARE), which should make its first alpha release this week. There are just a couple of fatal bugs to fix. It implements full three-dimensional clipping (behind, too far away or off-screen) and single buffering. > I will give a registered copy of a > program I'm making with it to who gives me the one I'll use. What might that be ? God Bless Daniel