Ejemplo n.º 1
0
        // clockwise detection: https://stackoverflow.com/questions/1165647/how-to-determine-if-a-list-of-polygon-points-are-in-clockwise-order

        private void addPathPoints(SvgParser.SvgPath path)
        {
            pathPoints = new List <Vector2f>(path.npts);
            float    shoeLaceSum = 0f;
            Vector2f v, vNext;

            for (int i = 0; i < path.npts; ++i)
            {
                v            = PathToVector.PointAt(path, i);
                vNext        = PathToVector.PointAt(path, (i + 1) % path.npts);
                shoeLaceSum += (vNext.x - v.x) * (vNext.y + v.y);
                pathPoints.Add(v);
                average += v;
            }
            area = Math.Abs(shoeLaceSum) / 2f;
            isClockwiseOrdered = (shoeLaceSum > 0f) != isYAxisInverted;
            average           /= path.npts;
        }
Ejemplo n.º 2
0
 public void display(SvgParser.SvgPath path)
 {
     displayPoints(PathToVector.GetPointList(path));
 }