Math
The Circumcircle of a Triangle
Is a circle which passes through all three vertices of a triangle. See Math Open Reference. See also this simpler propane sketch, note the simplified collinearity test in the Points
class, where we make use of Vec2D
math (don’t try this with processings PVector
class because, it doesn’t know whether it is 2D
or 3D
vector and hence deeply flawed).
Using Matrix Math
For detailed workings see Circumcircle at Mathworld Wolfram.com
a = {
{
x1 y1 1}
, {
x2 y2 1}
, {
x3 y3 1}
}
bx = -{
{
x12 + y12 y1 1}
, {
x22 + y22 y2 1}
, {
x32 + y32 y3 1}
}
by = {
{
x12 + y12 x1 1}
, {
x22 + y22 x2 1}
, {
x32 + y32 x3 1}
}
xo = -bx / 2 * a
yo = -by / 2 * a