package module
v0.0.0-...-b0092f6 Latest Latest

This package is not in the latest version of its module.

Go to latest
Published: Nov 20, 2017 License: MIT Imports: 2 Imported by: 0



go for the Reimann sphere

GoDoc GoLint

The Riemann sphere extends the complex plane by adding one point at Infinity. It is the plane plus one point, say it the North pole, with some good math formulas to ensure nice behaviuors, in particular to avoid functions discontinuity and other goodies like Conformal map i.e. circles are mapped into circles.

I dedicate this work to my father Umberto Casati and the great mathematician Luigi Bianchi who was a great inspiration for me.





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



This section is empty.


This section is empty.


func CircleEq

func CircleEq(c Circle, d Circle) bool

CircleEq checks that two circles are equal.

func PointEq

func PointEq(p Point, q Point) bool

PointEq checks that two points are equal.


type Circle

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

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

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

func (c *Circle) Inv(i Circle)

Inv computes inversive geometry transform.

type Point

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

func Conj(p Point) Point

Conj returns the conjugated point.

func Infinity

func Infinity() Point

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

func LFT

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

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

func NewPoint

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

func Zero() Point

Zero returns the origin point {0, 0}.

func (*Point) Inv

func (p *Point) Inv(c Circle)

Inv implements inversion respect to a circle.

func (*Point) Norm

func (p *Point) Norm()

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

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL