[vtk-developers] Adding ComputeArea() to vtkTriangle

David Doria daviddoria+vtk at gmail.com
Tue Jan 5 16:38:56 EST 2010


On Wed, Dec 23, 2009 at 3:40 PM, David Doria <daviddoria+vtk at gmail.com> wrote:
> On Tue, Dec 22, 2009 at 4:54 PM, Bill Lorensen <bill.lorensen at gmail.com>
> wrote:
>>
>> You can do whatever you want to in a test as long as it is portable.
>>
>> On Tue, Dec 22, 2009 at 4:45 PM, David Doria <daviddoria+vtk at gmail.com>
>> wrote:
>> >  Tue, Dec 22, 2009 at 4:39 PM, David Cole <david.cole at kitware.com>
>> > wrote:
>> >>
>> >> On Tue, Dec 22, 2009 at 4:34 PM, David Doria <daviddoria+vtk at gmail.com>
>> >> wrote:
>> >>>
>> >>> On Tue, Dec 22, 2009 at 4:21 PM, Bill Lorensen
>> >>> <bill.lorensen at gmail.com>
>> >>> wrote:
>> >>>>
>> >>>> 1) I would modify the current test for triangle.
>> >>>> 2) When you add the TestPolygon test, check vtkPolygon's coverage to
>> >>>> see if you can exercise some uncovered code. There are 193 uncovered
>> >>>> lines of code:
>> >>>>
>> >>>>
>> >>>> http://www.cdash.org/CDash/viewCoverageFile.php?buildid=498540&fileid=10908473
>> >>>>
>> >>>> Bill
>> >>>
>> >>> Ok, I'll add more polygon tests. I've never looked at these coverage
>> >>> files - I'm assuming that the red 000000 means that line is not
>> >>> tested? Can
>> >>> you figure out where the line is tested by the number? e.g.
>> >>>
>> >>> 00037579   void vtkPolygon::ComputeNormal(vtkPoints *p, double *n)
>> >>>
>> >>> How would you turn 00037579 into a file name?
>> >>
>> >> The number preceding each line is supposed to be the number of times
>> >> that
>> >> line was called. To find callers, grep for the function name, once you
>> >> find
>> >> a candidate, set a breakpoint on the line and run a test in the
>> >> debugger to
>> >> verify that you can stop there...
>> >>
>> >
>> > A couple more things...
>> > 1) Can/should tests use smart pointers?
>> > 2) Can this function be placed somewhere so it doesn't need to be copied
>> > into many of the tests?
>> > // Perform a fuzzy compare of floats/doubles
>> > template<class A>
>> > bool fuzzyCompare(A a, A b) {
>> >   return fabs(a - b) < vtkstd::numeric_limits<A>::epsilon();
>> > }
>> > Thanks,
>> >
>> > David
>
> I have written tests for several of the vtkPolygon functions (2 versions of
> ComputeNormal and IntersectPolygonWithPolygon). Some were very awkward -
> taking double* input rather than vtkPoints - maybe I will wrap these into
> polygon->ComputeNormal(normal);
> and
> polygon->IntersectWithPolygon(polygon2);
> Anyone have a problem with this?
> Is there a way I can verify the coverage increase before committing these?
> Or should I just look at the dashboard coverage the next day?
> Thanks,
>
> David

Any comments on these function additions?

Thanks,

David



More information about the vtk-developers mailing list