Пример #1
0
        public double Area()
        {
            double accum = 0;

            //returns the area of this polygon.
            //calculate each triangle...
            for (int i = 0; i < points.Count - 1; i += 2)
            {
                //item i and i+1, and the center, form the triangle.
                PointF firstpoint  = points[i];
                PointF secondpoint = points[i + 1];
                PointF midspot     = TrigFunctions.MidPoint(firstpoint, secondpoint);
                double H           = TrigFunctions.Distance(Center, midspot);
                //width is distance between the two points.
                double W = TrigFunctions.Distance(firstpoint, secondpoint);
                accum += (W * H) / 2;
            }

            return((float)accum);
        }
Пример #2
0
 public override PointF PerformFrame(IStateOwner gstate, PointF CurrentLocation)
 {
     //return new PointF(CurrentLocation.X + _Delta.X, CurrentLocation.Y + _Delta.Y);
     TrigFunctions.IncrementLocation(gstate, ref CurrentLocation, _Delta);
     return(CurrentLocation);
 }
Пример #3
0
        //returns an array representing the distances of each point from the center point of this polygon.
        public float[] Radii()
        {
            PointF CenterP = Center;

            return((from m in points select TrigFunctions.Distance(CenterP, m)).ToArray());
        }