[vtk-developers] Class design for spline visualizations

Lin M majcjc at gmail.com
Mon Apr 6 11:17:35 EDT 2015


Yes, I got it now. :-)

The only left thing is a presumption that how control points are arranged.
My opinion is that the control points are stored in this order:

P_{0, 0, 0};P_{1, 0, 0};...;P_{degree[0], 0, 0};
P_{0, 1, 0};P_{1, 1, 0};...;P_{degree[0], 1, 0};
...
P_{0, degree[1], 0};P_{1, degree[1], 0};...;P_{degree[0], degree[1], 0};
P_{0, 0, 1};P_{1, 0, 1};...;P_{degree[0], 0, 1};
...
P_{0, degree[1], degree[2]};P_{1, degree[1], degree[2]};...;P_{degree[0],
degree[1], degree[2]};

On Mon, Apr 6, 2015 at 10:55 AM, David Thompson <david.thompson at kitware.com>
wrote:

> Hi Lin,
>
> One last correction: P_i will have 4 components per tuple. The outputPt
> array may have either 3 or 4 components per tuple (depending on whether you
> perform the projection division operation or not).
>
>         David
>
> On Apr 6, 2015, at 10:53 AM, David Thompson <david.thompson at kitware.com>
> wrote:
>
> >> In the function:
> >> void InterpolateOnPatch(vtkDataArray* outputPt, vtkDataArray* P_i,
> double* r);
> >
> > Sorry, I see that I did not specify quite enough information. In
> addition to P_i, you will also need to know how the control points are
> arranged. So, a proper signature could be
> >
> >  void InterpolateOnPatch(vtkDataArray* outputPt, int dim, vtkDataArray*
> P_i, int* degree, double* r);
> >
> > where
> >
> >  outputPt is a VTK data array to hold interpolated points.
> >           It will have 3 components; you should use InsertNextPoint()
> >           to add the 3-D coordinates mapped from r by the patch.
> >  dim      is the dimension of the parameter-space.
> >           This is the size of the arrays named r and degree.
> >  P_i      is a VTK data array of control point coordinates.
> >           It will have 3 components per tuple.
> >           The number of tuples will be the product of the entries
> >           in degree + 1. For example, if dim == 3, then P_i should
> >           have (degree[0] + 1)*(degree[1] + 1)*(degree[2] + 1) tuples.
> >  degree   is an array of integer values specifying the degree
> >           of along each parametric coordinate in the patch.
> >           When dim == 1, degree has a single entry specifying the
> >           degree of a curve (degree[0] == 1 -> linear, degree[0] == 3 ->
> cubic).
> >  r        is an array of parametric coordinates specifying a single point
> >           on the patch. It is of length dim.
> >
> > I am working on a test that will pass this function curve, surface, and
> volume patches of different degree including some well-known test cases
> like this biquartic sphere of parametric dimension 2 (dim == 2):
> >
> >
> http://content.lib.utah.edu/utils/getfile/collection/uspace/id/3043/filename/2155.pdf
> >
> > Does this make more sense?
> >
> >       David
> >
> >> 1. Do I assume that i and r are both a 3-vectors here? If not, how do I
> determine the dimension of that?
> >> 2. Do I assume the highest degree of each polynomial dimension is equal
> to each other, thus the maximum of (i,j,k) for P_{i,j,k} can be calculated
> by max(i)=max(j)=max(k)=P_i->GetNumberOfTuples()/3?
> >> 3. Even I know the maximum of (i,j,k), what's the order of storage for
> the P_i in memory?
> >>
> >> Best,
> >> Lin
> >>
> >>
> >> On Fri, Apr 3, 2015 at 12:56 PM, David Thompson <
> david.thompson at kitware.com> wrote:
> >>> 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
> >>
> >
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/vtk-developers/attachments/20150406/69491b15/attachment-0001.html>


More information about the vtk-developers mailing list