FS#2751RArc::getVectorTo(point) does not exclude point at center with infinite solutions
- Type
- Bug
- Status
- Assigned
- Category
- QCAD (main)
- Severity
- Low
- Priority
- Low
- Reported version
- n/a
- Operating system
- All
- Reported
- 2026-09-15 by CVH
Version: Since initial commit of QCAD3.
Current art: https://github.com/qcad/qcad/blob/master/src/core/math/RArc.cpp
For a point coinciding with the center, getAngleTo() at line 788 returns zero by default.
For an arc starting at, ending at or spanning over orientation zero
(verified and not excluded by line 789-791)
the method returns a defined point on the arc at zero rads.
Analog to RCircle::getVectorTo there are infinite solutions and thus none well defined.
The RCircle method excludes a point at the center and returns an invalid RVector.
... However:
Comparing the SquaredMagnitude() with 1e-18 is fundamentally incorrect (FS#2741)
Correctly squaring both sides of (|d - v| < tol) results in: ((d - v)² < tol²)
And this expands to: (d² - 2dv + v² < tol²) where one still needs to know the magnitude.
... Additionally:
getAngleTo() returns zero by default when the two points are 1e-6 units or less apart.
A factor thousand times larger than RS.PointTolerance.
This can still result in a defined point on the arc at zero rads for
points at a distance between 1e-9 to 1e-6 from the center.
As like all getVectorTo() methods it is a key resource.
RArc::getClosestPointOnShape() can for example return a false solution.
Fixing this may for example break InfoDistanceEP.prototype.pickCoordinate
or RSnapPerpendicular::snapEntity ...
... Only if you manage to indicate really near the center of an arbitrary arc. ;-)
Then RSnapPerpendicular::snapEntity has no solution for a circle and its center.
But it has a solution at zero rads for an arc.
Regards,
CVH