Skip to main content

circumcenter

Function circumcenter 

Source
pub fn circumcenter(a: Point2, b: Point2, c: Point2) -> Point2
Expand description

Compute the circumcenter of a triangle (a, b, c).

Uses the formula:

D = 2 * (ax * (by - cy) + bx * (cy - ay) + cx * (ay - by))
ux = ((ax² + ay²) * (by - cy) + (bx² + by²) * (cy - ay) + (cx² + cy²) * (ay - by)) / D
uy = ((ax² + ay²) * (cx - bx) + (bx² + by²) * (ax - cx) + (cx² + cy²) * (bx - ax)) / D