FS#2589Apollonius.getCommonTangents(...) may fail to return the correct tangents
- Type
- Bug
- Status
- Closed
- Resolution
- Implemented
- Category
- QCAD (main)
- Severity
- Low
- Priority
- Low
- Reported version
- 3.30.1
- Operating system
- All
- Reported
- 2024-07-18 by CVH
- Closed
- 2024-08-29 by andrew
- Votes
- 1
Andrew,
Related to Draw > Circle > Circle2TP > Apollonius.getSolutionsPCC
In some occasions the returned tangents are misplaced.
After inversion resulting in not valid tangent circles and cleaned out by Apollonius.verify(...)
Documented such a result in the attached file:
- c1 and c2 are the inversion circles ordered by size.
- CommonTangents[0-3] are the returned tangents (red)
- added code references for tangents1
- the expected tangents are in green.
For some reason the order of things matters.
Most probably other resources rely on that.
In the case of Apollonius.getSolutionsPCC it doesn't.
All returned tangents are inversed to possible solutions.
Verified and returned.
https://github.com/qcad/qcad/blob/master/scripts/Apollonius.js#L988-L996
None of documented tangents will produce valid solutions.
The fix here is to use ShapeAlgorithms.getTangents(...) instead.
Although that it also includes a flaw (FS#2588)
I also suspect that this is one of the reasons why Apollonius may fail to produce (all) solutions for common cases.
Why methods for creating tangent circles are incomplete.
Regards,
CVH
Comments (1)
Andrew,
Studied this in depth for solving Circle2TP exceptions or incomplete results.
Below is my code for finding all possible tangents between 2 shapes.
Primarily for 2 RCircle shapes.
Including support for RLine shapes and RPoint shapes as zero sized circles.
I included the adapted tangents code as a js file: Apollonius.getAllTangents.js
An overview of what is returned is included: Apollonius_getAllTangents.dxf
Regards,
CVH