<div dir="ltr"><div><div><div><div><div><div>Hi Bill,<br><br></div>It looks to me like the apex of vtkPyramid is at {.5, .5, 1}. I used this test code to play around with it:<br>from vtk import *<br>ugrid = vtkUnstructuredGrid()<br>pts = vtkPoints()<br>pts.InsertNextPoint(0, 0, 0)<br>pts.InsertNextPoint(1, 0, 0)<br>pts.InsertNextPoint(1, 1, 0)<br>pts.InsertNextPoint(0, 1, 0)<br>pts.InsertNextPoint(.5, .5, 1)<br>ugrid.SetPoints(pts)<br>ugrid.Allocate(10)<br>p = [0, 1, 2, 3, 4]<br>ugrid.InsertNextCell(VTK_PYRAMID, 5, p)<br>c = ugrid.GetCell(0)<br>pcoords = [0, 0, 0]<br>x = [0, 0, 0]<br>w = [0, 0, 0, 0, 0]<br>subid = vtk.mutable(0)<br># EvaluateLocation() is from parametric to global coordinate<br>c.EvaluateLocation(subid, pcoords, x, w)<br>print x<br>pcoords = [.5, .5, 1]<br>c.EvaluateLocation(subid, pcoords, x, w)<br><br># EvaluatePosition() is from global to parametric coordinate<br>x = [.5, .5, 1]<br>closestpoint = [-1, -1, -1]<br>dist2 = vtk.mutable(0)<br>result = c.EvaluatePosition(x, closestpoint, subid, pcoords, dist2, w)<br>print result, pcoords<br><br><br><br><br><br></div>I didn't test vtkQuadraticPyramid though. Looking at the vtkPyramid.h though I see the following which looks wrong to me:<br>//----------------------------------------------------------------------------<br>inline int vtkPyramid::GetParametricCenter(double pcoords[3])<br>{<br> pcoords[0] = pcoords[1] = 0.4;<br> pcoords[2] = 0.2;<br> return 0;<br>}<br><br><br></div>I would have thought that pcoords[0] and pcoords[1] should be 0.5 instead of 0.4. Since the volume of the above cell is 1/3 I would also think that pcoords[2] should be 1/3 instead of 0.2, but I may be wrong on that. It's also kind of weird that in vtkQuadraticPyramid.h that method is:<br>//----------------------------------------------------------------------------<br>// Return the center of the quadratic pyramid in parametric coordinates.<br>//<br>inline int vtkQuadraticPyramid::GetParametricCenter(double pcoords[3])<br>{<br> pcoords[0] = pcoords[1] = 6./13;<br> pcoords[2] = 3./13;<br> return 0;<br>}<br><br></div>Just my 2 cents on the matter though since I haven't gone through the code that closely.<br><br></div>Cheers,<br></div>Andy<br></div><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Jun 22, 2015 at 6:29 AM, Will Schroeder <span dir="ltr"><<a href="mailto:will.schroeder@kitware.com" target="_blank">will.schroeder@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="ltr">Bill it could be that the vtkPyramid functions were originally written (a long time ago) as degenerate hex shape functions which might explain the apex parametric coordinates. I believe Mathieu found and implemented an alternative formulation and also added the quadratic version; I'm not sure where to find that reference.<div>W</div></div><div class="gmail_extra"><span class=""><br><div class="gmail_quote">On Sat, Jun 20, 2015 at 2:31 PM, Bill Lorensen <span dir="ltr"><<a href="mailto:bill.lorensen@gmail.com" target="_blank">bill.lorensen@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Folks,<br>
<br>
As I continue to work through a comprehensive unit test for vtk cells,<br>
I have found an issue(s) with vtkPyramid and vtkQuadraticPyramid.<br>
<br>
For example, the parametric coordinates for the Pyramid (and Quadratic<br>
Pyramid) place the apex at 0, 0, 1. I believe it should be centered on<br>
the base (which would be .5, .5, 1).<br>
<br>
Changing that causes other issues with the shape functions.<br>
<br>
I am seeking a copy of the reference quoted in the QuadraticPyramid<br>
code so that I can verify the implementation.<br>
// The shape functions and derivatives could be implemented thanks to<br>
// the report Pyramid Solid Elements Linear and Quadratic Iso-P Models<br>
// From Center For Aerospace Structures<br>
</blockquote></div><br><br clear="all"><div><br></div></span><span class="HOEnZb"><font color="#888888">-- <br><div>William J. Schroeder, PhD<br>Kitware, Inc.<br>28 Corporate Drive<br>Clifton Park, NY 12065<br><a href="mailto:will.schroeder@kitware.com" target="_blank">will.schroeder@kitware.com</a><br><a href="http://www.kitware.com" target="_blank">http://www.kitware.com</a><br><a href="tel:%28518%29%20881-4902" value="+15188814902" target="_blank">(518) 881-4902</a></div>
</font></span></div>
<br>_______________________________________________<br>
Powered by <a href="http://www.kitware.com" rel="noreferrer" target="_blank">www.kitware.com</a><br>
<br>
Visit other Kitware open-source projects at <a href="http://www.kitware.com/opensource/opensource.html" rel="noreferrer" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
<br>
Search the list archives at: <a href="http://markmail.org/search/?q=vtk-developers" rel="noreferrer" target="_blank">http://markmail.org/search/?q=vtk-developers</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="http://public.kitware.com/mailman/listinfo/vtk-developers" rel="noreferrer" target="_blank">http://public.kitware.com/mailman/listinfo/vtk-developers</a><br>
<br>
<br></blockquote></div><br></div>