public void Contains(ref Vector3 point, out ContainmentType result) { if ((double)PlaneHelper.ClassifyPoint(ref point, ref this.top) > 0.0) { result = ContainmentType.Disjoint; } else if ((double)PlaneHelper.ClassifyPoint(ref point, ref this.bottom) > 0.0) { result = ContainmentType.Disjoint; } else if ((double)PlaneHelper.ClassifyPoint(ref point, ref this.left) > 0.0) { result = ContainmentType.Disjoint; } else if ((double)PlaneHelper.ClassifyPoint(ref point, ref this.right) > 0.0) { result = ContainmentType.Disjoint; } else if ((double)PlaneHelper.ClassifyPoint(ref point, ref this.near) > 0.0) { result = ContainmentType.Disjoint; } else if ((double)PlaneHelper.ClassifyPoint(ref point, ref this.far) > 0.0) { result = ContainmentType.Disjoint; } else { result = ContainmentType.Contains; } }
public void Contains(ref Vector3 point, out ContainmentType result) { float val; // If a point is on the POSITIVE side of the plane, then the point is not contained within the frustum // Check the top val = PlaneHelper.ClassifyPoint(ref point, ref this.top); if (val > 0) { result = ContainmentType.Disjoint; return; } // Check the bottom val = PlaneHelper.ClassifyPoint(ref point, ref this.bottom); if (val > 0) { result = ContainmentType.Disjoint; return; } // Check the left val = PlaneHelper.ClassifyPoint(ref point, ref this.left); if (val > 0) { result = ContainmentType.Disjoint; return; } // Check the right val = PlaneHelper.ClassifyPoint(ref point, ref this.right); if (val > 0) { result = ContainmentType.Disjoint; return; } // Check the near val = PlaneHelper.ClassifyPoint(ref point, ref this.near); if (val > 0) { result = ContainmentType.Disjoint; return; } // Check the far val = PlaneHelper.ClassifyPoint(ref point, ref this.far); if (val > 0) { result = ContainmentType.Disjoint; return; } // If we get here, it means that the point was on the correct side of each plane to be // contained. Therefore this point is contained result = ContainmentType.Contains; }
public void Contains(ref Vector3 point, out ContainmentType result) { for (int index = 0; index < 6; ++index) { if ((double)PlaneHelper.ClassifyPoint(ref point, ref this.planes[index]) > 0.0) { result = ContainmentType.Disjoint; return; } } result = ContainmentType.Contains; }
/// <summary> /// Containment test between this <see cref="BoundingFrustum"/> and specified <see cref="Vector3"/>. /// </summary> /// <param name="point">A <see cref="Vector3"/> for testing.</param> /// <param name="result">Result of testing for containment between this <see cref="BoundingFrustum"/> and specified <see cref="Vector3"/> as an output parameter.</param> public void Contains(ref Vector3 point, out ContainmentType result) { for (var i = 0; i < PlaneCount; ++i) { // TODO: we might want to inline this for performance reasons if (PlaneHelper.ClassifyPoint(ref point, ref this._planes[i]) > 0) { result = ContainmentType.Disjoint; return; } } result = ContainmentType.Contains; }