tigl
tigl copied to clipboard
Issue with control surface code
Hi Martin,
I just reproduced parts of this code for some OpenGL example for students.
I thin this code will not work if the p1 and p2 share the same y coordinate. Is this checked somewhere else?
I guess It is better to check for this case before constructing eyV, so if exV.y == 0 construct a different vector for eyV. For example:
gp_Vec eyV(2, 1 , -(2*exV.x + exV.y)/exV.z);
And then instead of creating the third axis "manually" we can simply calculate the cross product between exV and eyV which should then result in a local coordinate system that is always valid.
We would also have to negate the alpha rotation then, If I am correct...
taken from @Mk-arc's comment here: https://github.com/DLR-SC/tigl/commit/4cc8a9007c91fd375e5ab3556d1efd6284c8234f#r100084385