public static PolyLoop[] makePolyLoopArray(int size) { PolyLoop[] retarr = new PolyLoop[size]; for(int i = 0; i<size; i++) { PolyLoop pl = new PolyLoop(); retarr[i] = pl; } return retarr; }
//receives a polyloop and a list of points. //the polyloop is returned filled with cartesian points //can only create a polyloop with 100 coordinates at the most public static PolyLoop makePolyLoopsFromDbleList(PolyLoop pg, List<List<double>> pointslist) { pg.Points = new CartesianPoint[pointslist.Count()]; //culturally invariant by default int listcount = 0; foreach (List<double> ofpoints in pointslist) { //we assume that each set ofpoints has three coordinate //the first is an x coordinate, second is y, third is z //there will only be three doubles CartesianPoint pt = new CartesianPoint(); pt.Coordinate = new string[3]; CultureInfo ci = new CultureInfo(String.Empty); string xformat = string.Format(ci, "{0:0.000000}", ofpoints[0]); string yformat = string.Format(ci, "{0:0.000000}", ofpoints[1]); string zformat = string.Format(ci, "{0:0.000000}", ofpoints[2]); pt.Coordinate[0] = xformat; pt.Coordinate[1] = yformat; pt.Coordinate[2] = zformat; pg.Points[listcount] = pt; listcount++; } return pg; }
public static PlanarGeometry makegbPlanarGeom(List<List<Vector.MemorySafe_CartCoord>> coordinates) { PlanarGeometry pg = new PlanarGeometry(); PolyLoop pl = new PolyLoop(); pg.PolyLoop = pl; for (int i = 0; i < coordinates.Count(); i++) { //the polyloop array of points is defined pl.Points = new CartesianPoint[coordinates[i].Count()]; for (int j = 0; j < coordinates[i].Count(); j++) { //returns a point with three coordinate strings CartesianPoint cp = makegbCartesianPt(coordinates[i][j]); //the point is added to the polyloop pl.Points[j] = cp; } } return pg; }