Steve,
I used this code to try and add a nurbs surface on top of non-planar quads in the mesh. The mesh vertices pt0, pt1, pt2, pt3 are used to create the nurbs surface.
ON_NurbsSurface nurbs_surface;
int dimension = 3; // 3D surface
bool is_rational = true; // Rational surface
int order0 = 2; // Order in the U direction
int order1 = 2; // Order in the V direction
int cv_count0 = 2; // Number of control points in the U direction
int cv_count1 = 2; // Number of control points in the V direction
bool good = nurbs_surface.Create(dimension, is_rational, order0, order1, cv_count0, cv_count1);
nurbs_surface.SetCV(0, 0, pt0); nurbs_surface.SetCV(1, 0, pt1);
nurbs_surface.SetCV(1, 1, pt2); nurbs_surface.SetCV(0, 1, pt3);
sattribs.m_color = scolor;
c4 = pDoc->AddSurfaceObject(nurbs_surface, spattribs);
if (!c4) nb++;
else ng++;
The number of non-planar quads in this mesh is 493. Only 196 of these get a nurbs surface added (ng) while 297 (nb) do not. I do no know why this is happening. Also the faces that get an added nurbs surface is not reproducible as shown in the 3 successive results below:
Those images are all for Wireframe View. In Shaded View the last one looks like:
Notice 2 of the faces are completely colored in. I have no idea why but this is what I want for all the non-planar faces.
I have not been able to reproduce my earlier picture with the black rectangle colored red.
The non-planar quads are outlined in green using other code that traces over the edges of the mesh face with thick green lines.
Here is the .3dm showing the case with a few solid colored faces:
2D Nurbs Surface on top of non-planar quads.3dm (2.4 MB)
I have virtually no experience with nurbs surfaces. I would not be surprised if my bit of code above has issues. Something is definitely off as less than 50% of the faces are getting nurbs surfaces and the result is not reproducible from run to run. There’s trouble in River City and it starts with Nurbs…
Regards,
Terry,