is possible to convert the (x;y) coordinates system into a NURBS definition control points and knots?
The main idea is that I'm trying to develop a modeling tool in python for air wind generator and I want mathematically model the blades as a NURBS surfaces, but the curves that defines the blade transversal sections are normalized into (x;y) coordinates files.
Now I have all the (x;y) points defined into 2D Numpy array.
Are you certain that you need NURBS surfaces? As far as I can tell, their primary advantage over b-spline surfaces is that they can precisely model circular arcs. I've worked with airfoils for many years, and arcs aren't something that are particularly useful to me.
Anyway, romeric is correct when he states that there is nothing analogous to scipy.interpolate.splprep
for surfaces.
But if you're not against rolling your own, you can create a 3D array
from your section data of shape (3, m, n), where 'm' is the number of points per section, 'n' is the
number of sections, and the first dimension holds x, y, and z values on the m x n grid.
Once you have that, you can use scipy.interpolate.RectBivariateSpline
to create
3 separate 2D parametric surfaces for the x, y and z coordinates. Then write
a class to combine these into a single 2D surface in 3D space, so that when you call
mysurf.ev(0.5, 0.2)
for instance, it evaluates the 3 RectBivariateSpline
instances embedded in your class and returns an (x, y, z) coordinate.
I've posted a Gist here that may get you started. To try it, either run it from the command line, or do this:
from bsplinesurf import DemoBSplineSurf
srf = DemoBSplineSurf()
srf.plot()