public LRVertexResolver(CTTriangleMesh ctTriangleMesh, LRTriangleMesh lrTriangleMesh, bool[]vMarked, bool[]tMarked) { this.ctTriangleMesh = ctTriangleMesh; this.lrTriangleMesh = lrTriangleMesh; this.vMarked = vMarked; this.tMarked = tMarked; }
public LRTriangleResolver(CTTriangleMesh ctTriangleMesh, LRTriangleMesh lrTriangleMesh, bool[] vMarked, bool[] tMarked) { this.ctTriangleMesh = ctTriangleMesh; this.lrTriangleMesh = lrTriangleMesh; this.vMarked = vMarked; this.tMarked = tMarked; lrTriangleMesh.LR = new int[2 * lrTriangleMesh.MR]; tProcessed = new bool[ctTriangleMesh.Triangles.Length]; }
public LRCornerResolver(ref LRTriangleMesh lrTriangleMesh, ref CTTriangleMesh ctTriangleMesh, ref bool[] tMarked, ref int[] vertexMapping) { this.lrTriangleMesh = lrTriangleMesh; this.ctTriangleMesh = ctTriangleMesh; this.tMarked = tMarked; this.vertexMapping = vertexMapping; O = new List<int>(); OS = new List<int>(); IsolatedCorners = new List<int>(); }
public LRTriangleMesh Build() { int[] vertexMapping; lrTriangleMesh = new LRTriangleMesh(); //Run ring expander RingExpander(); //Resolve vertices LRVertexResolver lrVertexResolver = new LRVertexResolver(ctTriangleMesh, lrTriangleMesh, vMarked, tMarked); lrTriangleMesh = lrVertexResolver.ResolveVertices(out vertexMapping); //Resolve triangles LRTriangleResolver lrTriangleResolver = new LRTriangleResolver(ctTriangleMesh, lrTriangleMesh, vMarked, tMarked); lrTriangleMesh = lrTriangleResolver.ResolveTriangles(vertexMapping); return lrTriangleMesh; }
public void UpdateLrMesh(LRTriangleMesh lrTriangleMesh) { this.lrTriangleMesh = lrTriangleMesh; }
public LRTriangleMesh Execute(string fn) { LRTriangleMesh lrTriangleMesh = new LRTriangleMesh(); List<Point3D> v = new List<Point3D>(); int mr = -1; List<int> lr = new List<int>(); List<int> c = new List<int>(); List<Triangle> t = new List<Triangle>(); List<int> o = new List<int>(); List<int> ts = new List<int>(); List<int> os = new List<int>(); bool isRingVertex = true; using (StreamReader sr = new StreamReader(fn)) { String line = ""; while (!sr.EndOfStream) { line = sr.ReadLine(); if (line.StartsWith("V")) { if (isRingVertex) { ParseRingVertex(line, v, lr, ts, os); } else { ParseIsolatedVertex(line, v, c); } } if (line.StartsWith("-")) { mr = v.Count; isRingVertex = false; } if (line.StartsWith("T")) { ParseTriangle(line, t); } if (line.StartsWith("O")) { ParseOpposites(line, o); } } } lrTriangleMesh.V = v.ToArray(); lrTriangleMesh.MR = mr == -1 ? v.Count : mr; lrTriangleMesh.LR = lr.ToArray(); lrTriangleMesh.C = c.ToArray(); lrTriangleMesh.T = t.ToArray(); lrTriangleMesh.O = o.ToArray(); lrTriangleMesh.TS = ts.ToArray(); lrTriangleMesh.OS = os.ToArray(); return lrTriangleMesh; }
public LRWriter(LRTriangleMesh mesh) { this.mesh = mesh; }
/// <summary> /// Allows the game to perform any initialization it needs to before starting to run. /// This is where it can query for any required services and load any non-graphic /// related content. Calling base.Initialize will enumerate through any components /// and initialize them as well. /// </summary> protected override void Initialize() { IFLTriangleMesh iflTriangleMesh = MeshLoader.LoadMesh<IFLTriangleMesh>(inputPath); IConverter<LRTriangleMesh> converter = Converter.GetSpecificConverter<IFLTriangleMesh, LRTriangleMesh>(iflTriangleMesh); lrTriangleMesh = converter.Convert(); base.Initialize(); BasicEffect e = new BasicEffect(GraphicsDevice); e.VertexColorEnabled = true; e.View = Matrix.CreateLookAt(new Vector3(0, 0, 5), new Vector3(0, 0, 0), Vector3.Up); float aspect = GraphicsDevice.Viewport.AspectRatio; e.Projection = Matrix.CreatePerspectiveFieldOfView(MathHelper.ToRadians(60f), aspect, 1, 100); effect = e; this.IsMouseVisible = true; mouseStatePrevious = Mouse.GetState(); keyStateCurrent = Keyboard.GetState(); this.Window.AllowUserResizing = true; RasterizerState s = new RasterizerState(); s.CullMode = CullMode.None; GraphicsDevice.RasterizerState = s; int vertex = 0; currentCorner = lrTriangleMesh.VC(vertex); Vector3 cubePos = new Vector3((float)lrTriangleMesh.V[vertex].X, (float)lrTriangleMesh.V[vertex].Y, (float)lrTriangleMesh.V[vertex].Z); currentCube = new Cube(new Vector3(0.01f, 0.01f, 0.01f), cubePos); }