从Petrel的Triangle Mesh发出FractureNetwork图

时间:2011-07-27 17:08:11

标签: ocean petrel

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

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

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

1 个答案:

答案 0 :(得分: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/

看到