func (ff frustum) Contains(bb gfx.Boundable) bool { f := math.Mat4(ff) b := bb.Bounds() // Every corner of the 3D rectangle must be in the frustum -- thus we can // say that if no corner is in the frustum, the rectangle is not contained. var inside bool for _, corner := range b.Corners() { if _, inside = f.Project(corner); !inside { return false } } return true }
func (ff frustum) Intersects(bb gfx.Boundable) bool { f := math.Mat4(ff) b := bb.Bounds() // If any single corner of the 3D rectangle is in the frustum, then it is // intersecting. var inside bool for _, corner := range b.Corners() { if _, inside = f.Project(corner); inside { return true } } return false }