[vtk-developers] vtkPolyData->IsEdge fix

lucantiga at softhome.net lucantiga at softhome.net
Mon Mar 10 13:40:16 EST 2003


Hi Rasmus,
 I'm glad you raised the issue. Actually please replace 
>         if ((pts[(j-1)%npts]==p2)||(pts[(j+1)%npts]==p2))
with 
>         if (pts[(j+1)%npts]==p2)
 for the fix.

Luca

On Mon, 10 Mar 2003, Rasmus Reinhold Paulsen wrote:

> I am currently trying to get a deeper understanding of the way VTK handles
> topology. I found a strange "feature" in vtkPolyData->IsEdge. Apparently I
> am not the first:
> 
> Luca, January 2003:
> 
> 1) vtkPolyData::IsEdge(vtkIdType, vtkIdType) returns 1 if two points are
> on the same cell, and 0 otherwise. Quite a handy method indeed, but its
> name can be misleading if you work with n-sided polygons (n>3), since to
> me polygon edges are cell boundary edges. I think a caveat in IsEdge
> documentation would be perfect.
> 
> Luca proposes a fix:
> 
> inline int vtkPolyData::IsEdge(int p1, int p2)
> {
>   unsigned short int ncells;
>   int npts;
>   int i, j;
>   vtkIdType *cells, *pts;
> 
>   this->GetPointCells(p1,ncells,cells);
>   for (i=0; i<ncells; i++)
>   {
>     this->GetCellPoints(cells[i],npts,pts);
>     for (j=0; j<npts; j++)
>     {
>       if (p1==pts[j])
>         if ((pts[(j-1)%npts]==p2)||(pts[(j+1)%npts]==p2))
>           return 1;
>     }
>   }
> 
>   return 0;
> }
> 
> 
> Is there a reason for the current IsEdge behavior or should the above fix
> be applied?
> 
> 
> Regards
> Rasmus
> 
> _______________________________________________
> vtk-developers mailing list
> vtk-developers at public.kitware.com
> http://public.kitware.com/mailman/listinfo/vtk-developers
> 

-- 
Luca Antiga, PhD
--------------------------------------
Imaging Research Laboratories
Robarts Research Institute
P.O. Box 5015, 100 Perth Drive
London, Ontario, Canada N6A 5K8
--------------------------------------
phone: (001) (519) 663-5777 ext.34028
email: lantiga at imaging.robarts.ca
web:   www.imaging.robarts.ca/~lantiga
--------------------------------------




More information about the vtk-developers mailing list