Documentation ¶
Index ¶
- Constants
- func NetSvg(name string, net *xir.Net) error
- func SvgDrawLinks(net *xir.Net, cx, cy int, canvas *svg.SVG)
- func SvgDrawNodes(net *xir.Net, cx, cy int, canvas *svg.SVG)
- func Vtag(net *xir.Net)
- type Bounds
- type Pinode
- func (ptr *Pinode) Bounds() Bounds
- func (ptr *Pinode) Force(node Positional)
- func (ptr *Pinode) Forces(net *xir.Net)
- func (ptr *Pinode) Height() int
- func (pi *Pinode) Insert(x *Plnode)
- func (ptr *Pinode) Limit(quad int) *xir.Point
- func (p *Pinode) NewQuad(sector int) *Pinode
- func (p *Pinode) Position() *xir.Point
- func (p *Pinode) RecomputeCentroid()
- func (p *Pinode) Select(x *Plnode) int
- func (ptr *Pinode) Size() int
- func (p *Pinode) Velocity() *xir.Point
- func (p *Pinode) Weight() float64
- type Plnode
- type Pnode
- type Positional
- type RectBounds
Constants ¶
const (
BHC = 0.2 //Barnes-Hut Constant
)
const FK = 1e-4
const FMAX = 10.0
const GMAX = 30.0
const (
// number of iterations to use for force layout
Iters = 500
)
const W = 1.0
Variables ¶
This section is empty.
Functions ¶
func SvgDrawLinks ¶
Draw the links of an xir network on the provided svg canvas relative to the central point (cx, cy)
func SvgDrawNodes ¶
Draw the nodes of an xir network on the provided svg canvas relative to the central point (cx, cy)
Types ¶
type Bounds ¶
type Bounds struct {
Width, Height float64
}
Simple data structure to keep track of the size of things
type Pinode ¶
type Pinode struct { Quad [4]Pnode // The four quadrants this interior node presides over Centroid xir.Point // Center of mass for this interior node Width float64 // The collective width of the underlying 4 quadrants Mass float64 // The collective mass of the underlying 4 quadrants // contains filtered or unexported fields }
func PTree ¶
PTree constructs a new PTree from an xir network. The return value is the root of the tree. This is an O(n*log(n)) operation where n is the number of nodes in the provided network.
func (*Pinode) Force ¶
func (ptr *Pinode) Force(node Positional)
Compute the force on the specified node within this Pinode
func (*Pinode) Insert ¶
This method inserts a new Pleaf node below this Pinode. This is a recursive insertion with O(log(n)) complexity where n is the number of nodes currently below this Pinode.
func (*Pinode) RecomputeCentroid ¶
func (p *Pinode) RecomputeCentroid()
type Plnode ¶
type Plnode struct {
Data Positional // The data that is encapsulated by this leaf node
}
type Pnode ¶
type Pnode interface{}
A Pnode is a generic node type that is always either a Pinode or Plnode
type Positional ¶
The positional interface must be implemented by data that is laied out and presented by this code
type RectBounds ¶
type RectBounds struct {
L, R, T, B float64
}
func (*RectBounds) Height ¶
func (r *RectBounds) Height() float64
func (*RectBounds) Width ¶
func (r *RectBounds) Width() float64