<HTML>
<HEAD>
<TITLE>Re: [vtk-developers] Adding ComputeArea() to vtkTriangle</TITLE>
</HEAD>
<BODY>
<FONT FACE="Calibri, Verdana, Helvetica, Arial"><SPAN STYLE='font-size:11pt'>Why not have a default implementation that breaks the cell into simplicia (line segments, triangles, or tetrahedra)?  That’s what vtkCellIntegrator (attached) does.<BR>
<BR>
-Ken<BR>
<BR>
<BR>
On 12/22/09 7:53 AM, "David Doria" <<a href="daviddoria+vtk@gmail.com">daviddoria+vtk@gmail.com</a>> wrote:<BR>
<BR>
</SPAN></FONT><BLOCKQUOTE><FONT FACE="Calibri, Verdana, Helvetica, Arial"><SPAN STYLE='font-size:11pt'><BR>
On Mon, Dec 21, 2009 at 10:53 AM, Moreland, Kenneth <<a href="kmorel@sandia.gov">kmorel@sandia.gov</a>> wrote:<BR>
</SPAN></FONT><BLOCKQUOTE><FONT FACE="Calibri, Verdana, Helvetica, Arial"><SPAN STYLE='font-size:11pt'>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.<BR>
<BR>
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.<BR>
<BR>
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.<BR>
<BR>
-Ken<BR>
<BR>
<BR>
<BR>
On 12/18/09 12:15 PM, "Berk Geveci" <<a href="berk.geveci@kitware.com">berk.geveci@kitware.com</a> <<a href="http://berk.geveci@kitware.com">http://berk.geveci@kitware.com</a>> > wrote:<BR>
<BR>
</SPAN></FONT><BLOCKQUOTE><FONT FACE="Calibri, Verdana, Helvetica, Arial"><SPAN STYLE='font-size:11pt'>I think Mathieu brings up an important point. I don't think this has<BR>
any direct impact on the issue here but it is still a good one. VTK<BR>
usually separates computation from the data structures. There is a<BR>
good reason behind this. For example, when you are computing the<BR>
volume of a polyhedron or performing some other numerical integration<BR>
over it, there may be more than one way to do it numerically. Some<BR>
more accurate but more costly, others less accurate but faster. This<BR>
is why you don't find a lot of computational geometry related methods<BR>
on vtkPolyData.<BR>
<BR>
On Fri, Dec 18, 2009 at 11:09 AM, Mathieu Malaterre<BR>
<<a href="mathieu.malaterre@gmail.com">mathieu.malaterre@gmail.com</a> <<a href="http://mathieu.malaterre@gmail.com">http://mathieu.malaterre@gmail.com</a>> > wrote:<BR>
> Ok, my bad. I thought this was introducing a new framework to compute<BR>
> 2D area which seem difficult to extend to 3d cell.<BR>
><BR>
> thanks for clarification.<BR>
><BR>
> On Fri, Dec 18, 2009 at 5:05 PM, Bill Lorensen <<a href="bill.lorensen@gmail.com">bill.lorensen@gmail.com</a> <<a href="http://bill.lorensen@gmail.com">http://bill.lorensen@gmail.com</a>> > wrote:<BR>
>> Mathieu,<BR>
>><BR>
>> vtkTriangle is a cell. It is not filter. It currently has a<BR>
>> TriangleArea() method, but it is cumbersome to use. David is proposing<BR>
>> a convenience method to do the computation. It calls the<BR>
>> TriangleArea() method but save the user from setting up the parameters<BR>
>> for that call.<BR>
>><BR>
>> Bill<BR>
>><BR>
>> On Fri, Dec 18, 2009 at 10:54 AM, David Doria <<a href="daviddoria+vtk@gmail.com">daviddoria+vtk@gmail.com</a> <<a href="http://daviddoria+vtk@gmail.com">http://daviddoria+vtk@gmail.com</a>> > wrote:<BR>
>>> On Fri, Dec 18, 2009 at 10:51 AM, Mathieu Malaterre<BR>
>>> <<a href="mathieu.malaterre@gmail.com">mathieu.malaterre@gmail.com</a> <<a href="http://mathieu.malaterre@gmail.com">http://mathieu.malaterre@gmail.com</a>> > wrote:<BR>
>>>><BR>
>>>> Hi David,<BR>
>>>><BR>
>>>>  I do not have a strong opinion on this particular case.<BR>
>>>>  However here is a couple of thoughts, I have from my modest<BR>
>>>> understanding of VTK.<BR>
>>>>  1. I would really separate source/sink from filter. You are writing a<BR>
>>>> partial filter (aka algorithm) in a data object.<BR>
>>>>  2. You are duplicating (possibly) code from vtkMeshQuality.<BR>
>>>><BR>
>>>> 2cts<BR>
>>>> -Mathieu<BR>
>>><BR>
>>> 1) I'm not sure I follow. Isn't vtkTriangle an "object", not a "source" or<BR>
>>> "filter"?<BR>
>>> 2) That is likely the case and that is exactly my point here -<BR>
>>> vtkMeshQuality (or anything else) should not have to implement this code, it<BR>
>>> should just be able to call ComputeArea() on a triangle object.<BR>
>>> Thanks,<BR>
>>><BR>
>>> David<BR>
>>> _______________________________________________<BR>
>>> Powered by www.kitware.com <<a href="http://www.kitware.com">http://www.kitware.com</a>> <BR>
>>><BR>
>>> Visit other Kitware open-source projects at<BR>
>>> <a href="http://www.kitware.com/opensource/opensource.html">http://www.kitware.com/opensource/opensource.html</a><BR>
>>><BR>
>>> Follow this link to subscribe/unsubscribe:<BR>
>>> <a href="http://www.vtk.org/mailman/listinfo/vtk-developers">http://www.vtk.org/mailman/listinfo/vtk-developers</a><BR>
>>><BR>
>>><BR>
>>><BR>
>> _______________________________________________<BR>
>> Powered by www.kitware.com <<a href="http://www.kitware.com">http://www.kitware.com</a>> <BR>
>><BR>
>> Visit other Kitware open-source projects at <a href="http://www.kitware.com/opensource/opensource.html">http://www.kitware.com/opensource/opensource.html</a><BR>
>><BR>
>> Follow this link to subscribe/unsubscribe:<BR>
>> <a href="http://www.vtk.org/mailman/listinfo/vtk-developers">http://www.vtk.org/mailman/listinfo/vtk-developers</a><BR>
>><BR>
>><BR>
><BR>
><BR>
><BR>
> --<BR>
> Mathieu<BR>
> _______________________________________________<BR>
> Powered by www.kitware.com <<a href="http://www.kitware.com">http://www.kitware.com</a>> <BR>
><BR>
> Visit other Kitware open-source projects at <a href="http://www.kitware.com/opensource/opensource.html">http://www.kitware.com/opensource/opensource.html</a><BR>
><BR>
> Follow this link to subscribe/unsubscribe:<BR>
> <a href="http://www.vtk.org/mailman/listinfo/vtk-developers">http://www.vtk.org/mailman/listinfo/vtk-developers</a><BR>
><BR>
><BR>
_______________________________________________<BR>
Powered by www.kitware.com <<a href="http://www.kitware.com">http://www.kitware.com</a>> <BR>
<BR>
Visit other Kitware open-source projects at <a href="http://www.kitware.com/opensource/opensource.html">http://www.kitware.com/opensource/opensource.html</a><BR>
<BR>
Follow this link to subscribe/unsubscribe:<BR>
<a href="http://www.vtk.org/mailman/listinfo/vtk-developers">http://www.vtk.org/mailman/listinfo/vtk-developers</a><BR>
<BR>
<BR>
<BR>
</SPAN></FONT></BLOCKQUOTE><FONT FACE="Calibri, Verdana, Helvetica, Arial"><SPAN STYLE='font-size:11pt'><BR>
</SPAN></FONT><FONT SIZE="1"><FONT FACE="Monaco, Courier New"><SPAN STYLE='font-size:7pt'><BR>
</SPAN></FONT></FONT></BLOCKQUOTE><FONT FACE="Calibri, Verdana, Helvetica, Arial"><SPAN STYLE='font-size:11pt'> <BR>
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"?<BR>
<BR>
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.<BR>
<BR>
Thoughts?<BR>
<BR>
Thanks,<BR>
<BR>
David<BR>
<BR>
</SPAN></FONT></BLOCKQUOTE><FONT FACE="Calibri, Verdana, Helvetica, Arial"><SPAN STYLE='font-size:11pt'><BR>
</SPAN></FONT><FONT SIZE="2"><FONT FACE="Consolas, Courier New, Courier"><SPAN STYLE='font-size:10pt'><BR>
   ****      Kenneth Moreland<BR>
    ***      Sandia National Laboratories<BR>
***********  <BR>
*** *** ***  email: <a href="kmorel@sandia.gov">kmorel@sandia.gov</a><BR>
**  ***  **  phone: (505) 844-8919<BR>
    ***      web:   <a href="http://www.cs.unm.edu/~kmorel">http://www.cs.unm.edu/~kmorel</a><BR>
</SPAN></FONT></FONT><FONT FACE="Calibri, Verdana, Helvetica, Arial"><SPAN STYLE='font-size:11pt'><BR>
</SPAN></FONT>
</BODY>
</HTML>