Beispiel #1
0
Datei: art.go Projekt: taysom/va
func testTurtle(d *doodle.Doodle) {
	var n int
	var x, dx, a, da float64
	bug.Where()
	t := d.New()
	n, x, dx, a, da = 400, 0.1, 0, 37, 17
	if flag.NArg() == 5 {
		n, _ = strconv.Atoi(flag.Arg(0))
		x, _ = strconv.ParseFloat(flag.Arg(1), 64)
		dx, _ = strconv.ParseFloat(flag.Arg(2), 64)
		a, _ = strconv.ParseFloat(flag.Arg(3), 64)
		da, _ = strconv.ParseFloat(flag.Arg(4), 64)
	}
	println(n, x, dx, a, da)
	if false {
		for i := 0; i < 4; i++ {
			t.Forward(2)
			t.Right(90)
		}
		t.Doit(40, 0, .1, 90, 0)
	} else {
		t.Doit(n, x, dx, a, da)
	}
}
Beispiel #2
0
Datei: art.go Projekt: taysom/va
func testSpline(d *doodle.Doodle) {
	list := listA
	if false {
		d.Plot(quad, -2, 5)
		d.Plot(func(x float64) float64 {
			return doodle.Poly(doodle.Vector{1, 0, -5, 0, 4}, x)
		}, -2, 5)
		d.Plot(cubic, -2, 3)
		d.Draw(line, 1.4, 3)
		d.Plot(line, 1.4, 3)
		for z := 0.0; z < 2; z += 0.1 {
			d.Line(doodle.Pt(-1, -2), doodle.Pt(4, 4+z))
		}
		d.GraphLine(list)
		d.GraphPoly(list)
		d.GraphQuadSpline(list)
		d.GraphCubicSplineA(list)
		d.GraphCubicSplineB(list)
		d.GraphCubicSplineC(list)
	}
	bug.Where()
	d.GraphLine(list)
	d.GraphCubicSplineC(list)
}