Exemplo n.º 1
0
        /// <summary>
        /// Returns true if this bound is either intersecting or colliding with the other bound.
        /// </summary>
        public bool Intersects(Bound other)
        {
            // TODO: optimize this function to avoid the sqrt
            Real centerDistances = Vector2r.Distance(X, Z, other.X, other.Z);
            Real range           = Radius + other.Radius;

            return(range >= centerDistances);
        }
Exemplo n.º 2
0
        public bool Equals(Vector2r p)
        {
            // If parameter is null return false:
            if ((object)p == null)
            {
                return(false);
            }

            // Return true if the fields match:
            return((X == p.X) && (Z == p.Z));
        }
Exemplo n.º 3
0
        public override bool Equals(System.Object obj)
        {
            // If parameter is null return false.
            if (obj == null || obj is Vector2r == false)
            {
                return(false);
            }

            // If parameter cannot be cast to Point return false.
            Vector2r p = (Vector2r)obj;

            // Return true if the fields match:
            return(X == p.X && Z == p.Z);
        }
Exemplo n.º 4
0
 /// <summary>
 /// Returns true if the given point is contained within this bound.
 /// </summary>
 public bool Contains(Vector2r point) {
     return Contains(point.X, point.Z);
 }
Exemplo n.º 5
0
 public static Real DistanceSq(Vector2r a, Vector2r b) {
     return DistanceSq(a.X, a.Z, b.X, b.Z);
 }
Exemplo n.º 6
0
        public bool Equals(Vector2r p) {
            // If parameter is null return false:
            if ((object)p == null) {
                return false;
            }

            // Return true if the fields match:
            return (X == p.X) && (Z == p.Z);
        }
Exemplo n.º 7
0
        /// <summary>
        /// Returns true if the given point is contained within this bound.
        /// </summary>
        public bool Contains(Real x, Real z)
        {
            Real distanceSq = Vector2r.DistanceSq(X, Z, x, z);

            return((Radius * Radius) > distanceSq);
        }
Exemplo n.º 8
0
 /// <summary>
 /// Returns true if the given point is contained within this bound.
 /// </summary>
 public bool Contains(Vector2r point)
 {
     return(Contains(point.X, point.Z));
 }
Exemplo n.º 9
0
 public static Real DistanceSq(Vector2r a, Vector2r b)
 {
     return(DistanceSq(a.X, a.Z, b.X, b.Z));
 }
Exemplo n.º 10
0
 protected static Vector2r Interpolate(Vector2r start, Vector2r end, float percentage) {
     return new Vector2r(
         Interpolate(start.X, end.X, percentage),
         Interpolate(start.Z, end.Z, percentage));
 }