2D geometry problem: fillet two curves
typhoon71 opened this issue · 1 comments
I'm using scikit-spatial to as a "geometry engine" of sort for some code of mine, that draws 2D parts.
I need to fillet (with a known radius):
- 2 lines
- 2 circles
- 1 line and 1 circle
To fillet the 2 lines I offset them of the fillet radius, and project the point of intersection (center) on the two lines, getting 2 points (start and end of the arc). This works with no issues.
To fillet 2 circles I was going to do something similar, offsetting the circles in this case, finding the intersection (one of two); the thing is I can't really project the center on the circles, so I tried drawing a third circle with the intersection as a center and getting the tangent point of interest.
This is geometrically sound, but when I do it I find 2 points of intersections, which is not correct; I determined it's caused by floating point error/rounding - depending of the circles diameters and the fillet radius it can be bigger or smaller.
Btw: this would've happened filleting the 2 lines too had I used a circle instead of projecting the center to get start and end of the arc.
So now I think I have two choice: find a way to deal with floating point rounding, or find some other way to get the tangency points, one that does not involve a third circle - maybe something with triangles and stuff.
Does someone have an idea of how to tackle this problem? I'm testing some fancy geometry, but I'm open to suggestions - floating point rounding included.
Thanks.
I don't think this fits as an issue. An issue on this repository is supposed to be a bug or a feature request for scikit-spatial
. You could ask this question in some geometry forum, like something on Stack Exchange.