Arc in Polydata

I am using the following code to add an Arc to the Polydata. Please correct me if I am wrong but I can’t get arcs in Polydata. It will still be a line.


center = [0.00, 25.72, 30.99]
p1 = [77.65, 63.01, 0.04]
p2 = [77.58, 63.01, 0.04]

arc = vtk.vtkArcSource()
arc.SetCenter(center[0], center[1], center[2])
arc.SetPoint1(p1[0], p1[1], p1[2])
arc.SetPoint2(p2[0], p2[1], p2[2])
arc.Update()

polydata = vtk.vtkPolyData()
polydata.ShallowCopy(arc.GetOutput())
polydata.Modified()

# write an XML file
writer = vtk.vtkXMLPolyDataWriter()
writer.SetFileName('arc.vtp')
writer.SetInputData(polydata)
writer.Write()

Hi @lassoan,

Is it possible to have an arc in vtk?

The code snippet above looks good. Did you expect that the arc source will generate some higher-order element instead of a polyline?

Yes. I expect it to generate an actual arc. Is that not possible in vtk?

An arc is represented by the vtkArcSource class in VTK. The class uses a parametric representation internally and for the rest of the processing and visualization pipeline it provides a polygonal representation at arbitrarily high resolution .

You must use a polygonal representation, because most general geometry processing algorithms and graphics hardware only supports basic linear primitives, such as points, lines, convex polygons (see for example Primitive - OpenGL Wiki and Chapter 11 - OpenGL Programming Guide).