s2: github.com/fibo/s2 Index | Files

package s2

import "github.com/fibo/s2"

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


Package Files

circle.go package.go point.go

func CircleEq Uses

func CircleEq(c Circle, d Circle) bool

CircleEq checks that two circles are equal.

func PointEq Uses

func PointEq(p Point, q Point) bool

PointEq checks that two points are equal.

type Circle Uses

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 Uses

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 Uses

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.

func (*Circle) Inv Uses

func (c *Circle) Inv(i Circle)

Inv computes inversive geometry transform.

type Point Uses

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').

func Conj Uses

func Conj(p Point) Point

Conj returns the conjugated point.

func Infinity Uses

func Infinity() Point

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

func LFT Uses

func LFT(p Point, m m2c.Matrix) Point

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

func NewPoint Uses

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.

func Zero Uses

func Zero() Point

Zero returns the origin point {0, 0}.

func (*Point) Inv Uses

func (p *Point) Inv(c Circle)

Inv implements inversion respect to a circle.

func (*Point) Norm Uses

func (p *Point) Norm()

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).