`import "github.com/fibo/s2"`

Package s2 implements the Riemann Sphere geometry. Point your browser to http://g14n.info/m2c for more info.

- func CircleEq(c Circle, d Circle) bool
- func PointEq(p Point, q Point) bool
- type Circle
- func NewCircle(center complex128, radius float64) Circle
- func NewLine(p complex128, q complex128) Circle
- func (c *Circle) Inv(i Circle)
- type Point

CircleEq checks that two circles are equal.

PointEq checks that two points are equal.

❖

type Circle struct { A float64 C complex128 D float64 }

A Circle and a line are the same in this world. They are represented by an hermitian 2x2 matrix (a, b, c, d) hence b = math.Conj(c) and a and d are real numbers. Lines have a = 0. The matrix determinant equals the negative of the radius square. When determinant is zero, the circle degenerates to a line. Imaginary circles exist, they have negative radius.

❖

func NewCircle(center complex128, radius float64) Circle

NewCircle constructor. When radius is zero it will degenerate to a point, when radius is negative it will create an imaginary circle.

❖

func NewLine(p complex128, q complex128) Circle

NewLine constructor, returns a line that is the locus of points equidistant from the given p, q points.

Inv computes inversive geometry transform.

❖

type Point struct { Z, W complex128 }

A Point is represented by the couple p = (z, w) of two complex numbers where two points are equal if (z, w) = λ (z', w').

Conj returns the conjugated point.

Infinity returns the point at infinity, i.e. with w = 0.

LFT computes a Linear fractional transformation (https://en.wikipedia.org/wiki/Linear_fractional_transformation).

❖

func NewPoint(Z complex128) *Point

NewPoint is a Point constructor. It only takes one Z argument, since W defaults to 1, i.e. the point is already normalized.

Zero returns the origin point {0, 0}.

Inv implements inversion respect to a circle.

Norm normalizes a point in the form (z, w) to the form z' or Infinity.

Package s2 imports 2 packages (graph). Updated 2017-12-02. Refresh now. Tools for package owners. This is an inactive package (no imports and no commits in at least two years).