Exemplo n.º 1
0
 /// <summary>
 /// Calculates the percentage of the shape the players have to fill that is filled by their shadow.
 /// </summary>
 /// <param name="shapeToFill">The shape players have to fill.</param>
 /// <param name="peoplesShadows">The players' overall shadow.</param>
 /// <returns>The percentage of the shape that is filled by the players' overall shadow.</returns>
 public float FilledPercentageFromGeometries(Geometry shapeToFill, Geometry peoplesShadows)
 {
     double maximumArea = shapeToFill.GetArea();
     double filledArea = Geometry.Combine(shapeToFill, peoplesShadows, GeometryCombineMode.Intersect, null).GetArea();
     double percentage = 100 * filledArea / maximumArea;
     percentage = Math.Round(percentage*1.5, 2);
     return percentage > 100 ? 100 : (float)percentage;
 }
    GetArea
    (
        Geometry oGeometry
    )
    {
        Debug.Assert(oGeometry != null);
        AssertValid();

        // Using the simeple Geometry.GetArea() overload leads to rounding
        // errors when used on circular vertices.  Use the other overload that
        // allows a tolerance to be specified.

        return ( oGeometry.GetArea(0.000001, ToleranceType.Relative) );
    }