[vtkusers] Sharing polyline vtkPoints with trangle strip

Martin, Paul paul.martin at dnvgl.com
Mon Aug 15 05:04:02 EDT 2016


Hi,

I am using multiple vtkTriangleStrips to render tubes with differing cross-section at each end, e.g. an ellipse at one end and a square at the other end. I am overlaying each of the tube's ends with a vtkPolyLine of contrasting colour to allow the user to view just the end cross-sections and hide the triangulated tube surface. I am creating a repeating timer on the interactor to animate the scene.

I have a separate vtkActor for each of the polylines and the triangle strip. Each of the ends of a tube can be translated and oriented differently when the animation is running.

The issue I have is that I can't find a way of specifying multiple vtkPoints arrays (i.e. one for each polyline) as input to the triangle strip, so I am creating a new vtkPoints array for the triangle strip's vtkPolyData and populating it with the vtkPoints arrays for each polyline in turn. This is repeated at each step in the animation, causing a significant performance hotspot when the number of tubes is scaled up:

// Update triangle strip to reflect transformed polylines
// Get points for each end
vtkPoints points = polylineEnd1Actor().GetMapper().GetInput().GetCell(0).GetPoints();
vtkPoints pointsEnd2 = polylineEnd2Actor().GetMapper().GetInput().GetCell(0).GetPoints();

// Create a new vtkPoints for triangle strip
int pointCountEnd2 = pointsEnd2.GetNumberOfPoints();
for (int i = 0; i < pointCountEnd2; ++i)
{
  // Append transformed pointsEnd2 to points for triangle strip poly data
  points.InsertNextPoint(pointsEnd2.GetPoint(i)[0], pointsEnd2.GetPoint(i)[1], pointsEnd2.GetPoint(i)[2]);
}

PolyDataForTriangleStrip.SetPoints(points);
PolyDataForTriangleStrip.Modified();
PolyDataNormalsForTriangleStrip.SetInputData(PolyDataForTriangleStrip);
PolyDataNormalsForTriangleStrip.Update();

I would like to find a way of mapping polydata/points of the two polylines directly to the triangle strip's polydata/points, such that when the polyline actors are transformed, their new point coordinates are reflected in the triangle strip without having to create a new vtkPoints.

I am using ActiViz.Net with C#.

**************************************************************************************
This e-mail and any attachments thereto may contain confidential information and/or information protected by intellectual property rights for the exclusive attention of the intended addressees named above. If you have received this transmission in error, please immediately notify the sender by return e-mail and delete this message and its attachments. Unauthorized use, copying or further full or partial distribution of this e-mail or its contents is prohibited.
**************************************************************************************
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/vtkusers/attachments/20160815/f3a3d73d/attachment.html>


More information about the vtkusers mailing list