[vtkusers] Rendering triangles method

Cory Quammen cory.quammen at kitware.com
Thu Mar 6 20:40:16 EST 2014


That seems like a reasonable example to follow. Yes, you will map your
triangle mesh with a vtkPolyDataMapper, but there are a few more steps
before it will be rendered. See the example at
http://www.vtk.org/Wiki/VTK/Examples/Cxx/GeometricObjects/Cube. You
can use everything after

  // Create a cube.
  vtkSmartPointer<vtkCubeSource> cubeSource =
    vtkSmartPointer<vtkCubeSource>::New();

and change

mapper->SetInputConnection(cubeSource->GetOutputPort());

to

mapper->SetInputData(polydata);

Hope that helps,
Cory

On Thu, Mar 6, 2014 at 3:13 PM,  <sean.larkin at lickenbrocktech.com> wrote:
> Hello,
> I have a text file which defines a number of objects in 3D space.  Each
> object has "nodes", which represent x,y,z positions, and then "cells",
> which represent triangles by defining three "nodes" to connect.  I've
> never rendered this kind of data before, as I generally render image
> data.  There is an example here:
> http://www.vtk.org/Wiki/VTK/Examples/Cxx/PolyData/TriangleArea
>
> Would this be a good way to construct the triangles?  And then render
> them with vtkPolyDataMapper?  There are hundreds of objects, each with
> as many as a thousand points.  I have no problem parsing the text file,
> I just want to use the best method to construct and render the objects.
>
> Thanks,
> Sean
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html
>
> Please keep messages on-topic and check the VTK FAQ at: http://www.vtk.org/Wiki/VTK_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://www.vtk.org/mailman/listinfo/vtkusers


More information about the vtkusers mailing list