문제

when i cast 3d point on 2d screen i use

    if( z > 1.0 )                   
     {
      screen_x = (x/z)*500;         
      screen_y = (y/z)*500;
     }

this is i just can throw away all 'rear' points and scale front points

but now i need to cast/projects line segments - to 2d points then i can draw it as 2d line

some cases would be that one point of line segment is in front space but the other in rear space - how to cast the rear space point so I could draw it as a 2d line?

much tnx for answer

도움이 되었습니까?

해결책

This will do what you ask:

screen_x = (x/(|z|+1.0))*500;         
screen_y = (y/(|z|+1.0))*500;
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top