[vtk-developers] Class design for spline visualizations

David Thompson david.thompson at kitware.com
Tue Jun 30 14:10:22 EDT 2015


Hi Lin,

> I didn't separate the homogenous coordinate with point coordinates but stored them all in a vtkDataArray with 4 components per tuple just as you suggest. In this way, vtkStructuredGrid cannot hold them as vtkPoints. The current API is like
> 
> void vtkNURBSPatchAdaptor::GetPatchShape(vtkUnstructuredGrid* outputSp, vtkDataArray* ctrlPts, int* ctrlPtsNum)
> the outputSp holds the surface mesh, ctrlPts and ctrlPtsNum hold information and data of nurbs control points, and the vtkSturcturedGrid only holds knot vectors and length.

Actually, the vtkStructuredGrid can hold the control points as PointData() (as opposed to Point  coordinates). There is no constraint on the number of components per tuple. The idea is to access the control points and knot data like this:

  vtkStructuredGrid* splineData;
  vtkDataArray* controlPoints = splineData->GetPointData()->GetArrayByName("control polygon");
  vtkDataArray* knotVector = splineData->GetFieldData()->GetArrayByName("knot vector");
  int numControlPointsPerAxis[3];
  splineData->GetDimensions(numControlPointsPerAxis);

That way all of the spline data is grouped into one dataset; it's just that the splineData's vtkPoints would not hold the control points. We could also store additional information in the arrays of splineData->GetFieldData(). For example, flags indicating which axes (if any) were periodic could be stored in a separate field-data array since there is no constraint on the number of components or tuples of field-data arrays.

Does that make sense?

	David



More information about the vtk-developers mailing list