[vtkusers] Problem using vtkTerrainContourLineInterpolator
jimmigoo
jimmigoo at gmail.com
Fri Dec 4 06:26:21 EST 2015
Hi folks!
I have a serious problem regarding vtkContourWidget using
vtkTerrainContourLineInterpolator.
I have to modify an area identified by a few vertexes, when I select one of
these vertex, and try to move it upon a 3D Actor, I found an infinite loop
inside vtkTerrainContourLineInterpolator::InterpolateLine method in bold
sentences. In particular, I really don't know what is that tolerance (I
think it's the maximum distance between two points in order to insert an
intermediate point to draw the line), because the boolean value
traversalDone (when infinite loop occurs) is never set to true, and RAM
memory increase significately till application crash.
const double tolerance = *1.0;*
bool traversalDone = false;
while (!traversalDone)
{
for (interpolatedCells->InitTraversal();
interpolatedCells->GetNextCell(npts, ptIdx); )
{
double p[3];
interpolatedPts->GetPoint(ptIdx[0], p);
if (*(p[0]-p1[0])*(p[0]-p1[0]) + (p[1]-p1[1])*(p[1]-p1[1]) <
tolerance*)
{
interpolatedPts->GetPoint(ptIdx[npts-1], p1);
if (*(p2[0]-p1[0])*(p2[0]-p1[0])
+ (p2[1]-p1[1])*(p2[1]-p1[1]) < tolerance*)
{
--npts;
traversalDone = true;
}
for (int i = 1; i < npts; i++)
{
rep->AddIntermediatePointWorldPosition(
idx1, interpolatedPts->GetPoint(ptIdx[i]) );
}
continue;
}
}
}
return 1;
I have this pipeline (I create these objects
vtkContourWidget* m_pContour;
vtkOrientedGlyphContourRepresentation* m_pRepresentation;
vtkTerrainContourLineInterpolator* m_pInterpolator;
vtkTerrainDataPointPlacer* m_pPointPlacer;
and I use vtkProjectedTerrainPath as the Projector contained inside
vtkTerrainContourLineInterpolator, I do not create a separated object for
it).
// Configure the vtkTerrainContourLineInterpolator
m_pInterpolator->SetImageData(l_pStructuredPoints);
vtkIdType l_iNumberOfLines = DEFAULT_MAX_INTERPOLATOR_LINES; (could be
100000 or 100, the problem is still present)
m_pInterpolator->GetProjector()->SetMaximumNumberOfLines(l_iNumberOfLines);
m_pInterpolator->GetProjector()->SetProjectionModeToHug();
m_pInterpolator->GetProjector()->SetHeightOffset(3);
m_pInterpolator->GetProjector()->SetHeightTolerance(0.1);
// Configure the Point Placer
m_pPointPlacer->RemoveAllProps();
m_pPointPlacer->AddProp(m_pDtmActor);
// Configure vtkContourRepresentation
m_pRepresentation->GetLinesProperty()->SetLineWidth(2.0);
m_pRepresentation->GetLinesProperty()->SetColor(1, 0, 0);
m_pRepresentation->SetLineInterpolator(m_pInterpolator);
m_pRepresentation->SetPointPlacer(m_pPointPlacer);
m_pRepresentation->SetRenderer(m_pRenderer);
vtkSphereSource* sphere = vtkSphereSource::New();
sphere->SetRadius(l_dDtmResolution / 2);
sphere->Update();
m_pRepresentation->SetCursorShape(sphere->GetOutput());
m_pRepresentation->SetActiveCursorShape(sphere->GetOutput());
sphere->Delete();
//Configure vtkContourWidget
m_pContour->SetRepresentation(m_pRepresentation);
m_pContour->SetInteractor(m_pRenderWindowInteractor);
I hope you can understand my problem.
I'm using VTK 6.1.0 version.
I'm looking for your kind reply
regards,
jimmigoo
--
View this message in context: http://vtk.1045678.n5.nabble.com/Problem-using-vtkTerrainContourLineInterpolator-tp5735312.html
Sent from the VTK - Users mailing list archive at Nabble.com.
More information about the vtkusers
mailing list