[vtkusers] Creating a surface with three or more points
Totte Karlsson
tottek at gmail.com
Fri Aug 8 15:06:39 EDT 2014
Hi,
I seem to got stuck on something seeming very basic. I need to create a
surface (that I can render) from an arbitrary number of 3D points, typically
less than 5-6 points. I'll use it to visualize 'planes' in molecular
geometries.
The first geometry I am trying out is just the faces of a cube, i.e from 8
points creating the 6 faces of the cube. But seem to get stuck..
I started to create each plane and was using delaunay2d (part of the problem
I believe)
Code looking like this
vtkSmartPointer<vtkPolyData> polydata =
vtkSmartPointer<vtkPolyData>::New();
polydata->SetPoints(mPoints);
// Triangulate the grid points
vtkSmartPointer<vtkDelaunay2D> delaunay =
vtkSmartPointer<vtkDelaunay2D>::New();
delaunay->SetInputData(polydata);
delaunay->Update();
// Create a mapper and actor
vtkSmartPointer<vtkPolyDataMapper> triangulatedMapper = GetMapper();
triangulatedMapper->SetInputConnection(delaunay->GetOutputPort());
vtkSmartPointer<vtkActor> triangulatedActor = GetActor();
triangulatedActor->SetMapper(triangulatedMapper);
where mPoints contain 4 points defining one cube face.
However, the above only works for the planes that are perpendicular to the z
axes.
How to construct the other 4 planes? The ones parallel to the z-axes?
I guess I should not need to use triangulation at all here, but I seem not
be able to find a simple example on how to just create and render a plane
from 4 points.
-tk
--
View this message in context: http://vtk.1045678.n5.nabble.com/Creating-a-surface-with-three-or-more-points-tp5728151.html
Sent from the VTK - Users mailing list archive at Nabble.com.
More information about the vtkusers
mailing list