예제 #1
0
func getVertices(s string, m r3.Matrix) (vertices []Point) {
	line := makePolyline(s)
	for _, v := range line.vertices {
		vertices = append(vertices, Point{m.MulVector(v.Vector).Normalize()})
	}
	return
}
예제 #2
0
func dumpUnusedEdges(unusedEdges []Edge, m r3.Matrix, numExpected int) {
	if len(unusedEdges) == numExpected {
		return
	}
	fmt.Printf("Wrong number of unused edges (%d expected, %d actual):\n",
		numExpected, len(unusedEdges))
	for _, edge := range unusedEdges {
		p0 := LatLngFromPoint(Point{m.Transpose().MulVector(edge.v0.Vector)})
		p1 := LatLngFromPoint(Point{m.Transpose().MulVector(edge.v1.Vector)})
		fmt.Printf("  [%.6f, %.6f] -> [%.6f, %.6f]\n",
			p0.Lat.Degrees(), p0.Lng.Degrees(),
			p1.Lat.Degrees(), p1.Lng.Degrees())
	}
}
예제 #3
0
func findMissingLoops(actual, expected []*Loop,
	m r3.Matrix, maxSplits int, maxError float64, label string) bool {
	// Dump any loops from "actual" that are not present in "expected".
	found := false
	for i, loop := range actual {
		if findLoop(loop, expected, maxSplits, maxError) {
			continue
		}
		fmt.Printf("%s loop %d:\n", label, i)
		for _, v := range loop.vertices {
			ll := LatLngFromPoint(Point{m.Transpose().MulVector(v.Vector)})
			fmt.Printf("  [%.6f, %.6f]\n", ll.Lat.Degrees(), ll.Lng.Degrees())
		}
		found = true
	}
	return found
}
예제 #4
0
파일: point.go 프로젝트: calendreco/gos2
func PointFromFrame(m r3.Matrix, q Point) Point {
	return Point{m.MulVector(q.Vector)}
}