geom

package module
v0.0.0-...-96f3e8a Latest Latest
Warning

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

Go to latest
Published: Jan 3, 2018 License: BSD-2-Clause-Views Imports: 2 Imported by: 33

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Debug = false

Functions

func CoordChan

func CoordChan(points []Coord) (ch <-chan Coord)

func CrossProduct

func CrossProduct(p, q Coord) (z float64)

func DotProduct

func DotProduct(p, q Coord) (r float64)

func RectsEqual

func RectsEqual(r1, r2 Rect) bool

func RectsIntersect

func RectsIntersect(r1, r2 Rect) bool

func RectsIntersectStrict

func RectsIntersectStrict(r1, r2 Rect) bool

func VectorAngle

func VectorAngle(X, Y Coord) (r float64)

func VertexAngle

func VertexAngle(A, B, C Coord) (r float64)

Types

type Bounded

type Bounded interface {
	Bounds() (bounds Rect)
}

type Coord

type Coord struct {
	X, Y float64
}

func LineIntersection

func LineIntersection(l1, l2 Line) (p Coord)

func (Coord) DistanceFrom

func (p Coord) DistanceFrom(q Coord) (d float64)

func (Coord) DistanceFromSquared

func (p Coord) DistanceFromSquared(q Coord) (ds float64)

func (*Coord) Equals

func (p *Coord) Equals(oi interface{}) (equals bool)

func (Coord) EqualsCoord

func (p Coord) EqualsCoord(q Coord) bool

func (*Coord) Hashcode

func (p *Coord) Hashcode() (hash uint64)

func (Coord) Magnitude

func (p Coord) Magnitude() (m float64)

func (Coord) MagnitudeSquared

func (p Coord) MagnitudeSquared() (ms float64)

func (Coord) Minus

func (p Coord) Minus(q Coord) (r Coord)

func (Coord) Plus

func (p Coord) Plus(q Coord) (r Coord)

func (Coord) QuadMM

func (p Coord) QuadMM(q Coord) bool

func (Coord) QuadMP

func (p Coord) QuadMP(q Coord) bool

func (Coord) QuadPM

func (p Coord) QuadPM(q Coord) bool

func (Coord) QuadPP

func (p Coord) QuadPP(q Coord) bool

func (*Coord) Rotate

func (p *Coord) Rotate(rad float64)

func (*Coord) RotateLeft

func (p *Coord) RotateLeft()

func (*Coord) RotateRight

func (p *Coord) RotateRight()

func (*Coord) Scale

func (p *Coord) Scale(xfactor, yfactor float64)

func (Coord) Times

func (p Coord) Times(s float64) (r Coord)

func (*Coord) Translate

func (p *Coord) Translate(offset Coord)

func (Coord) Unit

func (p Coord) Unit() (u Coord)

type Line

type Line struct {
	Intersection Coord
	Normal       Coord
}

A line that goes through Intersection and has a normal Normal.

type Path

type Path struct {
	// contains filtered or unexported fields
}

func (*Path) AddVertex

func (p *Path) AddVertex(v Coord)

func (*Path) Bounds

func (p *Path) Bounds() (bounds *Rect)

func (*Path) Clone

func (p *Path) Clone() (op *Path)

func (*Path) Equals

func (p *Path) Equals(oi interface{}) bool

func (*Path) Error

func (me *Path) Error(other *Path) (offset Coord, error float64)

func (*Path) InsertVertexAfter

func (p *Path) InsertVertexAfter(v Coord, index int)

func (*Path) Length

func (p *Path) Length() int

func (*Path) Register

func (p *Path) Register(op *Path) (offset Coord, match bool)

func (*Path) Rotate

func (p *Path) Rotate(rad float64)

func (*Path) Scale

func (p *Path) Scale(xf, yf float64)

func (*Path) Translate

func (p *Path) Translate(offset Coord)

func (*Path) Vertices

func (p *Path) Vertices() (v []Coord)

type Polygon

type Polygon struct {
	Path
}

func (*Polygon) Bisect

func (me *Polygon) Bisect(i, j int) (p1, p2 *Polygon)

bisect a polygon by joining vertices i and j

func (*Polygon) Clone

func (p *Polygon) Clone() (op *Polygon)

func (*Polygon) ContainsCoord

func (me *Polygon) ContainsCoord(p Coord) bool

func (*Polygon) Equals

func (p *Polygon) Equals(oi interface{}) bool

func (*Polygon) Error

func (me *Polygon) Error(other *Polygon) (offset Coord, error float64)

func (*Polygon) Register

func (p *Polygon) Register(op *Polygon) (offset Coord, match bool)

func (*Polygon) Segment

func (me *Polygon) Segment(index int) (s *Segment)

func (*Polygon) Triangles

func (me *Polygon) Triangles() (tris []Triangle, ok bool)

func (*Polygon) Vertex

func (me *Polygon) Vertex(index int) (v Coord)

func (*Polygon) VertexAngle

func (me *Polygon) VertexAngle(index int) (r float64)

func (*Polygon) WindingOrder

func (me *Polygon) WindingOrder() (winding float64)

type Rect

type Rect struct {
	Min, Max Coord
}

func NilRect

func NilRect() (r Rect)

this rect contains nothing

func RectsIntersection

func RectsIntersection(r1, r2 Rect) (ri Rect)

func (Rect) Bounds

func (r Rect) Bounds() (bounds Rect)

func (Rect) Center

func (r Rect) Center() (center Coord)

func (Rect) ContainsCoord

func (r Rect) ContainsCoord(p Coord) bool

func (Rect) ContainsRect

func (r Rect) ContainsRect(o Rect) bool

func (Rect) Equals

func (r Rect) Equals(oi interface{}) bool

func (*Rect) ExpandToContain

func (r *Rect) ExpandToContain(ch <-chan Coord)

func (*Rect) ExpandToContainCoord

func (r *Rect) ExpandToContainCoord(p Coord)

func (*Rect) ExpandToContainRect

func (r *Rect) ExpandToContainRect(q Rect)

func (Rect) Height

func (r Rect) Height() float64

func (*Rect) Scale

func (r *Rect) Scale(xf, yf float64)

func (Rect) Size

func (r Rect) Size() (w, h float64)

func (Rect) String

func (r Rect) String() string

func (*Rect) Translate

func (r *Rect) Translate(offset Coord)

func (Rect) Width

func (r Rect) Width() float64

type Segment

type Segment struct {
	A, B Coord
}

func (*Segment) Extrapolate

func (s *Segment) Extrapolate(t float64) (p Coord)

func (*Segment) IntersectParameters

func (s *Segment) IntersectParameters(t *Segment) (ps, pt float64)

func (*Segment) Intersection

func (s *Segment) Intersection(t *Segment) (p Coord, ok bool)

type Transformable

type Transformable interface {
	Translate(offset Coord)
	Rotate(rad float64)
	Scale(xfactor, yfactor float64)
}

type Triangle

type Triangle struct {
	A, B, C Coord
}

func (*Triangle) Bounds

func (me *Triangle) Bounds() (bounds *Rect)

func (*Triangle) ContainsCoord

func (me *Triangle) ContainsCoord(p Coord) bool

func (*Triangle) Equals

func (me *Triangle) Equals(oi interface{}) bool

func (*Triangle) HasVertex

func (me *Triangle) HasVertex(v Coord) bool

func (*Triangle) Vertices

func (me *Triangle) Vertices() (vertices []Coord)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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