[vtk-developers] Class design for spline visualizations

David Thompson david.thompson at kitware.com
Fri Apr 3 12:56:12 EDT 2015


> My name is Lin. I'm interested in the project idea about spline visualizations from VTK/GSoC2015. I hope I can make some works on this topic and I understand that many preliminary discussions are needed for a new set of classes in VTK. This mail will contain the conversations about class design for this project.

Hi Lin,

One of the first things we should discuss is notation so we can be consistent and avoid confusion.

Notation
--------

One of the first steps will be interpolating points on Bézier patches given control points, P_i, and parametric coordinates, r. Note that i and r may be 1-, 2-, or 3-vectors depending on whether the patch is a curve, surface, or volumetric region. Because VTK assumes points always have 3-D coordinates, each control point will always have 4 coordinates (3 spatial coordinates plus a denominator because we are interested in rational functions). So, a simple bilinear surface patch might be defined by

  P_{0,0} = (0,0,0,1)
  P_{1,0} = (1,0,2,1)
  P_{1,1} = (1,1,0,1)
  P_{0,1} = (0,1,1,1)

and for r = (0.5, 0.5), P(r) = (0.5, 0.5, 0.75, 1). P(r) can be projected to a 3-D point by dividing the first 3 coordinates by the fourth. Let's call the projected version P'(r) = (0.5/1, 0.5/1, 0.75/1).

As the degree increases, more control points will be required. The example above is for a rectangular patch. Bézier patches may also be triangular or tetrahedral by using barycentric coordinates. https://en.wikipedia.org/wiki/B%C3%A9zier_triangle

VTK background
--------------

Because we are dealing with rational patches, one of the first issues will be how control points are represented. The vtkPoints class assumes that points always have 3 coordinates (not 4 like our control points). We can

1. Assume that control points are specified with 2 things: a vtkPoints instance plus a vtkDataArray holding the denominators.
2. Create a new vtkControlPoints class that inherits from vtkPoints and allows for an extra coordinate.
3. Not use vtkPoints instances at all and store control points in a vtkDataArray with 4 components per tuple.

I am leaning toward option 2. Note that these classes do not force a particular memory layout because of recent changes to the VTK array classes. So, another related issue is how the interpolation techniques can be written to allow alternative memory layouts so that isogeometric finite element simulations can specify the memory layout instead of forcing the simulation to adopt VTK's.

It would be a good idea to read this wiki page: http://www.vtk.org/Wiki/VTK/InSituDataStructures (especially the "Mapped vtkDataArrays" section) to understand how the array classes have changed recent to allow different memory layouts.

A good first step would be to write a few tests to perform interpolation of some simple 1-, 2-, and 3-D patches given control points in a vtkDataArray and using the vtkDataArrayIteratorMacro to access control point coordinates. I can provide some control points, parametric coordinates, and the correct interpolated point values if you provide a function like

  void InterpolateOnPatch(vtkDataArray* outputPt, vtkDataArray* P_i, double* r);

that interpolates P_i(r) and stores the result in outputPt by calling outputPt->InsertNextTuple().

	David


More information about the vtk-developers mailing list