/// <summary> /// Checks whether the given <see cref="GreatCircleSegment"/> intersects with this <see cref="GreatCicle"/>. /// The point of intersection can then be found in the out-Parameter. /// </summary> /// <param name="arc">The arc segment to be checked.</param> /// <param name="intersection">The point of intersection, if they intersect.</param> /// <returns>Whether the <see cref="GreatCircleSegment"/> intersects this <see cref="GreatCircle"/> or not.</returns> public bool Intersects(GreatCircleSegment arc, out SphereCoordinate intersection) { intersection = default(SphereCoordinate); CartesianVector possibleIntersection; if (!Intersects(arc.BaseCircle, out possibleIntersection)) { return(false); } if (arc.IsOnArc(possibleIntersection)) { intersection = possibleIntersection; return(true); } if (arc.IsOnArc(-possibleIntersection)) { intersection = -possibleIntersection; return(true); } return(false); }
/// <summary> /// Checks whether the given <see cref="GreatCircleSegment"/> intersects with this one. /// The point of intersection can then be found in the out-Parameter. /// </summary> /// <param name="other">The arc segment to be checked.</param> /// <param name="intersection">The point of intersection, if they intersect.</param> /// <returns>Whether the two <see cref="GreatCircleSegment"/>s intersect or not.</returns> public bool Intersects(GreatCircleSegment other, out SphereCoordinate intersection) { // http://www.boeing-727.com/Data/fly%20odds/distance.html intersection = default(SphereCoordinate); if (Length.IsAlmostEqualTo(0) || other.Length.IsAlmostEqualTo(0)) { return(false); } CartesianVector possibleIntersection1; if (!BaseCircle.Intersects(other.BaseCircle, out possibleIntersection1)) { return(false); } var possibleIntersection2 = -possibleIntersection1; if (IsOnArc(possibleIntersection1) && other.IsOnArc(possibleIntersection1)) { intersection = possibleIntersection1; return(true); } if (IsOnArc(possibleIntersection2) && other.IsOnArc(possibleIntersection2)) { intersection = possibleIntersection2; return(true); } return(false); }
/// <summary> /// Checks whether the given <see cref="GreatCircleSegment"/> intersects with this one. /// The point of intersection can then be found in the out-Parameter. /// </summary> /// <param name="other">The arc segment to be checked.</param> /// <param name="intersection">The point of intersection, if they intersect.</param> /// <returns>Whether the two <see cref="GreatCircleSegment"/>s intersect or not.</returns> public bool Intersects(GreatCircleSegment other, out SphereCoordinate intersection) { // http://www.boeing-727.com/Data/fly%20odds/distance.html intersection = default(SphereCoordinate); if (Length.IsAlmostEqualTo(0) || other.Length.IsAlmostEqualTo(0)) return false; CartesianVector possibleIntersection1; if (!BaseCircle.Intersects(other.BaseCircle, out possibleIntersection1)) return false; var possibleIntersection2 = -possibleIntersection1; if (IsOnArc(possibleIntersection1) && other.IsOnArc(possibleIntersection1)) { intersection = possibleIntersection1; return true; } if (IsOnArc(possibleIntersection2) && other.IsOnArc(possibleIntersection2)) { intersection = possibleIntersection2; return true; } return false; }
/// <summary> /// Checks whether the given <see cref="GreatCircleSegment"/> intersects with this <see cref="GreatCicle"/>. /// The point of intersection can then be found in the out-Parameter. /// </summary> /// <param name="arc">The arc segment to be checked.</param> /// <param name="intersection">The point of intersection, if they intersect.</param> /// <returns>Whether the <see cref="GreatCircleSegment"/> intersects this <see cref="GreatCircle"/> or not.</returns> public bool Intersects(GreatCircleSegment arc, out SphereCoordinate intersection) { intersection = default(SphereCoordinate); CartesianVector possibleIntersection; if (!Intersects(arc.BaseCircle, out possibleIntersection)) return false; if (arc.IsOnArc(possibleIntersection)) { intersection = possibleIntersection; return true; } if (arc.IsOnArc(-possibleIntersection)) { intersection = -possibleIntersection; return true; } return false; }