Esempio n. 1
0
        /// <summary>
        /// Returns whether the planar projections of the two <i>Coordinate</i>s are equal.
        ///</summary>
        /// <param name="coordinate"><i>ICoordinate</i> with which to do the 2D comparison.</param>
        /// <returns>
        /// <c>true</c> if the x- and y-coordinates are equal;
        /// the Z coordinates do not have to be equal.
        /// </returns>
        public bool Equals2D(CoordinateF coordinate)
        {
            CoordinateF coordF = coordinate;

            if (coordF == null)
            {
                if (_x != coordinate.X)
                {
                    return(false);
                }
                if (_y != coordinate.Y)
                {
                    return(false);
                }
            }
            else
            {
                // Compare at the float level if possible.
                if (_x != coordF.X)
                {
                    return(false);
                }
                if (_y != coordF.Y)
                {
                    return(false);
                }
            }
            return(true);
        }
Esempio n. 2
0
        /// <summary>
        /// Returns true if other has the same values for x, y and z.
        /// </summary>
        /// <param name="other"><i>ICoordinate</i> with which to do the 3D comparison.</param>
        /// <returns><c>true</c> if <c>other</c> is a <c>ICoordinate</c> with the same values for x, y and z.</returns>
        public bool Equals3D(CoordinateF other)
        {
            CoordinateF coordF = other;

            if (coordF == null)
            {
                return((_x == other.X) && (_y == other.X) && ((_z == other.Z) ||
                                                              (Double.IsNaN(_z) && Double.IsNaN(other.Z))));
            }
            return((_x == coordF.X) && (_y == coordF.Y) && ((_z == coordF.Z) || ((float.IsNaN(_z) && float.IsNaN(coordF.Z)))));
        }
Esempio n. 3
0
 /// <summary>
 /// Copies the X, Y and Z values from the CoordinateF without doing a conversion.
 /// </summary>
 /// <param name="coord">X, Y Z</param>
 public FloatVector3(CoordinateF coord)
 {
     X = coord.X;
     Y = coord.Y;
     Z = coord.Z;
 }
Esempio n. 4
0
 /// <summary>
 /// Returns true if other has the same values for x, y and z.
 /// </summary>
 /// <param name="other"><i>ICoordinate</i> with which to do the 3D comparison.</param>
 /// <returns><c>true</c> if <c>other</c> is a <c>ICoordinate</c> with the same values for x, y and z.</returns>
 public bool Equals3D(CoordinateF other)
 {
     CoordinateF coordF = other;
     if (coordF == null)
     {
         return (_x == other.X) && (_y == other.X) && ((_z == other.Z)
    || (Double.IsNaN(_z) && Double.IsNaN(other.Z)));
     }
     return (_x == coordF.X) && (_y == coordF.Y) && ((_z == coordF.Z) || ((float.IsNaN(_z) && float.IsNaN(coordF.Z))));
 }
Esempio n. 5
0
 /// <summary>
 /// Returns whether the planar projections of the two <i>Coordinate</i>s are equal.
 ///</summary>
 /// <param name="coordinate"><i>ICoordinate</i> with which to do the 2D comparison.</param>
 /// <returns>
 /// <c>true</c> if the x- and y-coordinates are equal;
 /// the Z coordinates do not have to be equal.
 /// </returns>
 public bool Equals2D(CoordinateF coordinate)
 {
     CoordinateF coordF = coordinate;
     if (coordF == null)
     {
         if (_x != coordinate.X)
             return false;
         if (_y != coordinate.Y)
             return false;
     }
     else
     {
         // Compare at the float level if possible.
         if (_x != coordF.X)
             return false;
         if (_y != coordF.Y)
             return false;
     }
     return true;
 }
Esempio n. 6
0
 /// <summary>
 /// Copies the X, Y and Z values from the CoordinateF without doing a conversion.
 /// </summary>
 /// <param name="coord">X, Y Z</param>
 public FloatVector3(CoordinateF coord)
 {
     X = coord.X;
     Y = coord.Y;
     Z = coord.Z;
 }