Ejemplo n.º 1
0
        /// <summary>
        /// Coordinates of where a perpendicular projection intersects the provided coordinate.
        /// The first coordinate is of the closer intersection.
        /// Returns infinity if the point is coincident with the circular curve center.
        /// </summary>
        /// <param name="point">The point.</param>
        /// <param name="referenceArc">The line to which a perpendicular projection is drawn.</param>
        /// <returns>CartesianCoordinate.</returns>
        /// <exception cref="NotImplementedException"></exception>
        public static Tuple <CartesianCoordinate, CartesianCoordinate> CoordinatesOfPerpendicularProjection(CartesianCoordinate point, CircularCurve referenceArc)
        {
            if (point == referenceArc.Center)
            {
                return(new Tuple <CartesianCoordinate, CartesianCoordinate>(
                           new CartesianCoordinate(double.PositiveInfinity, double.PositiveInfinity),
                           new CartesianCoordinate(double.PositiveInfinity, double.PositiveInfinity)
                           ));
            }

            LinearCurve ray = new LinearCurve(referenceArc.Center, point);

            CartesianCoordinate[] intersectionCoordinates = referenceArc.IntersectionCoordinate(ray);

            double distance1 = CartesianOffset.Separation(point, intersectionCoordinates[0]);
            double distance2 = CartesianOffset.Separation(point, intersectionCoordinates[1]);
            CartesianCoordinate intersectionClose = (distance1 < distance2) ? intersectionCoordinates[0] : intersectionCoordinates[1];
            CartesianCoordinate intersectionFar   = (distance1 < distance2) ? intersectionCoordinates[1] : intersectionCoordinates[0];

            return(new Tuple <CartesianCoordinate, CartesianCoordinate>(intersectionClose, intersectionFar));
        }
 /// <summary>
 /// The length of the chord connecting the start and end limits.
 /// </summary>
 /// <param name="relativePositionStart">Relative position along the path at which the length measurement is started.</param>
 /// <param name="relativePositionEnd">Relative position along the path at which the length measurement is ended.</param>
 /// <returns>System.Double.</returns>
 public override double ChordLengthBetween(double relativePositionStart, double relativePositionEnd)
 {
     return(LinearCurve.Length(CoordinateCartesian(relativePositionStart), CoordinateCartesian(relativePositionEnd)));
 }
 /// <summary>
 /// The length of the chord connecting the start and end limits.
 /// </summary>
 /// <returns>System.Double.</returns>
 public override double ChordLength()
 {
     return(LinearCurve.Length(Range.Start.Limit, Range.End.Limit));
 }
Ejemplo n.º 4
0
 /// <summary>
 /// Returns points where the circular curve intersects the provided linear curve.
 /// </summary>
 /// <param name="otherLine">Linear curve that intersects the current linear curve.</param>
 /// <returns>CartesianCoordinate.</returns>
 public CartesianCoordinate[] IntersectionCoordinate(LinearCurve otherLine)
 {
     return(IntersectionLinearCircular.IntersectionCoordinates(otherLine, this));
 }