forked from fnoble/Plot-o-matic
-
Notifications
You must be signed in to change notification settings - Fork 0
/
plotconfig.py
57 lines (42 loc) · 2.34 KB
/
plotconfig.py
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
54
55
56
57
from variables import Variables, Expression
from plugins.viewers.tools3D.Frame import *
from plugins.viewers.tvtkHelper.Primitives import *
from vtk.util import colors
from numpy.random import rand
class Arnold1(PrimitiveCollection):
def __init__(self,frame,T=None,**kwargs):
PrimitiveCollection.__init__(self,frame,T)
self.primitives=[
Box(self.frame,T='tr(-0.8,0,0)',x_length=3.2,y_length=0.20,z_length=0.01,**kwargs),
Box(self.frame,x_length=0.40,y_length=4,z_length=0.04,**kwargs),
Box(self.frame,T='tr(-2.4,0,0)',x_length=0.40,y_length=1,z_length=0.04,**kwargs),
Box(self.frame,T='tr(-2.4,0,-0.20)',x_length=0.40,y_length=0.04,z_length=0.40,**kwargs),
]
class Logo(PrimitiveCollection):
def __init__(self,frame,T=None,**kwargs):
PrimitiveCollection.__init__(self,frame,T)
self.primitives=[
Text(self.frame,text='Joby')
]
class TVTKconfig(PrimitiveCollection):
def __init__(self,variables):
self.variables=variables
w=WorldFrame(variables)
self.add(Text(w,text='Plot-o-matic goes TVTK!'))
ned=Frame(w,'TRx(pi)',name="North East Down");
diskframe=Frame(ned,'tr(AP_DISK_r_n2d_n_x,AP_DISK_r_n2d_n_y,AP_DISK_r_n2d_n_z)*quat(AP_DISK_q_n2d_q0,AP_DISK_q_n2d_q1,AP_DISK_q_n2d_q2,AP_DISK_q_n2d_q3)',name="diskframe")
orientation=Frame(ned,'tr(20,20,0)*quat(AP_EST2USER_0_q_n2b_q0,AP_EST2USER_0_q_n2b_q1,AP_EST2USER_0_q_n2b_q2,AP_EST2USER_0_q_n2b_q3)')
airframe=Frame(ned,'tr(AP_EST2USER_0_r_n2b_n_x,AP_EST2USER_0_r_n2b_n_y,AP_EST2USER_0_r_n2b_n_z)*quat(AP_EST2USER_0_q_n2b_q0,AP_EST2USER_0_q_n2b_q1,AP_EST2USER_0_q_n2b_q2,AP_EST2USER_0_q_n2b_q3)')
ax=Frame(ned,'sc(50)')
self.add(Arrow(ax,color=colors.red))
self.add(Text(ax,T='tr(1,0,0)*sc(0.1)',text='N / X'))
self.add(Arrow(ax,T='TRz(pi/2)',color=colors.green))
self.add(Text(ax,T='tr(0,1,0)*sc(0.1)',text='E / Y'))
self.add(Arrow(ax,T='TRy(-pi/2)',color=colors.blue))
self.add(Text(ax,T='tr(0,0,1)*sc(0.1)',text='D / Z'))
self.add(Plane(ned,T='sc(400)',representation='wireframe',color=colors.grey,x_resolution=40,y_resolution=40))
self.add(Arnold1(orientation,T='sc(5)',color=colors.blue))
self.add(Text(orientation,text='Reference only'))
self.add(Arnold1(airframe,color=colors.red))
self.add(Logo(ned))
self.add(Circle(diskframe,radius=variables.new_expression('AP_DISK_radius')))