Find Point(s) x,y,z on surface at maximum u - create new surface


#1

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.

Steve


(Dale Fugier) #2

Hi Steve,

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.

http://wiki.mcneel.com/developer/opennurbs/limitations

So, you might be able to generate the surface you want using standalone openNURBS.

Why not just use Rhino?


#4

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);


(Dale Fugier) #5

Hi Steve,

If you need to create a grid of points, ON_PointGrid can be useful. See opennurbs_pointgrid.h for details.

If you have an ON_3dPointArray and you need to get a value out if, just dereference it like you would any other array. For example:

ON_3dPointArray points;
points.Add( ON_3dPoint(1,2,3) );
...
ON_3dPoint pt = points[0];

Not sure I’ve answered your questions…


(Menno Deij - van Rijswijk) #6

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

  1. the knot vectors in U- and V-direction
  2. the end conditions (these control the curvature at the end of the surface)
  3. possible periodicity in profile curves (i.e. with a closed, rather than open trailing edge)
  4. 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.