public Intersect ( BoundingBox box ) : FrustrumIntersectionType | ||
box | BoundingBox | |
return | FrustrumIntersectionType |
public FrustrumIntersectionType Intersect(BoundingBox box) {
var totalIn = 0;
foreach (var intersection in Planes.Select(plane => Plane.Intersects(plane, box))) {
switch (intersection) {
case PlaneIntersectionType.Back:
return FrustrumIntersectionType.None;
case PlaneIntersectionType.Front:
totalIn++;
break;
}
}
return totalIn == 6 ? FrustrumIntersectionType.Inside : FrustrumIntersectionType.Intersection;
}
}
public virtual bool Visible(BoundingBox box) { if (DisableFrustum) { return(true); } if (Frustum == null) { throw new Exception("Call SetLens() first"); } return(Frustum.Intersect(box) > 0); }