Exemple #1
0
func NewOctreeVol(cube *go4game.HyperRect) *OctreeVol {
	rtn := OctreeVol{
		BoundCube: cube,
		Center:    cube.Center(),
		DataList:  make([]OctreeVolObjI, 0, MaxOctreeVolData),
	}
	return &rtn
}
Exemple #2
0
func main() {
	v1 := go4game.Vector3D{0, 0, 0}
	v2 := go4game.Vector3D{1, -1, 1}
	d8 := v1.To8Direct(v2)
	fmt.Printf("%v %v %v\n", v1, v2, d8)
	hr := go4game.HyperRect{
		go4game.Vector3D{-10, -10, -10},
		go4game.Vector3D{10, 10, 10},
	}
	nhr := hr.MakeCubeBy8Driect(v1, d8)
	fmt.Printf("%v %v %v isin %v\n", hr, nhr, d8, v2.IsIn(nhr))

}
Exemple #3
0
func (t *Team) makeNearObjs(ot *go4game.Octree, hr *go4game.HyperRect) SPObjList {
	mainobj := t.findMainObj()
	if mainobj == nil {
		return nil
	}
	rtn := NearInfo{
		sl: make(SPObjList, 0),
		t:  t,
	}
	ot.QueryByHyperRect(rtn.gather, hr.Move(mainobj.PosVector))
	//log.Printf("nears %v", len(rtn.sl))
	t.NearStat.Add(int64(len(rtn.sl)))
	return rtn.sl
}