Hi all.
Rhino 7.
I’m doing hundreds of Mesh-Mesh intersections to find quickly collisions/clashes…
I’m using MeshMeshFast() method, but i’m getting a:
Rhino.Geometry.Intersect.Intersection.MeshMeshFast(Rhino.Geometry.Mesh, Rhino.Geometry.Mesh)’ is obsolete: ‘Use the MeshMesh() method.’
warning.
I tried MeshMeshFast, but it is actually much slower!
This execute in 8ms :
Mesh ma = Mesh.CreateFromBox(new Box(Plane.WorldXY, new Interval(0, 2), new Interval(0, 2), new Interval(0, 2)), 3, 3, 3);
Mesh mb = Mesh.CreateFromBox(new Box(Plane.WorldXY, new Interval(1, 3), new Interval(1, 3), new Interval(1, 3)), 3, 3, 3);
for(int i = 0;i < 1000;i++){
Line[] lines = Rhino.Geometry.Intersect.Intersection.MeshMeshFast(ma, mb);
}
And this takes 270ms :
Mesh ma = Mesh.CreateFromBox(new Box(Plane.WorldXY, new Interval(0, 2), new Interval(0, 2), new Interval(0, 2)), 3, 3, 3);
Mesh mb = Mesh.CreateFromBox(new Box(Plane.WorldXY, new Interval(1, 3), new Interval(1, 3), new Interval(1, 3)), 3, 3, 3);
Mesh[] meshes = new Mesh[2];
meshes[0] = ma;
meshes[1] = mb;
Polyline[] intersections;
Polyline[] overlaps;
Mesh overlapmesh;
for(int i = 0;i < 1000;i++){
Rhino.Geometry.Intersect.Intersection.MeshMesh(meshes, 0.005, out intersections,
false, out overlaps, false, out overlapmesh, null, System.Threading.CancellationToken.None, null);
}
meshmeshfast intersection.gh (4.9 KB)
Is this expected/normal? There are better/faster methods?
MeshMeshAccurate() seems to be as fast as (or as slow as) MeshMesh() .