Esempio n. 1
0
func cv(x, y []int, p pointtype) {
	//
	m := uint(len(x))
	if m == 0 || m != uint(len(y)) {
		return
	}
	var A application
	switch p {
	case pt:
		A = point
	case ptinv:
		A = pointInv
	case onpt:
		A = on
	}
	A(x[0], y[0])
	n := uint(0)
	var dx, dy int
	for i := uint(1); i < m; i++ {
		if x[i] < x[i-1] {
			dx = x[i-1] - x[i]
		} else {
			dx = x[i] - x[i-1]
		}
		if y[i] < y[i-1] {
			dy = y[i-1] - y[i]
		} else {
			dy = y[i] - y[i-1]
		}
		n += uint(math.Sqrt(float64(dx*dx+dy*dy) + 0.5))
	}
	if n == 0 {
		return
	}
	X, Y := make([]int, n), make([]int, n)
	for i := uint(0); i < n; i++ {
		X[i], Y[i] = bezier(x, y, m, n, i)
	}
	if underX && p != onpt {
		xker.Points(X, Y, p == pt)
		return
	}
	for i := uint(0); i < n; i++ {
		A(X[i], Y[i])
	}
}
Esempio n. 2
0
func pointset(x, y []int) {
	//
	if !ok2(x, y) {
		return
	}
	n := uint(len(x))
	if n == 0 {
		return
	}
	if underX {
		xker.Points(x, y, true)
		return
	}
	if !visible {
		return
	}
	for i := 0; i < int(n); i++ {
		point(x[i], y[i])
	}
}