I would like to explore the model view projection matrices (used for rendering in OpenGL) of Sketchup View. The model matrix is simply the transformation of a group (component), the view matrix can be derived from the API of Camera. The projection matrix, however is unknown, which may relate to the screen_coords API.
Although the document says that
The screen_coords method is used to retrieve the screen coordinates of the given point on the screen.
The x and y values returned correspond to the x and y screen coordinates. Ignore the z values.
The Z values is ignored, but I have found the z value is absolutely not random, see the following outputs from my test
view.screen_coords(ORIGIN)
Point3d(482.891, 624.479, 0.610971)
view.screen_coords(ORIGIN)
Point3d(593.434, 547.559, 0.569721)
view.screen_coords(ORIGIN)
Point3d(618.357, 607.126, 0.551426)
view.screen_coords(ORIGIN)
Point3d(605.397, 1346.42, 0.606774)
view.screen_coords(ORIGIN)
Point3d(487.177, 578.22, 0.897464)
view.screen_coords(ORIGIN)
Point3d(-275.086, -898.803, 0.9989)
view.screen_coords(ORIGIN)
Point3d(668.732, 620.059, 0.54988)
view.screen_coords(ORIGIN)
Point3d(658.804, 585.768, 0.550005)
So I would like to ask that if anyone have idea, how to relate this API to get the projection matrix in OpenGL?
Thanks,
Han