/// <summary> /// Calculates distance between two <see cref="Point3D" /> objects. /// </summary> /// <param name="a">First <see cref="Point3D"/>.</param> /// <param name="b">Second <see cref="Point3D"/>.</param> /// <returns>Distance between two <see cref="Point3D" /> objects.</returns> public static double DistanceBetween( Point3D a, Point3D b ) { return Math.Sqrt(( a.X - b.X ) * ( a.X - b.X ) + ( a.Y - b.Y ) * ( a.Y - b.Y ) + ( a.Z - b.Z ) * ( a.Z - b.Z )); }
/// <summary> /// Calculates distance between two <see cref="Point3D" /> objects. /// </summary> /// <param name="a">First <see cref="Point3D"/>.</param> /// <param name="b">Second <see cref="Point3D"/>.</param> /// <returns>Distance between two <see cref="Point3D" /> objects.</returns> public static double DistanceBetween( Point3D a, Point3D b ) { return Utility.DistanceBetween(a, b); }
/// <summary> /// Returns distance between current <see cref="Point3D"/> and some other. /// </summary> /// <param name="other"><see cref="Point3D"/> distance to which is needed to calculate.</param> /// <returns><see cref="double"/> value, that is distance between current and some other <see cref="Point3D"/> objects.</returns> public float DistanceTo( Point3D other ) { return ( float )Math.Sqrt(( m_X - other.X ) * ( m_X - other.X ) + ( m_Y - other.Y ) * ( m_Y - other.Y ) + ( m_Z - other.Z ) * ( m_Z - other.Z )); }
/// <summary> /// Indicates if provided <see cref="Point3D"/> is inside current <see cref="Zone"/> geometrical space. /// </summary> /// <param name="p"><see cref="Point3D"/> object to validate.</param> /// <returns>True, if provided <see cref="Point3D"/> is inside current <see cref="Zone"/>, otherwise false.</returns> public virtual bool IsInside( Point3D p ) { #if ZONE_REVALIDATION_COUNTER IncrementRevalidationsCount(); #endif foreach ( IZone z in m_Zones ) if ( z.IsInside(p) ) return true; return false; }