[vtkusers] vtkCutter Inner/Outter Contours
Nicolas Sarrasin
nsarrasin at phenix-systems.com
Fri May 28 12:01:01 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);
}
But my tmpDTArray is NULL.
Is this the right way to do ? How to explain that my pointer is NULL ?
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
--
------------------------------------------------------------------------
Logo Phenix Systems <www.phenix-systems.com> Nicolas Sarrasin -
Ingénieur Developpement 3D CFAO
Phenix systems <www.phenix-systems.com>
Parc Européen d'Entreprises
rue Richard Wagner - 63200 Riom FRANCE
tel : +33 (0)4 73 33 45 85 | fax : +33 (0)4 73 33 45 86
Pensez environnement !
N'imprimez ce mail que si c'est vraiment nécessaire
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20100528/29482bb4/attachment.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: logo_contact.gif
Type: image/gif
Size: 2985 bytes
Desc: not available
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20100528/29482bb4/attachment.gif>
More information about the vtkusers
mailing list