Esempio n. 1
0
        public static CSG hull(CSG csg, PropertyStorage storage)
        {
            List <IVector3d> points = new List <IVector3d>(csg.getPolygons().Count * 3);

            csg.getPolygons().ForEach(p => p.vertices.ForEach(v => points.Add(v.pos)));

            return(hull(points, storage));
        }
Esempio n. 2
0
        public static List <Polygon> boundaryPolygons(CSG csg)
        {
            List <Polygon> result = new List <Polygon>();

            foreach (List <Polygon> polygonGroup in searchPlaneGroups(csg.getPolygons()))
            {
                result.AddRange(boundaryPolygonsOfPlaneGroup(polygonGroup));
            }

            return(result);
        }
Esempio n. 3
0
 /// <summary>
 /// Saves the specified csg using STL ASCII format.
 /// </summary>
 /// <param name="path">destination path</param>
 /// <param name="csg">csg to save</param>
 /// <exception cref="IOException"></exception>
 ///
 public static void toStlFile(string p, CSG csg)
 {
     using (var file = File.Open(p, FileMode.Create | FileMode.Truncate))
     {
         using (var writer = new StreamWriter(file, Encoding.UTF8))
         {
             writer.Write("solid v3d.csg\n");
             csg.getPolygons().ForEach(poly => writer.Write(poly.toStlString()));
             writer.Write("endsolid v3d.csg\n");
         }
     }
 }