Custom projection matrix for the SBDDocumentCamera

Hi,
I was wondering if it is possible to interchange the projection matrix of a SBDDocumentCamera with an arbitrary one.
To my current knowledge, changes of the projection matrix of a SBDDocumentCamera can only be achieved by modifying values like the field of view and it is impossible to change it arbitrarily. The SBDDocumentCamera seems to implement symmetric projection matrices like this one (Please ignore the first two lines, I was not able to find a better image):This matrix can be completely modified by changing the near and far plane values as well as the field of view of the SBDDocumentCamera.
However, for my application case a general projection matrix is needed, like the one shown here (please note the additional nonzero values in the third column):So my question is: Is it possible to modify the projection matrix of a SBDDocumentCamera in a way that it is able to represent a general projection matrix?
Thanks in advance,
Karsten

Hi Karsten,
One potential way might be to "hack" SAMSON, but this may only work when the camera is static. With
SBCamera::getProjectionMatrix()
you get adouble const*
that you couldconst_cast
to adouble*
to modify the matrix by hand and set the exact components you want. Unfortunately this might be overwritten when a camera parameter is updated.
Could you please say which API you would like to have for 0.8.0 ?Thanks,
Stephane

First of all I have to thank you for the quick response. Funnily, I thought of using const_cast on the matrix pointer beforehand but considered it as too "hacky".
There should be several possibilites how one could introduce this into the API: Each camera gets a state that determines whether it implements a symmetric or asymmetric projection including two methods that query and set the state. Then, an additonal method (possibly like
SetPlanesAsymmetric(float left, float right, float top, float bottom)
) could be used to transfer the wanted plane values to SAMSON. This approach would leave the old API intact, if the symmetric projection is the standard state.  Derive a class like SBDAsymmetricDocumentCamera from the currently available SBDDocumentCamera, overriding all methods concerning the projection matrix. This is probably the least favourable alternative, although the old API would still be valid.
 The camera gets two additional methods
SetValuesSymmetric(float aspect, float fovy, float zNear, float zFar)
andSetValuesAsymmetric(float left, float right, float top, float bottom, float zNear, float zFar)
. Then, theGetProjectionMatrix()
andGetProjectionMatrixTranspose()
methods would have to be changed to take an additional boolean input parameter determining which kind of matrix is wanted. This would break the old API and I am not sure how this would propagate to the convenience display methods likeSAMSON::displayCylinders(...)
.
Unfortunately I do not know which of these possibilities (and I probably missed some additional ones) would fit best into your way of writing SAMSON.
Best,
Karsten
 Each camera gets a state that determines whether it implements a symmetric or asymmetric projection including two methods that query and set the state. Then, an additonal method (possibly like