'Null' curvature in Rhino 8

Hi all,

I was handling a crash report today, and I ended up running it in debug. What I discovered is that Rhino 8 sometimes does something new when querying a surface for curvature. I’ve never seen it do this in the 4 or 5 years we’ve been doing curvature analysis. See below:

image

The purple surfaces are yielding curvature (kappa) of ‘null’ instead of ‘zero’, using the following code.

B.Surfaces[0].ClosestPoint(Centroid, out double _u, out double _v);
SurfaceCurvature SC = B.Surfaces[0].CurvatureAt(_u, _v);
temp_K.Add(new double[2] { SC.Kappa(0), SC.Kappa(1) });

This is fine. I can handle this, but just thought I would flag it in case this behavior wasn’t intended. I haven’t seen it happen yet with something that actually had a curvature… I will let you know if that does happen, of course.

Thanks.

Arthur

Hi @Arthur,

Make sure to check the return value of methods you call - don’t assume they always work.

var rc = B.Surfaces[0].ClosestPoint(Centroid, out double _u, out double _v);
if (rc)
{
  SurfaceCurvature SC = B.Surfaces[0].CurvatureAt(_u, _v);
  if (null != SC)
    temp_K.Add(new double[2] { SC.Kappa(0), SC.Kappa(1) });
}

– Dale

Hi Dale,

In this instance, what do you recommend I do if it doesn’t work, assuming I still need the curvature?

Arthur

@Arthur - you’ll need to provide us a way of repeating the issue.

Thanks,

– Dale

I’ll see what I can do.

Ok. I’ve found the surface that was causing the issue. See this file:

https://www.dropbox.com/t/y8EMwl7ZD9mi49oV

It’s not hard to imagine why this surface would generate an odd result… it’s flat and twisted, after all… That said, SelBadObjects does not catch it, so I’m not sure how to filter for this condition.

Let me know if you have any suggestions. If not, I think I’ll abort when I run into a condition where a non-planar surface yields null curvature and has a significant measurable area - or something like that.

Arthur

It’s 0,-0 here, not a null.

Hi,

What point did you use? I think what my code did was take an analysis mesh, and then get the curvature at the centroid of each mesh face.

I’m guessing the issue occurred close to that twisted region.

Arthur

I used the point included in your file, which I assume is the centroid. I think you should attach a GH script to replicate this issue.

No. I said centroid of the mesh faces (not the brep centroid), of which there will be many.

Sit tight. I will get the uv coordinates it crashes on.

Arthur

Try hard-coding these into your u,v inputs to y.CurvatureAt(u,v):

u = -2.0376416529701178
v = 0.33513973621584375

Arthur

Yeah, the SurfaceCurvature returned is Null.