# Arrow

vtk-examples/Python/GeometricObjects/Arrow

### Description¶

vtkArrowSource object appends a cylinder to a cone to form an arrow.

The shaft base is always at (0,0,0). The arrow tip is always at (1,0,0). If "Invert" is true, then the ends are flipped i.e. tip is at (0,0,0) while base is at (1, 0, 0).

The resolution of the cone and shaft can be set and default to 6.

The radius of the cone and shaft can be set and default to 0.03 and 0.1. The length of the tip can also be set, and defaults to 0.35.

Other languages

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

Question

### Code¶

Arrow.py

#!/usr/bin/env python

# noinspection PyUnresolvedReferences
import vtkmodules.vtkInteractionStyle
# noinspection PyUnresolvedReferences
import vtkmodules.vtkRenderingOpenGL2
from vtkmodules.vtkCommonColor import vtkNamedColors
from vtkmodules.vtkRenderingCore import (
vtkActor,
vtkPolyDataMapper,
vtkRenderWindow,
vtkRenderWindowInteractor,
vtkRenderer
)

def main():
colors = vtkNamedColors()

arrowSource = vtkArrowSource()
# arrowSource.SetTipLength(.9)

# Create a mapper and actor
mapper = vtkPolyDataMapper()
mapper.SetInputConnection(arrowSource.GetOutputPort())
actor = vtkActor()
actor.SetMapper(mapper)

# Visualize
renderer = vtkRenderer()
renderWindow = vtkRenderWindow()
renderWindow.SetWindowName('Arrow')
renderWindowInteractor = vtkRenderWindowInteractor()
renderWindowInteractor.SetRenderWindow(renderWindow)