Andrew,
I know I have to elaborate my final paragraph in the topic:
https://qcad.org/rsforum/viewtopic.php?f=33&t=8773
But its too early for that and at the moment I can't be complete ... Sorry.
Although everyone will see where these (too) small circles do or do not intersect, I can foresee your answer here:
"QCAD can't handle these circles/arcs properly"
And yes, if it was possible I would already have chosen microns as unit.
These are only snippets from a larger design and as circles there the same logic applies.
With the attached dxf: (Auto zoom on load doesn't zoom in)
Select All (TA), zoom to Selection (ZS), Deselect All (TN)
Select Line from 2 Points (LI) ... Select snapping to intersections (SI)
Then hover over the pairs of circles close at the (near) intersections.
What happens is that these circles are all considered to be tangent pairwise within a fixed tolerance.
And the intersection of circles is always on the larger one if not of equal size.
See RShape.getIntersectionPointsCC: Tolerance = 1e-4 ; Sorting circles shapes by size.
Is there a better approach?
Not at this moment but I have isolated one rare case that can be avoided.
Concentric circles/arcs with a delta in radius smaller than the tolerance are also considered to be tangent.
The tangent or intersection point is then fixed at 0°of the larger circle/arc. (The Rvector u ≈ (0,0,0,1))
Solution:
In RShape.getIntersectionPointsCC the concentrically test at line 1072-1075 should be promoted to be the first test.
https://github.com/qcad/qcad/blob/f4b8b ... .cpp#L1072
Regards,
CVH
Intersection of 2 (too small) circles (or arcs)
Moderator: andrew
Forum rules
Always indicate your operating system and QCAD version.
Attach drawing files and screenshots.
Post one question per topic.
Always indicate your operating system and QCAD version.
Attach drawing files and screenshots.
Post one question per topic.
Re: Intersection of 2 (too small) circles (or arcs)
Andrew,
thanks for reading the topic and the recent commits:
Sep 30, 2021: https://github.com/qcad/qcad/commit/77a ... d273768449
- Promoted the concentric test to first in line.
- Implemented a relative tolerance = 1 part per thousand of the average radius.
Oct 1, 2021: https://github.com/qcad/qcad/commit/071 ... d273768449
- Updated tolerance to 10 parts per million of the average radius.
I need to let that sink in for a while ...
The relative tolerance should have a profound impact on what are considered to be tangent circles or arcs.
And thus on all QCAD methods that rely on tangent circles/arcs intersections.
The tolerance value is also used to filter out 2 almost equal solutions. (Line 1100 ...)
I can not envision two circles not considered tangent and with two distinct intersections that are less than the tolerance apart. IMHO the RVector near equality test will always return 'False'.
For a sum of radii larger than 20 units the relative tolerance exceeds the former fixed tolerance of 1e-4.
At some point the tolerance may even exceed the smallest radius ... diameter ...
Like I said, I have no closed format for this issue.
The further a point is from the origin, the lower its positional accuracy in floating point notation will be.
What also counts for all points on a circle wherever that is located.
Now all depends on how round a circle will be when represented in the limited binary Cartesian grid given its radius and its location.
In floating point the roundness itself is a quite chaotic relation:
And it tends to increase more with position than with size.
As example a circle R=1 @(400,400) is round to within 3.73e-14 units tested every degree from 0 to 359.
But very far from the origin e.g. @(4e12,4e12) it is only round to within 3.13e-4 units or 0.3%.
Summary:
Any intersection point is only the best local representation of a point on the larger circle/arc.
Intersection points are not guaranteed to be on the smaller circle/arc.
For the case that I have at hand: When trimming two arc shapes pair-wise ...
... Then only the orientations to these intersections are required there an arc shape has ending angles and not ending points.
These angles are found by solving a convex or concave KITE shape.
The advantage is that orientations have a steady uncertainty not larger than 9e-16 throughout the plane.
Regards,
CVH
thanks for reading the topic and the recent commits:
Sep 30, 2021: https://github.com/qcad/qcad/commit/77a ... d273768449
- Promoted the concentric test to first in line.
- Implemented a relative tolerance = 1 part per thousand of the average radius.
Oct 1, 2021: https://github.com/qcad/qcad/commit/071 ... d273768449
- Updated tolerance to 10 parts per million of the average radius.
I need to let that sink in for a while ...
The relative tolerance should have a profound impact on what are considered to be tangent circles or arcs.
And thus on all QCAD methods that rely on tangent circles/arcs intersections.
The tolerance value is also used to filter out 2 almost equal solutions. (Line 1100 ...)
I can not envision two circles not considered tangent and with two distinct intersections that are less than the tolerance apart. IMHO the RVector near equality test will always return 'False'.
For a sum of radii larger than 20 units the relative tolerance exceeds the former fixed tolerance of 1e-4.
At some point the tolerance may even exceed the smallest radius ... diameter ...
Like I said, I have no closed format for this issue.
The further a point is from the origin, the lower its positional accuracy in floating point notation will be.
What also counts for all points on a circle wherever that is located.
Now all depends on how round a circle will be when represented in the limited binary Cartesian grid given its radius and its location.
In floating point the roundness itself is a quite chaotic relation:
And it tends to increase more with position than with size.
As example a circle R=1 @(400,400) is round to within 3.73e-14 units tested every degree from 0 to 359.
But very far from the origin e.g. @(4e12,4e12) it is only round to within 3.13e-4 units or 0.3%.
Summary:
Any intersection point is only the best local representation of a point on the larger circle/arc.
Intersection points are not guaranteed to be on the smaller circle/arc.
For the case that I have at hand: When trimming two arc shapes pair-wise ...
... Then only the orientations to these intersections are required there an arc shape has ending angles and not ending points.
These angles are found by solving a convex or concave KITE shape.
The advantage is that orientations have a steady uncertainty not larger than 9e-16 throughout the plane.
Regards,
CVH
-
- Premier Member
- Posts: 474
- Joined: Mon Sep 30, 2019 6:21 am
- Location: Melbourne - Australia
Re: Intersection of 2 (too small) circles (or arcs)
Hi CVH
I just downloaded your dxf file and maybe I'm not understanding?
I can snap to the intersections of the small circles
See Gif Below..
Cheers
John
PS
QCAD/CAM
Version: 3.26.4.13 (3.26.4.13)
Internet: QCAD.org
Build Date: Nov 18 2021
Revision: fbb9f37
Qt Version: 5.8.0
Architecture: x86_64
Compiler: gcc 4.8.1
I just downloaded your dxf file and maybe I'm not understanding?
I can snap to the intersections of the small circles
See Gif Below..
Cheers
John
PS
QCAD/CAM
Version: 3.26.4.13 (3.26.4.13)
Internet: QCAD.org
Build Date: Nov 18 2021
Revision: fbb9f37
Qt Version: 5.8.0
Architecture: x86_64
Compiler: gcc 4.8.1
- Attachments
-
- 2_small_arcs.gif (2.09 MiB) Viewed 3981 times
IF IT IS TO BE IT IS UP TO ME [ Ten most powerful 2 letter words ]
Re: Intersection of 2 (too small) circles (or arcs)
John,
See changes made by Andrew reported in the second post. (A silent bug fix, if you like)
The issue existed with a fixed tolerance of 1e-4.
Any distance below that was considered tangent resulting in one single point on a line between both centers.
And always on the larger circle.
Andrew fixed that with a relative tolerance given the 2 radii in question.
So yes, it works now for those small circles in the example dxf.
These are no longer considered to be tangent pair-wise and 2 or no intersection points are returned.
Letting us snapping to the real intersection points like you report.
It was all an issue with the RoundPolylineCorners Addon of which you possess a copy.
That also rounds correct between two non-tangent arcs or between non-tangent arcs and lines.
This requires the intersection of lines or arcs vs an arc and that is done by circle intersection.
I also mention that this may have a profound impact on what is considered as tangent circles ... and arcs.
There was no follow up because the Addon sits dead in the water.
Related to how QCAD merges (OG, OC, OL) an arc shape to a polyline in general.
I think that you already know the rest of the story. ... connect tolerance + plain copy of the arc bulge factor ...
Regards,
CVH
See changes made by Andrew reported in the second post. (A silent bug fix, if you like)
The issue existed with a fixed tolerance of 1e-4.
Any distance below that was considered tangent resulting in one single point on a line between both centers.
And always on the larger circle.
Andrew fixed that with a relative tolerance given the 2 radii in question.
So yes, it works now for those small circles in the example dxf.
These are no longer considered to be tangent pair-wise and 2 or no intersection points are returned.
Letting us snapping to the real intersection points like you report.
It was all an issue with the RoundPolylineCorners Addon of which you possess a copy.
That also rounds correct between two non-tangent arcs or between non-tangent arcs and lines.
This requires the intersection of lines or arcs vs an arc and that is done by circle intersection.
I also mention that this may have a profound impact on what is considered as tangent circles ... and arcs.
There was no follow up because the Addon sits dead in the water.
Related to how QCAD merges (OG, OC, OL) an arc shape to a polyline in general.
I think that you already know the rest of the story. ... connect tolerance + plain copy of the arc bulge factor ...
Regards,
CVH
Last edited by CVH on Sat Nov 27, 2021 8:40 am, edited 2 times in total.
-
- Premier Member
- Posts: 474
- Joined: Mon Sep 30, 2019 6:21 am
- Location: Melbourne - Australia
Re: Intersection of 2 (too small) circles (or arcs)
Thanks CVH
It didn't have solved in the title and I thought I was going mad or had a superior version of Qcad
Cheers
John
PS RoundPolyLineCorners I'm using quite a lot...
It didn't have solved in the title and I thought I was going mad or had a superior version of Qcad
Cheers
John
PS RoundPolyLineCorners I'm using quite a lot...
IF IT IS TO BE IT IS UP TO ME [ Ten most powerful 2 letter words ]
Re: Intersection of 2 (too small) circles (or arcs)
Kinda solved
Regards,
CVH