예제 #1
0
        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);
        }
예제 #2
0
        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.
        }
예제 #3
0
 /// <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));
 }
예제 #4
0
 /// <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));
 }
예제 #5
0
 /// <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));
 }
예제 #6
0
 public Vector3k IntersectionDistXY(BoundingCylinder b)
 {
     return(new Vector3k(this.X - b.X, this.Y - b.Y, Accum.Zero));
 }