Triangle

triangle provides helpers for common triangle centers and circles.

It supports centroid, incenter, excenters, circumcenter, orthocenter, incircle, excircles, and circumcircle.

Import

import atcoder/extra/geometry/geometry_template
import atcoder/extra/geometry/triangle

Example

import atcoder/extra/geometry/geometry_templateimport atcoder/extra/geometry/trianglelet  a = initPoint[float](0.0, 0.0)  b = initPoint[float](4.0, 0.0)  c = initPoint[float](0.0, 3.0)let g = centroid(a, b, c)let ic = incircle(a, b, c)let cc = circumcircle(a, b, c)doAssert g.re == 4.0 / 3.0doAssert g.im == 1.0doAssert ic.p.re == 1.0doAssert ic.p.im == 1.0doAssert ic.r == 1.0doAssert cc.p.re == 2.0doAssert cc.p.im == 1.5doAssert cc.r == 2.5

API

centroid

centroid(a, b, c)

Returns the centroid.

incircle / incenter

incircle(a, b, c)
incenter(a, b, c)

Returns the incircle or the incenter.

excircle / excenter

excircle(a, b, c)
excenter(a, b, c)

Returns the three excircles or the three excenters.

circumcircle / circumcenter

circumcircle(a, b, c)
circumcenter(a, b, c)

Returns the circumcircle or the circumcenter.

orthocenter

orthocenter(a, b, c)

Returns the orthocenter.

Notes