Round the angle of a triangle with a specific radius

103 Views Asked by At

I have three known points defining a triangle: $A(x_a,y_a), B(x_b,y_b)$ and $C(x_c,y_c)$.
How do I round the angle (ABC) of a specific radius $r$?

I know that the slope of $AB$ edge is: $(y_a - y_b) / ( x_a - x_b)$.

My circle with center (unknown) $O:(x_o, y_o)$ will have an equation $(y_a - y_o)^2 + (x_a -x_o) = r^2$.

The point $B$ will also satisfy the equation of the circle.

Knowing the slopes of the line equations of my triangle and that my circle has a radius of known $r$, I have troubles to find the center of my circle and the points $M,N$ where my circle will intersect with the edges of the triangle. The points $M,N$ are also the tangential points of the circle.

After working little the math it seems that I have too many unknowns for my system.

I would really appreciate any help.

Kind regards

2

There are 2 best solutions below

0
On

The general equation for a circle is :

$$x^2 + y^2+2gx+2fy+c=0 $$

And all three points will satisfy this equation.

Hence :

$$ x_a^2+y_a^2+2gx_a+2fy_a+c=0 $$ $$ x_b^2+y_b^2+2gx_b+2fy_b+c=0 $$ $$ x_c^2+y_c^2+2gx_c+2fy_c+c=0 $$

You have three equations and three unknowns $ f,g,c$. Solve them together to get the values and substitute them in the equation of the circle to get its equation.

0
On

I think that what you want is a circle arc passing through $AB$, having radius $r$, and with the "bump" of the arc on the side opposite $C$.

Here's a way to do that:

h = dist(A,B)/2   // compute half the distance from A to B
if (h < r) then ERROR // no radius-r circle can pass through
                      // points farther apart than 2r!
s = sqrt(r*r - h*h)   // Distance by which to offset circle
ux = Bx - Ax      // Ax denotes the x coord of point A
uy = By - Ay
w = sqrt(ux*ux + uy*uy)
ux = ux/w
uy = uy/w       // (ux, uy) is now a length-1 vector from A towards B

vx = Cx - Ax
vy = Cy - Ay
// Note that (-uy, ux) is a length 1 vector perpendicular to AB
// We check whether this points in the same halfspace as AC, 
// or the opposite one. 
dot = (-uy) * vx + ux * vy
if (dot > 0) then s = -s

Mx = (Ax + Bx)/2
My = (Ay + By)/2  // coordinates of midpoint of edge AB
Qx = Mx + s* (-uy)
Qy = My + s * ux  // Q is the center of the desired circle. 
                  // computed by offsetting the edge midpoint 
                  // by distance s along the vector (-uy, ux)