public override MeshBase CreateMesh(GridderSource source) { PointGridderSource src = (PointGridderSource)source; vec3 minvec3 = new vec3(); vec3 maxvec3 = new vec3(); bool isSet = false; PointPositionBuffer positions = new PointPositionBuffer(); PointRadiusBuffer radiusBuffer = null; int dimSize = src.DimenSize; Random random = new Random(); // setup positions unsafe { positions.AllocMem(dimSize); var cells = (vec3*)positions.Data; for (int gridIndex = 0; gridIndex < dimSize; gridIndex++) { vec3 p = src.TranslateMatrix * src.Positions[gridIndex]; cells[gridIndex] = p; } } radiusBuffer = this.CreateRadiusBufferData(src, src.Radius); PointMeshGeometry3D mesh = new PointMeshGeometry3D(positions, radiusBuffer, dimSize); mesh.Max = src.TransformedActiveBounds.Max; mesh.Min = src.TransformedActiveBounds.Min; return mesh; }
public override MeshBase CreateMesh(GridderSource source) { PointGridderSource src = (PointGridderSource)source; vec3 minvec3 = new vec3(); vec3 maxvec3 = new vec3(); bool isSet = false; PointPositionBuffer positions = new PointPositionBuffer(); PointRadiusBuffer radiusBuffer = null; int dimSize = src.DimenSize; Random random = new Random(); // setup positions unsafe { positions.AllocMem(dimSize); var cells = (vec3 *)positions.Data; for (int gridIndex = 0; gridIndex < dimSize; gridIndex++) { vec3 p = src.TranslateMatrix * src.Positions[gridIndex]; cells[gridIndex] = p; } } radiusBuffer = this.CreateRadiusBufferData(src, src.Radius); PointMeshGeometry3D mesh = new PointMeshGeometry3D(positions, radiusBuffer, dimSize); mesh.Max = src.TransformedActiveBounds.Max; mesh.Min = src.TransformedActiveBounds.Min; return(mesh); }
public override MeshBase CreateMesh(GridderSource source) { PointGridderSource src = (PointGridderSource)source; PointPositionBuffer positions = new PointPositionBuffer(); PointRadiusBuffer radiusBuffer = null; int dimSize = src.DimenSize; // setup positions unsafe { positions.AllocMem(dimSize); Vertex *cells = (Vertex *)positions.Data; for (int gridIndex = 0; gridIndex < dimSize; gridIndex++) { Vertex p = src.Transform * src.Positions[gridIndex]; cells[gridIndex] = p; } } radiusBuffer = this.CreateRadiusBufferData(src, src.Radius); PointMeshGeometry3D mesh = new PointMeshGeometry3D(positions, radiusBuffer, dimSize); mesh.Max = src.TransformedActiveBounds.Max; mesh.Min = src.TransformedActiveBounds.Min; return(mesh); }
public override TexCoordBuffer CreateTextureCoordinates(GridderSource source, int[] gridIndexes, float[] values, float minValue, float maxValue) { PointGridderSource src = (PointGridderSource)source; int[] visibles = src.BindResultsVisibles(gridIndexes); int dimenSize = src.DimenSize; float[] textures = src.GetInvisibleTextureCoords(); float distance = Math.Abs(maxValue - minValue); for (int i = 0; i < gridIndexes.Length; i++) { int gridIndex = gridIndexes[i]; if (visibles[gridIndex] > 0) { float value = values[i]; if (value < minValue) { value = minValue; } if (value > maxValue) { value = maxValue; } if (!(distance <= 0.0f)) { textures[gridIndex] = (value - minValue) / distance; if (textures[gridIndex] < 0.5f) { textures[gridIndex] = 0.5f - (0.5f - textures[gridIndex]) * 0.99f; } else { textures[gridIndex] = (textures[gridIndex] - 0.5f) * 0.99f + 0.5f; } } else { //最小值最大值相等时,显示最小值的颜色 textures[gridIndex] = 0.01f; //textures[gridIndex] = 0; } } } PointTexCoordBuffer coordBuffer = new PointTexCoordBuffer(); unsafe { coordBuffer.AllocMem(src.DimenSize); float *coords = (float *)coordBuffer.Data; for (int gridIndex = 0; gridIndex < dimenSize; gridIndex++) { coords[gridIndex] = textures[gridIndex]; } } return(coordBuffer); }
public override TexCoordBuffer CreateTextureCoordinates(GridderSource source, int[] gridIndexes, float[] values, float minValue, float maxValue) { HexahedronGridderSource src = (HexahedronGridderSource)source; int[] resultsVisibles = src.ExpandVisibles(gridIndexes); int[] bindVisibles = src.BindCellActive(src.BindVisibles, resultsVisibles); int dimenSize = src.DimenSize; float[] textures = src.GetInvisibleTextureCoords(); float distance = Math.Abs(maxValue - minValue); for (int i = 0; i < gridIndexes.Length; i++) { int gridIndex = gridIndexes[i]; float value = values[i]; if (value < minValue){ value = minValue; bindVisibles[gridIndex] = 0; } if (value > maxValue){ value = maxValue; bindVisibles[gridIndex] = 0; } if (bindVisibles[gridIndex] > 0) { if (!(distance <= 0.0f)) { textures[gridIndex] = (value - minValue) / distance; if (textures[gridIndex] < 0.5f) { textures[gridIndex] = 0.5f - (0.5f - textures[gridIndex]) * 0.99f; } else { textures[gridIndex] = (textures[gridIndex] - 0.5f) * 0.99f + 0.5f; } } else { //最小值最大值相等时,显示最小值的颜色 //textures[gridIndex] = 0.01f; textures[gridIndex] = 0.01f; } } } HexahedronTexCoordBuffer coordBuffer = new HexahedronTexCoordBuffer(); unsafe { int gridCellCount = src.DimenSize; coordBuffer.AllocMem(gridCellCount); HexahedronTexCoord* coords = (HexahedronTexCoord*)coordBuffer.Data; for (int gridIndex = 0; gridIndex < dimenSize; gridIndex++) { coords[gridIndex].SetCoord(textures[gridIndex]); } } return coordBuffer; }
public override TexCoordBuffer CreateTextureCoordinates(GridderSource source, int[] gridIndexes, float[] values, float minValue, float maxValue) { PointGridderSource src = (PointGridderSource)source; int[] visibles = src.BindResultsVisibles(gridIndexes); int dimenSize = src.DimenSize; float[] textures = src.GetInvisibleTextureCoords(); float distance = Math.Abs(maxValue - minValue); for (int i = 0; i < gridIndexes.Length; i++) { int gridIndex = gridIndexes[i]; if (visibles[gridIndex] > 0) { float value = values[i]; if (value < minValue) value = minValue; if (value > maxValue) value = maxValue; if (!(distance <= 0.0f)) { textures[gridIndex] = (value - minValue) / distance; if (textures[gridIndex] < 0.5f) { textures[gridIndex] = 0.5f - (0.5f - textures[gridIndex]) * 0.99f; } else { textures[gridIndex] = (textures[gridIndex] - 0.5f) * 0.99f + 0.5f; } } else { //最小值最大值相等时,显示最小值的颜色 textures[gridIndex] = 0.01f; //textures[gridIndex] = 0; } } } PointTexCoordBuffer coordBuffer = new PointTexCoordBuffer(); unsafe { coordBuffer.AllocMem(src.DimenSize); float* coords = (float*)coordBuffer.Data; for (int gridIndex = 0; gridIndex < dimenSize; gridIndex++) { coords[gridIndex] = textures[gridIndex]; } } return coordBuffer; }
private void OnGridPropertyChanged(object sender, EventArgs e) { GridderSource source = this.sim3D.Tag as GridderSource; if (source == null) { return; } List <SimLabGrid> gridders = this.sim3D.Scene.SceneContainer.Traverse <SimLabGrid>().ToList <SimLabGrid>(); if (gridders.Count <= 0) { return; } SimLabGrid grid = gridders[0]; GridProperty prop = this.CurrentProperty; if (prop == null) { return; } float minValue = prop.MinValue; float maxValue = prop.MaxValue; float step = (maxValue - minValue) / 10.0f; if (step <= 0.0f) { step = 1.0f; } this.sim3D.SetColorIndicator(minValue, maxValue, step); TexCoordBuffer textureCoordinates = source.CreateTextureCoordinates(prop.GridIndexes, prop.Values, minValue, maxValue); grid.SetTextureCoods(textureCoordinates); DynamicUnstructureGrid dynamicUnstructureGrid = gridders[0] as DynamicUnstructureGrid; DynamicUnstructuredGridderSource dynamicUnstructureGridderSource = source as DynamicUnstructuredGridderSource; if (dynamicUnstructureGrid != null && dynamicUnstructureGridderSource != null) { TexCoordBuffer anotherTextureCoordinates = dynamicUnstructureGridderSource.CreateFractureTextureCoordinates(prop.GridIndexes, prop.Values, minValue, maxValue); dynamicUnstructureGrid.SetFractionTextureCoords(anotherTextureCoordinates); } this.sim3D.Invalidate(); }
private float GetRadius(GridderSource source) { Rectangle3D rect = source.TransformedActiveBounds; float dx = rect.SizeX; float dy = rect.SizeY; float wellRadius; #region decide the well radius if (dx != dy) { float min = Math.Min(dx, dy); float max = Math.Max(dx, dy); if (min > max * 0.75f) { int n = 30; wellRadius = (min / n) * 0.5f; } else if (min >= max * 0.5f) //长方形的模型 { int n = 20; wellRadius = (min / n) * 0.5f; } else if (min >= (max * 0.25)) { int n = 15; wellRadius = (min / n) * 0.5f; } else if (min >= max * 0.16) { int n = 15; wellRadius = (min / n) * 0.5f; } else { int n = 10; wellRadius = (min / n) * 0.5f; } } else { int n = 40; wellRadius = (dx / n) * 0.5f; } #endregion return(wellRadius); }
public override MeshBase CreateMesh(GridderSource source) { PointGridderSource src = (PointGridderSource)source; Vertex minVertex = new Vertex(); Vertex maxVertex = new Vertex(); bool isSet = false; PointPositionBuffer positions = new PointPositionBuffer(); PointRadiusBuffer radiusBuffer = null; int dimSize = src.DimenSize; Random random = new Random(); // setup positions unsafe { positions.AllocMem(dimSize); Vertex *cells = (Vertex *)positions.Data; for (int gridIndex = 0; gridIndex < dimSize; gridIndex++) { Vertex p = src.Positions[gridIndex]; cells[gridIndex] = p; if (!isSet) { minVertex = p; maxVertex = p; isSet = true; } if (src.IsActiveBlock(gridIndex)) { minVertex = SimLab.SimGrid.helper.VertexHelper.MinVertex(minVertex, p); maxVertex = SimLab.SimGrid.helper.VertexHelper.MaxVertex(maxVertex, p); } } } radiusBuffer = this.CreateRadiusBufferData(src, src.Radius); PointMeshGeometry3D mesh = new PointMeshGeometry3D(positions, radiusBuffer, dimSize); mesh.Max = maxVertex; mesh.Min = minVertex; return(mesh); }
public abstract TexCoordBuffer CreateTextureCoordinates(GridderSource source, int[] gridIndexes, float[] values, float minValue, float maxValue);
/// <summary> /// 通过网格数据源生成 /// </summary> /// <param name="source"></param> /// <returns></returns> public abstract MeshBase CreateMesh(GridderSource source);
public override TexCoordBuffer CreateTextureCoordinates(GridderSource source, int[] gridIndexes, float[] values, float minValue, float maxValue) { HexahedronGridderSource src = (HexahedronGridderSource)source; int[] resultsVisibles = src.ExpandVisibles(gridIndexes); int[] bindVisibles = src.BindVisibles(src.BindVisibles, resultsVisibles); int dimenSize = src.DimenSize; float[] textures = src.GetInvisibleTextureCoords(); float distance = Math.Abs(maxValue - minValue); for (int i = 0; i < gridIndexes.Length; i++) { int gridIndex = gridIndexes[i]; float value = values[i]; if (value < minValue) { value = minValue; bindVisibles[gridIndex] = 0; } if (value > maxValue) { value = maxValue; bindVisibles[gridIndex] = 0; } if (bindVisibles[gridIndex] > 0) { if (!(distance <= 0.0f)) { textures[gridIndex] = (value - minValue) / distance; if (textures[gridIndex] < 0.5f) { textures[gridIndex] = 0.5f - (0.5f - textures[gridIndex]) * 0.99f; } else { textures[gridIndex] = (textures[gridIndex] - 0.5f) * 0.99f + 0.5f; } } else { //最小值最大值相等时,显示最小值的颜色 //textures[gridIndex] = 0.01f; textures[gridIndex] = 0.01f; } } } HexahedronTexCoordBuffer coordBuffer = new HexahedronTexCoordBuffer(); unsafe { int gridCellCount = src.DimenSize; coordBuffer.AllocMem(gridCellCount); HexahedronTexCoord *coords = (HexahedronTexCoord *)coordBuffer.Data; for (int gridIndex = 0; gridIndex < dimenSize; gridIndex++) { coords[gridIndex].SetCoord(textures[gridIndex]); } } return(coordBuffer); }
public override MeshBase CreateMesh(GridderSource source) { HexahedronGridderSource src = (HexahedronGridderSource)source; PositionBuffer positions = new HexahedronPositionBuffer(); HalfHexahedronIndexBuffer halfHexahedronIndices = new HalfHexahedronIndexBuffer(); int dimSize = src.DimenSize; int I, J, K; unsafe { positions.AllocMem(dimSize); HexahedronPosition *cell = (HexahedronPosition *)positions.Data; for (int gridIndex = 0; gridIndex < dimSize; gridIndex++) { src.InvertIJK(gridIndex, out I, out J, out K); cell[gridIndex].FLT = src.Transform * src.PointFLT(I, J, K); cell[gridIndex].FRT = src.Transform * src.PointFRT(I, J, K); cell[gridIndex].BRT = src.Transform * src.PointBRT(I, J, K); cell[gridIndex].BLT = src.Transform * src.PointBLT(I, J, K); cell[gridIndex].FLB = src.Transform * src.PointFLB(I, J, K); cell[gridIndex].FRB = src.Transform * src.PointFRB(I, J, K); cell[gridIndex].BRB = src.Transform * src.PointBRB(I, J, K); cell[gridIndex].BLB = src.Transform * src.PointBLB(I, J, K); } //网格个数*每个六面体的面数*描述每个六面体的三角形个数 int halfHexahedronIndexCount = dimSize * 2; //int memorySizeInBytes = halfHexahedronIndexCount * sizeof(HalfHexahedronIndex); //halfHexahedronIndices.AllocMem(memorySizeInBytes); halfHexahedronIndices.AllocMem(halfHexahedronIndexCount); HalfHexahedronIndex *array = (HalfHexahedronIndex *)halfHexahedronIndices.Data; for (int gridIndex = 0; gridIndex < dimSize; gridIndex++) { array[gridIndex * 2].dot0 = (uint)(8 * gridIndex + 6); array[gridIndex * 2].dot1 = (uint)(8 * gridIndex + 2); array[gridIndex * 2].dot2 = (uint)(8 * gridIndex + 7); array[gridIndex * 2].dot3 = (uint)(8 * gridIndex + 3); array[gridIndex * 2].dot4 = (uint)(8 * gridIndex + 4); array[gridIndex * 2].dot5 = (uint)(8 * gridIndex + 0); array[gridIndex * 2].dot6 = (uint)(8 * gridIndex + 5); array[gridIndex * 2].dot7 = (uint)(8 * gridIndex + 1); array[gridIndex * 2].restartIndex = uint.MaxValue; array[gridIndex * 2 + 1].dot0 = (uint)(8 * gridIndex + 3); array[gridIndex * 2 + 1].dot1 = (uint)(8 * gridIndex + 0); array[gridIndex * 2 + 1].dot2 = (uint)(8 * gridIndex + 2); array[gridIndex * 2 + 1].dot3 = (uint)(8 * gridIndex + 1); array[gridIndex * 2 + 1].dot4 = (uint)(8 * gridIndex + 6); array[gridIndex * 2 + 1].dot5 = (uint)(8 * gridIndex + 5); array[gridIndex * 2 + 1].dot6 = (uint)(8 * gridIndex + 7); array[gridIndex * 2 + 1].dot7 = (uint)(8 * gridIndex + 4); array[gridIndex * 2 + 1].restartIndex = uint.MaxValue; } HexahedronMeshGeometry3D mesh = new HexahedronMeshGeometry3D(positions, halfHexahedronIndices); mesh.Max = source.TransformedActiveBounds.Min; mesh.Min = source.TransformedActiveBounds.Max; return(mesh); } }
public override MeshBase CreateMesh(GridderSource source) { HexahedronGridderSource src = (HexahedronGridderSource)source; PositionBuffer positions = new HexahedronPositionBuffer(); HalfHexahedronIndexBuffer halfHexahedronIndices = new HalfHexahedronIndexBuffer(); int dimSize = src.DimenSize; int I, J, K; unsafe { positions.AllocMem(dimSize); var cell = (HexahedronPosition*)positions.Data; for (int gridIndex = 0; gridIndex < dimSize; gridIndex++) { src.InvertIJK(gridIndex, out I, out J, out K); cell[gridIndex].FLT = src.TranslateMatrix * src.PointFLT(I, J, K); cell[gridIndex].FRT = src.TranslateMatrix * src.PointFRT(I, J, K); cell[gridIndex].BRT = src.TranslateMatrix * src.PointBRT(I, J, K); cell[gridIndex].BLT = src.TranslateMatrix * src.PointBLT(I, J, K); cell[gridIndex].FLB = src.TranslateMatrix * src.PointFLB(I, J, K); cell[gridIndex].FRB = src.TranslateMatrix * src.PointFRB(I, J, K); cell[gridIndex].BRB = src.TranslateMatrix * src.PointBRB(I, J, K); cell[gridIndex].BLB = src.TranslateMatrix * src.PointBLB(I, J, K); } //网格个数*每个六面体的面数*描述每个六面体的三角形个数 int halfHexahedronIndexCount = dimSize * 2; //int memorySizeInBytes = halfHexahedronIndexCount * sizeof(HalfHexahedronIndex); //halfHexahedronIndices.AllocMem(memorySizeInBytes); halfHexahedronIndices.AllocMem(halfHexahedronIndexCount); HalfHexahedronIndex* array = (HalfHexahedronIndex*)halfHexahedronIndices.Data; for (int gridIndex = 0; gridIndex < dimSize; gridIndex++) { array[gridIndex * 2].dot0 = (uint)(8 * gridIndex + 6); array[gridIndex * 2].dot1 = (uint)(8 * gridIndex + 2); array[gridIndex * 2].dot2 = (uint)(8 * gridIndex + 7); array[gridIndex * 2].dot3 = (uint)(8 * gridIndex + 3); array[gridIndex * 2].dot4 = (uint)(8 * gridIndex + 4); array[gridIndex * 2].dot5 = (uint)(8 * gridIndex + 0); array[gridIndex * 2].dot6 = (uint)(8 * gridIndex + 5); array[gridIndex * 2].dot7 = (uint)(8 * gridIndex + 1); array[gridIndex * 2].restartIndex = uint.MaxValue; array[gridIndex * 2 + 1].dot0 = (uint)(8 * gridIndex + 3); array[gridIndex * 2 + 1].dot1 = (uint)(8 * gridIndex + 0); array[gridIndex * 2 + 1].dot2 = (uint)(8 * gridIndex + 2); array[gridIndex * 2 + 1].dot3 = (uint)(8 * gridIndex + 1); array[gridIndex * 2 + 1].dot4 = (uint)(8 * gridIndex + 6); array[gridIndex * 2 + 1].dot5 = (uint)(8 * gridIndex + 5); array[gridIndex * 2 + 1].dot6 = (uint)(8 * gridIndex + 7); array[gridIndex * 2 + 1].dot7 = (uint)(8 * gridIndex + 4); array[gridIndex * 2 + 1].restartIndex = uint.MaxValue; } HexahedronMeshGeometry3D mesh = new HexahedronMeshGeometry3D(positions, halfHexahedronIndices); mesh.Max = source.TransformedActiveBounds.Min; mesh.Min = source.TransformedActiveBounds.Max; return mesh; } }
public Well3DTrajectoryHelper(GridderSource source, IScientificCamera camera, List <WellTrajectory> wells) { this.gridder = source; this.camera = camera; this.wellTrajectoryList = wells; }
// 在VertexHelper里有这两个方法了。 //protected Vertex MinVertex(Vertex min, Vertex value) //{ // if (min.X > value.X) // min.X = value.X; // if (min.Y > value.Y) // min.Y = value.Y; // if (min.Z > value.Z) // min.Z = value.Z; // return min; //} //protected Vertex MaxVertex(Vertex max, Vertex value) //{ // if (max.X < value.X) // max.X = value.X; // if (max.Y < value.Y) // max.Y = value.Y; // if (max.Z < value.Z) // max.Z = value.Z; // return max; //} /// <summary> /// 通过网格数据源生成 /// </summary> /// <param name="source"></param> /// <returns></returns> public abstract MeshBase CreateMesh(GridderSource source);
public override MeshBase CreateMesh(GridderSource source) { HexahedronGridderSource src = (HexahedronGridderSource)source; Vertex minVertex = new Vertex(); Vertex maxVertex = new Vertex(); bool isSet = false; PositionBuffer positions = new HexahedronPositionBuffer(); HalfHexahedronIndexBuffer halfHexahedronIndices = new HalfHexahedronIndexBuffer(); int dimSize = src.DimenSize; int I, J, K; unsafe { positions.AllocMem(dimSize); HexahedronPosition *cell = (HexahedronPosition *)positions.Data; for (int gridIndex = 0; gridIndex < dimSize; gridIndex++) { src.InvertIJK(gridIndex, out I, out J, out K); cell[gridIndex].FLT = src.PointFLT(I, J, K); cell[gridIndex].FRT = src.PointFRT(I, J, K); cell[gridIndex].BRT = src.PointBRT(I, J, K); cell[gridIndex].BLT = src.PointBLT(I, J, K); cell[gridIndex].FLB = src.PointFLB(I, J, K); cell[gridIndex].FRB = src.PointFRB(I, J, K); cell[gridIndex].BRB = src.PointBRB(I, J, K); cell[gridIndex].BLB = src.PointBLB(I, J, K); if (!isSet && src.IsActiveBlock(gridIndex)) { minVertex = cell[gridIndex].FLT; maxVertex = minVertex; isSet = true; } if (isSet && src.IsActiveBlock(gridIndex)) { minVertex = SimLab.SimGrid.helper.VertexHelper.MinVertex(minVertex, cell[gridIndex].FLT); maxVertex = SimLab.SimGrid.helper.VertexHelper.MaxVertex(maxVertex, cell[gridIndex].FLT); minVertex = SimLab.SimGrid.helper.VertexHelper.MinVertex(minVertex, cell[gridIndex].FRT); maxVertex = SimLab.SimGrid.helper.VertexHelper.MaxVertex(maxVertex, cell[gridIndex].FRT); minVertex = SimLab.SimGrid.helper.VertexHelper.MinVertex(minVertex, cell[gridIndex].BRT); maxVertex = SimLab.SimGrid.helper.VertexHelper.MaxVertex(maxVertex, cell[gridIndex].BRT); minVertex = SimLab.SimGrid.helper.VertexHelper.MinVertex(minVertex, cell[gridIndex].BLT); maxVertex = SimLab.SimGrid.helper.VertexHelper.MaxVertex(maxVertex, cell[gridIndex].BLT); minVertex = SimLab.SimGrid.helper.VertexHelper.MinVertex(minVertex, cell[gridIndex].FLB); maxVertex = SimLab.SimGrid.helper.VertexHelper.MaxVertex(maxVertex, cell[gridIndex].FLB); minVertex = SimLab.SimGrid.helper.VertexHelper.MinVertex(minVertex, cell[gridIndex].FRB); maxVertex = SimLab.SimGrid.helper.VertexHelper.MaxVertex(maxVertex, cell[gridIndex].FRB); minVertex = SimLab.SimGrid.helper.VertexHelper.MinVertex(minVertex, cell[gridIndex].BRB); maxVertex = SimLab.SimGrid.helper.VertexHelper.MaxVertex(maxVertex, cell[gridIndex].BRB); minVertex = SimLab.SimGrid.helper.VertexHelper.MinVertex(minVertex, cell[gridIndex].BLB); maxVertex = SimLab.SimGrid.helper.VertexHelper.MaxVertex(maxVertex, cell[gridIndex].BLB); } } //网格个数*每个六面体的面数*描述每个六面体的三角形个数 int halfHexahedronIndexCount = dimSize * 2; //int memorySizeInBytes = halfHexahedronIndexCount * sizeof(HalfHexahedronIndex); //halfHexahedronIndices.AllocMem(memorySizeInBytes); halfHexahedronIndices.AllocMem(halfHexahedronIndexCount); HalfHexahedronIndex *array = (HalfHexahedronIndex *)halfHexahedronIndices.Data; for (int gridIndex = 0; gridIndex < dimSize; gridIndex++) { array[gridIndex * 2].dot0 = (uint)(8 * gridIndex + 6); array[gridIndex * 2].dot1 = (uint)(8 * gridIndex + 2); array[gridIndex * 2].dot2 = (uint)(8 * gridIndex + 7); array[gridIndex * 2].dot3 = (uint)(8 * gridIndex + 3); array[gridIndex * 2].dot4 = (uint)(8 * gridIndex + 4); array[gridIndex * 2].dot5 = (uint)(8 * gridIndex + 0); array[gridIndex * 2].dot6 = (uint)(8 * gridIndex + 5); array[gridIndex * 2].dot7 = (uint)(8 * gridIndex + 1); array[gridIndex * 2].restartIndex = uint.MaxValue; array[gridIndex * 2 + 1].dot0 = (uint)(8 * gridIndex + 3); array[gridIndex * 2 + 1].dot1 = (uint)(8 * gridIndex + 0); array[gridIndex * 2 + 1].dot2 = (uint)(8 * gridIndex + 2); array[gridIndex * 2 + 1].dot3 = (uint)(8 * gridIndex + 1); array[gridIndex * 2 + 1].dot4 = (uint)(8 * gridIndex + 6); array[gridIndex * 2 + 1].dot5 = (uint)(8 * gridIndex + 5); array[gridIndex * 2 + 1].dot6 = (uint)(8 * gridIndex + 7); array[gridIndex * 2 + 1].dot7 = (uint)(8 * gridIndex + 4); array[gridIndex * 2 + 1].restartIndex = uint.MaxValue; } HexahedronMesh mesh = new HexahedronMesh(positions, halfHexahedronIndices); mesh.Max = maxVertex; mesh.Min = minVertex; return(mesh); } }