trapezoid

package
v0.0.0-...-b5aa40e Latest Latest
Warning

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

Go to latest
Published: Feb 7, 2018 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Node

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

A Node is a node in a tree structure for trapezoid map queries. It is structured so that each variety of Node is the same struct, but each has a different payload and query function.

func NewRoot

func NewRoot() *Node

NewRoot returns a root node. There is only one root node. We use a root node to avoid having "if parent == nil, set this to root" checks in our map code.

func NewTrapNode

func NewTrapNode(tr *Trapezoid) *Node

NewTrapNode returns a leaf node holding a trapezoid

func NewX

func NewX(p geom.D3) *Node

NewX returns an X-Node at point P

func NewY

func NewY(e geom.FullEdge) *Node

NewY returns a Y-Node at edge e

func TrapezoidalMap

func TrapezoidalMap(dc *dcel.DCEL) (*dcel.DCEL, map[*dcel.Face]*dcel.Face, *Node, error)

TrapezoidalMap converts a dcel into a version of itself split into trapezoids and a search structure to find a containing trapezoid in the map in response to a point location query.

func (*Node) DCEL

func (tn *Node) DCEL() (*dcel.DCEL, map[*dcel.Face]*dcel.Face)

DCEL converts the trapezoids in the node search structure into a DCEL. This algorithm does not work? Consider scrapping this and replacing it with encoding the trapezoids as an OFF structure and decoding the resulting OFF structure as a DCEL.

func (*Node) PointLocate

func (tn *Node) PointLocate(vs ...float64) (*dcel.Face, error)

PointLocate returns, from a given complex structure, which substructure that point falls into, if any. In the trapezoidal map, the query structure can be point-located on.

func (*Node) Query

func (tn *Node) Query(fe geom.FullEdge) []*Trapezoid

Query is shorthand for tn.query(fe, tn)

func (*Node) String

func (tn *Node) String() string

type Trapezoid

type Trapezoid struct {
	Neighbors [4]*Trapezoid
	// contains filtered or unexported fields
}

A Trapezoid is used when contstructing a Trapezoid map, and contains references to its neighbor trapezoids and the edges that border it.

func (*Trapezoid) AsPoints

func (tr *Trapezoid) AsPoints() []geom.D2

AsPoints converts a trapezoid's internal values into four points.

func (*Trapezoid) BotEdge

func (tr *Trapezoid) BotEdge() geom.FullEdge

BotEdge returns a translation of tr's values to tr's bottom edge as a FullEdge

func (*Trapezoid) Copy

func (tr *Trapezoid) Copy() *Trapezoid

Copy returns a trapezoid with identical edges and neighbors.

func (*Trapezoid) DCELEdges

func (tr *Trapezoid) DCELEdges() []*dcel.Edge

DCELEdges evaluates and returns the edges of a trapezoid as DCElEdges with initialized origins, prevs, and nexts.

func (*Trapezoid) GetNeighbors

func (tr *Trapezoid) GetNeighbors() (*Trapezoid, *Trapezoid, *Trapezoid, *Trapezoid)

func (*Trapezoid) HasDefinedPoint

func (tr *Trapezoid) HasDefinedPoint(p geom.D3) bool

HasDefinedPoint returns for a given Trapezoid whether or not any of the points on the Trapezoid's perimeter match the query point. We make an assumption here that there will be no edges who have vertices defined on other edges, aka that all intersections are represented through vertices.

func (*Trapezoid) Lefts

func (tr *Trapezoid) Lefts(tr2 *Trapezoid)

Lefts is shorthand for setting both of tr's left neighbors to the same value.

func (*Trapezoid) Rights

func (tr *Trapezoid) Rights(tr2 *Trapezoid)

Rights is shorthand for setting both of tr's right neighbors to the same value

func (*Trapezoid) String

func (tr *Trapezoid) String() string

func (*Trapezoid) TopEdge

func (tr *Trapezoid) TopEdge() geom.FullEdge

TopEdge acts as BotEdge for tr's top

Jump to

Keyboard shortcuts

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