Exemplo n.º 1
0
        ///// <summary>
        ///// Create a new object as copy of this instance.
        ///// </summary>
        //public override Coordinate Copy()
        //{
        //    return new CoordinateZ(X, Y, Z);
        //}

        /// <summary>
        /// Computes the 3-dimensional Euclidean distance to another location.
        /// </summary>
        /// <param name="c">A <see cref="CoordinateZ"/> with which to do the distance comparison.</param>
        /// <returns>the 3-dimensional Euclidean distance between the locations.</returns>
        public double Distance3D(CoordinateZ c)
        {
            double dx = X - c.X;
            double dy = Y - c.Y;
            double dz = Z - c.Z;

            if (double.IsNaN(dz))
            {
                dz = 0;
            }
            return(Math.Sqrt(dx * dx + dy * dy + dz * dz));
        }
Exemplo n.º 2
0
 /// <summary>
 /// Tests if another CoordinateZ has the same value for Z, within a tolerance.
 /// </summary>
 /// <param name="c">A <see cref="CoordinateZ"/>.</param>
 /// <param name="tolerance">The tolerance value.</param>
 /// <returns><c>true</c> if the Z ordinates are within the given tolerance.</returns>
 public bool EqualInZ(CoordinateZ c, double tolerance)
 {
     return(EqualsWithTolerance(this.Z, c.Z, tolerance));
 }
Exemplo n.º 3
0
 /// <summary>
 /// Returns <c>true</c> if <paramref name="other"/>
 /// has the same values for X, Y and Z.
 /// </summary>
 /// <param name="other">A <see cref="CoordinateZ"/> with which to do the 3D comparison.</param>
 /// <returns>
 /// <c>true</c> if <paramref name="other"/> is a <see cref="CoordinateZ"/>
 /// with the same values for X, Y and Z.
 /// </returns>
 public bool Equals3D(CoordinateZ other)
 {
     return((X == other.X) && (Y == other.Y) &&
            ((Z == other.Z) || (double.IsNaN(Z) && double.IsNaN(other.Z))));
 }