File: TestEllipseArcSourceResolution.py

package info (click to toggle)
vtk9 9.5.2%2Bdfsg3-4
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 205,916 kB
  • sloc: cpp: 2,336,565; ansic: 327,116; python: 111,200; yacc: 4,104; java: 3,977; sh: 3,032; xml: 2,771; perl: 2,189; lex: 1,787; makefile: 178; javascript: 165; objc: 153; tcl: 59
file content (53 lines) | stat: -rwxr-xr-x 1,248 bytes parent folder | download | duplicates (7)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
#!/usr/bin/env python

import math
from vtkmodules.vtkFiltersSources import vtkEllipseArcSource
from vtkmodules.vtkRenderingCore import (
    vtkActor,
    vtkPolyDataMapper,
    vtkRenderWindow,
    vtkRenderer,
)
import vtkmodules.vtkRenderingFreeType
import vtkmodules.vtkRenderingOpenGL2
from vtkmodules.util.misc import vtkGetDataRoot
VTK_DATA_ROOT = vtkGetDataRoot()

# Demonstrates the generation of an elliptical arc

arc=vtkEllipseArcSource()
arc.SetRatio(.25)
arc.SetResolution(40)
arc.SetStartAngle(45)
arc.SetSegmentAngle(360)
arc.CloseOff()
arc.Update()

assert arc.GetOutput().GetNumberOfPoints() == arc.GetResolution()+1

arc.CloseOn()
arc.Update()

assert arc.GetOutput().GetNumberOfPoints() == arc.GetResolution()

m=vtkPolyDataMapper()
m.SetInputData(arc.GetOutput())
a = vtkActor()
a.SetMapper(m)
a.GetProperty().SetColor(1,1,0)
a.GetProperty().EdgeVisibilityOn()
a.GetProperty().RenderLinesAsTubesOn()
a.GetProperty().SetLineWidth(3)
a.GetProperty().SetVertexColor(1,0,0)
a.GetProperty().VertexVisibilityOn()
a.GetProperty().RenderPointsAsSpheresOn()
a.GetProperty().SetPointSize(6)

r=vtkRenderer()
r.AddActor(a)
r.SetBackground(.4,.4,.4)
renWin=vtkRenderWindow()
renWin.AddRenderer(r)
renWin.Render()

# --- end of script ---