public Vector3k IntersectionDist(BoundingCylinder b) { Vector3k dist = new Vector3k(this.X - b.X, this.Y - b.Y, Accum.Zero); dist.Z = IntersectionDistZ(b); return(dist); }
public Accum IntersectionDistZ(BoundingCylinder b) { if (this.Z >= b.Z) // If the bottom of this bounding cylinder is inside b. { return(b.Top - this.Z); } else if (this.Top <= b.Top) // Or if the top is inside b. { return(-(b.Z - this.Top)); } return(Accum.Zero); // This shouldn't really happen. }
/// <summary> /// Checks for intersection with a bounding cylinder. /// </summary> /// <param name="b">The bounding cylinder to check for intersection with.</param> /// <returns>Returns a boolean indicating whether an intersection happened.</returns> public bool Intersects(BoundingCylinder b) { return(IntersectsXY(b) || IntersectsZ(b)); }
/// <summary> /// Checks for intersection with a bounding cylinder in the Z axis. /// </summary> /// <param name="b">The bounding cylinder to check for intersection with.</param> /// <returns>Returns a boolean indicating whether an intersection happened.</returns> public bool IntersectsZ(BoundingCylinder b) { return(MathUtils.IsBetween(this.Z, b.Z, b.Top) || MathUtils.IsBetween(this.Top, b.Z, b.Top)); }
/// <summary> /// Checks for intersection with a bounding cylinder in the XY axes. /// </summary> /// <param name="b">The bounding cylinder to check for intersection with.</param> /// <returns>Returns a boolean indicating whether an intersection happened.</returns> public bool IntersectsXY(BoundingCylinder b) { return(FixedMath.Abs(IntersectionDistXY(b).LengthSquared) < FixedMath.Square(this.Radius + b.Radius)); }
public Vector3k IntersectionDistXY(BoundingCylinder b) { return(new Vector3k(this.X - b.X, this.Y - b.Y, Accum.Zero)); }