Tangential Circle through Point
Circle passing through a point and tangential to two curves
1
//Increase num for higher precision
2
//Will fail if too low and take too long if too high
3
num = 15;
4
5
//Centers of circles that are tangential and equidistant to the input Curves
6
pt1 = c1.PointAtParameter(0..1..#num);
7
pt2 = c2.PointAtParameter(0..1..#num);
8
pl1 = Plane.ByThreePoints(c1.CenterPoint,c1.CenterPoint.Translate(0,0,1),pt1);
9
vc1 = Vector.ByTwoPoints(c2.CenterPoint,pt2);
10
pt3 = Point.PruneDuplicates(List.Flatten(pt2.Project(pl1<1>,vc1<2>),-1),0.01);
11
ds1 = Math.Round(pt3<1>.DistanceTo(pt1<2>),1);
12
ds2 = Math.Round(pt3<1>.DistanceTo(pt2<2>),1);
13
pt4 = List.FilterByBoolMask(pt3,List.AllFalse((ds1==ds2)<1>))["out"];
14
15
//Centers that are equidistant to the input Curves and Point
16
ds3 = Math.Round(pt4<1>.DistanceTo(c1<2>),1);
17
ds4 = Math.Round(pt4<1>.DistanceTo(c2<2>),1);
18
ds5 = Math.Round(pt4<1>.DistanceTo(p1<2>),1);
19
pt5 = List.FilterByBoolMask(pt4,ds3==ds5 && ds4==ds5)["in"];
20
ds6 = pt5.DistanceTo(p1);
21
cr1 = Circle.ByCenterPointRadius(pt5,ds6);
22
23
//Geometry Color
24
[GeometryColor.ByGeometryColor(p1,Color.ByARGB(255,255,0,0)),
25
GeometryColor.ByGeometryColor(c1,Color.ByARGB(255,0,255,0)),
26
GeometryColor.ByGeometryColor(c2,Color.ByARGB(255,0,0,255)),
27
GeometryColor.ByGeometryColor(cr1[0],Color.ByARGB(255,255,0,255))];
Copied!
tanPntArc.zip
3KB
Binary
1
//Curve 1
2
c1 = Arc.ByThreePoints(Point.ByCoordinates(-3,2),
3
Point.ByCoordinates(2,1),Point.ByCoordinates(5,3));
4
5
// Curve 2
6
c2 = Arc.ByThreePoints(Point.ByCoordinates(-6,2),
7
Point.ByCoordinates(-4,1),Point.ByCoordinates(0,3));
8
9
//Point
10
p1 = Point.ByCoordinates(-2,1);
11
12
//Limit length of arcs as much as possible
13
//Will fail if no circle passes through the point
14
//Multiple circles that satisfy the condition possible
Copied!
Last modified 1yr ago
Copy link