voronoi

package module
v0.0.0-...-9f41c7f Latest Latest
Warning

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

Go to latest
Published: Sep 11, 2012 License: Apache-2.0 Imports: 3 Imported by: 0

README

Voronoi Graph library for Go

This code implements a library to perform Fortune's algorithm on a set of points, returning Voronoi edges which can be used to construct tiling polygons.

This implementation is heavily based off of Ivan Kuckir's writeup and code, which is available from: http://blog.ivank.net/fortunes-algorithm-and-implementation.html

Documentation

Overview

An implementation of Fortune's algorithm to get Voronoi edges for a set of points.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Edge

type Edge struct {
	Start     *Point
	End       *Point
	Direction *Point
	Left      *Point
	Right     *Point
	F         float64
	G         float64
	Neighbor  *Edge
}

func Ed

func Ed(x1 float64, y1 float64, x2 float64, y2 float64) *Edge

func NewEdge

func NewEdge(s *Point, a *Point, b *Point) *Edge

type Edges

type Edges []*Edge

type Event

type Event struct {
	Point   *Point
	IsPlace bool
	Y       float64
	Arch    *Parabola
}

func NewEvent

func NewEvent(p *Point, place bool) *Event

type EventList

type EventList []*Event

func (EventList) Find

func (l EventList) Find(e *Event) int

func (EventList) Last

func (l EventList) Last() *Event

func (*EventList) Remove

func (l *EventList) Remove(e *Event) bool

type EventQueue

type EventQueue []*Event

func (EventQueue) Len

func (q EventQueue) Len() int

func (EventQueue) Less

func (q EventQueue) Less(i int, j int) bool

func (*EventQueue) Pop

func (q *EventQueue) Pop() interface{}

func (*EventQueue) Push

func (q *EventQueue) Push(x interface{})

func (EventQueue) Swap

func (q EventQueue) Swap(i int, j int)

type Parabola

type Parabola struct {
	IsLeaf bool
	Site   *Point
	Edge   *Edge
	Event  *Event
	Parent *Parabola
	// contains filtered or unexported fields
}

func NewLeafParabola

func NewLeafParabola(s *Point) *Parabola

func NewParabola

func NewParabola() *Parabola

func (*Parabola) GetLeft

func (p *Parabola) GetLeft() *Parabola

func (*Parabola) GetLeftChild

func (p *Parabola) GetLeftChild() *Parabola

func (*Parabola) GetLeftParent

func (p *Parabola) GetLeftParent() *Parabola

func (*Parabola) GetRight

func (p *Parabola) GetRight() *Parabola

func (*Parabola) GetRightChild

func (p *Parabola) GetRightChild() *Parabola

func (*Parabola) GetRightParent

func (p *Parabola) GetRightParent() *Parabola

func (*Parabola) Left

func (p *Parabola) Left() *Parabola

func (*Parabola) Print

func (p *Parabola) Print()

func (*Parabola) Right

func (p *Parabola) Right() *Parabola

func (*Parabola) SetLeft

func (p *Parabola) SetLeft(c *Parabola)

func (*Parabola) SetRight

func (p *Parabola) SetRight(c *Parabola)

type Point

type Point struct {
	X float64
	Y float64
}

func Pt

func Pt(x float64, y float64) *Point

type Vertices

type Vertices []*Point

type Voronoi

type Voronoi struct {
	Edges    Edges
	Vertices Vertices
	Places   *Vertices
	Width    float64
	Height   float64
	Root     *Parabola
	Y        float64
	// contains filtered or unexported fields
}

func (*Voronoi) GetEdges

func (v *Voronoi) GetEdges(places *Vertices, w float64, h float64) Edges

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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