public static List <PlanarSurface> PlanarSurface(List <ICurve> boundaryCurves, double tolerance = Tolerance.Distance) { if (boundaryCurves == null || boundaryCurves.Where(x => x != null).Count() == 0) { BH.Engine.Reflection.Compute.RecordError("Cannot create planar surface from null curves."); return(null); } List <ICurve> checkedCurves = boundaryCurves.Where(x => x.IIsClosed(tolerance) && x.IIsPlanar(tolerance)).ToList(); List <List <ICurve> > distributed = Compute.DistributeOutlines(checkedCurves, tolerance); List <PlanarSurface> surfaces = new List <PlanarSurface>(); for (int i = 0; i < distributed.Count; i++) { PlanarSurface srf = new PlanarSurface( distributed[i][0], distributed[i].Skip(1).ToList() ); surfaces.Add(srf); } return(surfaces); }
public static List <PlanarSurface> PlanarSurface(List <ICurve> boundaryCurves) { List <ICurve> checkedCurves = boundaryCurves.Where(x => x.IIsClosed() && x.IIsPlanar()).ToList(); List <List <ICurve> > distributed = Compute.DistributeOutlines(checkedCurves); List <PlanarSurface> surfaces = new List <PlanarSurface>(); for (int i = 0; i < distributed.Count; i++) { PlanarSurface srf = new PlanarSurface( distributed[i][0], distributed[i].Skip(1).ToList() ); surfaces.Add(srf); } return(surfaces); }