# Vertex

VTKExamples/Python/GeometricObjects/Vertex

### Description

The vertex is a primary zero-dimensional cell. It is defined by a single point.

Other Languages

See (Cxx), (Java), (CSharp)

### Code

Vertex.py

    #!/usr/bin/env python
    # -*- coding: utf-8 -*-

    import vtk

    def main():
        colors = vtk.vtkNamedColors()

        points = vtk.vtkPoints()
        points.InsertNextPoint(0, 0, 0)

        vertex = vtk.vtkVertex()
        vertex.GetPointIds().SetId(0, 0)

        vertices = vtk.vtkCellArray()
        vertices.InsertNextCell(vertex)

        polydata = vtk.vtkPolyData()
        polydata.SetPoints(points)
        polydata.SetVerts(vertices)

        # Setup actor and mapper
        mapper = vtk.vtkPolyDataMapper()
        mapper.SetInputData(polydata)
        actor = vtk.vtkActor()
        actor.SetMapper(mapper)
        actor.GetProperty().SetPointSize(10)
        actor.GetProperty().SetColor(colors.GetColor3d("Cyan"))

        # Setup render window, renderer, and interactor
        renderer = vtk.vtkRenderer()
        renderWindow = vtk.vtkRenderWindow()
        renderWindow.SetWindowName("Vertex")
        renderWindow.AddRenderer(renderer)
        renderWindowInteractor = vtk.vtkRenderWindowInteractor()
        renderWindowInteractor.SetRenderWindow(renderWindow)
        renderer.AddActor(actor)
        renderer.SetBackground(colors.GetColor3d("DarkGreen"))

        renderWindow.Render()
        renderWindowInteractor.Start()

    if __name__ == '__main__':
        main()