<div dir="ltr">Hi Dr. Thompson,<div><br></div><div>Is there any example for 2- and 3-d Bezier Interpolation?</div><div><br></div><div>Best,</div><div>Lin</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Sat, May 30, 2015 at 1:54 PM, Lin M <span dir="ltr"><<a href="mailto:majcjc@gmail.com" target="_blank">majcjc@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Hi Dr. Thompson,<div><br></div><div>I have written a helper function to generate control points for arbitrary ellipse and modified the PatchInterpolation.py test to image test which contains line, circle and ellipse.</div><div><br></div><div>A question about the push the data. I followed the instruction in <a href="https://gitlab.kitware.com/vtk/vtk/blob/master/Documentation/dev/git/data.md" target="_blank">https://gitlab.kitware.com/vtk/vtk/blob/master/Documentation/dev/git/data.md</a>, but I didn't see the message when doing the commit step.</div><div><br></div><div><pre style="font-family:Menlo,'Liberation Mono',Consolas,'DejaVu Sans Mono','Ubuntu Mono','Courier New','andale mono','lucida console',monospace;font-size:12px;white-space:pre-wrap;padding:8.5px;margin-top:0px;margin-bottom:9px;line-height:1.428571429;word-break:break-all;word-wrap:break-word;color:rgb(51,51,51);border:1px solid rgb(204,204,204);border-radius:4px;background-color:rgb(245,245,245)"><code style="font-family:Menlo,'Liberation Mono',Consolas,'DejaVu Sans Mono','Ubuntu Mono','Courier New','andale mono','lucida console',monospace;font-size:inherit;padding:0px;color:inherit;white-space:pre-wrap;border-radius:0px;word-wrap:normal;margin-top:0px;background-color:transparent">Some/Module/Testing/Data/Baseline/MyTest.png.md5: Added content to Git at refs/data/MD5/...
Some/Module/Testing/Data/Baseline/MyTest.png.md5: Added content to local store at .ExternalData/MD5/...
Content link Some/Module/Testing/Data/Baseline/MyTest.png.md5 -> .ExternalData/MD5/...</code></pre></div><div>The image test runs correctly in my local machine.</div><div><br></div><div>Best,</div><div>Lin</div></div><div class="HOEnZb"><div class="h5"><div class="gmail_extra"><br><div class="gmail_quote">On Sat, May 23, 2015 at 12:16 AM, David Thompson <span dir="ltr"><<a href="mailto:david.thompson@kitware.com" target="_blank">david.thompson@kitware.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="auto"><div>Hi Lin,</div><div><br></div><div>I believe VTK expects each test to generate a single baseline image whose filename matches the Python script name (e.g., <font color="#000000" style="text-decoration:none;outline:none;background-color:rgba(255,255,255,0)"><a href="https://gitlab.kitware.com/vtk/vtk/blob/master/Filters/Core/Testing/Python/TestSynchronizedTemplates3D.py" style="text-decoration:none;outline:none;background-color:rgba(255,255,255,0)" target="_blank">TestSynchronizedTemplates3D.py</a> must have its baseline image named </font><font color="#000000" style="text-decoration:none;outline:none;background-color:rgba(255,255,255,0)"><a href="https://gitlab.kitware.com/vtk/vtk/blob/master/Filters/Core/Testing/Python/TestSynchronizedTemplates3D.py" style="text-decoration:none;outline:none;background-color:rgba(255,255,255,0)" target="_blank">TestSynchronizedTemplates3D.</a>png in the Data/Baselines directory).</font></div><span><font color="#888888"><div><font color="#000000" style="text-decoration:none;outline:none;background-color:rgba(255,255,255,0)"><br></font></div><div><font color="#000000" style="text-decoration:none;outline:none;background-color:rgba(255,255,255,0)"> David</font></div></font></span><div><div><div><br>On May 22, 2015, at 23:15, Lin M <<a href="mailto:majcjc@gmail.com" target="_blank">majcjc@gmail.com</a>> wrote:<br><br></div><blockquote type="cite"><div><div dir="ltr">Hi Dr. Thompson<div><br></div><div>I changed the python test to baseline image and followed the instructions in the VTK Data page, but running CMake doesn't seem to make the .md5 files. Do you have any idea about that?</div><div><br></div><div>I outputed two images named bezier-circle.png and bezier-line.png and put them in source-tree/Filters/Bezier/Testing/Data/Baseline.</div><div><br></div><div>Best,</div><div>Lin</div><div><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, May 19, 2015 at 1:52 PM, David Thompson <span dir="ltr"><<a href="mailto:david.thompson@kitware.com" target="_blank">david.thompson@kitware.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi Lin,<br>
<br>
A few additional things that might help:<br>
<br>
1. When you are done reviewing the merge request I assigned to you, please click "Accept merge request" or add a "+1" comment so that it will become part of the splines/filter-bezier branch.<br>
<br>
2. A good pattern to follow for the image-based test is Filters/Sources/Testing/Python/TestPlatonicSolids.py . You can see how it obtains the path to img_file and calls vtk.test.Testing.compareImage to perform a rendering to compare. The baseline image that the rendering is compared against is not stored in the VTK git repo. Instead, MD5 checksums of images are stored in the git repo and the images are uploaded separately. See<br>
<br>
<a href="https://gitlab.kitware.com/vtk/vtk/blob/master/Documentation/dev/git/data.md" target="_blank">https://gitlab.kitware.com/vtk/vtk/blob/master/Documentation/dev/git/data.md</a><br>
<br>
for a description of how to generate a test image, add its MD5 sum, and upload it with your merge request.<br>
<br>
3. If you are going to generate helper methods to create conic sections, then be aware that you'll have to return multiple sets of control points because ellipses cannot be represented with a single patch (it is best to return one patch per quadrant) because of the way they are parameterized.<br>
<span><font color="#888888"><br>
David<br>
</font></span><div><div><br>
> On May 18, 2015, at 10:45 PM, Lin M <<a href="mailto:majcjc@gmail.com" target="_blank">majcjc@gmail.com</a>> wrote:<br>
><br>
> Hi Dr. Thompson<br>
><br>
> Thanks! I'll look into that and implement the test asap.<br>
><br>
> Best,<br>
> Lin<br>
><br>
> On Mon, May 18, 2015 at 10:36 PM, David Thompson <<a href="mailto:david.thompson@kitware.com" target="_blank">david.thompson@kitware.com</a>> wrote:<br>
> Hi Lin,<br>
><br>
> Sorry for the slow reply.<br>
><br>
> > Is there any dataset for precomputed Bezier interpolation? I'm currently comparing the result with my manual calculating. In this way I can not test many examples and it's quite low efficient.<br>
><br>
> I've pushed a merge request to the project that adds a couple simple test cases. I'll add some more over the next few days. You can run the test by building VTK with the VTK_WRAP_PYTHON option turned ON and then running:<br>
><br>
> make<br>
> ./bin/vtkpython /path/to/src/Filters/Bezier/Testing/Python/PatchInterpolation.py<br>
><br>
> If you uncomment the lines below the "For debugging, ..." message in PatchInterpolation.py, running the test will create some files (named bezier-circle.vtk and bezier-line.vtk) that you can load into ParaView.<br>
><br>
> 1. As I mentioned earlier, it would be great to do image-based testing. A good exercise would be to modify the Python test into an image test version.<br>
><br>
> 2. Another good exercise would be to generate control points for other conic sections such as hyperbolas, parabolas, and the more generate case of ellipses. I recommend "The NURBS Book" by Les Piegl; the circle quadrant example in the Python test is from pp. 26--32 of the book. It would be really nice to have a utility that would create control points given a few shape parameters. For example:<br>
><br>
> ctrlPts, prange = ellipse(major_radius=2, minor_radius=1)<br>
> ctrlPts, prange = hyperbola(semi_major_axis=2/3, eccentricity=1)<br>
><br>
> Once we have the 1-, 2-, and 3-d Bezier interpolation tested, we can work on converting B-splines into Bézier patches and testing that.<br>
><br>
> David<br>
><br>
> ><br>
> > On Mon, Apr 27, 2015 at 1:46 PM, David Thompson <<a href="mailto:david.thompson@kitware.com" target="_blank">david.thompson@kitware.com</a>> wrote:<br>
> > Hi Lin,<br>
> ><br>
> > > ... I changed the method to compute binomial coefficient from vtkMath::Binomial to vtkMath::Factorial using our memoization improvement and tried to merge from Lin.Ma/filter-bezier to Spline/filter-bezier.<br>
> ><br>
> > Great! I can see that you were able to merge to the branch.<br>
> ><br>
> > > What do you think is the proper thing to do next?<br>
> ><br>
> > Right now, it looks like TestPatchInterpolation is modifying the array holding control point coordinates. I think it would be a good idea to write the interpolated points to a separate array and then make the test verify that Bernstein polynomial is being computed properly.<br>
> ><br>
> > There are 2 ways to verify things: value tests and image tests.<br>
> ><br>
> > 1. Value testing. Interpolate a few different r values on a few different sets of control points and compare the resulting point coordinates to values you know are good. The comparison must allow for small differences due to the differences in floating-point arithmetic implementations on different platforms.<br>
> ><br>
> > 2. Image testing. Plot the interpolated points and compare the rendering of the interpolated points to one you have verified is correct. While not as accurate as value testing, it can often be easier to debug a failing test with a rendered image. VTK provides utilities for comparing images (also allowing for small differences due to floating-point math, OpenGL implementations, and so on). The image baselines that get compared to your test's rendering are stored outside of the git repository to keep the repository from getting bloated. Instead, the MD5 sum of the baseline images are stored in the git repository and the images are stored separately on Kitware's servers, which can be queried to find a file with a given MD5 sum.<br>
> ><br>
> > Please take a look at this documentation on adding test data and baseline images to VTK:<br>
> ><br>
> > <a href="https://gitlab.kitware.com/vtk/vtk/blob/master/Documentation/dev/git/data.md" target="_blank">https://gitlab.kitware.com/vtk/vtk/blob/master/Documentation/dev/git/data.md</a><br>
> ><br>
> > and see if you can add an image-based test of the patch interpolation.<br>
> ><br>
> > David<br>
> ><br>
><br>
><br>
<br>
</div></div></blockquote></div><br></div>
</div></blockquote></div></div></div></blockquote></div><br></div>
</div></div></blockquote></div><br></div>