COSMOS core  1.0.2 (beta)
Comprehensive Open-architecture Solution for Mission Operations Systems
cubesat2obj.cpp File Reference
Include dependency graph for cubesat2obj.cpp:

Functions

int main (int argc, char *argv[])
 

Variables

wavefront obj
 
vector< string > part
 
string name = "testu"
 

Function Documentation

int main ( int  argc,
char *  argv[] 
)
9 {
10  uint16_t usize = 3;
11  char variant = 'a';
12 
13  switch (argc)
14  {
15  case 4:
16  variant = argv[3][0];
17  case 3:
18  usize = atoi(argv[2]);
19  case 2:
20  name = argv[1];
21  break;
22  }
23 
24  switch (usize)
25  {
26  case 12:
27  obj.add_3u("u12lf", Vector(.05, .05, 0.));
28  obj.add_3u("u12rf", Vector(.05, -.05, 0.));
29  obj.add_3u("u12lr", Vector(-.05, .05, 0.));
30  obj.add_3u("u12rr", Vector(-.05, -.05, 0.));
31  switch (variant)
32  {
33  case 'b':
34  obj.add_cuboid("cosmos.pvstrg.x+panel", Vector(.003, .2, .3), Math::Quaternions::eye(), Vector(.1, 0., 0.));
35  obj.add_cuboid("cosmos.pvstrg.x-panel", Vector(.003, .2, .3), Math::Quaternions::eye(), Vector(-.1, 0., 0.));
36  obj.add_cuboid("cosmos.pvstrg.y+panel", Vector(.2, .003, .3), Math::Quaternions::eye(), Vector(0., .1, 0.));
37  obj.add_cuboid("cosmos.pvstrg.y-panel", Vector(.2, .003, .3), Math::Quaternions::eye(), Vector(0., -.1, 0.));
38  obj.add_cuboid("cosmos.pvstrg.z+panel", Vector(.2, .2, .003), Math::Quaternions::eye(), Vector(0., 0., .15));
39  obj.add_cuboid("cosmos.pvstrg.z-panel", Vector(.2, .2, .003), Math::Quaternions::eye(), Vector(0., 0., -.15));
40  break;
41  case 'c':
42  obj.add_cuboid("cosmos.pvstrg.x+panel", Vector(.3, .2, .003), Math::Quaternions::eye(), Vector(.25, 0., .15));
43  obj.add_cuboid("cosmos.pvstrg.x-panel", Vector(.3, .2, .003), Math::Quaternions::eye(), Vector(-.25, 0., .15));
44  obj.add_cuboid("cosmos.pvstrg.y+panel", Vector(.2, .003, .3), Math::Quaternions::eye(), Vector(0., .1, 0.));
45  obj.add_cuboid("cosmos.pvstrg.y-panel", Vector(.2, .003, .3), Math::Quaternions::eye(), Vector(0., -.1, 0.));
46  obj.add_cuboid("cosmos.pvstrg.z+panel", Vector(.2, .2, .003), Math::Quaternions::eye(), Vector(0., 0., .15));
47  obj.add_cuboid("cosmos.pvstrg.z-panel", Vector(.2, .2, .003), Math::Quaternions::eye(), Vector(0., 0., -.15));
48  break;
49  case 'd':
50  obj.add_cuboid("cosmos.pvstrg.x+panel", Vector(.3, .2, .003), Math::Quaternions::eye(), Vector(.25, 0., .15));
51  obj.add_cuboid("cosmos.pvstrg.x-panel", Vector(.3, .2, .003), Math::Quaternions::eye(), Vector(-.25, 0., .15));
52  obj.add_cuboid("cosmos.pvstrg.y+panel", Vector(.2, .3, .003), Math::Quaternions::eye(), Vector(0., .25, .15));
53  obj.add_cuboid("cosmos.pvstrg.y-panel", Vector(.2, .3, .003), Math::Quaternions::eye(), Vector(0., -.25, .15));
54  obj.add_cuboid("cosmos.pvstrg.z+panel", Vector(.2, .2, .003), Math::Quaternions::eye(), Vector(0., 0., .15));
55  obj.add_cuboid("cosmos.pvstrg.z-panel", Vector(.2, .2, .003), Math::Quaternions::eye(), Vector(0., 0., -.15));
56  break;
57  case 'a':
58  default:
59  break;
60  }
61  break;
62  case 6:
63  obj.add_3u("u6l", Vector(0., .05, 0.));
64  obj.add_3u("u6r", Vector(0., -.05, 0.));
65  switch (variant)
66  {
67  case 'b':
68  obj.add_cuboid("cosmos.pvstrg.x+panel", Vector(.003, .2, .3), Math::Quaternions::eye(), Vector(.05, 0., 0.));
69  obj.add_cuboid("cosmos.pvstrg.x-panel", Vector(.003, .2, .3), Math::Quaternions::eye(), Vector(-.05, 0., 0.));
70  obj.add_cuboid("cosmos.pvstrg.y+panel", Vector(.1, .003, .3), Math::Quaternions::eye(), Vector(0., .1, 0.));
71  obj.add_cuboid("cosmos.pvstrg.y-panel", Vector(.1, .003, .3), Math::Quaternions::eye(), Vector(0., -.1, 0.));
72  obj.add_cuboid("cosmos.pvstrg.z+panel", Vector(.1, .2, .003), Math::Quaternions::eye(), Vector(0., 0., .15));
73  obj.add_cuboid("cosmos.pvstrg.z-panel", Vector(.1, .2, .003), Math::Quaternions::eye(), Vector(0., 0., -.15));
74  break;
75  case 'c':
76  obj.add_cuboid("cosmos.pvstrg.x+panel", Vector(.3, .2, .003), Math::Quaternions::eye(), Vector(.2, 0., .15));
77  obj.add_cuboid("cosmos.pvstrg.x-panel", Vector(.3, .2, .003), Math::Quaternions::eye(), Vector(-.2, 0., .15));
78  obj.add_cuboid("cosmos.pvstrg.y+panel", Vector(.1, .003, .3), Math::Quaternions::eye(), Vector(0., .1, 0.));
79  obj.add_cuboid("cosmos.pvstrg.y-panel", Vector(.1, .003, .3), Math::Quaternions::eye(), Vector(0., -.1, 0.));
80  obj.add_cuboid("cosmos.pvstrg.z+panel", Vector(.1, .2, .003), Math::Quaternions::eye(), Vector(0., 0., .15));
81  obj.add_cuboid("cosmos.pvstrg.z-panel", Vector(.1, .2, .003), Math::Quaternions::eye(), Vector(0., 0., -.15));
82  break;
83  case 'd':
84  obj.add_cuboid("cosmos.pvstrg.x+panel", Vector(.3, .2, .003), Math::Quaternions::eye(), Vector(.2, 0., .15));
85  obj.add_cuboid("cosmos.pvstrg.x-panel", Vector(.3, .2, .003), Math::Quaternions::eye(), Vector(-.2, 0., .15));
86  obj.add_cuboid("cosmos.pvstrg.y+panel", Vector(.1, .3, .003), Math::Quaternions::eye(), Vector(0., .25, .15));
87  obj.add_cuboid("cosmos.pvstrg.y-panel", Vector(.1, .3, .003), Math::Quaternions::eye(), Vector(0., -.25, .15));
88  obj.add_cuboid("cosmos.pvstrg.z+panel", Vector(.1, .2, .003), Math::Quaternions::eye(), Vector(0., 0., .15));
89  obj.add_cuboid("cosmos.pvstrg.z-panel", Vector(.1, .2, .003), Math::Quaternions::eye(), Vector(0., 0., -.15));
90  break;
91  case 'a':
92  default:
93  break;
94  }
95  break;
96  case 3:
97  obj.add_3u("u3", Vector(0., 0., 0.));
98  switch (variant)
99  {
100  case 'b':
101  obj.add_cuboid("cosmos.pvstrg.x+panel", Vector(.003, .1, .3), Math::Quaternions::eye(), Vector(.05, 0., 0.));
102  obj.add_cuboid("cosmos.pvstrg.x-panel", Vector(.003, .1, .3), Math::Quaternions::eye(), Vector(-.05, 0., 0.));
103  obj.add_cuboid("cosmos.pvstrg.y+panel", Vector(.1, .003, .3), Math::Quaternions::eye(), Vector(0., .05, 0.));
104  obj.add_cuboid("cosmos.pvstrg.y-panel", Vector(.1, .003, .3), Math::Quaternions::eye(), Vector(0., -.05, 0.));
105  obj.add_cuboid("cosmos.pvstrg.z+panel", Vector(.1, .1, .003), Math::Quaternions::eye(), Vector(0., 0., .15));
106  obj.add_cuboid("cosmos.pvstrg.z-panel", Vector(.1, .1, .003), Math::Quaternions::eye(), Vector(0., 0., -.15));
107  break;
108  case 'c':
109  obj.add_cuboid("cosmos.pvstrg.x+panel", Vector(.3, .1, .003), Math::Quaternions::eye(), Vector(.2, 0., .15));
110  obj.add_cuboid("cosmos.pvstrg.x-panel", Vector(.3, .1, .003), Math::Quaternions::eye(), Vector(-.2, 0., .15));
111  obj.add_cuboid("cosmos.pvstrg.y+panel", Vector(.1, .003, .3), Math::Quaternions::eye(), Vector(0., .05, 0.));
112  obj.add_cuboid("cosmos.pvstrg.y-panel", Vector(.1, .003, .3), Math::Quaternions::eye(), Vector(0., -.05, 0.));
113  obj.add_cuboid("cosmos.pvstrg.z+panel", Vector(.1, .1, .003), Math::Quaternions::eye(), Vector(0., 0., .15));
114  obj.add_cuboid("cosmos.pvstrg.z-panel", Vector(.1, .1, .003), Math::Quaternions::eye(), Vector(0., 0., -.15));
115  break;
116  case 'd':
117  obj.add_cuboid("cosmos.pvstrg.x+panel", Vector(.3, .1, .003), Math::Quaternions::eye(), Vector(.2, 0., .15));
118  obj.add_cuboid("cosmos.pvstrg.x-panel", Vector(.3, .1, .003), Math::Quaternions::eye(), Vector(-.2, 0., .15));
119  obj.add_cuboid("cosmos.pvstrg.y+panel", Vector(.1, .3, .003), Math::Quaternions::eye(), Vector(0., .2, .15));
120  obj.add_cuboid("cosmos.pvstrg.y-panel", Vector(.1, .3, .003), Math::Quaternions::eye(), Vector(0., -.2, .15));
121  obj.add_cuboid("cosmos.pvstrg.z+panel", Vector(.1, .1, .003), Math::Quaternions::eye(), Vector(0., 0., .15));
122  obj.add_cuboid("cosmos.pvstrg.z-panel", Vector(.1, .1, .003), Math::Quaternions::eye(), Vector(0., 0., -.15));
123  break;
124  case 'a':
125  default:
126  break;
127  }
128  break;
129  case 1:
130  default:
131  obj.add_1u("u1", Vector(0., 0., 0.));
132  switch (variant)
133  {
134  case 'b':
135  obj.add_cuboid("cosmos.pvstrg.x+panel", Vector(.003, .1, .1), Math::Quaternions::eye(), Vector(.05, 0., 0.));
136  obj.add_cuboid("cosmos.pvstrg.x-panel", Vector(.003, .1, .1), Math::Quaternions::eye(), Vector(-.05, 0., 0.));
137  obj.add_cuboid("cosmos.pvstrg.y+panel", Vector(.1, .003, .1), Math::Quaternions::eye(), Vector(0., .05, 0.));
138  obj.add_cuboid("cosmos.pvstrg.y-panel", Vector(.1, .003, .1), Math::Quaternions::eye(), Vector(0., -.05, 0.));
139  obj.add_cuboid("cosmos.pvstrg.z+panel", Vector(.1, .1, .003), Math::Quaternions::eye(), Vector(0., 0., .05));
140  obj.add_cuboid("cosmos.pvstrg.z-panel", Vector(.1, .1, .003), Math::Quaternions::eye(), Vector(0., 0., -.05));
141  break;
142  case 'a':
143  default:
144  break;
145  }
146  break;
147  }
148 
149  obj.save_file(".", name);
150 }
void add_3u(string basename, Vector offset)
Definition: objlib.cpp:285
wavefront obj
Definition: cubesat2obj.cpp:4
void add_1u(string basename, Vector offset)
Definition: objlib.cpp:250
string name
Definition: cubesat2obj.cpp:6
Matrix eye(double scale)
Scaled Identity ::Matrix.
Definition: matrix.cpp:2025
void add_cuboid(string name, Vector size, Quaternion orientation, Vector offset)
Definition: objlib.cpp:141
int32_t save_file(string loc, string name)
Definition: objlib.cpp:766
Vector Class.
Definition: vector.h:672

Variable Documentation

wavefront obj
vector<string> part
string name = "testu"