Ejemplo n.º 1
0
        // Token: 0x0600005E RID: 94 RVA: 0x00003568 File Offset: 0x00001768
        private static void AddHalfEdge(ushort v0, ushort v1, ushort normalId, IList <TriangleMesh.Normal> normals, Dictionary <uint, ushort> halfEdges, List <TriangleMesh.EdgeLine> edgeLines, List <TriangleMesh.SurfaceLine> surfaceLines)
        {
            uint   key = TriangleMesh.MakeKey(v0, v1);
            ushort num;

            if (!halfEdges.TryGetValue(key, out num))
            {
                halfEdges.Add(key, normalId);
                return;
            }
            halfEdges.Remove(key);
            TriangleMesh.Normal normal  = normals[(int)normalId];
            TriangleMesh.Normal normal2 = normals[(int)num];
            float num2 = normal.X * normal2.X + normal.Y * normal2.Y + normal.Z * normal2.Z;

            if ((double)num2 < 0.999)
            {
                if ((double)num2 > 0.3)
                {
                    surfaceLines.Add(new TriangleMesh.SurfaceLine(normalId, v0, num, v1));
                    return;
                }
                edgeLines.Add(new TriangleMesh.EdgeLine(normalId, v0, num, v1));
            }
        }
Ejemplo n.º 2
0
        // Token: 0x06000058 RID: 88 RVA: 0x00002D90 File Offset: 0x00000F90
        public bool CheckForTwoManifold()
        {
            HashSet <uint> hashSet = new HashSet <uint>();

            foreach (TriangleMesh.Triangle triangle in this.Triangles)
            {
                ushort v  = triangle.V0;
                ushort v2 = triangle.V1;
                ushort v3 = triangle.V2;
                TriangleMesh.Corner corner  = this.Corners[(int)v];
                TriangleMesh.Corner corner2 = this.Corners[(int)v2];
                TriangleMesh.Corner corner3 = this.Corners[(int)v3];
                uint item = TriangleMesh.MakeKey(corner.VertexIndex, corner2.VertexIndex);
                if (!hashSet.Remove(item))
                {
                    hashSet.Add(item);
                }
                uint item2 = TriangleMesh.MakeKey(corner2.VertexIndex, corner3.VertexIndex);
                if (!hashSet.Remove(item2))
                {
                    hashSet.Add(item2);
                }
                uint item3 = TriangleMesh.MakeKey(corner3.VertexIndex, corner.VertexIndex);
                if (!hashSet.Remove(item3))
                {
                    hashSet.Add(item3);
                }
            }
            return(hashSet.Count == 0);
        }