A question about NurbSurface.Points.CountV

Hi

I am trying to find points at the edge of a nurb surface. The code I have, works well at v=0 but I run in to something I don’t understand at the other end (maxV). I am getting the .NurbSurface.PointAt(u, 0), then finding the NurbSurface.ClosestPoint and then converting back to a point3d with a NurbSurface.PointAt. However when I try to do this at the other edge of the surface using NurbSurface.PointAt(u, NurbSurface.Points.CountV - 1), I get a point that appears to be 2v off the end of the surface. I discovered this yesterday in another way - I was drawing isocurves on the surface for i=0: i < nurbsSrf.Points.CountV; i++ and I got 2 curves (at equal spacing) beyond the end of the surface. In other words. The actual max v on the surface appears to be at nurbsSrf.Points.CountV - 3.

To give the some sample code and a screen dump of the points I’m printing (just to help diagnose the problem - these aren’t the final points):

Point3d pointMin = nurbsSrf.PointAt(u, 0);
Point3d pointMinAdj = nurbsSrf.PointAt(u, 1);

Point3d pointMax = nurbsSrf.PointAt(u, nurbsSrf.Points.CountV - 1);
Point3d pointMaxAdj = nurbsSrf.PointAt(u, nurbsSrf.Points.CountV - 2);

doc.Objects.AddPoint(pointMin);
doc.Objects.AddPoint(pointMinAdj);
doc.Objects.AddPoint(pointMax);
doc.Objects.AddPoint(pointMaxAdj);

I think you confuse the point count with the parameter value to use to evaluate the surface. It is possible to use parameter values outside of the knot domain. These parameters will give points that are outside of the surface. This is what happened in your case.

int offset = nurbsSrf.Degree(1)-1; // to account for multiplicity of knots at start and end of the domain.
double vMin = nurbsSrf.KnotsV[0 + offset];
double vMinAdj = nurbsSrf.KnotsV[1 + offset];

Point3d pointMin = nurbsSrf.PointAt(u, vMin);
Point3d pointMinAdj = nurbsSrf.PointAt(u, vMinAdj);

double vMax = nurbsSrf.KnotsV[nurbsSrf.KnotsV.Count - 1 - offset];
double vMaxAdj = nurbsSrf.KnotsV[nurbsSrf.KnotsV.Count - 2 - offset];

Point3d pointMax = nurbsSrf.PointAt(u, vMax);
Point3d pointMaxAdj = nurbsSrf.PointAt(u, vMaxAdj);

doc.Objects.AddPoint(pointMin);
doc.Objects.AddPoint(pointMinAdj);
doc.Objects.AddPoint(pointMax);
doc.Objects.AddPoint(pointMaxAdj);

Thanks so much! Very much appreciated!

Hannah