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

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

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?

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

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;
...
ON_3dPoint pt = points[0];
``````