示例#1
0
func createSubPlots(root *node.Node, pts plotter.XYs, depth int) {
	if pts == nil {
		pts = make(plotter.XYs, depth+1)
	}

	// fmt.Println("Depth: ", depth)
	pts[depth].X = float64(root.GetX())
	pts[depth].Y = float64(root.GetY())

	if depth == 0 {
		if root.GetX() != theGoalX || root.GetY() != theGoalY {
			return
		}

		pts[depth].X = float64(root.GetX())
		pts[depth].Y = float64(root.GetY())

		total++

		plotutil.AddLinePoints(myPlot, pts)
		return
	}

	for _, item := range root.GetChildren() {
		createSubPlots(item, pts, depth-1)
	}
}