SurfaceCurvature fails with sphere and parabula

Using the Rhino3dm library in vvvv gamma and I noticed that to evaluate a surface it needs to create a normal vector.

The creation of a normal vector seems to fail for a sphere and parabola primitive. Many other types of surfaces like lofts, donuts or extrusions I have tried work flawlessly.

What is it about the sphere and parabola that could make it fail?

Evaluating all the test surfaces in Grasshopper works just fine.

My test objects:

surface_curves.3dm (1.3 MB)

Just for context and showing the power of other software environments for using rhino/GH stuff. Evaluating the donut 250.000 times in Grasshopper takes close to 2 seconds. The viewport is unusable since Rhino/Grasshopper does not instance their own helper geometries like points, planes, etc. (this should have been a no-brainer).

In vvvv the same donut with the same 250.000 points takes 1.2 seconds and rendering each point as a cube the viewport runs at 60fps. So currently the obvious downside is that it is very selective on which surfaces it evaluates and which it just fails on.

Okay, I put in some error checking now and found out that it actually only fails for the first and last point in the example of the sphere.

That means it fails if any of the parameters I want to evaluate are exactly 0 or 1.

What could be an explanation for that?

That exception translates into “something in your code is null”. The problem of this sort of error is, that it can occur much earlier. It all depends on how strict null checking is applied on the whole codebase.