Exemplo n.º 1
0
        // Token: 0x0600005D RID: 93 RVA: 0x000033C0 File Offset: 0x000015C0
        public TriangleMesh CreateSurfaceLines()
        {
            Dictionary <uint, ushort>       dictionary   = new Dictionary <uint, ushort>();
            List <TriangleMesh.EdgeLine>    edgeLines    = new List <TriangleMesh.EdgeLine>();
            List <TriangleMesh.SurfaceLine> surfaceLines = new List <TriangleMesh.SurfaceLine>();
            List <TriangleMesh.Line>        list         = new List <TriangleMesh.Line>();

            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];
                TriangleMesh.AddHalfEdge(corner.VertexIndex, corner2.VertexIndex, corner.NormalIndex, this.Normals, dictionary, edgeLines, surfaceLines);
                TriangleMesh.AddHalfEdge(corner2.VertexIndex, corner3.VertexIndex, corner2.NormalIndex, this.Normals, dictionary, edgeLines, surfaceLines);
                TriangleMesh.AddHalfEdge(corner3.VertexIndex, corner.VertexIndex, corner3.NormalIndex, this.Normals, dictionary, edgeLines, surfaceLines);
            }
            foreach (uint num in dictionary.Keys)
            {
                ushort v4 = (ushort)(num & 65535u);
                ushort v5 = (ushort)(num >> 16);
                list.Add(new TriangleMesh.Line(v4, v5));
            }
            return(new TriangleMesh(this.Origin, this.Normals, this.Vertices, edgeLines, surfaceLines, list, this.Corners, this.Triangles, this.ReferenceLines, this.ReferenceLineRadius));
        }
Exemplo 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);
        }
Exemplo n.º 3
0
        // Token: 0x0600005A RID: 90 RVA: 0x0000308C File Offset: 0x0000128C
        public double CalculateVolume()
        {
            double num = 0.0;

            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];
                TriangleMesh.Vertex vertex  = this.Vertices[(int)corner.VertexIndex];
                TriangleMesh.Vertex vertex2 = this.Vertices[(int)corner2.VertexIndex];
                TriangleMesh.Vertex vertex3 = this.Vertices[(int)corner3.VertexIndex];
                num += this.TetrahedronVolume(this.Origin, new Vector3((double)vertex2.X, (double)vertex2.Y, (double)vertex2.Z), new Vector3((double)vertex.X, (double)vertex.Y, (double)vertex.Z), new Vector3((double)vertex3.X, (double)vertex3.Y, (double)vertex3.Z));
            }
            return(num);
        }
Exemplo n.º 4
0
        // Token: 0x06000059 RID: 89 RVA: 0x00002EAC File Offset: 0x000010AC
        public Vector3 CalculateCenteroid()
        {
            Vector3 vector = Vector3.Zero;
            double  num    = 0.0;

            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];
                TriangleMesh.Vertex vertex  = this.Vertices[(int)corner.VertexIndex];
                TriangleMesh.Vertex vertex2 = this.Vertices[(int)corner2.VertexIndex];
                TriangleMesh.Vertex vertex3 = this.Vertices[(int)corner3.VertexIndex];
                double  num2    = this.TetrahedronVolume(this.Origin, new Vector3((double)vertex2.X, (double)vertex2.Y, (double)vertex2.Z), new Vector3((double)vertex.X, (double)vertex.Y, (double)vertex.Z), new Vector3((double)vertex3.X, (double)vertex3.Y, (double)vertex3.Z));
                Vector3 vector2 = this.TetrahedronCenteroid(this.Origin, new Vector3((double)vertex2.X, (double)vertex2.Y, (double)vertex2.Z), new Vector3((double)vertex.X, (double)vertex.Y, (double)vertex.Z), new Vector3((double)vertex3.X, (double)vertex3.Y, (double)vertex3.Z));
                vector += vector2 * num2;
                num    += num2;
            }
            return(vector / num);
        }