<br><div class="gmail_quote">On Tue, Dec 22, 2009 at 3:31 PM, John Platt <span dir="ltr"><<a href="mailto:jcplatt@dsl.pipex.com">jcplatt@dsl.pipex.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
Hi,<br>
<br>
Have you considered computing the cell size numerically? I seem to recall that Gaussian quadrature will give the exact area/volume for polynomial edges provided the integration order is set appropriately. This can be done with one function for triangles & quads, another for pentahedrons & hex's and possibly a 3rd for tetrahedrons & pyramids (including the nonlinear variants). You should expect the size to be negative if the cell is inside-out, or severely distorted with the determinant of the Jacobian changing sign between integration points.<br>

<br>
Just a thought.<br>
<br>
John.<br>
<br>
----- Original Message ----- From: "Bill Lorensen" <<a href="mailto:bill.lorensen@gmail.com" target="_blank">bill.lorensen@gmail.com</a>><br>
To: "Berk Geveci" <<a href="mailto:berk.geveci@kitware.com" target="_blank">berk.geveci@kitware.com</a>><br>
Cc: "VTK Developers" <<a href="mailto:vtk-developers@vtk.org" target="_blank">vtk-developers@vtk.org</a>>; "Moreland,Kenneth" <<a href="mailto:kmorel@sandia.gov" target="_blank">kmorel@sandia.gov</a>><br>

Sent: Tuesday, December 22, 2009 5:24 PM<br>
Subject: Re: [vtk-developers] Adding ComputeArea() to vtkTriangle<div><div></div><div class="h5"><br>
<br>
<br>
I agree with Berk. ComputeArea() for triangle is enough. Maybe also<br>
for vtkPolygon. There is already a TriangleArea method in vtkTriangle<br>
and a ComputeArea() in vtkPolygon.  David D's ComputeArea() is a good<br>
convenience addition.<br>
<br>
On Tue, Dec 22, 2009 at 12:12 PM, Berk Geveci <<a href="mailto:berk.geveci@kitware.com" target="_blank">berk.geveci@kitware.com</a>> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
I don't think that this is a good idea. Users will expect a method<br>
that computes "size" in vtkCell to do it "right". However, unless you<br>
are subdividing adaptively, simple subdivision is likely to be very<br>
inaccurate for higher order cells. Having a default implementation<br>
that may be inaccurate for bunch of subclasses is a bad ideas unless<br>
you have the time and resources to go to all subclasses and override<br>
the default implementation.<br>
<br>
We started with a very simple request: add ComputeArea() to<br>
vtkTriangle. Now, we are talking about going down a path that is long<br>
and somewhat researchy - without resources to go all the way. Unless<br>
David is willing to spend some significant amount of time figuring out<br>
how to compute the volume of higher order elements accurately, I'd<br>
suggest going back to the original ComputeArea() and skipping the<br>
ComputeSize() idea.<br>
<br>
-berk<br>
<br>
On Tue, Dec 22, 2009 at 10:03 AM, Moreland, Kenneth <<a href="mailto:kmorel@sandia.gov" target="_blank">kmorel@sandia.gov</a>> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Why not have a default implementation that breaks the cell into simplicia<br>
(line segments, triangles, or tetrahedra)? That’s what vtkCellIntegrator<br>
(attached) does.<br>
<br>
-Ken<br>
<br>
<br>
On 12/22/09 7:53 AM, "David Doria" <<a href="mailto:daviddoria%2Bvtk@gmail.com" target="_blank">daviddoria+vtk@gmail.com</a>> wrote:<br>
<br>
<br>
On Mon, Dec 21, 2009 at 10:53 AM, Moreland, Kenneth <<a href="mailto:kmorel@sandia.gov" target="_blank">kmorel@sandia.gov</a>><br>
wrote:<br>
<br>
Yes, but the vtkCell classes (of which vtkTriangle is one) is not really<br>
like the vtkDataObject objects. These classes are designed to hold methods<br>
for common computations. For example, they already hold methods for<br>
computing interpolation, derivatives, contours, and intersections. In this<br>
regard, a method to compute the length/area/volume of the cell is wholly<br>
appropriate.<br>
<br>
My only criticism (everyone has to have an opinion, right?) is that it would<br>
be helpful if there was a pure virtual method in vtkCell, perhaps called<br>
ComputeSize, that returned the length, area, or volume (depending on the<br>
dimensionality of the cell). That way you would not have to down cast the<br>
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<br>
vtkCellIntegrator in ParaView that does something similar. Perhaps the<br>
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="mailto:berk.geveci@kitware.com" target="_blank">berk.geveci@kitware.com</a><br>
<<a href="http://berk.geveci" target="_blank">http://berk.geveci</a>@<a href="http://kitware.com" target="_blank">kitware.com</a>> > wrote:<br>
<br>
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="mailto:mathieu.malaterre@gmail.com" target="_blank">mathieu.malaterre@gmail.com</a> <<a href="http://mathieu.malaterre" target="_blank">http://mathieu.malaterre</a>@<a href="http://gmail.com" target="_blank">gmail.com</a>> > wrote:<br>

