[vtk-developers] Adding ComputeArea() to vtkTriangle

Wes Turner wes.turner at kitware.com
Tue Dec 22 10:04:40 EST 2009


A cell can have a 0 size ... take for example a degenerate triangle.  It
would be nice if any implementation could differentiate between the general
"I don't know how to do this" and the "Your cell is broken".

- Wes

On Tue, Dec 22, 2009 at 9:53 AM, David Doria
<daviddoria+vtk at gmail.com<daviddoria%2Bvtk at gmail.com>
> wrote:

>
> On Mon, Dec 21, 2009 at 10:53 AM, Moreland, Kenneth <kmorel at sandia.gov>wrote:
>
>>  Yes, but the vtkCell classes (of which vtkTriangle is one) is not really
>> like the vtkDataObject objects.  These classes are designed to hold methods
>> for common computations.  For example, they already hold methods for
>> computing interpolation, derivatives, contours, and intersections.  In this
>> regard, a method to compute the length/area/volume of the cell is wholly
>> appropriate.
>>
>> My only criticism (everyone has to have an opinion, right?) is that it
>> would be helpful if there was a pure virtual method in vtkCell, perhaps
>> called ComputeSize, that returned the length, area, or volume (depending on
>> the dimensionality of the cell).  That way you would not have to down cast
>> the vtkCell to some known subclass and hope the implementation is there.
>>
>> Now that I write this, it occurs to me that somewhere there is a
>> vtkCellIntegrator in ParaView that does something similar.  Perhaps the
>> implementation of that could be duplicated in vtkCell.
>>
>> -Ken
>>
>>
>>
>> On 12/18/09 12:15 PM, "Berk Geveci" <berk.geveci at kitware.com> wrote:
>>
>> I think Mathieu brings up an important point. I don't think this has
>> any direct impact on the issue here but it is still a good one. VTK
>> usually separates computation from the data structures. There is a
>> good reason behind this. For example, when you are computing the
>> volume of a polyhedron or performing some other numerical integration
>> over it, there may be more than one way to do it numerically. Some
>> more accurate but more costly, others less accurate but faster. This
>> is why you don't find a lot of computational geometry related methods
>> on vtkPolyData.
>>
>> On Fri, Dec 18, 2009 at 11:09 AM, Mathieu Malaterre
>> <mathieu.malaterre at gmail.com> wrote:
>> > Ok, my bad. I thought this was introducing a new framework to compute
>> > 2D area which seem difficult to extend to 3d cell.
>> >
>> > thanks for clarification.
>> >
>> > On Fri, Dec 18, 2009 at 5:05 PM, Bill Lorensen <bill.lorensen at gmail.com>
>> wrote:
>> >> Mathieu,
>> >>
>> >> vtkTriangle is a cell. It is not filter. It currently has a
>> >> TriangleArea() method, but it is cumbersome to use. David is proposing
>> >> a convenience method to do the computation. It calls the
>> >> TriangleArea() method but save the user from setting up the parameters
>> >> for that call.
>> >>
>> >> Bill
>> >>
>> >> On Fri, Dec 18, 2009 at 10:54 AM, David Doria <
>> daviddoria+vtk at gmail.com> wrote:
>> >>> On Fri, Dec 18, 2009 at 10:51 AM, Mathieu Malaterre
>> >>> <mathieu.malaterre at gmail.com> wrote:
>> >>>>
>> >>>> Hi David,
>> >>>>
>> >>>>  I do not have a strong opinion on this particular case.
>> >>>>  However here is a couple of thoughts, I have from my modest
>> >>>> understanding of VTK.
>> >>>>  1. I would really separate source/sink from filter. You are writing
>> a
>> >>>> partial filter (aka algorithm) in a data object.
>> >>>>  2. You are duplicating (possibly) code from vtkMeshQuality.
>> >>>>
>> >>>> 2cts
>> >>>> -Mathieu
>> >>>
>> >>> 1) I'm not sure I follow. Isn't vtkTriangle an "object", not a
>> "source" or
>> >>> "filter"?
>> >>> 2) That is likely the case and that is exactly my point here -
>> >>> vtkMeshQuality (or anything else) should not have to implement this
>> code, it
>> >>> should just be able to call ComputeArea() on a triangle object.
>> >>> Thanks,
>> >>>
>> >>> David
>> >>> _______________________________________________
>> >>> Powered by www.kitware.com
>> >>>
>> >>> Visit other Kitware open-source projects at
>> >>> http://www.kitware.com/opensource/opensource.html
>> >>>
>> >>> Follow this link to subscribe/unsubscribe:
>> >>> http://www.vtk.org/mailman/listinfo/vtk-developers
>> >>>
>> >>>
>> >>>
>> >> _______________________________________________
>> >> Powered by www.kitware.com
>> >>
>> >> Visit other Kitware open-source projects at
>> http://www.kitware.com/opensource/opensource.html
>> >>
>> >> Follow this link to subscribe/unsubscribe:
>> >> http://www.vtk.org/mailman/listinfo/vtk-developers
>> >>
>> >>
>> >
>> >
>> >
>> > --
>> > Mathieu
>> > _______________________________________________
>> > Powered by www.kitware.com
>> >
>> > Visit other Kitware open-source projects at
>> http://www.kitware.com/opensource/opensource.html
>> >
>> > Follow this link to subscribe/unsubscribe:
>> > http://www.vtk.org/mailman/listinfo/vtk-developers
>> >
>> >
>> _______________________________________________
>> Powered by www.kitware.com
>>
>> Visit other Kitware open-source projects at
>> http://www.kitware.com/opensource/opensource.html
>>
>> Follow this link to subscribe/unsubscribe:
>> http://www.vtk.org/mailman/listinfo/vtk-developers
>>
>>
>>
>>
>>
>>
> Per Ken's suggestion, I am trying to implement a virtual double
> ComputeSize() function for vtkCell.  There are a lot of cells! Many of which
> I have no idea how to get their size. Is it acceptable to somehow commit
> these changes without having all of them implemented? Something like a
> filler "return 0" and a comment "this function has not yet been
> implemented"?
>
> The idea would be that then the framework is setup, so when a developer who
> is familiar with the particular cell subclass sees the missing
> implementation, they could easily fill it in.
>
> Thoughts?
>
> Thanks,
>
> David
>
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Follow this link to subscribe/unsubscribe:
> http://www.vtk.org/mailman/listinfo/vtk-developers
>
>
>


-- 
Wesley D. Turner, Ph.D.
Kitware, Inc.
Technical Leader
28 Corporate Drive
Clifton Park, NY 12065-8662
Phone: 518-881-4920
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/vtk-developers/attachments/20091222/4e1a3014/attachment.html>


More information about the vtk-developers mailing list