[vtkusers] vtkClipPolyData with vtkBox doesn't work
Adeline Joliet
adeline_joli at hotmail.com
Fri Jan 15 10:41:30 EST 2010
Hello,
Ok, here a simple code
// this is the futur cuted polydata..
vtkCubeSource * rectangle = vtkCubeSource::New();
simpleCube->SetCenter(0,0,0);
simpleCube->SetXLength(150);
simpleCube->SetYLength(40);
simpleCube->SetZLength(100);
vtkBox * boxFunc = vtkBox::New();
// a 20x20x20 box.
// I displayed a vtkCubeSource with the same bounds and it clearly intersect with the rectangle...
double testBounds[6];
testBounds[0] = -10.0;
testBounds[1] = 10.0;
testBounds[2] = -10.0;
testBounds[3] = 10.0;
testBounds[4] = -10;
testBounds[5] = 10.0;
boxFunc->SetBounds(testBounds);
vtkExtractPolyDataGeometry * clipper3 = vtkExtractPolyDataGeometry::New();
clipper3->SetInput(simpleCube);
clipper3->SetImplicitFunction(boxFunc);
clipper3->ExtractInsideOn();
clipper3->Update();
// Rendering stuff...
vtkPolyDataMapper *map2 = vtkPolyDataMapper::New();
map2->SetInput(clipper2->GetOutput());
vtkActor* act2 = vtkActor::New();
act2->SetMapper(map2);
act2->SetProperty( this->CubeProperty);
this->CurrentRenderer->AddActor(act2);
And renctangle is not displated.... if I se tExtractInsideOff rectangle is displayed
but not cuted...
Regards,
Adeline
Subject: Re: [vtkusers] vtkClipPolyData with vtkBox doesn't work
From: emonson at cs.duke.edu
Date: Fri, 15 Jan 2010 10:10:00 -0500
CC: vtkusers at vtk.org
To: adeline_joli at hotmail.com
Hello Adeline,
(Please reply to the whole list so others can help if they have ideas, too.)
Okay, if setting the bounds manually doesn't work, maybe you can post a more complete code sample and someone will be able to play with it or spot the problem.
Good luck,-Eric
On Jan 15, 2010, at 5:00 AM, Adeline Joliet wrote:Hello Eric,
Thank's for the answer.
"So, are you seeing nothing when you render your scene?"
Actually no, nothing appends my Polydata is not "cuted" it's exactly the same size
Then I tried InsideOutOn() and now nothing is dislplayed.
I don't know where I can be wrong.. I will try again to set the bounds manually, but not sure that's the problem..
Regards,
Adeline
Subject: Re: [vtkusers] vtkClipPolyData with vtkBox doesn't work
From: emonson at cs.duke.edu
Date: Thu, 14 Jan 2010 14:28:52 -0500
CC: vtkusers at vtk.org
To: adeline_joli at hotmail.com
Hello Adeline,
So, are you seeing nothing when you render your scene? One thing to be careful of when using a box for your clip function is which direction the default normals of the box faces point -- this defines whether the clip leaves the inside intact or cuts out the inside of the box. Maybe this isn't the problem you're having, but you could try setting
clipper->InsideOutOn();
and see if anything shows up.
Otherwise, there are examples of clipping with the vtkBoxWidget and it's GetPlanes method in {vtksource}/Widgets/Testing/Cxx/BoxWidget.cxx and {vtksource}/Examples/GUI/Python/BoxWidget.py in case those could help you track down the problem or approach it in another way.
Talk to you later,-Eric
------------------------------------------------------Eric E MonsonDuke Visualization Technology Group
On Jan 14, 2010, at 12:29 PM, Adeline Joliet wrote:Hello,
I'm trying to cut un polydata using vtkClipPolyData with a vtkBox as implicit function.
my Polydata is simply a rectangle (x = 100, y = 50, z= 20). I'd like to cut this rectangle to obtain
only the part of the middle.. (so i'd like to cut to a right side AND a left side...)
here is the code
vtkBox * cuting = vtkBox::New();
double boundy[6];
//m_image is a vtkImageData that represent a cube (my rectangle polydata interect this cube, so the bounds should be correct...)
m_image->GetBounds(boundy);
cuting->SetBounds(boundy);
vtkClipPolyData * clipper = vtkClipPolyData::New();
clipper->SetInput(newPolyData);
clipper->SetClipFunction(cuting);
// and then I display clipper->GetOutput...
the thing is that i tried with vtkPlane and it works... but the problem is that i need if a use
vtkPlane I can cut only One side....
any help would be appreciated,
Than's
Adeline
Windows 7 : Trouvez le PC qui vous convient! Découvrez notre offre !_______________________________________________
Powered by www.kitware.com
Visit other Kitware open-source projects athttp://www.kitware.com/opensource/opensource.html
Please keep messages on-topic and check the VTK FAQ at:http://www.vtk.org/Wiki/VTK_FAQ
Follow this link to subscribe/unsubscribe:
http://www.vtk.org/mailman/listinfo/vtkusers
Faites une bonne action avec Bing Solidaire ! C'est ici !
_________________________________________________________________
Téléchargez Internet Explorer 8 et surfez sans laisser de trace !
http://clk.atdmt.com/FRM/go/182932252/direct/01/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20100115/043cb10d/attachment.htm>
More information about the vtkusers
mailing list