line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
# |
2
|
|
|
|
|
|
|
# Rinchi Common Image Generator Interface for Perl |
3
|
|
|
|
|
|
|
# Class Identifier: f78ae818-200e-11de-bdb4-001c25551abc |
4
|
|
|
|
|
|
|
# Author: Brian M. Ames |
5
|
|
|
|
|
|
|
# |
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
package Rinchi::CIGIPP::TrajectoryDefinition; |
8
|
|
|
|
|
|
|
|
9
|
1
|
|
|
1
|
|
21
|
use 5.006; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
37
|
|
10
|
1
|
|
|
1
|
|
5
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
32
|
|
11
|
1
|
|
|
1
|
|
19
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
1154
|
|
12
|
1
|
|
|
1
|
|
6
|
use Carp; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
2721
|
|
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
require Exporter; |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
our @ISA = qw(Exporter); |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
# Items to export into callers namespace by default. Note: do not export |
19
|
|
|
|
|
|
|
# names by default without a very good reason. Use EXPORT_OK instead. |
20
|
|
|
|
|
|
|
# Do not simply export all your public functions/methods/constants. |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
# This allows declaration use Rinchi::CIGI::AtmosphereControl ':all'; |
23
|
|
|
|
|
|
|
# If you do not need this, moving things directly into @EXPORT or @EXPORT_OK |
24
|
|
|
|
|
|
|
# will save memory. |
25
|
|
|
|
|
|
|
our %EXPORT_TAGS = ( 'all' => [ qw( |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
) ] ); |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
our @EXPORT_OK = ( @{ $EXPORT_TAGS{'all'} } ); |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
our @EXPORT = qw( |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
); |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
our $VERSION = '0.01'; |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
# Preloaded methods go here. |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
=head1 NAME |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
Rinchi::CIGIPP::TrajectoryDefinition - Perl extension for the Common Image |
42
|
|
|
|
|
|
|
Generator Interface - Trajectory Definition data packet. |
43
|
|
|
|
|
|
|
data packet. |
44
|
|
|
|
|
|
|
=head1 SYNOPSIS |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
use Rinchi::CIGIPP::TrajectoryDefinition; |
47
|
|
|
|
|
|
|
my $traj_def = Rinchi::CIGIPP::TrajectoryDefinition->new(); |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
$packet_type = $traj_def->packet_type(); |
50
|
|
|
|
|
|
|
$packet_size = $traj_def->packet_size(); |
51
|
|
|
|
|
|
|
$entity_ident = $traj_def->entity_ident(55021); |
52
|
|
|
|
|
|
|
$x_acceleration = $traj_def->x_acceleration(60.29); |
53
|
|
|
|
|
|
|
$y_acceleration = $traj_def->y_acceleration(33.53); |
54
|
|
|
|
|
|
|
$z_acceleration = $traj_def->z_acceleration(3.749); |
55
|
|
|
|
|
|
|
$retardation_rate = $traj_def->retardation_rate(5.483); |
56
|
|
|
|
|
|
|
$terminal_velocity = $traj_def->terminal_velocity(84.799); |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
=head1 DESCRIPTION |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
The Trajectory Definition packet enables the Host to describe a trajectory |
61
|
|
|
|
|
|
|
along which an IG-driven entity, such as a tracer round or particulate debris, |
62
|
|
|
|
|
|
|
travels. This is useful for simulating gravity and other static forces acting |
63
|
|
|
|
|
|
|
upon the entity. This packet is commonly used in conjunction with the Rate |
64
|
|
|
|
|
|
|
Control packet. |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
=head2 EXPORT |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
None by default. |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
#============================================================================== |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
=item new $traj_def = Rinchi::CIGIPP::TrajectoryDefinition->new() |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
Constructor for Rinchi::TrajectoryDefinition. |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
=cut |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
sub new { |
79
|
1
|
|
|
1
|
1
|
228
|
my $class = shift; |
80
|
1
|
|
33
|
|
|
7
|
$class = ref($class) || $class; |
81
|
|
|
|
|
|
|
|
82
|
1
|
|
|
|
|
14
|
my $self = { |
83
|
|
|
|
|
|
|
'_Buffer' => '', |
84
|
|
|
|
|
|
|
'_ClassIdent' => 'f78ae818-200e-11de-bdb4-001c25551abc', |
85
|
|
|
|
|
|
|
'_Pack' => 'CCSfffff', |
86
|
|
|
|
|
|
|
'_Swap1' => 'CCvVVVVV', |
87
|
|
|
|
|
|
|
'_Swap2' => 'CCnNNNNN', |
88
|
|
|
|
|
|
|
'packetType' => 20, |
89
|
|
|
|
|
|
|
'packetSize' => 24, |
90
|
|
|
|
|
|
|
'entityIdent' => 0, |
91
|
|
|
|
|
|
|
'xAcceleration' => 0, |
92
|
|
|
|
|
|
|
'yAcceleration' => 0, |
93
|
|
|
|
|
|
|
'zAcceleration' => 0, |
94
|
|
|
|
|
|
|
'retardationRate' => 0, |
95
|
|
|
|
|
|
|
'terminalVelocity' => 0, |
96
|
|
|
|
|
|
|
}; |
97
|
|
|
|
|
|
|
|
98
|
1
|
50
|
|
|
|
6
|
if (@_) { |
99
|
0
|
0
|
|
|
|
0
|
if (ref($_[0]) eq 'ARRAY') { |
|
|
0
|
|
|
|
|
|
100
|
0
|
|
|
|
|
0
|
$self->{'_Buffer'} = $_[0][0]; |
101
|
|
|
|
|
|
|
} elsif (ref($_[0]) eq 'HASH') { |
102
|
0
|
|
|
|
|
0
|
foreach my $attr (keys %{$_[0]}) { |
|
0
|
|
|
|
|
0
|
|
103
|
0
|
0
|
|
|
|
0
|
$self->{"_$attr"} = $_[0]->{$attr} unless ($attr =~ /^_/); |
104
|
|
|
|
|
|
|
} |
105
|
|
|
|
|
|
|
} |
106
|
|
|
|
|
|
|
} |
107
|
|
|
|
|
|
|
|
108
|
1
|
|
|
|
|
3
|
bless($self,$class); |
109
|
1
|
|
|
|
|
3
|
return $self; |
110
|
|
|
|
|
|
|
} |
111
|
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
#============================================================================== |
113
|
|
|
|
|
|
|
|
114
|
|
|
|
|
|
|
=item sub packet_type() |
115
|
|
|
|
|
|
|
|
116
|
|
|
|
|
|
|
$value = $traj_def->packet_type(); |
117
|
|
|
|
|
|
|
|
118
|
|
|
|
|
|
|
Data Packet Identifier. |
119
|
|
|
|
|
|
|
|
120
|
|
|
|
|
|
|
This attribute identifies this data packet as the Trajectory Definition packet. |
121
|
|
|
|
|
|
|
The value of this attribute must be 20. |
122
|
|
|
|
|
|
|
|
123
|
|
|
|
|
|
|
=cut |
124
|
|
|
|
|
|
|
|
125
|
|
|
|
|
|
|
sub packet_type() { |
126
|
1
|
|
|
1
|
1
|
7
|
my ($self) = @_; |
127
|
1
|
|
|
|
|
9
|
return $self->{'packetType'}; |
128
|
|
|
|
|
|
|
} |
129
|
|
|
|
|
|
|
|
130
|
|
|
|
|
|
|
#============================================================================== |
131
|
|
|
|
|
|
|
|
132
|
|
|
|
|
|
|
=item sub packet_size() |
133
|
|
|
|
|
|
|
|
134
|
|
|
|
|
|
|
$value = $traj_def->packet_size(); |
135
|
|
|
|
|
|
|
|
136
|
|
|
|
|
|
|
Data Packet Size. |
137
|
|
|
|
|
|
|
|
138
|
|
|
|
|
|
|
This attribute indicates the number of bytes in this data packet. The value of |
139
|
|
|
|
|
|
|
this attribute must be 24. |
140
|
|
|
|
|
|
|
|
141
|
|
|
|
|
|
|
=cut |
142
|
|
|
|
|
|
|
|
143
|
|
|
|
|
|
|
sub packet_size() { |
144
|
1
|
|
|
1
|
1
|
6
|
my ($self) = @_; |
145
|
1
|
|
|
|
|
10
|
return $self->{'packetSize'}; |
146
|
|
|
|
|
|
|
} |
147
|
|
|
|
|
|
|
|
148
|
|
|
|
|
|
|
#============================================================================== |
149
|
|
|
|
|
|
|
|
150
|
|
|
|
|
|
|
=item sub entity_ident([$newValue]) |
151
|
|
|
|
|
|
|
|
152
|
|
|
|
|
|
|
$value = $traj_def->entity_ident($newValue); |
153
|
|
|
|
|
|
|
|
154
|
|
|
|
|
|
|
Entity ID. |
155
|
|
|
|
|
|
|
|
156
|
|
|
|
|
|
|
This attribute identifies the entity for which the trajectory is defined. |
157
|
|
|
|
|
|
|
|
158
|
|
|
|
|
|
|
=cut |
159
|
|
|
|
|
|
|
|
160
|
|
|
|
|
|
|
sub entity_ident() { |
161
|
1
|
|
|
1
|
1
|
7
|
my ($self,$nv) = @_; |
162
|
1
|
50
|
|
|
|
6
|
if (defined($nv)) { |
163
|
1
|
|
|
|
|
3
|
$self->{'entityIdent'} = $nv; |
164
|
|
|
|
|
|
|
} |
165
|
1
|
|
|
|
|
3
|
return $self->{'entityIdent'}; |
166
|
|
|
|
|
|
|
} |
167
|
|
|
|
|
|
|
|
168
|
|
|
|
|
|
|
#============================================================================== |
169
|
|
|
|
|
|
|
|
170
|
|
|
|
|
|
|
=item sub x_acceleration([$newValue]) |
171
|
|
|
|
|
|
|
|
172
|
|
|
|
|
|
|
$value = $traj_def->x_acceleration($newValue); |
173
|
|
|
|
|
|
|
|
174
|
|
|
|
|
|
|
Acceleration X. |
175
|
|
|
|
|
|
|
|
176
|
|
|
|
|
|
|
This attribute specifies the X component of the acceleration vector. |
177
|
|
|
|
|
|
|
|
178
|
|
|
|
|
|
|
=cut |
179
|
|
|
|
|
|
|
|
180
|
|
|
|
|
|
|
sub x_acceleration() { |
181
|
1
|
|
|
1
|
1
|
7
|
my ($self,$nv) = @_; |
182
|
1
|
50
|
|
|
|
5
|
if (defined($nv)) { |
183
|
1
|
|
|
|
|
3
|
$self->{'xAcceleration'} = $nv; |
184
|
|
|
|
|
|
|
} |
185
|
1
|
|
|
|
|
4
|
return $self->{'xAcceleration'}; |
186
|
|
|
|
|
|
|
} |
187
|
|
|
|
|
|
|
|
188
|
|
|
|
|
|
|
#============================================================================== |
189
|
|
|
|
|
|
|
|
190
|
|
|
|
|
|
|
=item sub y_acceleration([$newValue]) |
191
|
|
|
|
|
|
|
|
192
|
|
|
|
|
|
|
$value = $traj_def->y_acceleration($newValue); |
193
|
|
|
|
|
|
|
|
194
|
|
|
|
|
|
|
Acceleration Y. |
195
|
|
|
|
|
|
|
|
196
|
|
|
|
|
|
|
This attribute specifies the Y component of the acceleration vector. |
197
|
|
|
|
|
|
|
|
198
|
|
|
|
|
|
|
=cut |
199
|
|
|
|
|
|
|
|
200
|
|
|
|
|
|
|
sub y_acceleration() { |
201
|
1
|
|
|
1
|
1
|
6
|
my ($self,$nv) = @_; |
202
|
1
|
50
|
|
|
|
5
|
if (defined($nv)) { |
203
|
1
|
|
|
|
|
3
|
$self->{'yAcceleration'} = $nv; |
204
|
|
|
|
|
|
|
} |
205
|
1
|
|
|
|
|
3
|
return $self->{'yAcceleration'}; |
206
|
|
|
|
|
|
|
} |
207
|
|
|
|
|
|
|
|
208
|
|
|
|
|
|
|
#============================================================================== |
209
|
|
|
|
|
|
|
|
210
|
|
|
|
|
|
|
=item sub z_acceleration([$newValue]) |
211
|
|
|
|
|
|
|
|
212
|
|
|
|
|
|
|
$value = $traj_def->z_acceleration($newValue); |
213
|
|
|
|
|
|
|
|
214
|
|
|
|
|
|
|
Acceleration Z. |
215
|
|
|
|
|
|
|
|
216
|
|
|
|
|
|
|
This attribute specifies the Z component of the acceleration vector. |
217
|
|
|
|
|
|
|
|
218
|
|
|
|
|
|
|
=cut |
219
|
|
|
|
|
|
|
|
220
|
|
|
|
|
|
|
sub z_acceleration() { |
221
|
1
|
|
|
1
|
1
|
6
|
my ($self,$nv) = @_; |
222
|
1
|
50
|
|
|
|
4
|
if (defined($nv)) { |
223
|
1
|
|
|
|
|
3
|
$self->{'zAcceleration'} = $nv; |
224
|
|
|
|
|
|
|
} |
225
|
1
|
|
|
|
|
3
|
return $self->{'zAcceleration'}; |
226
|
|
|
|
|
|
|
} |
227
|
|
|
|
|
|
|
|
228
|
|
|
|
|
|
|
#============================================================================== |
229
|
|
|
|
|
|
|
|
230
|
|
|
|
|
|
|
=item sub retardation_rate([$newValue]) |
231
|
|
|
|
|
|
|
|
232
|
|
|
|
|
|
|
$value = $traj_def->retardation_rate($newValue); |
233
|
|
|
|
|
|
|
|
234
|
|
|
|
|
|
|
Retardation Rate. |
235
|
|
|
|
|
|
|
|
236
|
|
|
|
|
|
|
This attribute specifies the magnitude of an acceleration applied against the |
237
|
|
|
|
|
|
|
entity's instantaneous linear velocity vector. This is used to simulate drag |
238
|
|
|
|
|
|
|
and other frictional forces acting upon the entity. |
239
|
|
|
|
|
|
|
|
240
|
|
|
|
|
|
|
=cut |
241
|
|
|
|
|
|
|
|
242
|
|
|
|
|
|
|
sub retardation_rate() { |
243
|
1
|
|
|
1
|
1
|
5
|
my ($self,$nv) = @_; |
244
|
1
|
50
|
|
|
|
5
|
if (defined($nv)) { |
245
|
1
|
|
|
|
|
2
|
$self->{'retardationRate'} = $nv; |
246
|
|
|
|
|
|
|
} |
247
|
1
|
|
|
|
|
3
|
return $self->{'retardationRate'}; |
248
|
|
|
|
|
|
|
} |
249
|
|
|
|
|
|
|
|
250
|
|
|
|
|
|
|
#============================================================================== |
251
|
|
|
|
|
|
|
|
252
|
|
|
|
|
|
|
=item sub terminal_velocity([$newValue]) |
253
|
|
|
|
|
|
|
|
254
|
|
|
|
|
|
|
$value = $traj_def->terminal_velocity($newValue); |
255
|
|
|
|
|
|
|
|
256
|
|
|
|
|
|
|
Terminal Velocity. |
257
|
|
|
|
|
|
|
|
258
|
|
|
|
|
|
|
This attribute specifies the maximum velocity the entity can sustain. |
259
|
|
|
|
|
|
|
|
260
|
|
|
|
|
|
|
=cut |
261
|
|
|
|
|
|
|
|
262
|
|
|
|
|
|
|
sub terminal_velocity() { |
263
|
1
|
|
|
1
|
1
|
6
|
my ($self,$nv) = @_; |
264
|
1
|
50
|
|
|
|
5
|
if (defined($nv)) { |
265
|
1
|
|
|
|
|
2
|
$self->{'terminalVelocity'} = $nv; |
266
|
|
|
|
|
|
|
} |
267
|
1
|
|
|
|
|
4
|
return $self->{'terminalVelocity'}; |
268
|
|
|
|
|
|
|
} |
269
|
|
|
|
|
|
|
|
270
|
|
|
|
|
|
|
#========================================================================== |
271
|
|
|
|
|
|
|
|
272
|
|
|
|
|
|
|
=item sub pack() |
273
|
|
|
|
|
|
|
|
274
|
|
|
|
|
|
|
$value = $traj_def->pack(); |
275
|
|
|
|
|
|
|
|
276
|
|
|
|
|
|
|
Returns the packed data packet. |
277
|
|
|
|
|
|
|
|
278
|
|
|
|
|
|
|
=cut |
279
|
|
|
|
|
|
|
|
280
|
|
|
|
|
|
|
sub pack($) { |
281
|
1
|
|
|
1
|
1
|
5
|
my $self = shift ; |
282
|
|
|
|
|
|
|
|
283
|
1
|
|
|
|
|
8
|
$self->{'_Buffer'} = CORE::pack($self->{'_Pack'}, |
284
|
|
|
|
|
|
|
$self->{'packetType'}, |
285
|
|
|
|
|
|
|
$self->{'packetSize'}, |
286
|
|
|
|
|
|
|
$self->{'entityIdent'}, |
287
|
|
|
|
|
|
|
$self->{'xAcceleration'}, |
288
|
|
|
|
|
|
|
$self->{'yAcceleration'}, |
289
|
|
|
|
|
|
|
$self->{'zAcceleration'}, |
290
|
|
|
|
|
|
|
$self->{'retardationRate'}, |
291
|
|
|
|
|
|
|
$self->{'terminalVelocity'}, |
292
|
|
|
|
|
|
|
); |
293
|
|
|
|
|
|
|
|
294
|
1
|
|
|
|
|
11
|
return $self->{'_Buffer'}; |
295
|
|
|
|
|
|
|
} |
296
|
|
|
|
|
|
|
|
297
|
|
|
|
|
|
|
#========================================================================== |
298
|
|
|
|
|
|
|
|
299
|
|
|
|
|
|
|
=item sub unpack() |
300
|
|
|
|
|
|
|
|
301
|
|
|
|
|
|
|
$value = $traj_def->unpack(); |
302
|
|
|
|
|
|
|
|
303
|
|
|
|
|
|
|
Unpacks the packed data packet. |
304
|
|
|
|
|
|
|
|
305
|
|
|
|
|
|
|
=cut |
306
|
|
|
|
|
|
|
|
307
|
|
|
|
|
|
|
sub unpack($) { |
308
|
0
|
|
|
0
|
1
|
|
my $self = shift @_; |
309
|
|
|
|
|
|
|
|
310
|
0
|
0
|
|
|
|
|
if (@_) { |
311
|
0
|
|
|
|
|
|
$self->{'_Buffer'} = shift @_; |
312
|
|
|
|
|
|
|
} |
313
|
0
|
|
|
|
|
|
my ($a,$b,$c,$d,$e,$f,$g,$h) = CORE::unpack($self->{'_Pack'},$self->{'_Buffer'}); |
314
|
0
|
|
|
|
|
|
$self->{'packetType'} = $a; |
315
|
0
|
|
|
|
|
|
$self->{'packetSize'} = $b; |
316
|
0
|
|
|
|
|
|
$self->{'entityIdent'} = $c; |
317
|
0
|
|
|
|
|
|
$self->{'xAcceleration'} = $d; |
318
|
0
|
|
|
|
|
|
$self->{'yAcceleration'} = $e; |
319
|
0
|
|
|
|
|
|
$self->{'zAcceleration'} = $f; |
320
|
0
|
|
|
|
|
|
$self->{'retardationRate'} = $g; |
321
|
0
|
|
|
|
|
|
$self->{'terminalVelocity'} = $h; |
322
|
|
|
|
|
|
|
|
323
|
0
|
|
|
|
|
|
return $self->{'_Buffer'}; |
324
|
|
|
|
|
|
|
} |
325
|
|
|
|
|
|
|
|
326
|
|
|
|
|
|
|
#========================================================================== |
327
|
|
|
|
|
|
|
|
328
|
|
|
|
|
|
|
=item sub byte_swap() |
329
|
|
|
|
|
|
|
|
330
|
|
|
|
|
|
|
$obj_name->byte_swap(); |
331
|
|
|
|
|
|
|
|
332
|
|
|
|
|
|
|
Byte swaps the packed data packet. |
333
|
|
|
|
|
|
|
|
334
|
|
|
|
|
|
|
=cut |
335
|
|
|
|
|
|
|
|
336
|
|
|
|
|
|
|
sub byte_swap($) { |
337
|
0
|
|
|
0
|
1
|
|
my $self = shift @_; |
338
|
|
|
|
|
|
|
|
339
|
0
|
0
|
|
|
|
|
if (@_) { |
340
|
0
|
|
|
|
|
|
$self->{'_Buffer'} = shift @_; |
341
|
|
|
|
|
|
|
} else { |
342
|
0
|
|
|
|
|
|
$self->pack(); |
343
|
|
|
|
|
|
|
} |
344
|
0
|
|
|
|
|
|
my ($a,$b,$c,$d,$e,$f,$g,$h) = CORE::unpack($self->{'_Swap1'},$self->{'_Buffer'}); |
345
|
|
|
|
|
|
|
|
346
|
0
|
|
|
|
|
|
$self->{'_Buffer'} = CORE::pack($self->{'_Swap2'},$a,$b,$c,$d,$e,$f,$g,$h); |
347
|
0
|
|
|
|
|
|
$self->unpack(); |
348
|
|
|
|
|
|
|
|
349
|
0
|
|
|
|
|
|
return $self->{'_Buffer'}; |
350
|
|
|
|
|
|
|
} |
351
|
|
|
|
|
|
|
|
352
|
|
|
|
|
|
|
1; |
353
|
|
|
|
|
|
|
__END__ |