示例#1
0
        public List <Coord3d> getDecimatedVertices(double dstep)
        {
            List <Coord3d> steps   = new List <Coord3d>();
            int            num     = vertices.Count;
            int            i       = 0;
            double         segLen  = 0;
            Coord3d        a       = default(Coord3d);
            Coord3d        dir     = default(Coord3d);
            Coord3d        stepDir = default(Coord3d);
            Coord3d        b       = vertices[0];
            Coord3d        curr    = b.Clone();

            while (i < num - 1)
            {
                a       = b;
                b       = vertices[i + 1];
                dir     = b.substract(a);
                segLen  = 1 / dir.magSquared();
                stepDir = dir.normalizeTo(dstep);
                curr    = a.interpolateTo(b, curr.substract(a).dot(dir) * segLen);
                while (curr.substract(a).dot(dir) / segLen <= 1)
                {
                    steps.Add(curr.Clone());
                    curr.addSelf(stepDir);
                }
                i += 1;
            }
            return(steps);
        }
示例#2
0
 /// <summary>
 /// Add a point to the polygon
 /// </summary>
 /// <param name="point">Point to add</param>
 public void Add(Point point)
 {
     _points.Add(point);
     _bbox.@add(point);
     // Recompute Center
     _center = new Coord3d();
     foreach (Point p in _points)
     {
         _center.addSelf(p.xyz);
     }
     _center.divideSelf(_points.Count);
 }