[vtkusers] [!! SPAM] vtkusers Digest, Vol 73, Issue 50

Nicolas Sarrasin nsarrasin at phenix-systems.com
Thu May 27 09:42:34 EDT 2010


Thanks for your reply Karthik.

For the moment, i can get all of my contours separetly but I still need 
help with evaluating the orientation of the normals.

I looked around vtkPolyDataNormals to compute the normals then I tried 
this :

     connectFilter->SetExtractionModeToAllRegions();
     connectFilter->SetInputConnection(sliceCutter->GetOutputPort());
     connectFilter->Update();

     int nbContours = connectFilter->GetNumberOfExtractedRegions();

     connectFilter->SetExtractionModeToSpecifiedRegions();

     for(int idx=0; idx<nbContours; idx++)
     {
         connectFilter->InitializeSpecifiedRegionList();
         connectFilter->AddSpecifiedRegion(idx);
         connectFilter->Update();

         vtkSmartPointer<vtkPolyData> tmpPolyData = 
vtkSmartPointer<vtkPolyData>::New();
         tmpPolyData->DeepCopy(connectFilter->GetOutput());
         tmpPolyData->Update();

         vtkSmartPointer<vtkPolyDataNormals> tmpNormals = 
vtkSmartPointer<vtkPolyDataNormals>::New();
         tmpNormals->SetInput(tmpPolyData);
         tmpNormals->ComputeCellNormalsOn();
         tmpNormals->ComputePointNormalsOff();
         tmpNormals->Update();

         vtkSmartPointer<vtkDataArray> tmpDTArray = 
tmpNormals->GetOutput()->GetCellData()->GetNormals();

         vtkSmartPointer<vtkFloatArray> normArray = 
vtkFloatArray::SafeDownCast(tmpDTArray);
         // How to get the result ???
     }

But my tmpDTArray is NULL.

Is this the right way to do ?

Thanks by advance

Nicolas.

Date: Wed, 26 May 2010 15:40:50 +0530
From: Karthik Krishnan <karthik.krishnan at kitware.com>
Subject: Re: [vtkusers] vtkCutter Inner/Outter Contours
To: Nicolas Sarrasin <nsarrasin at phenix-systems.com>
Cc: vtkusers at vtk.org
Message-ID:
<AANLkTimQhl-EFvnsgy4u8ZfGBFuh30h9fNWRJ2j0lITT at mail.gmail.com>
Content-Type: text/plain; charset="iso-8859-1"

Pass the output of the cutter through a vtkPolyDatConnectivity filter.
You'll then need to look at the orientation of the normals of each connected
component. The outer faces of the cut surface are going to be oriented in
another direction.


On Wed, May 26, 2010 at 1:40 PM, Nicolas Sarrasin <
nsarrasin at phenix-systems.com> wrote:

 >  Hi all,
 >
 > I recently posted a message here :
 > http://www.vtk.org/pipermail/vtkusers/2010-May/109274.html but didn't
 > received any answers.
 > I guess I wasn't clear, here comes a simplification :
 >
 > I use vtkCutter to get planar slices from a stl file. From the result (
 > vtkCutter->GetOutput() ) I get, I would like to know the orientation 
of the
 > several contours I obtained (eg which are outter and which are inner).
 >
 > As previously, as preview of my problem :
 > http://img514.imageshack.us/img514/6747/orientationcontours.png
 >
 > Thanks by advance for helping me.
 >
 > Nicolas
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20100527/e14ec9d0/attachment.htm>


More information about the vtkusers mailing list