Documentation
¶
Index ¶
- Constants
- Variables
- type Edge
- type Graph
- func (g *Graph) AddEdge(id string, start, end *Node, speed float64, poly []Point) (*Edge, error)
- func (g *Graph) AddNode(id string, position Point) (*Node, error)
- func (g *Graph) GetBestPath(start, end *Node, maxDuration float64, reverse bool) ([]*Edge, error)
- func (g *Graph) GetDistance(start, end *Node, maxDuration float64, reverse bool) (float64, error)
- func (g *Graph) GetEdge(id string) (*Edge, error)
- func (g *Graph) GetNode(id string) (*Node, error)
- type Heap
- type Node
- type Point
- func (p *Point) ClosestPointOnEdge(edge *Edge) (closestPoint Point)
- func (p *Point) ClosestPointOnSegment(a, b Point) Point
- func (p *Point) Distance(other Point) float64
- func (p *Point) DistanceToEdge(edge *Edge) float64
- func (p *Point) IsOnSegment(a, b Point) bool
- func (p *Point) Move(dx, dy float64) Point
- func (a *Point) MoveTowards(b Point, d float64) Point
- type Segment2D
- type SegmentNode
Constants ¶
View Source
const ( EarthRadius = 6378137 Epsilon = 1e-6 )
Variables ¶
Functions ¶
This section is empty.
Types ¶
type Edge ¶
type Edge struct {
ID string `json:"id"`
Start string `json:"start"`
End string `json:"end"`
Speed float64 `json:"speed"`
Poly []Point `json:"polygon"`
Length float64 `json:"length"`
}
func (*Edge) LengthFrom ¶
type Graph ¶
type Graph struct {
Nodes map[string]*Node `json:"nodes"`
Edges map[string]*Edge `json:"edges"`
Seg *Segment2D `json:"-"`
}
func (*Graph) GetBestPath ¶
func (*Graph) GetDistance ¶
type Point ¶
func (*Point) ClosestPointOnEdge ¶
func (*Point) ClosestPointOnSegment ¶
func (*Point) DistanceToEdge ¶
func (*Point) IsOnSegment ¶
type Segment2D ¶
func NewSegment2D ¶
func NewSegment2D(nodes []*SegmentNode) *Segment2D
func (*Segment2D) GetInterval ¶
type SegmentNode ¶
Click to show internal directories.
Click to hide internal directories.