예제 #1
0
func (this *coords64) Add(newValue geom.Point) {
	if newValue.NumDim() != this.dimensions {
		panic(fmt.Sprintf("Number of dimensions in coordinate(%d) do not match those in this coords object (%d)",
			newValue.NumDim(), this.dimensions))
	}
	this.data = append(this.data, newValue.ToArray()...)
}
예제 #2
0
func (this *coords64) Set(coordIdx uint32, newValue geom.Point) {
	if newValue.NumDim() != this.dimensions {
		panic(fmt.Sprintf("Number of dimensions in coordinate(%d) do not match those in this coords object (%d)",
			newValue.NumDim(), this.dimensions))
	}

	setIdx := coordIdx * uint32(this.dimensions)

	if setIdx > uint32(len(this.data))-uint32(this.dimensions) {
		panic(fmt.Sprintf("Insert index is out of bounds.  Legal bounds are: 0 -> %d but was %d", this.NumCoords(), coordIdx))
	}

	for i := uint8(0); i < newValue.NumDim(); i++ {
		this.data[setIdx+uint32(i)] = newValue.Ord(i)
	}
}
예제 #3
0
func (this *coords64) Insert(idx uint32, newValue geom.Point) {
	this.InsertRaw(idx, newValue.ToArray())
}