20070803, 17:22  #1 
Mar 2007
Austria
2·151 Posts 
convert 3d into 2d
I have a question about 3d point rendering. You have a 3d point P1 with cartesian coordinates x1,y1,z1.You also have the azimuth a and the elevation b(angles). Now I like to know the x and y coordinates of if seen in 2d. I know it's not very clear but I can't tell it clearer so please post if you don't understand.
Last fiddled with by nuggetprime on 20070803 at 17:22 
20070803, 17:59  #2 
∂^{2}ω=0
Sep 2002
República de California
2·5,693 Posts 
Uh, the x and ycoordinates are the same in 2D as they are in 3D  just the zcoordinate gets lost.

20070804, 03:53  #3 
"Phil"
Sep 2002
Tracktown, U.S.A.
1,117 Posts 
It sounds like you are asking for the x and y coordinates in a projection, given a specific azimuth a and elevation b. Sounds like an elementary problem, if you don't get an answer within the next day or two, I will work it out. Should be a good exercise for the next time I teach trigonometry.

20070805, 02:32  #4 
Sep 2002
2·331 Posts 
Some code changed from basic to pascal mixed with assembly
then rearranged to show the order of execution. Code:
rho := 10; theta := 0.7; { 0.7 0.9 1.1 rotate clockwise about z axis} phi := 1.3; d := 500; { 500 700 900 increase size on screen} th := theta; { angles in radians } ph := phi; s1 := sin(th); c1 := cos(th); s2 := sin(ph); c2 := cos(ph); cx := 256; { x center offset 0..512 x left to right } cy := 256; { y center offset 0..512 y bottom to top after flip } { first 5 points of 11 using values of 0 or 1 } data[0,0] := 1; data[1,0] := 1; data[2,0] := 0; { point 0 } data[0,1] := 1; data[1,1] := 1; data[2,1] := 1; { point 1 } data[0,2] := 0; data[1,2] := 1; data[2,2] := 1; { point 2 } data[0,3] := 0; data[1,3] := 1; data[2,3] := 1; { point 3 } data[0,4] := 1; data[1,4] := 1; data[2,4] := 0; { point 4 } for n := 0 to 4 do begin x := data[0,n]; { do for each point } y := data[1,n]; z := data[2,n]; { begin Transform } xe := x * s1 + y * c1; ye := x * c1 * c2  y * s1 * c2 + z * s2; ze := x * s2 * c1  y * s2 * s1  z * c2 + rho; sx := d * xe / ze + cx; sy := cy  d * ye / ze; { screen coordinates are 0..512 x, left to right } { 0..512 y, top to bottom } { the screen y is flipped to 0 on bottom, 512 on top } { 0,0 translated to screen center 256, 256 } { end Transform } x := sx; y := sy; { then use the result for either MoveToEx or LineTo } writeln(' invoke MoveToEx,hDC,',x:3,',',y:3,',NULL'); writeln(' invoke LineTo, hDC,',x:3,',',y:3); end; { full 11 points produce visible faces of a cube } { invoke MoveToEx,hDC,262,277,NULL invoke LineTo, hDC,263,220 invoke LineTo, hDC,297,212 invoke LineTo, hDC,296,265 invoke LineTo, hDC,262,277 invoke LineTo, hDC,221,267 invoke LineTo, hDC,220,213 invoke LineTo, hDC,256,206 invoke LineTo, hDC,297,212 invoke MoveToEx,hDC,220,213,NULL invoke LineTo, hDC,263,220 } Last fiddled with by dsouza123 on 20070805 at 02:34 
20070816, 17:12  #5 
"Lucan"
Dec 2006
England
6474_{10} Posts 
How do you say this in Spanish

20070816, 17:14  #6 
∂^{2}ω=0
Sep 2002
República de California
2·5,693 Posts 

20070922, 08:35  #7 
23×197 Posts 
I could nt understand the middle part of the code.

Thread Tools  
Similar Threads  
Thread  Thread Starter  Forum  Replies  Last Post 
convert files from srsieve/srfile into worktodo.txt  Rincewind  PrimeNet  9  20141101 11:47 
How to convert 5495bit binary number to decimal?  Stargate38  Software  12  20120207 21:19 
convert to standard ASCII text when possible?  ixfd64  mersennewiki  5  20060406 00:00 
Convert Binary to BCD code  tinhnho  Miscellaneous Math  8  20050918 15:14 
Linux! Convert me!  OmbooHankvald  Linux  8  20050813 23:50 