Documentation ¶
Index ¶
- type Base
- type BaseEdge
- type BaseFace
- type BaseHalfedge
- func (h *BaseHalfedge) Edge() Edge
- func (h *BaseHalfedge) Face() Face
- func (h *BaseHalfedge) From() Node
- func (h *BaseHalfedge) Next() Halfedge
- func (h *BaseHalfedge) Prev() Halfedge
- func (h *BaseHalfedge) SetEdge(e Edge)
- func (h *BaseHalfedge) SetFace(f Face)
- func (h *BaseHalfedge) SetFrom(u Node)
- func (h *BaseHalfedge) SetNext(he Halfedge)
- func (h *BaseHalfedge) SetPrev(he Halfedge)
- func (h *BaseHalfedge) SetTwin(he Halfedge)
- func (h *BaseHalfedge) Twin() Halfedge
- type BaseNode
- type Edge
- type Face
- type Graph
- func (g *Graph) AddFace(id int, nodes ...graph.Node) error
- func (g *Graph) AddNode(id int) Node
- func (g *Graph) Edge(x, y graph.Node) graph.Edge
- func (g *Graph) EdgeBetween(x, y graph.Node) graph.Edge
- func (g *Graph) Edges() []graph.Edge
- func (g *Graph) Face(id int) Face
- func (g *Graph) Faces() []Face
- func (g *Graph) From(x graph.Node) []graph.Node
- func (g *Graph) Halfedge(x, y graph.Node) Halfedge
- func (g *Graph) HalfedgesAround(f Face) []Halfedge
- func (g *Graph) HalfedgesFrom(x graph.Node) []Halfedge
- func (g *Graph) HalfedgesTo(x graph.Node) []Halfedge
- func (g *Graph) Has(x graph.Node) bool
- func (g *Graph) HasEdge(x, y graph.Node) bool
- func (g *Graph) HasFace(id int) bool
- func (g *Graph) NewFaceID() int
- func (g *Graph) NewNodeID() int
- func (g *Graph) Node(id int) Node
- func (g *Graph) Nodes() []graph.Node
- func (g *Graph) RemoveEdge(e graph.Edge)
- func (g *Graph) RemoveFace(f Face)
- func (g *Graph) RemoveNode(x graph.Node)
- type Halfedge
- type Items
- type Node
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Base ¶
type Base struct{}
Base implements Items interface for allocating base elements of DCEL data structure.
func (Base) NewHalfedge ¶
type BaseEdge ¶
type BaseEdge struct {
// contains filtered or unexported fields
}
func NewBaseEdge ¶
func (*BaseEdge) SetHalfedges ¶
type BaseFace ¶
type BaseFace struct {
// contains filtered or unexported fields
}
func NewBaseFace ¶
func (*BaseFace) SetHalfedge ¶
type BaseHalfedge ¶
type BaseHalfedge struct {
// contains filtered or unexported fields
}
func NewBaseHalfedge ¶
func NewBaseHalfedge() *BaseHalfedge
func (*BaseHalfedge) Edge ¶
func (h *BaseHalfedge) Edge() Edge
func (*BaseHalfedge) Face ¶
func (h *BaseHalfedge) Face() Face
func (*BaseHalfedge) From ¶
func (h *BaseHalfedge) From() Node
func (*BaseHalfedge) Next ¶
func (h *BaseHalfedge) Next() Halfedge
func (*BaseHalfedge) Prev ¶
func (h *BaseHalfedge) Prev() Halfedge
func (*BaseHalfedge) SetEdge ¶
func (h *BaseHalfedge) SetEdge(e Edge)
func (*BaseHalfedge) SetFace ¶
func (h *BaseHalfedge) SetFace(f Face)
func (*BaseHalfedge) SetFrom ¶
func (h *BaseHalfedge) SetFrom(u Node)
func (*BaseHalfedge) SetNext ¶
func (h *BaseHalfedge) SetNext(he Halfedge)
func (*BaseHalfedge) SetPrev ¶
func (h *BaseHalfedge) SetPrev(he Halfedge)
func (*BaseHalfedge) SetTwin ¶
func (h *BaseHalfedge) SetTwin(he Halfedge)
func (*BaseHalfedge) Twin ¶
func (h *BaseHalfedge) Twin() Halfedge
type BaseNode ¶
type BaseNode struct {
// contains filtered or unexported fields
}
func NewBaseNode ¶
func (*BaseNode) SetHalfedge ¶
type Edge ¶
type Edge interface { graph.Edge // ID returns an edge identifier unique within the graph. ID() int // Halfedges returns the two halfedges that form the edge. Halfedges() (Halfedge, Halfedge) // SetHalfedges sets the two halfedges that form the edge. SetHalfedges(Halfedge, Halfedge) }
Edge is an undirected edge in the DCEL data structure.
type Face ¶
type Face interface { // ID returns a face identifier unique within the graph. ID() int // Halfedge returns an adjacent halfedge. Halfedge() Halfedge // SetHalfedge sets an adjacent halfedge. SetHalfedge(Halfedge) }
Face is a face in the DCEL data structure.
type Graph ¶
type Graph struct {
// contains filtered or unexported fields
}
Graph implements the doubly-connected edge list data structure.
func (*Graph) AddFace ¶
AddFace adds a new face with given ID and with vertices given by nodes. Any missing node or edge between two consecutive nodes will be added to the graph first.
If the nodes are not pair-wise distinct, if two consecutive nodes are already connected by a halfedge with an adjacent Face, or if the existing graph topology does not permit adding the face, an error will be returned.
AddFace panics if a face with the given id already exists in the graph or if the length of nodes is less than 3.
func (*Graph) AddNode ¶
AddNode adds a new, isolated node with the given id to the graph and returns it. AddNode panics if a node with same id already exists in the graph.
func (*Graph) EdgeBetween ¶
EdgeBetween returns the edge between x and y or nil if the nodes are not connected.
func (*Graph) Face ¶
Face returns the face with the given id or nil if it does not exist within the graph.
func (*Graph) Halfedge ¶
Halfedge returns the halfedge from x to y, or nil if the nodes are not connected by an edge or at least one is isolated.
func (*Graph) HalfedgesAround ¶
HalfedgesAround returns all halfedges adjacent to the given face.
func (*Graph) HalfedgesFrom ¶
HalfedgesFrom returns all halfedges whose From node is x.
func (*Graph) HalfedgesTo ¶
HalfedgesTo returns all halfedges whose Twin.From node is x.
func (*Graph) Node ¶
Node returns the node with the given id or nil if it does not exist within the graph.
func (*Graph) RemoveEdge ¶
RemoveEdge removes the edge between nodes identified by e.From and e.To and its adjacent faces from g.
func (*Graph) RemoveFace ¶
RemoveFace disconnects f from g and sets its Halfedge to nil.
func (*Graph) RemoveNode ¶
RemoveNode removes the node with ID given by x.ID() from the graph as well as any edges attached to it.
type Halfedge ¶
type Halfedge interface { // From returns the origin node. From() Node // SetFrom sets the origin node. SetFrom(Node) // Twin returns the twin halfedge in the same edge. Twin() Halfedge // SetTwin sets the twin halfedge in the same edge. SetTwin(Halfedge) // Next returns the next halfedge around the adjacent face. Next() Halfedge // SetNext sets the next halfedge around the adjacent face. SetNext(Halfedge) // Prev returns the previous halfedge around the adjacent face. Prev() Halfedge // SetPrev sets the previous halfedge around the adjacent face. SetPrev(Halfedge) // Edge returns the undirected edge to which the halfedge belongs. Edge() Edge // SetEdge sets the undirected edge to which the halfedge belongs. SetEdge(Edge) // Face returns the adjacent face. Face() Face // SetFace sets the adjacent face. SetFace(Face) }
Halfedge is a an oriented edge in the DCEL data structure.
type Items ¶
type Items interface { // NewNode returns a new node with the given id. NewNode(int) Node // NewHalfedge returns a new halfedge. NewHalfedge() Halfedge // NewEdge returns a new edge with the given id. NewEdge(int) Edge // NewFace returns a new face with the given id. NewFace(int) Face }
Items wraps methods for allocating graph entities that can be stored in the DCEL data structure.
type Node ¶
type Node interface { graph.Node // Halfedge returns the outgoing halfedge from the node. When the node is // isolated, the returned halfedge is nil. When the node is at a boundary, // the halfedge's Face is nil. Halfedge() Halfedge // SetHalfedge sets the outgoing halfedge from the node. SetHalfedge(Halfedge) }
Node is a graph node in the DCEL data structure.