compas icon indicating copy to clipboard operation
compas copied to clipboard

fix angle_vectors_signed

Open robin-oval opened this issue 4 years ago • 1 comments
trafficstars

fix angle_vectors_signed - the check to reverse the angle was always True

bug fix in a backwards-compatible manner

robin-oval avatar Apr 01 '21 15:04 robin-oval

can you add a test and an entry in the changelog?

tomvanmele avatar Apr 02 '21 06:04 tomvanmele

@tomvanmele seems an important fix +1!

jf--- avatar Aug 16 '23 07:08 jf---

@jf--- i can't resolve the conflicts and @robin-oval is unresponsive. will fix in a separate PR and close this one...

tomvanmele avatar Aug 16 '23 07:08 tomvanmele

@tomvanmele wonderful, we discussed a Precision class ( akin to that of opencascade ). The threshold variable in @robin-oval's fix is a good candidate for use of such a class. In the past I ran into numerical stability issues in a Quaternion class, here sys.float_info.epsilon came in very useful to overcome those. I think that a (multiple) of sys.float_info.epsilon could be a good foundation for such a class?

jf--- avatar Aug 16 '23 08:08 jf---

:) we have a dev meeting tomorrow and the precision module is one of the topics...

tomvanmele avatar Aug 16 '23 08:08 tomvanmele

just FYI, i am planning to use a default precision of 1e-12, since there are some differences between the behaviour of IPY CPY at higher precisions...

tomvanmele avatar Aug 16 '23 08:08 tomvanmele

the precision module will also be the new home for compas.geometry.close and compas.geometry.allclose, and similar functions.

tomvanmele avatar Aug 16 '23 08:08 tomvanmele

could you elaborate a bit on how you used floating point precision to overcome those numerical instabilities you mentioned?

tomvanmele avatar Aug 16 '23 08:08 tomvanmele

just FYI, i am planning to use a default precision of 1e-12, since there are some differences between the behaviour of IPY CPY at higher precisions...

Ah interesting! But so that's sys.float_info.epsilon would resolve that?

could you elaborate a bit on how you used floating point precision to overcome those numerical instabilities you mentioned?

Comparing angles in Quaternion is pretty sensitive -- the sign of the angle can flip a problem when comparing to math.pi/2. sys.float_info.epsilon helped to resolve that robustly

jf--- avatar Aug 16 '23 08:08 jf---

the precision module will also be the new home for compas.geometry.close and compas.geometry.allclose, and similar functions.

right, a compas.precision seems terrific


That said, a required precision for angles is very different from those of vertices or point ( see Precision.Confusion )

Therefore an allclose function is too broad I think.

Therefore the suggestion to model the class on OCC, and adopt similar angular, confusion, intersection and parametric methods

jf--- avatar Aug 16 '23 08:08 jf---

Therefore the suggestion to model the class on OCC, and adopt similar angular, confusion, intersection and parametric methods

cool will have a look

tomvanmele avatar Aug 16 '23 08:08 tomvanmele

@jf--- done here #1174

tomvanmele avatar Aug 16 '23 12:08 tomvanmele

Nice! The default for angles in OCC is 1e-7 IIRC, 1e-3 is quite a low threshold I think. Moreover a future refactor where numerical precision is handled in a central class is a nice idea. For now clearly this is progress. Shall I sum up this thread as an issue / feature? #1174 closed this issue?

jf--- avatar Aug 16 '23 14:08 jf---

Shall I sum up this thread as an issue / feature?

yup, sounds good!

tomvanmele avatar Aug 16 '23 14:08 tomvanmele