<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#003333">
<font size="-1"><font face="Tahoma">Ok i've found the problem.<br>
<br>
It comes from my convertion. (Sometimes I have to reverse the
order of the new line to add...)<br>
<br>
FYI I also use CleanPolyData before my convertion.<br>
<br>
Thanks for our help, and sorry for </font></font><span
class="Apple-style-span" style="border-collapse: separate; color:
rgb(0, 0, 0); font-family: 'Times New Roman'; font-style: normal;
font-variant: normal; font-weight: normal; letter-spacing: normal;
line-height: normal; orphans: 2; text-indent: 0px; text-transform:
none; white-space: normal; widows: 2; word-spacing: 0px;
font-size: medium;"><span class="Apple-style-span"
style="font-family: arial,sans-serif; font-size: 13px;
white-space: nowrap;">disturbance ^^.<br>
<br>
Nicolas.<br>
</span></span><br>
Le 06/01/2011 15:10, David Gobbi a écrit :
<blockquote
cite="mid:AANLkTi=LrgdgZEcErLcXXP8exMGT2R+A6PdfLSiP64DU@mail.gmail.com"
type="cite">If vtkStripper works most of the time, but not all the
time, it might be a tolerance issue. What I mean is, the
endpoints for the line segments might not match exactly.
<div><br>
</div>
<div>You could try using vtkCleanPolyData with SetTolerance(1e-6)
before vtkStripper. This will merge all nearly-coincident
points.</div>
<div><br>
</div>
<div> David</div>
<div><br>
<div><br>
<div class="gmail_quote">On Thu, Jan 6, 2011 at 6:55 AM,
Nicolas Sarrasin <span dir="ltr"><<a
moz-do-not-send="true"
href="mailto:nsarrasin@phenix-systems.com">nsarrasin@phenix-systems.com</a>></span>
wrote:<br>
<blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt
0.8ex; border-left: 1px solid rgb(204, 204, 204);
padding-left: 1ex;">
<div>
<div class="h5">
<div bgcolor="#ffffff" text="#003333"> <font
size="-1"><font face="Tahoma">Yes of course !<br>
<br>
That's why I'm writing "</font></font><small>For
most of case it works well", vtkStripper helps me
a lot.<br>
<br>
But with this example, my convertion fails.<br>
<br>
With debug, I found that the secondth (and last)
line close the arc of circle but when I display
it, this doesn't appear, as it's shown in the
pictures I linked.<br>
<br>
</small>Le 06/01/2011 14:47, David Gobbi a écrit :
<blockquote type="cite">
<pre>Hi Nicolas,
In my last email to you, I recommended the vtkStripper filter for
generating a polyline from line segments. Did you try it?
Cheers,
David
On Thu, Jan 6, 2011 at 3:30 AM, Nicolas Sarrasin
<a moz-do-not-send="true" href="mailto:nsarrasin@phenix-systems.com" target="_blank"><nsarrasin@phenix-systems.com></a> wrote:
</pre>
<blockquote type="cite">
<pre>Hi all,
I'm trying to convert a set of line into one only vtkPolyLine. (original
post here :
<a moz-do-not-send="true" href="http://vtk.1045678.n5.nabble.com/construct-a-vtkPolyLine-PolyGon-from-a-set-of-vtkLines-td3325716.html" target="_blank">http://vtk.1045678.n5.nabble.com/construct-a-vtkPolyLine-PolyGon-from-a-set-of-vtkLines-td3325716.html</a>)
I go through all the polylines of vtkPolyData->GetLines() and then get the
associated points.
For most of case it works well, but I'm actually encounter a problem on a
case.
The input polydata
(<a moz-do-not-send="true" href="http://img525.imageshack.us/img525/8370/vtkconvertioninit.png" target="_blank">http://img525.imageshack.us/img525/8370/vtkconvertioninit.png</a>) is composed
of two lines which trace an arc of circle.
After the convertion, this arc is closed
(<a moz-do-not-send="true" href="http://img502.imageshack.us/img502/8773/vtkconvertionres.png" target="_blank">http://img502.imageshack.us/img502/8773/vtkconvertionres.png</a>).
It comes from the second line which might not be correct.
Can someone explain me what is going wrong ?
Thanks by advance.
Here is a c++ sample code with the input file attached (wire.vtp).
****
#include <vtkSmartPointer.h>
#include <vtkCellArray.h>
#include <vtkPoints.h>
#include <vtkPolyData.h>
#include <vtkXMLPolyDataReader.h>
#include <vtkXMLPolyDataWriter.h>
#include <vtkPolyLine.h>#include <vtkSmartPointer.h>
#include <vtkCellArray.h>
#include <vtkPoints.h>
#include <vtkPolyData.h>
#include <vtkXMLPolyDataReader.h>
#include <vtkXMLPolyDataWriter.h>
#include <vtkPolyLine.h>
int main (int argc, char *argv[])
{
vtkSmartPointer<vtkXMLPolyDataReader> reader =
vtkSmartPointer<vtkXMLPolyDataReader>::New();
reader->SetFileName("./wire.vtp");
vtkSmartPointer<vtkPolyData> init_data =
vtkSmartPointer<vtkPolyData>::New();
init_data = reader->GetOutput();
vtkSmartPointer<vtkPoints> init_points =
vtkSmartPointer<vtkPoints>::New();
init_points=init_data->GetPoints();
vtkSmartPointer<vtkCellArray> init_lineArray =
vtkSmartPointer<vtkCellArray>::New();
init_lineArray = init_data->GetLines();
int nblines = init_lineArray->GetNumberOfCells();
vtkSmartPointer<vtkPolyData> new_data =
vtkSmartPointer<vtkPolyData>::New();
vtkSmartPointer<vtkPoints> new_points =
vtkSmartPointer<vtkPoints>::New();
vtkSmartPointer<vtkPolyLine> polyline =
vtkSmartPointer<vtkPolyLine>::New();
vtkSmartPointer<vtkCellArray> new_lineArray =
vtkSmartPointer<vtkCellArray>::New();
double coords[3];
vtkIdType nbpts=0, *pts=0;
for( init_lineArray->InitTraversal(); init_lineArray->GetNextCell(nbpts,
pts);)
{
vtkIdType init_ind=0, new_ind=0;
for(int p=0; p<nbpts; p++)
{
init_ind=pts[p];
if(init_ind<0)
continue;
init_points->GetPoint( init_ind, coords);
new_ind=new_points->InsertNextPoint(coords);
polyline->GetPointIds()->InsertNextId(new_ind);
}
}
new_lineArray->InsertNextCell(polyline);
new_data->SetPoints(new_points);
new_data->SetLines(new_lineArray);
vtkSmartPointer<vtkXMLPolyDataWriter> writer =
vtkSmartPointer<vtkXMLPolyDataWriter>::New();
writer->SetFileName("./new_wire.vtp");
writer->SetInput(new_data);
writer->Write();
****
</pre>
</blockquote>
</blockquote>
</div>
</div>
</div>
<br>
</blockquote>
</div>
<br>
</div>
</div>
</blockquote>
</body>
</html>