[vtk-developers] vtkSelectPolyData don't give accses to cell information !!
Youness BENCHRIFA
younes.benchrifa at gmail.com
Wed Jul 20 17:45:19 EDT 2011
Hello,
I'm using "vtkSelectPolyData"
I want to know please if we can get access to information about cells in
the smallest region cut from the sphere(as example) ?
when I compute the number of cells :
polyData = loop2->GetSelectionEdges ();
polyData->GetNumberOfCells();
i got 0 cell.
Here is the code giving as example in vtk.
---------------------------------------------------------------------------
package require vtk
package require vtkinteraction
package require vtktesting
# Define loop to clip with
#
vtkPoints selectionPoints
selectionPoints InsertPoint 0 -0.16553 0.135971 0.451972
selectionPoints InsertPoint 1 -0.0880123 -0.134952 0.4747
selectionPoints InsertPoint 2 0.00292618 -0.134604 0.482459
selectionPoints InsertPoint 3 0.0641941 0.067112 0.490947
selectionPoints InsertPoint 4 0.15577 0.0734765 0.469245
selectionPoints InsertPoint 5 0.166667 -0.129217 0.454622
selectionPoints InsertPoint 6 0.241259 -0.123363 0.420581
selectionPoints InsertPoint 7 0.240334 0.0727106 0.432555
vtkSphereSource sphere
sphere SetPhiResolution 50
sphere SetThetaResolution 100
sphere SetStartPhi 0
sphere SetEndPhi 90
vtkSelectPolyData loop
loop SetInputConnection [sphere GetOutputPort]
loop SetLoop selectionPoints
loop GenerateSelectionScalarsOn
loop SetSelectionModeToSmallestRegion; #negative scalars inside
vtkClipPolyData clip; #clips out positive region
clip SetInputConnection [loop GetOutputPort]
vtkPolyDataMapper clipMapper
clipMapper SetInputConnection [clip GetOutputPort]
vtkLODActor clipActor
clipActor SetMapper clipMapper
vtkSelectPolyData loop2
loop2 SetInputConnection [sphere GetOutputPort]
loop2 SetLoop selectionPoints
loop2 SetSelectionModeToSmallestRegion
vtkPolyDataMapper selectMapper
selectMapper SetInputConnection [loop2 GetOutputPort]
vtkLODActor selectActor
selectActor SetMapper selectMapper
selectActor AddPosition 1 0 0
eval [selectActor GetProperty] SetColor $peacock
# Create graphics stuff
#
vtkRenderer ren1
vtkRenderWindow renWin
renWin AddRenderer ren1
vtkRenderWindowInteractor iren
iren SetRenderWindow renWin
# Add the actors to the renderer, set the background and size
#
ren1 AddActor clipActor
ren1 AddActor selectActor
ren1 SetBackground .1 .2 .4
renWin SetSize 500 250
set cam1 [ren1 GetActiveCamera]
$cam1 SetClippingRange 0.236644 11.8322
$cam1 SetFocalPoint 0.542809 -0.0166201 0.183931
$cam1 SetPosition 1.65945 0.364443 2.29141
$cam1 SetViewUp -0.0746604 0.986933 -0.14279
iren Initialize
# render the image
#
iren AddObserver UserEvent {wm deiconify .vtkInteract}
# prevent the tk window from showing up then start the event loop
wm withdraw .
More information about the vtk-developers
mailing list