func coordsJoined2D(values []float64) geom.Coords {
	if len(values) < 2 {
		return coords64.NewCoords64()
	}
	c1 := coords64.NewCoords64FromSlice(2, values[:2])
	c2 := coords64.NewCoords64FromSlice(2, values[2:])
	return geom.NewCoordsJoined(c1, c2)
}
func coordsJoined3D(values []float64) geom.Coords {
	if len(values) < 3 {
		return coords64.NewCoords64WithDimensions(3)
	}
	c1 := coords64.NewCoords64FromSlice(3, values[:3])
	c2 := coords64.NewCoords64FromSlice(3, values[3:])
	return geom.NewCoordsJoined(c1, c2)
}
Beispiel #3
0
func TestNewLinearRingInsufficientCoords(t *testing.T) {
	c := coords64.NewCoords64FromSlice(2, []float64{1, 1, 2, 2})
	assert.Panics(t, func() { geom.NewLinearRingFromCoords(c) })
}
Beispiel #4
0
func TestNewLinearRingFromLine(t *testing.T) {
	c := coords64.NewCoords64FromSlice(2, []float64{1, 1, 5, 5, 1, 1})
	geom.NewLinearRingFromCoords(c)
}
Beispiel #5
0
func TestNewLinearRingEndPointMismatchLine(t *testing.T) {
	c := coords64.NewCoords64FromSlice(2, []float64{1, 1, 2, 2, 3, 3})
	assert.Panics(t, func() { geom.NewLinearRingFromCoords(c) })
}
Beispiel #6
0
func TestLineCoords(t *testing.T) {
	line := geom.NewLine(coords64.NewCoords64FromSlice(2, []float64{1, 1, 5, 5}))
	assert.Equal(t, 2, int(line.Coords().NumCoords()))
}
Beispiel #7
0
func TestNewLineCoords(t *testing.T) {
	geom.NewLine(coords64.NewCoords64FromSlice(2, []float64{1, 1, 5, 5}))
}