   3D to 2D Conversion - Edge Cases
  Hi,I have been working on converting a 3D world position into a 2D point on the screen. The easy bit was making the 3d point convert to 2d if the screen coordinate evaluates to being on the screen. I'll try to explain below. (Sorry for the dodgy ascii picture)   \1   / 2  \  /\/   ------\---/----3--  \ /   '  4In the above example the point(1) would translate onto somewhere just to the right of the centre of the screen. This works beautifully.Point 2 would be clamped to the edge of the screen on the left. Again this works perfectly. The problems arrive when trying to deal with corner cases.Point 3 is on or near to the camera plane. The problem was that the w property of the converted point was so small the resultant x-axis ends up being -infinaty. This caused problems but I seem to have solved it by making the edge cases tend towards half way down the screen. In this way instead of point 3 tending to infinaty and flying off the top of the screen it now nears 0.5 on the y-axis.The solution to solving point 3 fitted with my designers views in that it showed the way the player has to move the camera to rotate the view back to get the point on the screen.If the point is behind the camera though I get some problems. I have faked this as a temporary measure for now by locking the y-axis to 0.5 and x-axis to the correct edge, if the point is behind the camera. This means the user knows where to turn but it is not totally correct as this does not account with tilting the camera up or down etc.So after all that finally I get to the questions!1. How can I clamp a point to the edge of the screen when that point is behind the camera?2. Ideally I would like a better way of dealing with number 3 also so that it does not tend towards the centre point but instead shows the correct relative position?Any pointers in the right direction would be great as i'm out of ideas.   