public void BuildFromGrid2(ICartGridData pointStripList) { int minStripLen = GetMinStripLength(pointStripList); int id = 0; IPlyVertex[,] vertexGrid = new PlyVertex[pointStripList.Count, minStripLen]; for (int i = 0; i < pointStripList.Count; i++) { for (int j = 0; j < minStripLen; j++) { vertexGrid[i, j] = new PlyVertex(pointStripList[i][j], id++); Vertices.Add(vertexGrid[i, j]); } } for (int i = 0; i < pointStripList.Count - 1; i++) { for (int j = 0; j < minStripLen - 1; j++) { var indices1 = new List <int>() { vertexGrid[i, j].ID, vertexGrid[i, j + 1].ID, vertexGrid[i + 1, j].ID }; Faces.Add(new PlyFace(indices1)); var indices2 = new List <int>() { vertexGrid[i, j + 1].ID, vertexGrid[i + 1, j + 1].ID, vertexGrid[i + 1, j].ID }; Faces.Add(new PlyFace(indices2)); } } }
//public List<Triangle> AsTriList() //{ // List<Triangle> tris = new List<Triangle>(); // uint index = 0; // foreach (PlyFace face in Faces) // { // if (face.Indices.Count == 3) // { // tris.Add(new Triangle(Vertices[face.Indices[0]],Vertices[face.Indices[1]],Vertices[face.Indices[2]],Vertices[face.Indices[0]].Normal,index++)); // } // if (face.Indices.Count == 4) // { // tris.Add(new Triangle(Vertices[face.Indices[0]],Vertices[face.Indices[1]],Vertices[face.Indices[2]],Vertices[face.Indices[0]].Normal,index++)); // tris.Add(new Triangle(Vertices[face.Indices[2]], Vertices[face.Indices[3]],Vertices[face.Indices[0]],Vertices[face.Indices[2]].Normal,index++)); // } // } // return tris; //} private int GetMinStripLength(ICartGridData pointStripList) { int minStripLen = int.MaxValue; foreach (var strip in pointStripList) { if (strip.Count < minStripLen) { minStripLen = strip.Count; } } return(minStripLen); }
public void BuildModel(ref Model3DGroup modelgroup, ICartGridData data, double minToleranceValue, double maxToleranceValue, double scalingFactor, COLORCODE colorCode) { try { maxArraySize = 1000000; model_group = modelgroup; this.maxToleranceValue = maxToleranceValue; System.Diagnostics.Stopwatch sw = new System.Diagnostics.Stopwatch(); sw.Start(); DefineLights(); var mapBuilder = new CartMapBuilder(data, scalingFactor); mapBuilder.CreateAltitudeMap(minToleranceValue * scalingFactor, maxToleranceValue * scalingFactor, colorCode); SetMapValues(mapBuilder); model_group.Children.Add(mapBuilder.DefineModel()); } catch (Exception) { throw; } }
public CartGridDataEnumerator(CartGridData collection) { _collection = collection; curIndex = -1; currentItem = default; }