示例#1
0
        /// <summary>
        /// Get the point on the arc closest to the specified angle, described
        /// as a parameter value from 0-1.  This may be a point on the arc (if the
        /// angle lies within the necessary range) or it may be the start or end
        /// of the arc if the angle lies outside that range.
        /// </summary>
        /// <param name="angle">The angle on the arc's circle</param>
        /// <returns></returns>
        public double ClosestArcParameter(Angle angle)
        {
            Angle toStart          = Circle.Azimuth(Vertices.First().Position);
            Angle radMeasure       = RadianMeasure;
            Angle toPointFromStart = (angle - toStart).ToSign(radMeasure.Sign());

            if (toPointFromStart.Abs() <= radMeasure.Abs())
            {
                return(toPointFromStart / radMeasure);
            }
            else if (toPointFromStart.Abs() < radMeasure.Abs() + radMeasure.Explement().Abs() / 2)
            {
                return(1); // Closest to end
            }
            else
            {
                return(0); // Closest to start
            }
        }
示例#2
0
        /// <summary>
        /// Is the specified point within the specified subset of the
        /// angle range of this arc's sector?
        /// </summary>
        /// <param name="point"></param>
        /// <param name="arcBounds">The </param>
        /// <returns></returns>
        public bool IsInAngleRange(Vector point, Interval arcBounds)
        {
            Angle angle            = Circle.Azimuth(point);
            Angle toStart          = Circle.Azimuth(PointAt(arcBounds.Start));
            Angle radMeasure       = RadianMeasure * arcBounds.Size;
            Angle toPointFromStart = (angle - toStart).ToSign(radMeasure.Sign());

            if (toPointFromStart.Abs() <= radMeasure.Abs())
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
示例#3
0
        /// <summary>
        /// Is the specified point within the angle range of this arc's sector?
        /// </summary>
        /// <param name="point"></param>
        /// <returns></returns>
        public bool IsInAngleRange(Vector point)
        {
            Angle angle            = Circle.Azimuth(point);
            Angle toStart          = Circle.Azimuth(Vertices.First().Position);
            Angle radMeasure       = RadianMeasure;
            Angle toPointFromStart = (angle - toStart).ToSign(radMeasure.Sign());

            if (toPointFromStart.Abs() <= radMeasure.Abs())
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }