Node:Returning Information for Points, Next:, Previous:Returning Coordinates, Up:Point Reference



Returning Information

real epsilon (void) Static function
Returns the positive real value of smallest magnitude \epsilon that should be used as a coordinate value in a Point. A coordinate of a Point may also contain -\epsilon.

The value \epsilon is used for testing the equality of Points in Point::operator==() (see Point Reference; Operators):

Let \epsilon be the value returned by epsilon(), P and Q be Points, and P_x, Q_x, P_y, Q_y, P_z, and Q_z the updated x, y, and z-coordinates of P and Q, respectively. If and only if ||P_x| - |Q_x|| < \epsilon, ||P_y| - |Q_y|| < \epsilon, and ||P_z| - |Q_z|| < \epsilon, then P = Q.

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 start with two Points P and Q at different locations. Then they should be transformed using different rotations in such a way that they should end up at the same location. Let \epsilon stand for the value returned by epsilon(), and let x, y, and y stand for the world_coordinates of the Points after apply_transform() has been called on them. If x_P = x_Q, y_P = y_Q, and z_P = z_Q, \epsilon is a good value.

Rotation causes a significant loss of precision to due to the use of the sin() and cos() functions. Therefore, neither Point::epsilon() nor Transform::epsilon() (see Tranform 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.