[vtkusers] vtkFeatureEdges "feature" (with attachments!)

Kirt Schaper kirt at pet.med.va.gov
Thu Jul 27 12:44:07 EDT 2000


To: 
Subject: 


I believe there is an error in vtkFeatureEdges.cxx which results
in incorrect counts for feature and manifold edges.  I am using
vtk-3.1 (compiled on a lintel box -- RedHat 6.1).  I created a
small non-manifold polydata model (one fin) and a small tcl
program to compute and report the various edge types (boundary,
manifold and non-manifold).  I've attached both files.

What appears to happen is that the manifold edge count is
double what it should be, and also includes boundary edges,
that is:
        trueManifold = manifold/2 - boundary
                where
        manifold = reported manifold edge count
        boundary = reported boundary edge count
My example program reports both counts.

I've played with various edge topologies and the above formula
always holds.

In looking at the vtkFeatureEdges.cxx code, I can see why the
manifold count is twice what it should be, there is no check
to insure that the edge has not been counted previously (as
there is for non-manifold edges) and each manifold edge is
(by definition) part of two cells.  I don't, however,  see
why boundary edges are included in the manifold count.  I believe
the problem also exists for feature edges, however, I have not
explored them.



----------------------------------------------------------
	Stop explaining, it hurts too much!
----------------------------------------------------------
Kirt Schaper		| Bell: (612) 725-2000 x4791
PET Center (11P)	|  net: kirt at pet.med.va.gov
VA Medical Center	|  FAX: (612) 725-2068
MPLS, MN  55417		|  URL: http://pet.med.va.gov:8080
-------------- next part --------------
catch {load vtktcl}
if { [catch {set VTK_TCL $env(VTK_TCL)}] != 0} { set VTK_TCL "../../examplesTcl" }

source $VTK_TCL/vtkInt.tcl

vtkPolyDataReader reader
	reader SetFileName "bad-cube_poly.vtk"
vtkFeatureEdges edges
	edges SetInput [reader GetOutput]
	edges FeatureEdgesOff
	edges BoundaryEdgesOff
	edges ManifoldEdgesOff
	edges NonManifoldEdgesOff
vtkPolyDataMapper mapper
    mapper SetInput [reader GetOutput]
    eval mapper SetScalarRange [[reader GetOutput] GetScalarRange]
vtkActor actor
    actor SetMapper mapper
vtkRenderer ren
vtkRenderWindow renWin
    renWin AddRenderer ren
vtkRenderWindowInteractor renWinInter
    renWinInter SetRenderWindow renWin

ren AddActor actor
	[actor GetProperty] SetRepresentationToWireframe
ren SetBackground .2 .2 .6
renWin SetSize 300 300
set cam [ren GetActiveCamera]
$cam SetPosition 3.0 -0.8 4.0
$cam SetClippingRange 0.1 10.0
$cam ComputeViewPlaneNormal
renWinInter SetUserMethod {wm deiconify .vtkInteract}
renWin Render

edges BoundaryEdgesOn
edges Update
set numOfBoundaryEdges [[[edges GetOutput] GetLines] GetNumberOfCells]
edges BoundaryEdgesOff

edges ManifoldEdgesOn
edges Update
set numOfManifoldEdges [[[edges GetOutput] GetLines] GetNumberOfCells]
edges ManifoldEdgesOff

edges NonManifoldEdgesOn
edges Update
set numOfNonManifoldEdges [[[edges GetOutput] GetLines] GetNumberOfCells]
edges NonManifoldEdgesOn

set numOfEdges [expr $numOfBoundaryEdges + $numOfManifoldEdges + $numOfNonManifoldEdges]
puts [format "      raw counts: total=%d   boundary=%d manifold=%d non-manifold=%d" \
	$numOfEdges $numOfBoundaryEdges $numOfManifoldEdges $numOfNonManifoldEdges]

set numOfManifoldEdges [expr $numOfManifoldEdges/2 - $numOfBoundaryEdges]
set numOfEdges [expr $numOfBoundaryEdges + $numOfManifoldEdges + $numOfNonManifoldEdges]
puts [format "corrected counts: total=%d   boundary=%d manifold=%d non-manifold=%d" \
	$numOfEdges $numOfBoundaryEdges $numOfManifoldEdges $numOfNonManifoldEdges]

wm withdraw .
-------------- next part --------------
# vtk DataFile Version 2.0
Cube with fin example
ASCII
DATASET POLYDATA

POINTS 9 float
0.0 0.0 0.0
1.0 0.0 0.0
1.0 1.0 0.0
0.0 1.0 0.0
0.0 0.0 1.0
1.0 0.0 1.0
1.0 1.0 1.0
0.0 1.0 1.0
1.5 1.5 0.5

POLYGONS 7 34
4 0 1 2 3
4 4 5 6 7
4 0 1 5 4
4 2 3 7 6
4 0 4 7 3
4 1 2 6 5
3 2 6 8


More information about the vtkusers mailing list