1

我在从 Petrel 中的 TriangleMesh 创建 FractureNetwork 时遇到问题。绘制时,您可以看到所有单独的三角形 - 我希望它是实心的。一些三角形似乎确实是相连的,但不是全部。我是否遗漏了什么,或者有什么技巧可以让 FractureNetwork 看起来很稳固?

TriangleMesh 是实心的,当我在 3D 窗口中打开 Wireframe 时,它​​看起来也正确。链接在 FractureNetwork 旁边显示带有 TriangleMesh 的图像。

http://www.flickr.com/photos/65551984@N07/5981436871/

4

1 回答 1

1

问题似乎在于用于生成三角形的索引的顺序。

当下面的代码用于生成裂缝网络时,三角形是有阴影的。

    public static void Test()
    {
        Point3[] vertices = new Point3[9];
        IndexedTriangle[] triangles = new IndexedTriangle[8];

        vertices[0] = new Point3(0, 100, 0);
        vertices[1] = new Point3(50, 100, 5);
        vertices[2] = new Point3(100, 100, 10);
        vertices[3] = new Point3(0, 50, 15);
        vertices[4] = new Point3(50, 50, 20);
        vertices[5] = new Point3(100, 50, 25);
        vertices[6] = new Point3(0, 0, 30);
        vertices[7] = new Point3(50, 0, 35);
        vertices[8] = new Point3(100, 0, 40);

        triangles[0] = new IndexedTriangle(0, 1, 3);
        triangles[1] = new IndexedTriangle(1, 3, 4);
        triangles[2] = new IndexedTriangle(1, 2, 4);
        triangles[3] = new IndexedTriangle(2, 4, 5);
        triangles[4] = new IndexedTriangle(3, 4, 6);
        triangles[5] = new IndexedTriangle(4, 6, 7);
        triangles[6] = new IndexedTriangle(4, 5, 7);
        triangles[7] = new IndexedTriangle(5, 7, 8);

        IndexedTriangleMesh triangleMesh = new IndexedTriangleMesh(triangles, vertices, null);

        TriangleMesh triMesh = null;
        using (ITransaction trans = Slb.Ocean.Core.DataManager.NewTransaction())
        {
            Project proj = PetrelProject.PrimaryProject;
            trans.Lock(proj);
            string colName = "TringleMeshes";
            Collection collection = Collection.NullObject;
            collection = proj.CreateCollection(colName);

            trans.Lock(collection);

            DomainObjectExtensionRoot root = DomainObjectExtensionRoot.GetInstance();
            trans.Lock(root);

            triMesh = root.CreateTriangleMesh("TestMesh", Domain.ELEVATION_DEPTH, collection, "Test", "");
            trans.Lock(triMesh);
            triMesh.IndexedTriangleMeshes = new IndexedTriangleMesh[] { triangleMesh };
            triMesh.Color = Color.Blue;
            trans.Commit();
        }

        Project project = PetrelProject.PrimaryProject;


        FractureNetwork fractureNetwork;                  

        using (ITransaction trans = Slb.Ocean.Core.DataManager.NewTransaction())
        {
            trans.Lock(project);

            fractureNetwork = project.CreateFractureNetwork("FractureNetwork", Domain.ELEVATION_DEPTH);

            fractureNetwork.CreateFracturePatches(triMesh.IndexedTriangleMeshes);

            trans.Commit();
        }

    }

但是,如果修改索引的顺序,则裂缝网络是稳固的。

    public static void Test()
    {
        Point3[] vertices = new Point3[9];
        IndexedTriangle[] triangles = new IndexedTriangle[8];

        vertices[0] = new Point3(0, 100, 0);
        vertices[1] = new Point3(50, 100, 5);
        vertices[2] = new Point3(100, 100, 10);
        vertices[3] = new Point3(0, 50, 15);
        vertices[4] = new Point3(50, 50, 20);
        vertices[5] = new Point3(100, 50, 25);
        vertices[6] = new Point3(0, 0, 30);
        vertices[7] = new Point3(50, 0, 35);
        vertices[8] = new Point3(100, 0, 40);

        triangles[0] = new IndexedTriangle(0, 1, 3);
        triangles[1] = new IndexedTriangle(1, 4, 3); // switched order of last two values
        triangles[2] = new IndexedTriangle(1, 2, 4);
        triangles[3] = new IndexedTriangle(2, 5, 4); // switched order of last two values
        triangles[4] = new IndexedTriangle(3, 4, 6);
        triangles[5] = new IndexedTriangle(4, 7, 6); // switched order of last two values
        triangles[6] = new IndexedTriangle(4, 5, 7);
        triangles[7] = new IndexedTriangle(5, 8, 7); // switched order of last two values

        IndexedTriangleMesh triangleMesh = new IndexedTriangleMesh(triangles, vertices, null);

        TriangleMesh triMesh = null;
        using (ITransaction trans = Slb.Ocean.Core.DataManager.NewTransaction())
        {
            Project proj = PetrelProject.PrimaryProject;
            trans.Lock(proj);
            string colName = "TringleMeshes";
            Collection collection = Collection.NullObject;
            collection = proj.CreateCollection(colName);

            trans.Lock(collection);

            DomainObjectExtensionRoot root = DomainObjectExtensionRoot.GetInstance();
            trans.Lock(root);

            triMesh = root.CreateTriangleMesh("TestMesh", Domain.ELEVATION_DEPTH, collection, "Test", "");
            trans.Lock(triMesh);
            triMesh.IndexedTriangleMeshes = new IndexedTriangleMesh[] { triangleMesh };
            triMesh.Color = Color.Blue;
            trans.Commit();
        }

        Project project = PetrelProject.PrimaryProject;


        FractureNetwork fractureNetwork;                  

        using (ITransaction trans = Slb.Ocean.Core.DataManager.NewTransaction())
        {
            trans.Lock(project);

            fractureNetwork = project.CreateFractureNetwork("FractureNetwork", Domain.ELEVATION_DEPTH);

            fractureNetwork.CreateFracturePatches(triMesh.IndexedTriangleMeshes);

            trans.Commit();
        }

    }

图片可见:http ://www.flickr.com/photos/65551984@N07/5987611731/

于 2011-07-29T16:42:10.270 回答