FS#2734Concerning: Commit 2b1838b
- Type
- Refactoring
- Status
- Closed
- Resolution
- Implemented
- Category
- ECMAScript
- Severity
- Low
- Priority
- Low
- Reported version
- 3.32.9
- Operating system
- All
- Reported
- 2026-07-22 by CVH
- Closed
- 2026-07-30 by andrew
RCircle.getVectorTo was modded to avoid the sqrt() in getMagnitude() and used v.getSquaredMagnitude().
Then comparing that with the square of the default tolerance (1e-18).
Part of Commit d233495
In RCircle::getDistanceTo
getDistanceTo2D is based on getMagnitude2D().
This should be compared with RS.PointTolerance (1e-9), not squared (1e-18).
! ! !
Only true in an arbitrary (unlimited) precision.
The method using the magnitude or the squared magnitude cannot be compared in floating point.
The squared magnitude will hardly ever have a meaningful 18th digit after the comma.
As it is the subtraction of the vector components with no more than 17 significant digits.
A method missing here is RVector::getSquaredMagnitude2D() avoiding + 0.0*0.0 for dz²
Here you use a circular tolerance area in 2D: Less than 1e-9 away in any 2D direction.
Or a spherical tolerance in 3D.
Positions are typically compared using an axis aligned square shape as tolerance range in 2D (RVector::equalsFuzzy2D) or a cubic box in 3D (RVector::equalsFuzzy):
Less than 1e-9 to 1.414214e-9 away in any 2D direction
Or less than 1e-9 to 1.732051e-9 away in 3D.
40 to 70% more tolerant depending 2 or 3D and the direction.
Regards,
CVH
PS:
I can start a comment on GitHub like before but that is no longer accepting inputs.