[vtk-developers] Bugs in vtkWedge

Tadeu Manoel tadeu at esss.com.br
Fri May 12 15:41:51 EDT 2006


François,

  I checked the code in vtkWedge.cxx in VTK 4.2 and 5.0.0, and the
EvaluatePosition bug still happens exchanging the triangles!

  I'm sorry about the faces, I was confused because it seems the description
of a wedge has changed since  VTK 4.2. There in vtkWedge.h it said:

// vtkWedge is a concrete implementation of vtkCell to represent a linear 3D
// wedge. A wedge consists of two triangular and three quadrilateral faces
// and is defined by the six points (0-5). vtkWedge uses the standard
// isoparametric shape functions for a linear pyramid. The pyramid is
defined
// by the six points (0-5) where (0,1,2) is the base of the wedge which,
// using the right hand rule, forms a triangle whose normal points in
// the direction of the opposite triangular face (3,4,5).

  To confuse even more, Mathieu Malaterre already said next version of the
book would be updated to the 4.2 definition! (
http://public.kitware.com/pipermail/vtk-developers/2006-February/004004.html)
So I thought this would be the "correct" definition.
  The way it was in 4.2, it seemed consistent with hexas (base quad face
poins towards opposite quad face) and pyras (base quad face points towards
opposite vertex).

On 5/12/06, Francois Bertel <francois.bertel at kitware.com> wrote:
>
> Hi Tadeu,
>
> The description of the vtkWedge class says:
>
> "(0,1,2) is the base of the wedge which, using the right hand rule, forms
> a triangle whose normal points outward (away from the triangular face
> (3,4,5)"
>
> I agree it is different from other cells but the description itself match
> the implementation. so GetFaceArray() is fine.
> Also  in the VTK text book, normal of 0-1-2  points toward the exterior
> and normal of 3-4-5 points toward face 0-1-2, so the face such that the
> normal points
> toward the exterior is 3-5-4.
>
> The example you gave, according to this description is wrong because
> obviously the normal of the first face you defined points toward the other
> face.
>
> Try thoses points instead:
>
> (8,0,8), (16,0,8), (16,8,8) (8,0,0), (16,0,0), (16,8,0)
>
> and tells us if EvaluatePosition() stills return true.
>
> I'm talking about VTK CVS.
> Which version of VTK are you talking about? I don't see the piece of you
> mentioned in EvaluatePosition() in VTK CVS.
>
> Regards.
>
> Tadeu Manoel wrote:
> > There is a bug in vtkWedge::EvaluatePosition, it can tell a point is
> > inside when in reality it is outside.
> >
> > E.g, try to create a vtkWedge with the following points:
> > (8,0,0), (16,0,0), (16,8,0), (8,0,8), (16,0,8), (16,8,8)
> >
> > And try to EvaluatePosition for point (17,6,4). It will return 1,
> > telling it is inside.
> >
> > A solution is to change the following code:
> >
> >   if ( pcoords[0] >= -0.001 && pcoords[0] <= 1.001 &&
> >   pcoords[1] >= -0.001 && pcoords[1] <= 1.001 &&
> >   pcoords[2] >= -0.001 && pcoords[2] <= 1.001 )
> >
> > To:
> >
> >    if ( pcoords[0] >= -0.001 && pcoords[1] >= -0.001 &&
> >        (pcoords[0] + pcoords[1]) <= 1.001 &&
> >         pcoords[2] >= -0.001 && pcoords[2] <= 1.001 )
> >
> >
> >
> > There is another bug in its faces array (and with GetFace and
> GetFaceArray):
> > The faces normals are pointing inside, instead of outside (as of all
> > other 3D cells).
> > Instead of:
> >
> > static int faces[5][4] = { {0,1,2,-1}, {3,5,4,-1},
> >                            {0,3,4,1}, {1,4,5,2}, {2,5,3,0} };
> >
> > It should be:
> >
> > static int faces[5][4] = { {0,2,1,-1}, {3,4,5,-1},
> >                            {0,1,4,3}, {1,2,5,4}, {2,0,3,5} };
> >
> >
> >
> > --
> > Edson Tadeu M. Manoel
> > ESSS - Engineering Simulation and Scientific Software
> > http://www.esss.com.br
>


--
Edson Tadeu M. Manoel
ESSS - Engineering Simulation and Scientific Software
http://www.esss.com.br
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/vtk-developers/attachments/20060512/688168a4/attachment.html>


More information about the vtk-developers mailing list