Node:Returning Information for Transforms, Next:, Previous:Querying Transforms, Up:Transform Reference



Returning Information

real epsilon (void) Static function
Returns the positive real value of smallest magnitude \epsilon which an element of a Transform should contain. An element of a Transform may also contain -\epsilon.

The value \epsilon is used for in the function clean() (see Transform Reference; Cleaning). It will also be used for comparing Transforms, when I've added the equality operator Transform::operator==().

epsilon() returns different values, depending on whether real is float or double: If real is float (the default), epsilon() returns 0.00001. If real is double, it returns 0.000000001.

Please note: I haven't tested whether 0.000000001 is a good value yet, so users should be aware of this if they set real to double!1 The way to test this is to transform two different Transforms t_1 and t_2 using different rotations in such a way that the end result should be the same for both Transforms. Let \epsilon stand for the value returned by epsilon(). If for all sets of corresponding elements E_1 and E_2 of t_1 and t_2, ||E_1| - |E_2|| \le \epsilon, then \epsilon is a good value. It will be easier to test this when I've added Transform::operator==().

Rotation causes a significant loss of precision to due to the use of the sin() and cos() functions. Therefore, neither Transform::epsilon() nor Point::epsilon() (see Point Reference; Returning Information) can be as small as I'd like them to be. If they are two small, operations that test for equality of Transforms and Points will return false for objects that should be equal.


Footnotes

  1. For that matter, I haven't really tested whether 0.00001 is a good value when real is float.