<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
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="mailto:bill.lorensen@gmail.com" target="_blank">bill.lorensen@gmail.com</a><br>
<<a href="http://bill.lorensen" target="_blank">http://bill.lorensen</a>@<a href="http://gmail.com" target="_blank">gmail.com</a>> > wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
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="mailto:daviddoria%2Bvtk@gmail.com" target="_blank">daviddoria+vtk@gmail.com</a><br>
<<a href="http://daviddoria" target="_blank">http://daviddoria</a>+<a href="mailto:vtk@gmail.com" target="_blank">vtk@gmail.com</a>> > wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
On Fri, Dec 18, 2009 at 10:51 AM, Mathieu Malaterre<br>
<<a href="mailto:mathieu.malaterre@gmail.com" target="_blank">mathieu.malaterre@gmail.com</a> <<a href="http://mathieu.malaterre" target="_blank">http://mathieu.malaterre</a>@<a href="http://gmail.com" target="_blank">gmail.com</a>> ><br>

wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<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>
</blockquote>
<br>
1) I'm not sure I follow. Isn't vtkTriangle an "object", not a "source"<br>
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<br>
code, it<br>
should just be able to call ComputeArea() on a triangle object.<br>
Thanks,<br>
<br>
David<br>
_______________________________________________<br>
Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a> <<a href="http://www.kitware.com" target="_blank">http://www.kitware.com</a>><br>
<br>
Visit other Kitware open-source projects at<br>
<a href="http://www.kitware.com/opensource/opensource.html" target="_blank">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" target="_blank">http://www.vtk.org/mailman/listinfo/vtk-developers</a><br>
<br>
<br>
<br>
</blockquote>
_______________________________________________<br>
Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a> <<a href="http://www.kitware.com" target="_blank">http://www.kitware.com</a>><br>
<br>
Visit other Kitware open-source projects at<br>
<a href="http://www.kitware.com/opensource/opensource.html" target="_blank">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" target="_blank">http://www.vtk.org/mailman/listinfo/vtk-developers</a><br>
<br>
<br>
</blockquote>
<br>
<br>
<br>
--<br>
Mathieu<br>
_______________________________________________<br>
Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a> <<a href="http://www.kitware.com" target="_blank">http://www.kitware.com</a>><br>
<br>
Visit other Kitware open-source projects at<br>
<a href="http://www.kitware.com/opensource/opensource.html" target="_blank">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" target="_blank">http://www.vtk.org/mailman/listinfo/vtk-developers</a><br>
<br>
<br>
</blockquote>
_______________________________________________<br>
Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a> <<a href="http://www.kitware.com" target="_blank">http://www.kitware.com</a>><br>
<br>
Visit other Kitware open-source projects at<br>
<a href="http://www.kitware.com/opensource/opensource.html" target="_blank">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" target="_blank">http://www.vtk.org/mailman/listinfo/vtk-developers</a><br>
<br>
<br>
<br>
<br>
<br>
<br>
Per Ken's suggestion, I am trying to implement a virtual double<br>
ComputeSize() function for vtkCell. There are a lot of cells! Many of which<br>
I have no idea how to get their size. Is it acceptable to somehow commit<br>
these changes without having all of them implemented? Something like a<br>
filler "return 0" and a comment "this function has not yet been<br>
implemented"?<br>
<br>
The idea would be that then the framework is setup, so when a developer who<br>
is familiar with the particular cell subclass sees the missing<br>
implementation, they could easily fill it in.<br>
<br>
Thoughts?<br>
<br>
Thanks,<br>
<br>
David<br>
<br>
<br>
<br>
**** Kenneth Moreland<br>
*** Sandia National Laboratories<br>
***********<br>
*** *** *** email: <a href="mailto:kmorel@sandia.gov" target="_blank">kmorel@sandia.gov</a><br>
** *** ** phone: (505) 844-8919<br>
*** web: <a href="http://www.cs.unm.edu/~kmorel" target="_blank">http://www.cs.unm.edu/~kmorel</a><br>
<br>
<br>
_______________________________________________<br>
Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
<br>
Visit other Kitware open-source projects at<br>
<a href="http://www.kitware.com/opensource/opensource.html" target="_blank">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" target="_blank">http://www.vtk.org/mailman/listinfo/vtk-developers</a><br>
<br>
<br>
<br>
</blockquote>
_______________________________________________<br>
Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
<br>
Visit other Kitware open-source projects at <a href="http://www.kitware.com/opensource/opensource.html" target="_blank">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" target="_blank">http://www.vtk.org/mailman/listinfo/vtk-developers</a><br>
<br>
<br>
</blockquote>
_______________________________________________<br>
Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
<br>
Visit other Kitware open-source projects at <a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
<br>
</div><div class="h5"><br></div></div></blockquote><div class="gmail_quote"><br></div>This is indeed a big project to implement correctly. I'll stick with the two functions that I can handle well and leave the rest for a larger group effort at a later date.</div>
<div class="gmail_quote"><br>I have added ComputeArea() for vtkTriangle and vtkPolygon. Before I commit them, I was going to add tests. There is an existing TestTriangle.cxx - should I put the area test in there, or create a separate TestTriangleComputeArea.cxx ? </div>
<div class="gmail_quote"><br></div><div class="gmail_quote">There is no TestPolygon.cxx, so I was going to create one.</div><div class="gmail_quote"><br></div><div class="gmail_quote">I was also going to add ComputeArea for vtkQuad, but I'm a bit confused. Why does vtkQuad derive from vtkCell instead of vtkPolygon. It seems like both vtkQuad and vtkTriangle are special cases of vtkPolygon. Is there a benefit to the current structure?</div>
<div class="gmail_quote"><br clear="all">David</div>