Curvature, circumradius, and circumcenter formulas for any three points

9 minute read

Published:

[Direct link to full PDF of this article] DOI


Abstract: This work succinctly details the procedures involved in determining the curvature of three arbitrary two-dimensional points and the radius and center of the circle which circumscribes the triangle formed by these points. Explicit equations solely a function of the Cartesian coordinates of the three points are provided for these values.


A circle can be fit to any three distinct and non-collinear Cartesian points $F$, $G$, and $H$ with coordinates of $(x_1,y_1)$, $(x_2,y_2)$, and $(x_3,y_3)$, respectively. Non-collinearity can be proven in a variety of ways. Since the area of the triangle formed by these three points will prove useful later, it can be calculated now, and a non-zero area proves the non-collinearity of the triplet of points.



Here, the Shoelace formula (also known as Gauss’s area formula and the surveyor’s formula [1]) can be employed for the $n=3$ case (where $n$ is the polygon’s number of sides or vertices) to find the area of the triangle as shown in Equation \eqref{eq:shoelace}; note that $x_{n+1}$ and $y_{n+1}$ are equal to $x_{1}$ and $y_{1}$, respectively. This result can be negative depending on the ordering of the points; the absolute value in the last step has been added to prevent this here.

\begin{align} A & = \frac{1}{2} \sum_{i=1}^{3} \begin{vmatrix} x_i & x_{i+1} \\ y_i & y_{i+1} \end{vmatrix} = \frac{1}{2} \left( \begin{vmatrix} x_1 & x_{2} \\ y_1 & y_{2} \end{vmatrix} + \begin{vmatrix} x_2 & x_{3} \\ y_2 & y_{3} \end{vmatrix} + \begin{vmatrix} x_3 & x_{1} \\ y_3 & y_{1} \end{vmatrix} \right) \notag\\ & = \frac{1}{2} \left( x_1 y_2 - x_2 y_1 + x_2 y_3 - x_3 y_2 + x_3 y_1 - x_1 y_3 \right) \notag\\ \lvert A \rvert & = \frac{1}{2} \lvert(x_2-x_1)\cdot(y_3-y_2)) - ((y_2-y_1)\cdot(x_3-x_2)\rvert \label{eq:shoelace} \end{align}

The circle which circumscribes a triangle is called the circumcircle [2]. Here, the side lengths opposite the vertices $F$, $G$, and $H$ will be denoted by the same letters in lowercase: $f$, $g$, and $h$, respectively. The circumcircle’s radius $R$ can be found using Equation \eqref{eq:circumradius} [3,4].

\begin{equation} R = \frac{fgh}{4A} \label{eq:circumradius} \end{equation}

These side lengths can be calculated using the Cartesian distance formula (Table 1) and then plugged back into Equation \eqref{eq:circumradius} alongside the triangle’s area from Equation \eqref{eq:shoelace} to obtain the radius $R$ in terms of only the original three points’ coordinates as shown in Equation \eqref{eq:circumradius-v2}.

Table 1: Triangle side lengths
SegmentNameLength
$\overline{FG}$$h$$\sqrt{(x_2-x_1)^2+(y_2-y_1)^2}$
$\overline{GH}$$f$$\sqrt{(x_3-x_2)^2+(y_3-y_2)^2}$
$\overline{HF}$$g$$\sqrt{(x_1-x_3)^2+(y_1-y_3)^2}$


\begin{equation} R = \frac{\sqrt{[(x_2-x_1)^2+(y_2-y_1)^2] \cdot [(x_3-x_2)^2+(y_3-y_2)^2] \cdot [(x_1-x_3)^2+(y_1-y_3)^2]}}{2\cdot\lvert((x_2-x_1)\cdot(y_3-y_2)) - ((y_2-y_1)\cdot(x_3-x_2))\rvert} \label{eq:circumradius-v2} \end{equation}

The curvature $\kappa$ (Menger curvature) of three points is simply the inverse of this circumradius and is shown in Equation \eqref{eq:CurvatureEq} [5,6,7]. Note that the absolute value in the numerator can be removed if differentiating between negative and positive curvature is desired.

\begin{align} \kappa & = \frac{1}{R} = \frac{4A}{fgh} \notag\\ & = \frac{2\cdot\lvert((x_2-x_1)\cdot(y_3-y_2)) - ((y_2-y_1)\cdot(x_3-x_2))\rvert}{\sqrt{[(x_2-x_1)^2+(y_2-y_1)^2] \cdot [(x_3-x_2)^2+(y_3-y_2)^2] \cdot [(x_1-x_3)^2+(y_1-y_3)^2]}} \label{eq:CurvatureEq} \end{align}



The center of the circumcircle can also be identified. However, the equations for defining the circumcenter’s coordinates are not as simple as those for the circumradius. From geometry, it is known that the perpendicular bisectors of the three faces of the triangle all intersect at the center of a circle which circumscribes the triangle [8]. The equations for each segment’s bisector can be found from its midpoint and slope (which is simply the inverse of the segment’s slope) and are shown in Table 2.

Table 2: Geometric properties of triangle to be circumscribed
SegmentMidpointSlopeBisector slopeBisector equation
$\overline{FG}$$\left(\frac{x_1 + x_2}{2},\frac{y_1 + y_2}{2}\right)$$\frac{y_2 - y_1}{x_2 - x_1}$$-\frac{x_2 - x_1}{y_2 - y_1}$$y = -\frac{x_2 - x_1}{y_2 - y_1}\left(x-\frac{x_1 + x_2}{2}\right) + \frac{y_1 + y_2}{2} $
$\overline{GH}$$\left(\frac{x_2 + x_3}{2},\frac{y_2 + y_3}{2}\right)$$\frac{y_3 - y_2}{x_3 - x_2}$$-\frac{x_3 - x_2}{y_3 - y_2}$$y = -\frac{x_3 - x_2}{y_3 - y_2}\left(x-\frac{x_2 + x_3}{2}\right) + \frac{y_2 + y_3}{2} $
$\overline{HF}$$\left(\frac{x_3 + x_1}{2},\frac{y_3 + y_1}{2}\right)$$\frac{y_1 - y_3}{x_1 - x_3}$$-\frac{x_1 - x_3}{y_1 - y_3}$$y = -\frac{x_1 - x_3}{y_1 - y_3}\left(x-\frac{x_3 + x_1}{2}\right) + \frac{y_3 + y_1}{2} $


Two of these equations can then be used to determine the coordinates of the center of the circle. Here, the equations from segments $\overline{FG}$ and $\overline{GH}$ are used. Simple substitution can be used to solve for $x$ first.

\begin{align} -\frac{x_2 - x_1}{y_2 - y_1}\left(x-\frac{x_1 + x_2}{2}\right) + \frac{y_1 + y_2}{2} = & -\frac{x_3 - x_2}{y_3 - y_2}\left(x-\frac{x_2 + x_3}{2}\right) + \frac{y_2 + y_3}{2} \notag\\ -\frac{x_2 - x_1}{y_2 - y_1}\left(x-\frac{x_1 + x_2}{2}\right) + \frac{x_3 - x_2}{y_3 - y_2}\left(x-\frac{x_2 + x_3}{2}\right) = & \frac{y_2 + y_3}{2} - \frac{y_1 + y_2}{2} \notag\\ x\left(\frac{x_3 - x_2}{y_3 - y_2}-\frac{x_2 - x_1}{y_2 - y_1}\right) = & \frac{y_3 - y_1}{2} - \frac{x_2 ^2 - x_1 ^2}{2(y_2 - y_1)} + \frac{x_3 ^2 - x_2 ^2}{2(y_3 - y_2)} \notag\\ \end{align}

The expression for $x$ can be slightly simplified once isolated.

\begin{align} x & = \cfrac{\cfrac{y_3 - y_1}{2} - \cfrac{x_2 ^2 - x_1 ^2}{2(y_2 - y_1)} + \cfrac{x_3 ^2 - x_2 ^2}{2(y_3 - y_2)}}{\left(\cfrac{x_3 - x_2}{y_3 - y_2}-\cfrac{x_2 - x_1}{y_2 - y_1}\right)} \notag\\ & = \cfrac{\left(\cfrac{(y_3 - y_1)(y_2 - y_1)(y_3 - y_2) - (x_2 ^2 - x_1 ^2)(y_3 - y_2) + (x_3 ^2 - x_2 ^2)(y_2 - y_1)}{2(y_2 - y_1)(y_3 - y_2)}\right)}{\left( \cfrac{(x_3 - x_2)(y_2 - y_1) - (x_2 - x_1)(y_3 - y_2)}{(y_2 - y_1)(y_3 - y_2)} \right)} \notag\\ & = \cfrac{(y_3 - y_1)(y_2 - y_1)(y_3 - y_2) - (x_2 ^2 - x_1 ^2)(y_3 - y_2) + (x_3 ^2 - x_2 ^2)(y_2 - y_1)}{2\left((x_3 - x_2)(y_2 - y_1)-(x_2 - x_1)(y_3 - y_2)\right)} \notag\\ & = \cfrac{(y_3 - y_1)(y_2 - y_1)(y_3 - y_2) - (x_2 ^2 - x_1 ^2)(y_3 - y_2) + (x_3 ^2 - x_2 ^2)(y_2 - y_1)}{-4A} \end{align}

This expression for $x$ can now be substituted back into any of the bisector equations to solve for $y$; the equation for $\overline{FG}$ will be employed again.

\begin{align} y & = -\frac{x_2 - x_1}{y_2 - y_1}\left(x-\frac{x_1 + x_2}{2}\right) + \frac{y_1 + y_2}{2} \notag\\ & = -\frac{x_2 - x_1}{y_2 - y_1}x + \frac{x_2 ^2 - x_1 ^2 + y_2 ^2 - y_1 ^2}{2(y_2 - y_1)} \notag\\ & = -\frac{x_2 - x_1}{y_2 - y_1}\left(\cfrac{(y_3 - y_1)(y_2 - y_1)(y_3 - y_2) - (x_2 ^2 - x_1 ^2)(y_3 - y_2) + (x_3 ^2 - x_2 ^2)(y_2 - y_1)}{2\left((x_3 - x_2)(y_2 - y_1)-(x_2 - x_1)(y_3 - y_2)\right)}\right) \notag\\ & \quad + \frac{(x_2 - x_1)^2 - (y_2 - y_1)^2}{2(y_2 - y_1)} \notag\\ & = \frac{x_2 - x_1}{y_2 - y_1}\left(\cfrac{(y_3 - y_1)(y_2 - y_1)(y_3 - y_2) - (x_2 ^2 - x_1 ^2)(y_3 - y_2) + (x_3 ^2 - x_2 ^2)(y_2 - y_1)}{4A}\right) \notag\\ & \quad + \frac{x_2 ^2 - x_1 ^2 + y_2 ^2 - y_1 ^2}{2(y_2 - y_1)} \notag\\ \end{align}


References

[1] B. Braden, “The Surveyor’s Area Formula,” The College Mathematics Journal, vol. 17, no. 4, pp. 326-337, 1986. doi: 10.1080/07468342.1986.11972974

[2] E. W. Weisstein, “Circumcircle,” MathWorld-A Wolfram Web Resource, 2001. [Online]. Available: http://mathworld.wolfram.com/Circumcircle.html

[3] E. W. Weisstein, “Circumradius,” MathWorld-A Wolfram Web Resource, 2001. [Online]. Available: http://mathworld.wolfram.com/Circumradius.html

[4] R. A. Johnson, Modern geometry; an elementary treatise on the geometry of the triangle and the circle, J. W. Young, Ed. Houghton, Mifflin company, 1929. [Online]. Available: http://hdl.handle.net/2027/wu.89043163211

[5] M. Kline, Calculus: An Intuitive and Physical Approach, ser. Dover Books on Mathematics. Dover Publications, 1998, ch. 15, pp. 457,458. ISBN 9780486404530

[6] J.-C. Léger, “Menger curvature and rectifiability,” Annals of mathematics, vol. 149, pp. 831-869, 1999.

[7] X. Tolsa, “Principal values for the cauchy integral and rectifiability,” Proceedings of the American Mathematical Society, vol. 128, no. 7, pp. 2111-2119, 2000.

[8] E. W. Weisstein, “Circumcenter,” MathWorld-A Wolfram Web Resource, 2001. [Online]. Available: http://mathworld.wolfram.com/Circumcenter.html


Python functions for curvature, circumradius, and circumcenter

[Download link of Python file]

'''
Curvature, circumradius, and circumcenter functions
written by Hunter Ratliff on 2019-02-03
'''

def curvature(x_data,y_data):
    '''
    Calculates curvature for all interior points
    on a curve whose coordinates are provided
    Input:
        - x_data: list of n x-coordinates
        - y_data: list of n y-coordinates
    Output:
        - curvature: list of n-2 curvature values
    '''
    curvature = []
    for i in range(1,len(x_data)-1):
        R = circumradius(x_data[i-1:i+2],y_data[i-1:i+2])
        if ( R == 0 ):
            print('Failed: points are either collinear or not distinct')
            return 0
        curvature.append(1/R)
    return curvature

def circumradius(xvals,yvals):
    '''
    Calculates the circumradius for three 2D points
    '''
    x1, x2, x3, y1, y2, y3 = xvals[0], xvals[1], xvals[2], yvals[0], yvals[1], yvals[2]
    den = 2*((x2-x1)*(y3-y2)-(y2-y1)*(x3-x2))
    num = ( (((x2-x1)**2) + ((y2-y1)**2)) * (((x3-x2)**2)+((y3-y2)**2)) * (((x1-x3)**2)+((y1-y3)**2)) )**(0.5)
    if ( den == 0 ):
        print('Failed: points are either collinear or not distinct')
        return 0
    R = abs(num/den)
    return R

def circumcenter(xvals,yvals):
    '''
    Calculates the circumcenter for three 2D points
    '''
    x1, x2, x3, y1, y2, y3 = xvals[0], xvals[1], xvals[2], yvals[0], yvals[1], yvals[2]
    A = 0.5*((x2-x1)*(y3-y2)-(y2-y1)*(x3-x2))
    if ( A == 0 ):
        print('Failed: points are either collinear or not distinct')
        return 0
    xnum = ((y3 - y1)*(y2 - y1)*(y3 - y2)) - ((x2**2 - x1**2)*(y3 - y2)) + ((x3**2 - x2**2)*(y2 - y1))
    x = xnum/(-4*A)
    y =  (-1*(x2 - x1)/(y2 - y1))*(x-0.5*(x1 + x2)) + 0.5*(y1 + y2)
    return x, y

# test values
x = [0,0.8,2.8]
y = [0,1.6,-0.4]

print(curvature(x,y))
print(circumradius(x[0:3],y[0:3]))
print(circumcenter(x[0:3],y[0:3]))