SpaceMorph too slow at R7


When using the SpaceMorph at R6 the process was faster than the same process at R7
I attach a command test with calls to function ClosestMeshPoint in a simple loop and the same call inside the method from SpaceMorph: MorphPoint
I attach too an example with two meshes. The process calling ato Morph can take above from 15 min.


C# Command Test:
Test ClosestMeshPoint.cs (1.8 KB)

File 3dm with 2 meshes: test closestpoint.rar - Google Drive

Hi @Eliseo,

I’m not seeing a significant difference in the performance in Mesh.ClosestMeshPoint between V6 and V7.

I used this simple Python script on your file to benchmark.

import Rhino
import rhinoscriptsyntax as rs
import System

def test_closest_mesh_point():
    red_mesh_id = rs.GetObject("Select the red mesh")
    if not red_mesh_id: return
    red_mesh = rs.coercemesh(red_mesh_id)
    if not red_mesh: return
    black_mesh_id = rs.GetObject("Select the black mesh")
    if not black_mesh_id: return
    black_mesh = rs.coercemesh(black_mesh_id)
    if not black_mesh: return
    sw = System.Diagnostics.Stopwatch()
    for v in red_mesh.Vertices:
        mp = black_mesh.ClosestMeshPoint(v, 0.0)
        #if mp: print(mp.Point)
    ts = sw.Elapsed
    et = System.String.Format("{0:00}:{1:00}:{2:00}.{3:00}", ts.Hours, ts.Minutes, ts.Seconds, ts.Milliseconds / 10)
    print('Elapsed Time: {0}'.format(et))

if __name__ == "__main__":

What am I missing?

– Dale

Hi Dale,

Sorry, I sent you a wrong file. The correct one is the attached below. The amount of time is during the call to Morph,

Test ClosestMeshPoint.cs (3.7 KB)

Hi @Eliseo,

I’ve run your code (slightly modified) on both V6 and V7 and I’m not seeing any significant difference in performance.

Rhino 6 SR35 - Elapsed Time: 00:00:06.43
Rhino 7 SR21 - Elapsed Time: 00:00:05.32

I’ve attached the project I tested with. (25.7 KB)

– Dale

Hi @dale

I am not using R6, my code at R7 is the same because I have not changed it, but… the Framework and RhinoCommon version are uptaded: I am using .NET Framework 4.8 and RhinoCommon 7.15.22039.13001

You are using Framework 4.5 and RhinoCommon 6.35.21222.17000

Could be this the problem?

Probably not. RhinoCommon is mostly just class declarations. The implementation is in core Rhino.

– Dale

Ok @dale

The amount of time is checking the mesh.IsValid value.

Thanks a lot