public Coords(Lines3D parent, int h, int d, int w) { this.parent = parent; Height = h; Depth = d; Width = w; }
static void Main() { Lines3D x = new Lines3D(); Lines max = new Lines(); max.Count = 0; max.Length = 0; for (int h = 0; h < x.H; h++) { for (int d = 0; d < x.D; d++) { for (int w = 0; w < x.W; w++) { Lines local = x.GetLongestLines(h, d, w); if (max.Length < local.Length) { max.Length = local.Length; max.Count = local.Count; } else if (max.Length == local.Length) { max.Count += local.Count; } } } } max.Print(); }
private void CreateVisibleDirection(GraphicsDevice g, Matrix Projection) { VertexPositionColor[] ArrayVertex = new VertexPositionColor[14]; // Initialize an array of indices of type short. short[] ArrayIndices = new short[(ArrayVertex.Length * 2) - 2]; int Index = 0; ArrayVertex[Index * 2] = new VertexPositionColor( new Vector3(0.5f, 0, 1), Color.White); ArrayVertex[Index * 2 + 1] = new VertexPositionColor( new Vector3(0.5f, 0, -0.5f), Color.White); ArrayIndices[Index * 2] = (short)(Index * 2); ArrayIndices[Index * 2 + 1] = (short)(Index * 2 + 1); ++Index; ArrayVertex[Index * 2] = new VertexPositionColor( new Vector3(0.5f, 0, -0.5f), Color.White); ArrayVertex[Index * 2 + 1] = new VertexPositionColor( new Vector3(1f, 0, -0.5f), Color.White); ArrayIndices[Index * 2] = (short)(Index * 2); ArrayIndices[Index * 2 + 1] = (short)(Index * 2 + 1); ++Index; //Top of arrow ArrayVertex[Index * 2] = new VertexPositionColor( new Vector3(1f, 0, -0.5f), Color.White); ArrayVertex[Index * 2 + 1] = new VertexPositionColor( new Vector3(0, 0, -1f), Color.White); ArrayIndices[Index * 2] = (short)(Index * 2); ArrayIndices[Index * 2 + 1] = (short)(Index * 2 + 1); ++Index; ArrayVertex[Index * 2] = new VertexPositionColor( new Vector3(0, 0, -1f), Color.White); ArrayVertex[Index * 2 + 1] = new VertexPositionColor( new Vector3(-1f, 0, -0.5f), Color.White); ArrayIndices[Index * 2] = (short)(Index * 2); ArrayIndices[Index * 2 + 1] = (short)(Index * 2 + 1); ++Index; ArrayVertex[Index * 2] = new VertexPositionColor( new Vector3(-1f, 0, -0.5f), Color.White); ArrayVertex[Index * 2 + 1] = new VertexPositionColor( new Vector3(-0.5f, 0, -0.5f), Color.White); ArrayIndices[Index * 2] = (short)(Index * 2); ArrayIndices[Index * 2 + 1] = (short)(Index * 2 + 1); ++Index; ArrayVertex[Index * 2] = new VertexPositionColor( new Vector3(-0.5f, 0, -0.5f), Color.White); ArrayVertex[Index * 2 + 1] = new VertexPositionColor( new Vector3(-0.5f, 0, 1), Color.White); ArrayIndices[Index * 2] = (short)(Index * 2); ArrayIndices[Index * 2 + 1] = (short)(Index * 2 + 1); ++Index; ArrayVertex[Index * 2] = new VertexPositionColor( new Vector3(-0.5f, 0, 1), Color.White); ArrayVertex[Index * 2 + 1] = new VertexPositionColor( new Vector3(0.5f, 0, 1), Color.White); ArrayIndices[Index * 2] = (short)(Index * 2); ArrayIndices[Index * 2 + 1] = (short)(Index * 2 + 1); ++Index; VisibleDirection = new Lines3D(g, Projection, ArrayVertex, ArrayIndices); }
public void Setup(float width, float height, float depth, Color c) { // Points - Front face _points[0] = new Point3D(0, 0, 0, c); //F-TL _points[1] = new Point3D(width, 0, 0, c); //F-TR _points[2] = new Point3D(0, height, 0, c); //F-BL _points[3] = new Point3D(width, height, 0, c); //F-BR // Points - Back face _points[4] = new Point3D(0, 0, depth, c); //B-TL _points[5] = new Point3D(width, 0, depth, c); //B-TR _points[6] = new Point3D(0, height, depth, c); //B-BL _points[7] = new Point3D(width, height, depth, c); //B-BR // Lines - Front face _lines[0] = new Lines3D(_points[0], _points[1]); // F-T _lines[1] = new Lines3D(_points[2], _points[3]); // F-B _lines[2] = new Lines3D(_points[0], _points[2]); // F-L _lines[3] = new Lines3D(_points[1], _points[3]); // F-R // Lines - back face _lines[4] = new Lines3D(_points[4], _points[5]); // B-T _lines[5] = new Lines3D(_points[6], _points[7]); // B-B _lines[6] = new Lines3D(_points[4], _points[6]); // B-L _lines[7] = new Lines3D(_points[5], _points[7]); // B-R // Lines - center _lines[8] = new Lines3D(_points[0], _points[4]); // C-TL _lines[9] = new Lines3D(_points[1], _points[5]); // B-TR _lines[10] = new Lines3D(_points[2], _points[6]); // B-BL _lines[11] = new Lines3D(_points[3], _points[7]); // B-BR }
Lines3D[] GetLines() { int x = _mesh.GetLength(0); int y = _mesh.GetLength(1); // Lines is based of the points Point3D[] p = GetPoints(); // Create line object // TODO: this can be simplifed Lines3D[] l = new Lines3D[((x-1) * y) + (x* (y-1))]; // Populate values in line objects, the lines will look somthing like so /* *-*-*-* * | | | | * *-*-*-* * | | | | * *-*-*-* * | | | | * *-*-*-* * */ int linePos = 0; for (int idxY=0; idxY<y; idxY++) { // Horz Line (count = x-1) for (int idxX = 0; idxX < x - 1; idxX++) { l[linePos].Start = p[(idxY*x) +idxX]; l[linePos].End = p[(idxY*x) +idxX +1]; // Point to right linePos++; } // Only add Vert lines if not on last row if (idxY < y-1) { // Vert Line (count = x) for (int idxX = 0; idxX < x; idxX++) { l[linePos].Start = p[(idxY * x) + idxX]; // Same point as Horz line l[linePos].End = p[((idxY + 1) * x) + idxX]; // Point down linePos++; } } } return l; }
Lines3D[] GetLines() { Lines3D[] ret = new Lines3D[1]; ret[0] = new Lines3D(_from, _to); return ret; }