Exemple #1
0
        public static void PushMesh(Autodesk.Revit.DB.Mesh mesh, IRenderPackage package)
        {
            for (var i = 0; i < mesh.NumTriangles; i++)
            {
                var triangle = mesh.get_Triangle(i);
                for (var j = 0; j < 3; j++)
                {
                    var xyz = triangle.get_Vertex(j);
                    package.PushTriangleVertex(xyz.X, xyz.Y, xyz.Z);
                }

                var a    = mesh.get_Triangle(i).get_Vertex(1).Subtract(mesh.get_Triangle(i).get_Vertex(0)).Normalize();
                var b    = mesh.get_Triangle(i).get_Vertex(2).Subtract(mesh.get_Triangle(i).get_Vertex(0)).Normalize();
                var norm = a.CrossProduct(b);
                package.PushTriangleVertexNormal(norm.X, norm.Y, norm.Z);
                package.PushTriangleVertexNormal(norm.X, norm.Y, norm.Z);
                package.PushTriangleVertexNormal(norm.X, norm.Y, norm.Z);
            }
        }
Exemple #2
0
        public static void PushMesh(Autodesk.Revit.DB.Mesh mesh, IRenderPackage package)
        {
            for (var i = 0; i < mesh.NumTriangles; i++)
            {
                var triangle = mesh.get_Triangle(i);
                for (var j = 0; j < 3; j++)
                {
                    var xyz = triangle.get_Vertex(j);
                    package.PushTriangleVertex(xyz.X, xyz.Y, xyz.Z);
                }

                var a = mesh.get_Triangle(i).get_Vertex(1).Subtract(mesh.get_Triangle(i).get_Vertex(0)).Normalize();
                var b = mesh.get_Triangle(i).get_Vertex(2).Subtract(mesh.get_Triangle(i).get_Vertex(0)).Normalize();
                var norm = a.CrossProduct(b);
                package.PushTriangleVertexNormal(norm.X, norm.Y, norm.Z);
                package.PushTriangleVertexNormal(norm.X, norm.Y, norm.Z);
                package.PushTriangleVertexNormal(norm.X, norm.Y, norm.Z);
            }
        }
Exemple #3
0
        public void Tessellate(IRenderPackage package, double tol = -1, int maxGridLines = 512)
        {
            for (int i = 0; i < vertices.Count; i = i + 3)
            {
                package.PushTriangleVertex(
                    vertices[i], vertices[i + 1], vertices[i + 2]);
            }

            for (int i = 0; i < normals.Count; i = i + 3)
            {
                package.PushTriangleVertexNormal(
                    normals[i], normals[i + 1], normals[i + 2]);
            }

            for (int i = 0; i < colors.Count; i = i + 4)
            {
                package.PushTriangleVertexColor(
                    colors[i], colors[i + 1], colors[i + 2], colors[i + 3]);
            }
        }
Exemple #4
0
 private void PushTriangleVertex(IRenderPackage package, Point p, Vector n)
 {
     package.PushTriangleVertex(p.X, p.Y, p.Z);
     package.PushTriangleVertexColor(255, 255, 0, 255);
     package.PushTriangleVertexNormal(n.X, n.Y, n.Z);
 }