Rhino.SurfaceCurvature oddity


During some geometry investigation (see this thread Moebius Surface) I noticed some peculiar results as returned by the Rhino.SurfaceCurvature function. My assumption was that a periodic surface would compensate for parameter values beyond the domain’s range (in a similar fashion to how we can locate a spot on a circle at 2.5 pi radians (450 degrees).
It did not. But, the function didn’t baulk either. The results were certainly interesting.

The wayward lines were created by trying to evaluate u parameters 16 – 25.

WaywardLines.3dm (34.8 KB)


I’m reposting the sample routine here.

Option Explicit

Sub SurfNormAtParam
Dim srf
Dim domU, domV
Dim domInput(1)
Dim tanVec
Dim arrdata

With Rhino
	srf = .GetObject("Pick a surface", 8)

	If (VarType(srf) <> vbString) Then Exit Sub

	domU = .SurfaceDomain(srf, 0)
	domInput(0) = .GetReal("U Param, input Real Number between " & CStr(DomU(0)) & " and " & CStr(DomU(1)), DomU(0))
	domV = .SurfaceDomain(srf, 1)
	domInput(1) = .GetReal("V Param, input Real Number between " & CStr(DomV(0)) & " and " & CStr(DomV(1)), DomV(0), DomV(0), DomV(1))
	arrdata = .SurfaceCurvature(srf, domInput)
	tanVec = .AddLine(arrdata(0), .PointAdd(arrdata(0), arrdata(1)))
End With

End Sub

(Menno Deij - van Rijswijk) #3

This is basically a result of the way NURBS work. You are not forced to use a parameter in the given knot domain, outside the domain of the curve or surface the equations still work.

This is not specifically related to periodic surfaces.


You are not forced to use a parameter in the given knot domain, outside the domain of the curve or surface the equations still work.

That was my assumption as well. The test routine and sample file above, however, show non viable results while evaluating beyond the domain of the periodic U span.

(Menno Deij - van Rijswijk) #5

I’m not sure what you mean by non viable.

Just to be clear - the fact that the equations “still work”, I mean that they output points in 3D space, somewhere. The location of these points, generated with parameter values outside the knot domains usually has indeed a strange relation to the originating surface.

When programming, I sometimes make the mistake of switching U- and V- indices. Especially on doubly curved surfaces, the outcome can look very strange indeed, more like a disordered ball of yarn that a nice surface.


No doubt a matter of semantics. I may be assigning to much value to the term “periodic”. I’d have thought that a periodic span, U, could be evaluated beyond the upper bound, yet still return a position on the surface (provided the V input was within the domain). In fact, an extruded circle performs pretty much as expected.

The example above, when evaluated out of bounds, immediately detaches from the surface. Understandable in the open V span, surprising, and TBH a bit disappointing, in the periodic. I’ll get over it.