I am having issues creating a FractureNetwork from a TriangleMesh in Petrel. When it is drawn, you can seen all the individual triangles - I would expect that it would be solid. Some of the triangles do seem to be connected, just not all of them. Am I missing something, or is there a trick to making the FractureNetwork appear solid?
The TriangleMesh is solid, and when I turn o开发者_高级运维n Wireframe in the 3D window it also looks correct. Link shows image with TriangleMesh next to FractureNetwork.
http://www.flickr.com/photos/65551984@N07/5981436871/
The issue seems to have been in the order of the indexes used for generating the triangles.
When the following code is used to generate a fracture network, the triangles are shaded.
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();
}
}
However, if the order of the indexes are modified, the fracture network is solid.
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();
}
}
Image can be seen at : http://www.flickr.com/photos/65551984@N07/5987611731/
精彩评论