问题
What's the main difference between a vertex and a point in VTK?
Well, I was assigning some computed points to an vtkPolyData output:
vtkPolyData* oput = vtkPolyData::SafeDownCast(out_info->Get(vtkDataObject::DATA_OBJECT()));
and I wondered whether to use the method SetVerts(vtkCellArray *v)
or the method SetPoints(vtkPoints *)
.
回答1:
In VTK datasets (i.e., classes inheriting vtkDataSet which is the simplest type of data that provides a notion of points), points are simply locations in space. Data may be stored at locations in space or on cells (e.g., triangles or tetrahedra) that represent a locus of points. Values stored on cells take on the same value at every point in the cell's locus.
Cells are defined by their corner points. In vtkPolyData, every cell is defined by a list of integer offsets into the point coordinates in a vtkPoints instance.
A vertex in VTK is a cell whose point locus is a single point.
It is possible to have points listed explicitly in a VTK dataset which are not reference by any cell (e.g., you can specify point coordinates in a vtkPoints object that are not used as corner points for any tetrahedron, triangle, or vertex cell). These points can only have point data (stored by arrays in a vtkPointData instance held by the vtkDataSet) and not cell data (stored by arrays in a vtkCellData instance held by the vtkDataSet).
So, SetPoints()
lets you provide point coordinates which vtkCellArray instances then reference to define point locii of various shapes. One category of shapes is vertices (hence SetVerts()
) while others include lines and polylines (SetLines()
) and triangles/quads (SetPolys()
).
回答2:
I think that depends on what the points are supposed to be. Points are just points that can be visualized e.g. as part of a point cloud, while verts are parts of triangles that can represent a surface or volume.
Without any specifics about your intent I think we can't really tell you which to use.
回答3:
Maybe the first part of this example is similar to what you need: http://www.vtk.org/Wiki/VTK/Examples/Cxx/Picking/AreaPicking
Typically you set the points and then you need to assign also the vertex (or other kind of cells) in order to have something to visualize (you can assign them manually like in the example, or use the vtkVertexGlyphFilter)
来源:https://stackoverflow.com/questions/37378343/difference-between-vertex-and-point-in-vtk