Demo for screenX() and screenY(). One common problem with 3D drawing is that the drawing coordinates are often different than the screen coordinates. in other words, drawing a point at 10,10,-500 will not be at 10,10 of the screen. The Z value will place the point somewhere else on the screen. Factor in any translate() scale() or rotate() calls and it becomes very complex to guess exactly where an object is located on the screen. Fortunately, Processing has, once again, made this task a lot easier by wrapping a complex formula into two functions- screenX() and screenY(). Pass in the x,y,z coordinates of a point and it will return the X or Y position of that point on the processing screen. ***Very useful for determining if the mouse is over or clicking on an object in 3D space.
Source code: _12_screenXY
Built with Processing