[vtk-developers] Triangular patch interpolation

David Thompson david.thompson at kitware.com
Fri Aug 21 10:43:59 EDT 2015


Hi Lin,

> I have merged the branch to spline/VTK. How can I make the Cdash test work then?

One thing you can do is create an account on midas3.kitware.com and upload the baseline images to your account there. Make sure you make the images public so that the dashboards can get to them. (VTK's ExternalData module fetches baselines from midas3 by searching for public files with a matching MD5 checksum.)

The other way is to follow the instructions:

https://gitlab.kitware.com/vtk/vtk/blob/master/Documentation/dev/git/develop.md
https://gitlab.kitware.com/vtk/vtk/blob/master/Documentation/dev/git/data.md

to create a merge request to the main VTK repo. You should probably rebase the spline/VTK changes to VTK's master branch before submitting that merge request.

	David

> 
> On Fri, Aug 21, 2015 at 12:58 PM, Lin M <majcjc at gmail.com> wrote:
> Hi Dr. Thompson,
> 
> I have finished supplementary documentation for the vtkFiltersBezier module. I think it's ready to be tested now.
> 
> On Thu, Aug 20, 2015 at 11:56 PM, Lin M <majcjc at gmail.com> wrote:
> Hi Dr. Thompson,
> 
> I have added image based tests for almost all vtkFiltersBezier related class including BREP file reader, patch(simplicial) interpolation and point projection for both curve and surface example.
> 
> I will complete required documents soon.
> 
> Best,
> Lin
> 
> On Tue, Aug 18, 2015 at 8:23 PM, David Thompson <david.thompson at kitware.com> wrote:
> Hi Lin,
> 
> It has been a while since we talked about that, and I am not sure from looking at the method whether Pt is supposed to be the input or output. If the input, then it should be named something like coord instead of Pt. If the output, then you are correct, it should be a "double*" and the documentation should spell out how much memory it must point to. (Since in general the n-th derivative is a symmetric tensor of rank n, there are (n+1)(n+2)...(n+k-1)/(k-1) partial derivatives. This is related to Pascal's simplex. See https://en.wikipedia.org/wiki/Pascal%27s_pyramid#Parallels_to_Pascal.27s_triangle_and_Multinomial_Coefficients and https://en.wikipedia.org/wiki/Differential_of_a_function#Higher-order_differentials .)
> 
> It is fine to have different methods for curves, surfaces, and volumes for now. As you can see in the links above, the general pattern is that the n-th total derivative is a tensor of all possible combinations of partial derivatives with respect to the 1, 2, or 3 parametric coordinates. Call the parametric coordinates r_i for i in {1, 2, 3} and say we are taking the n-th derivative of f. Then Python code to compute one possible ordering of the partial differentials in the output array would be
> 
> def pdiff(i,n):
>     r=[]
>     if i == 1:
>         return [[n,],]
>     for x in range(n+1):
>         for y in pdiff(i-1,n-x):
>             r.append(y+[x,])
>     return r
> 
> which returns a list of i-tuples that all sum to n. For example
> 
> pdiff(2,1) returns [[1, 0], [0, 1]]
> pdiff(2,2) returns [[2, 0], [1, 1], [0, 2]]
> 
> pdiff(3,1) returns [[1, 0, 0], [0, 1, 0], [0, 0, 1]]
> pdiff(3,2) returns [[2, 0, 0], [1, 1, 0], [0, 2, 0], [1, 0, 1], [0, 1, 1], [0, 0, 2]]
> 
> However, really only the first (Jacobian, a vector) and second (Hessian, a symmetric 3x3 matrix with 6 unique entries) derivatives are used very much because (a) the number of terms grows very fast with increasing derivative and (b) the first 2 derivatives are used widely for root-finding and curvature computation but further derivatives are not.
> 
>     David
> 
> On Aug 17, 2015, at 22:40, Lin M <majcjc at gmail.com> wrote:
> 
>> Hi Dr. Thompson,
>> 
>> I found you left an interface for vtkBezierPatchAdaptro::EvaluateDeriv(double Pt[3], double* Paras, int d).
>> For 1-d curve, the derivative is always a 3*1 vector, but with the parametric dimension increasing, higher order derivatives will contain many points (it becomes matrix-by-vector differential). I can't figure out a generalized way to interpret this. That's why I declared functions to compute derivative for curve, surface and volume separately. Do you have any suggestions for that? Thanks!
>> 
>> Best,
>> Lin
>> 
>> On Tue, Aug 18, 2015 at 1:04 AM, David Thompson <david.thompson at kitware.com> wrote:
>> Hi Lin,
>> 
>> > I have some questions about the test.
>> > 1. About simplicial interpolation. Should I test some simple cases (hard coded simple shape) or some shapes like the motorcycle?
>> 
>> Those are 2 different types of tests. (There are many; see http://stackoverflow.com/questions/437897/what-are-unit-testing-and-integration-testing-and-what-other-types-of-testing-s for some lists of test types). The first test (simple hard-coded shape) is a unit test and the second (test of both the reader, spline-to-patch class, and patch interpolation) is an integration test.
>> 
>> Both are important, but since you already have an integration test for the motorcycle, I think a good set of unit tests for simplicial interpolation would be enough.
>> 
>> > If it is the latter one, how to convert the rectangular patch to simpicial patch?
>> >
>> > 2. About point inversion. How to test it for the simpicial patch? I only implemented the point inversion for NURBS patch.
>> 
>> If you didn't implement it, you can't test it. :-) However, if you know what you want the test to look like, you can write the test before you implement inversion and just leave it commented out with a note. Many people think this is how development should be done in the first place, since it forces you to consider how people will use what you write.
>> 
>> > 3. About derivative computation. Should I just test them numerically? For example, given a shape and a parametric coordinate, test the result of our implementation with ground truth.
>> 
>> Again, since you are using the derivatives in code that is part of an integration, I think unit testing (as you suggest) is enough.
>> 
>>         David
>> 
> 
> 
> 



More information about the vtk-developers mailing list