예제 #1
0
        public override bool CanAreaBeComputed(Area_Based_Analyses.KnownMeasurementsAggregator known)
        {
            // Central Angle
            if (known.GetAngleMeasure(this.theArc.GetCentralAngle()) < 0) return false;

            // Radius / Circle
            return theArc.theCircle.CanAreaBeComputed(known);
        }
예제 #2
0
        //
        // Given known values, can the third side be determined: isosceles right triangle (with base known)
        //
        public List<KeyValuePair<Segment, double>> CalculateBaseOfIsosceles(Area_Based_Analyses.KnownMeasurementsAggregator known)
        {
            List<KeyValuePair<Segment, double>> pairs = new List<KeyValuePair<Segment, double>>();

            if (!this.provenIsosceles || !(this is IsoscelesTriangle)) return pairs;

            //
            // Make an isosceles triangle to acquire segments.
            //
            IsoscelesTriangle isoTri = new IsoscelesTriangle(this);
            Segment baseSeg = isoTri.baseSegment;

            double baseVal = known.GetSegmentLength(baseSeg);
            if (baseVal > 0) return pairs;

            //
            // Get the other sides.
            //
            Segment otherSide1, otherSide2;
            isoTri.GetOtherSides(baseSeg, out otherSide1, out otherSide2);

            // If we know 1 we should know the other, check anyway
            double otherVal1 = known.GetSegmentLength(otherSide1);
            double otherVal2 = known.GetSegmentLength(otherSide2);

            if (otherVal1 < 0 && otherVal2 < 0) return pairs;

            //
            // Get the base angle.
            //
            double baseAngleVal = known.GetAngleMeasure(isoTri.baseAngleOppositeLeg1);
            if (baseAngleVal < 0) baseAngleVal = known.GetAngleMeasure(isoTri.baseAngleOppositeLeg2);

            if (baseAngleVal < 0) return pairs;

            //
            // Compute the value of the base
            //
            double baseSideVal = 2.0 * otherVal1 * Math.Cos(Angle.toRadians(baseAngleVal));

            pairs.Add(new KeyValuePair<Segment, double>(baseSeg, baseSideVal));

            return pairs;
        }
예제 #3
0
        // Does the included Trig Formula apply?
        private double TrigArea(Area_Based_Analyses.KnownMeasurementsAggregator known)
        {
            for (int s = 0; s < orderedSides.Count; s++)
            {
                double a = known.GetSegmentLength(orderedSides[s]);
                double b = known.GetSegmentLength(orderedSides[(s+1) % orderedSides.Count]);

                double theta = known.GetAngleMeasure(new Angle(orderedSides[s], orderedSides[(s+1) % orderedSides.Count]));

                if (a > 0 && b > 0 && theta > 0)
                {
                    return TrigArea(a, b, theta);
                }
            }

            return -1;
        }
예제 #4
0
        public List<KeyValuePair<Segment, double>> RightTriangleTrigApplies(Area_Based_Analyses.KnownMeasurementsAggregator known)
        {
            List<KeyValuePair<Segment, double>> pairs = new List<KeyValuePair<Segment, double>>();

            if (!(this is RightTriangle) && !this.provenRight) return pairs;

            //
            // Make a right
            //
            RightTriangle rightTri = new RightTriangle(this);
            Angle otherAngle1, otherAngle2;
            Angle rightAngle = rightTri.rightAngle;
            rightTri.GetOtherAngles(rightAngle, out otherAngle1, out otherAngle2);

            double angleMeasure1 = known.GetAngleMeasure(otherAngle1);
            double angleMeasure2 = known.GetAngleMeasure(otherAngle2);

            // Need to know one side length
            if (angleMeasure1 < 0 && angleMeasure2 < 0) return pairs;

            double knownSegVal = -1;
            Segment knownSeg = null;
            foreach (Segment side in orderedSides)
            {
                knownSegVal = known.GetSegmentLength(side);
                if (knownSegVal > 0)
                {
                    knownSeg = side;
                    break;
                }
            }

            // Need to know one side length
            if (knownSegVal < 0) return pairs;

            // Need at least one measure.
            if (angleMeasure1 > 0) return CalcSides(rightTri, rightAngle, otherAngle1, angleMeasure1, knownSeg, knownSegVal);
            if (angleMeasure2 > 0) return CalcSides(rightTri, rightAngle, otherAngle2, angleMeasure2, knownSeg, knownSegVal);

            return pairs;
        }
예제 #5
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;
        }