コード例 #1
0
ファイル: Sector.cs プロジェクト: wcatykid/GeoShader
        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);
        }
コード例 #2
0
ファイル: Sector.cs プロジェクト: wcatykid/GeoShader
        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));
        }