I have a Rhino 4 file that contains one or more surfaces, these surfaces are NACA 0018 airfoils created using Sweep 2 Rails with the u direction aligned with the x-axis. I want to create a new surface, using the opennurbs toolkit, not Rhino, using starting location of airfoil trailing edge of one of the airfoil surfaces. How do I find the point(s), in x,y,z coordinates of the trailing edge of the foil and use those points as the starting location for my new surface? I would also like the isocurves in the v-direction on airfoil to align with the new surface. I am using the write_surface_example as a starting point for my surface creation.
To find locations on a curve, you would normally use:
ON_Curve::GetClosestPoint
ON_Curve::PointAt
or
ON_Curve::Evaluate
ON_Curve::EvPoint
The problem I see that that standalone openNURBS toolkit does not contain closest point calculations, as the toolkit is designed to read and write 3dm files.
Hi Dale,
Thank you for your response. I posted an example of the method I used below. So my cvarray holds the CV’s of the trailing edge of the surface, essentially at u=constant and varying v. I have made an assumption that chordwise is parallel to the u-dir (0). I want to create a point grid, lets say 10 in u-dir and 10 in v-dir using the cvarray as the starting edge of my new surface. Since my cvarray is an ON_3dPointArray I am not sure how to extract each CV in the cvarray to use as my starting point for the point grid. I have set up a nested for loop to create the points in the u-dir for each CV in the cvarray. i’m just not sure how to access the each CV in the 3dPointArray. Any guidance?
The second group of code is my first attempt and creating the point grid.
//get CV’s of trailing edge of surface
ON_3dPoint eval_cv;
ON_3dPointArray *cvarray = new ON_3dPointArray;
//GetCV at each CV on surface
for ( int i = nurbs_srf->CVCount(0)-1; i < nurbs_srf->CVCount(0); i++ ) { //u-dir
for ( int j = 0; j < nurbs_srf->CVCount(1); j++ ) { //v-dir
nurbs_srf->GetCV( i, j, eval_cv ); //Get the CV coordinates
cvarray->Append(eval_cv); //append each point to 3dPointArray
//Construct 3dPointArray (point cloud) to perform surface interpolation
ON_3dPoint pt3d;
ON_3dPointArray *ptarray = new ON_3dPointArray;
for ( int u = 0; u < 10; u++ ) {
pt3d = // trailing edge CV from each index in cvarray
for ( int v = 1; v < 10; v++ ) {
//create 3d point, offset in u-dir, aligned with CV trailing edge
ptarray->Append(pt3d);
If you are using openNURBS, you may want to look into coding your own bicubic NURBS interpolation code when going from NACA profile curves or points to a wing or propeller surface.
In my experience, you need detailed control over
the knot vectors in U- and V-direction
the end conditions (these control the curvature at the end of the surface)
possible periodicity in profile curves (i.e. with a closed, rather than open trailing edge)
the behavior at singularities (when one of the four sides of the NURBS surface is collapsed into a single point, if any)
I would start by reading a good introductory text about NURBS, if you haven’t already done so. My recommendation would be “Curves and Surfaces for Computer Aided Geometry and Design” by G. Farin. In chapter 14 he goes into detail about surface interpolation.