コード例 #1
0
        public Polygon2d iterative_offset(GeneralPolygon2d poly, double fDist, int nSteps)
        {
            int    N        = poly.Outer.VertexCount;
            double max_step = fDist / nSteps;

            Polygon2d cur = new Polygon2d(poly.Outer);

            for (int i = 0; i < N; ++i)
            {
                Vector2d n = cur.GetTangent(i).Perp;
                cur[i] = cur[i] + max_step * n;
            }

            return(cur);
        }