Exemple #1
0
        private void GetStartEndPoints(double angle1, double angle2, out Point start, out Point end, out double angle)
        {
            start = null;
            end   = null;
            angle = -1;

            if (angle2 - angle1 > 0 && angle2 - angle1 < Angle.toRadians(180))
            {
                start = endpoint1;
                end   = endpoint2;
                angle = angle1;
            }
            else if (angle1 - angle2 > 0 && angle1 - angle2 < Angle.toRadians(180))
            {
                start = endpoint2;
                end   = endpoint1;
                angle = angle2;
            }
            else if (angle2 - angle1 > 0 && angle2 - angle1 >= Angle.toRadians(180))
            {
                start = endpoint2;
                end   = endpoint1;
                angle = angle2;
            }
            else if (angle1 - angle2 > 0 && angle1 - angle2 >= Angle.toRadians(180))
            {
                start = endpoint1;
                end   = endpoint2;
                angle = angle1;
            }
        }
Exemple #2
0
        public override double GetArea(Area_Based_Analyses.KnownMeasurementsAggregator known)
        {
            if (theArc is Semicircle)
            {
                return((theArc as Semicircle).GetArea(known));
            }

            // Central Angle; this is minor arc measure by default
            double angleMeasure = Angle.toRadians(known.GetAngleMeasure(this.theArc.GetCentralAngle()));

            if (angleMeasure <= 0)
            {
                return(-1);
            }

            // Make a major arc measure, if needed.
            if (theArc is MajorArc)
            {
                angleMeasure = 2 * Math.PI - angleMeasure;
            }

            // Radius / Circle
            double circArea = theArc.theCircle.GetArea(known);

            if (circArea <= 0)
            {
                return(-1);
            }

            // The area is a proportion of the circle defined by the angle.
            return((angleMeasure / (2 * Math.PI)) * circArea);
        }
Exemple #3
0
        //
        // Add the 16-point unit circle to the set of snapping points
        //
        private void Construct16PointSnapPoints()
        {
            // Add all points to the unit circle
            foreach (int angle in ANGLE_MEASURES)
            {
                double x = this.radius * Math.Cos(Angle.toRadians(angle));
                double y = this.radius * Math.Sin(Angle.toRadians(angle));

                allComposingPoints.Add(new Point(angle.ToString() + "^o", x, y));
            }
        }
Exemple #4
0
        public override List <Segment> Segmentize()
        {
            if (approxSegments.Any())
            {
                return(approxSegments);
            }

            // How much we will change the angle measure as we create segments.
            double angleIncrement = Angle.toRadians(this.minorMeasure / Figure.NUM_SEGS_TO_APPROX_ARC);

            // Find the first point so we sweep in a counter-clockwise manner.
            double angle1 = Point.GetRadianStandardAngleWithCenter(theCircle.center, endpoint1);
            double angle2 = Point.GetRadianStandardAngleWithCenter(theCircle.center, endpoint2);

            Point  firstPoint  = null;
            Point  secondPoint = null;
            double angle       = -1;

            GetStartEndPoints(angle1, angle2, out firstPoint, out secondPoint, out angle);

            for (int i = 1; i <= Figure.NUM_SEGS_TO_APPROX_ARC; i++)
            {
                // Save this as an approximating point.
                approxPoints.Add(firstPoint);

                // Get the next point.
                angle      += angleIncrement;
                secondPoint = Point.GetPointFromAngle(theCircle.center, theCircle.radius, angle);

                // Make the segment.
                approxSegments.Add(new Segment(firstPoint, secondPoint));

                // Rotate points.
                firstPoint = secondPoint;
            }

            // Save this as an approximating point.
            approxPoints.Add(secondPoint);

            return(approxSegments);
        }
Exemple #5
0
 public double GetMajorArcMeasureRadians()
 {
     return(Angle.toRadians(GetMajorArcMeasureDegrees()));
 }
Exemple #6
0
 private double CalculateArcMinorMeasureRadians()
 {
     return(Angle.toRadians(new Angle(new Segment(theCircle.center, endpoint1), new Segment(theCircle.center, endpoint2)).measure));
 }
Exemple #7
0
 public static Point GetPointByLengthAndAngleInThirdQuadrant(int length, int measure)
 {
     return(new Point("", length * Math.Cos(Angle.toRadians(180 - measure)), length * Math.Sin(Angle.toRadians(180 - measure))));
 }
Exemple #8
0
        //
        //
        // Random number Generation (end)
        //
        //

        public static Point GetPointByLengthAndAngleInStandardPosition(int length, double measure)
        {
            return(new Point("", length * Math.Cos(Angle.toRadians(measure)), length * Math.Sin(Angle.toRadians(measure))));
        }