2
$\begingroup$

I'm currently working on a library for OpenSCAD which can make 2D sketches with more features. I'm currently struggling with the geometric construction of a fillet given 2 lines in the xy plane and a radius.

Given two lines and a radius, the goal is to construct an arbitrary number of points that form the fillet. The intent is to be able to form a polygon given those points that can approximate the fillet.

I've gotten to the point where the only factor I need to finish generating these points is the distance from the intersection of the two lines to the point of tangency. Any help to find this distance in terms of the lines and the radius of the circle would be greatly appreciated.

Each line is currently stored as a two points in x,y. However, converting them to another form, such as a point and a slope, would be relatively easy. Whichever form makes the question easier is equally easy to implement.

The set of points to be generated are in red

$\endgroup$
2
  • $\begingroup$ When you says "given two lines", in what form is each line given? An equation like $Ax + By + C = 0$? A pair of distinct points on the line? A single point and a normal vector? A single point and a direction vector? Whichever it is, answering the question should be straightforward, I expect, so give us details (you can click on "edit" below your question) and we can probably get you an answer. $\endgroup$ Nov 20, 2019 at 19:40
  • 1
    $\begingroup$ Find the angle between the two lines, call it $\theta$. Then the line joining the intersection and the center of the circle makes an angle $\theta/2$ with both lines. Therefore, the points of tangency are at a distance $r/\tan(\theta/2)$ from the intersection, and the center itself is at $r/\sin(\theta/2)$. $\endgroup$
    – user856
    Nov 20, 2019 at 19:55

3 Answers 3

0
$\begingroup$

Assuming you are given endpoints, end slopes and radius..$ (x1,y1),(x2,y2),m1,m2, R $

In a geometric constr the full arc can be drawn but for intermediate points one should take up computation.The following Mathematica program can be used to fill/continue on a circular path of given directions and radius. Shall explain if any part is not clear.

Clear["`.*"];
Rg = 2.; L = 1.2; smax = 2 Rg ArcSin[L/2/Rg]; 
xi = 1.25; yi = 0.5; ri = Sqrt[xi^2 + yi^2]; thi = 1; phi = 1.85;
thi = ArcTan[yi/xi]; sii = phi - ArcTan[yi/xi];
(*  Fillet part*)
Fillet = {SI'[s] + Sin[SI[s]]/R[s] == 1/Rg, SI[0] == sii, 
   R'[s] == Cos[SI[s]], R[0] == ri, TH'[s] == Sin[SI[s]]/R[s], 
   TH[0] == thi};
NDSolve[Fillet, {SI, R, TH}, {s, 0, smax}];
{si[t_], r[t_], th[t_]} = {SI[t], R[t], TH[t]} /. First[%];
Plot[{si[s], r[s], th[s]}, {s, .0, smax}, PlotLabel -> DIFFRL_method, 
   GridLines -> Automatic, AspectRatio -> Automatic, 
   PlotStyle -> {Blue, Thick}]
  {x[t_], y[t_]} = {r[t] Cos[th[s]], r[t] Sin[th[s]]};
ParametricPlot[{x[s], y[s]}, {s, .0, smax}, PlotLabel -> FILLETS, 
 PlotStyle -> {Thick, Magenta}, GridLines -> Automatic]

If we have radii (curvature) of either sign with same start & arc length:

enter image description here

$\endgroup$
0
$\begingroup$

As Rahul stated, the distance from the intersection to the points of tangency is $r/tan(\theta /2)$. Therefore a circle centered around the intersection of radius $r/tan(\theta /2)$ can be constructed. Then a perpendicular can be placed at each of the intersections between the constructed circle and the lines.

The intersection of these two perpendiculars is the center of the circle that forms the fillet. From there, the fillet is simply the subsection of the circle starting at one point of tangency to the other of the given radius.

$\endgroup$
0
$\begingroup$

The center of the arc is found by drawing parallels to the given lines, at distance $r$. I assume that you are able to obtain the equations of the latter (take the normalized implicit equations of the lines and add $\pm r$ to the independent term; the signs depend on the quadrant where you want the fillet).

Then the starting and ending angles of the arc are given by the directions of the normals to the lines.


The line of equation

$$ax+by+c=0$$ normalizes to

$$\frac a{\sqrt{a^2+b^2}}x+\frac b{\sqrt{a^2+b^2}}y+\frac c{\sqrt{a^2+b^2}}=\cos\phi \,x+\sin\phi\,y+\frac c{\sqrt{a^2+b^2}}=0,$$

where $\phi$ is the angle of the normal.


enter image description here

$\endgroup$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .