コード例 #1
0
ファイル: coords64.go プロジェクト: jesseeichar/gotopo
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
ファイル: coords64.go プロジェクト: jesseeichar/gotopo
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
ファイル: coords64.go プロジェクト: jesseeichar/gotopo
func (this *coords64) Insert(idx uint32, newValue geom.Point) {
	this.InsertRaw(idx, newValue.ToArray())
}