SU2024 Overlay - Camera's cx,cy and scale readout

I have hard time getting the values of camera shifts (.center_2d x & y) and scale factor (scale_2d) for 2p perspective from the available view and projection matrices.

Could someone share formulas to derive them?

Are you saying that the following do not work?

I can see the possibility that the latter is problematic for working on SKP files as screen size varies from machine to machine. But the returned x & y values are sort of a percentage of how far it is from the center point.


In a “live” API use I would guess that you should be able to get the current model camera via:

But there are no observers in the C API, so you would still need to use Ruby API observers to detect changes.

No.

I have to rely on the SUBeginFrameInfo struct from overlay.h which gives me the current camera info:
double projection_matrix[16]; ///< Projection Matrix.
double view_matrix[16]; ///< View Matrix

I think that the SketchUp code prefers column major order for matrices.
Seems like some matrix math may be in order. Sorry, I’m not an expert in this.

No worries Dan. Thank you for the input.

It looks the panning modifies projection_matrix[2] and [6], but they do not give the exact values. I will have to figure out the scale too.

I hope someone from SU Team will help here. Basic info on how the matrices are structured may do.

Zoom level adjusted fov can be read from info.projection_matrix[5]