Getting BSPLINESURFACE parameters from points on the surface

How would one obtain the spline parameters from a point on the spline surface?
I have looked at the header file opennurbs_surface.h but see no function to do this task.

Only the rhino sdk allows you to do this, openNURBS had no such functionality.

Are you familiar with what would be involved to solve this problem using Rhino SDK? I may be willing to expand into using it.

Keeping in mind that openNURB is just a toolkit for reading and writing Rhino’s 3dm file format, there are a number of features missing that you might normally see in a geometry library.

That said, these features are implemented in our full-featured toolkit, which is the Rhino SDK.

In the Rhino SDK, you can calculate the parameters of the point on the surface that is closest to a test point using either ON_Surface::GetClosestPoint or ON_Surface::PointAt.

– Dale

It is a two dimensional optimization problem, that can be solved using standard optimization routines. Of course there are implementation details, especially finding a good start point for the optimization. This is typically done on a coarse mesh generated on the surface, for which an R-tree representation can be used to solve kd-closest point problem, giving an initial start u,v coordinate.

@menno I have contemplated writing an steepest descent optimization given that I can get the gradient from opennurbs, but I didn’t want to RITW if I didn’t have to. @dale I have been using opennurbs as a geometry tool to sample NURBS, perhaps I would be better of giving Rhino SDK a spin

Maybe you know this already, but you can only use code written to the rhino sdk if rhino is running.

@menno, thanks for that information. I found RHINO through openNurbs and did not know that (Sokath, his eyes uncovered
).

The way I understand it is that OpenNURBS is the open-source part of the code, which is mainly targeted to reading and writing of 3dm files (the Rhino format that itself is open-source) and for “simple” NURBS operations (evaluation, derivatives, etc.)

Then, the Rhino SDK is the proprietary part of Rhino, mainly targeted to writing plug-ins for Rhino. The SDK includes OpenNURBS itself, plus all kinds of more complicated operations, like closest-point finding, mesh generation, complex intersections, etc. etc. Any code written for the Rhino SDK will only run as part of a Rhino plug-in.

In general I think this is great. Rhino has a low entry barrier (commercial license is ~1000 USD, edu license is a fraction of that) compared to other CAD packages like AutoCAD, Inventor, etc. Once you have a license for Rhino, you basically get all the advanced CAD functionality of the Rhino SDK, and you have a kick-ass CAD program to boot.

Alternatives include open-source CAD packages like BRL-CAD and OpenCASCADE.

I think it’s a very respectable business model, and it makes sense now that I know. I surfed the project and found that openNURBS has a ton of basic tools for edge geometry, surfaces &c. In my particular situation, the tool is sufficient as I can represent the edges as spline curves through the library, and represent it as a curve on the surface. I appreciate the help from both of you!

I am now using the method proposed by Hu and Wallner in A second order algorithm for orthogonal projection onto curves and surfaces (http://www.geometrie.tugraz.at/wallner/sproj.pdf)

1 Like