VRML/VRML2.pm

filter: Statementstmt 16.3% 114 / 696 Branchbran 9.3% 35 / 376 Conditioncond 4.8% 4 / 83 MC/DCmcdc 0.0% 0 / 54 Subroutinesub 22.7% 25 / 110 Podpod 1.6% 1 / 61 totaltotal 12.9% 179 / 1380 CC 229 SCAR 55.4
CC
229
Cov
13%
line
1122.0
transform_begin
870.0
background
380.0
CRAP 253.6
« VRML/VRML1.pm ↑ Summary VRML/Color.pm »
1 package VRML::VRML2;
2  
3 ############################## Copyright ##############################
4 # #
5 # This program is Copyright 1996,1998 by Hartmut Palm. #
6 # This program is free software; you can redistribute it and/or #
7 # modify it under the terms of the GNU General Public License #
8 # as published by the Free Software Foundation; either version 2 #
9 # of the License, or (at your option) any later version. #
10 # #
11 # This program is distributed in the hope that it will be useful, #
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of #
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
14 # GNU General Public License for more details. #
15 # #
16 # If you do not have a copy of the GNU General Public License write #
17 # to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, #
18 # MA 02139, USA. #
19 # #
20 #######################################################################
21  
22 1 require 5.000;
23 1 require VRML::VRML2::Standard;
24 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
25 1 ▶use VRML::Color;
Subroutine BEGIN: called CC=1 SCAR=0.0
26 1 ▶use vars qw(@ISA $VERSION %supported);
Subroutine BEGIN: called CC=1 SCAR=0.0
27 1 @ISA = qw(VRML::VRML2::Standard);
28  
29 1 $VERSION = "1.10";
30 1 %supported = (
31 'quote' => "Cortona VRML Client|Cosmo Player|CosmoPlayer|Live3D|WorldView",
32 'gzip' => "Cortona VRML Client|Cosmo Player|CosmoPlayer|libcosmoplayer|Live3D|WorldView|VRweb|GLview",
33 'target'=> "Cortona VRML Client|Cosmo Player|CosmoPlayer|libcosmoplayer|Live3D|WorldView|MSVRML2OCX"
34 );
35  
36 1 my $PI = 3.1415926;
37 1 my $PI_2 = $PI / 2;
38  
39 #--------------------------------------------------------------------
40  
41 6 ▶sub new {
Subroutine new: called CC=1 SCAR=0.0
Pod documented
42 6 my $class = shift;
43 6 my $version = shift;
44 6 my $self = new VRML::VRML2::Standard($version);
45 6 $self->{'viewpoint'} = [];
46 6 $self->{'route'} = [];
47 6 return bless $self, $class;
48 }
49  
50 0 ▶sub supported {
Subroutine supported: not called CC=1 SCAR=6.9
Pod undocumented
51 0 my $self = shift;
52 0 my $feature = shift;
53 0 return $self->{'BROWSER'} =~ /$supported{$feature}/i;
54 }
55  
56 #--------------------------------------------------------------------
57 # VRML Grouping Methods
58 #--------------------------------------------------------------------
59 0 ▶sub begin {
Subroutine begin: not called CC=1 SCAR=6.9
Pod undocumented
60 0 my $self = shift;
61 0 $self->Group(@_);
62 0 return $self;
63 }
64  
65 0 ▶sub end {
Subroutine end: not called CC=2 SCAR=17.9
Pod undocumented
66 0 my $self = shift;
67 0 $self->EndChildren->End($_[0]); # close [ and { with comment
68 0 for (@{$self->{'route'}}) { $self->ROUTE(@{$_}); }
69 0 $self->{'route'} = [];
70 0 return $self;
71 }
72  
73 0 ▶sub anchor_begin {
Subroutine anchor_begin: not called CC=5 SCAR=34.0
Pod undocumented
74 0 my $self = shift;
75 0 my ($url, $description, $parameter, $bboxSize, $bboxCenter) = @_;
76 0 ▶ my $quote = $self->{'BROWSER'} =~ /$supported{'quote'}/i ? '\\"' : "'";
Branch: 1 branch
BranchTrueFalseTotal
$self->{'BROWSER'} =~ /$VRML::VRML2::supported{'quote'}/i ? : 0 0 0
77 0 ▶ $description =~ s/"/$quote/g if defined $description;
Branch: 1 branch
BranchTrueFalseTotal
if defined $description 0 0 0
78 0 ▶ $parameter =~ s/"/$quote/g if defined $parameter;
Branch: 1 branch
BranchTrueFalseTotal
if defined $parameter 0 0 0
79 0 ▶ undef $parameter if $self->{'BROWSER'} !~ /$supported{'target'}/i;
Branch: 1 branch
BranchTrueFalseTotal
unless $self->{"BROWSER"} =~ /$VRML::VRML2::supported{"target"}/i 0 0 0
80 0 $self->Anchor($url, $description, $parameter, $bboxSize, $bboxCenter);
81 0 return $self;
82 }
83  
84 0 ▶sub anchor_end {
Subroutine anchor_end: not called CC=1 SCAR=6.9
Pod undocumented
85 0 my $self = shift;
86 0 $self->EndChildren->End($_[0]); # close [ and {
87 0 return $self;
88 }
89  
90 0 ▶sub billboard_begin {
Subroutine billboard_begin: not called CC=1 SCAR=6.9
Pod undocumented
91 0 my $self = shift;
92 0 $self->Billboard(@_);
93 0 return $self;
94 }
95  
96 0 ▶sub billboard_end {
Subroutine billboard_end: not called CC=1 SCAR=6.9
Pod undocumented
97 0 my $self = shift;
98 0 $self->EndChildren->End($_[0]); # close [ and {
99 0 return $self;
100 }
101  
102 0 ▶sub collision_begin {
Subroutine collision_begin: not called CC=3 SCAR=24.8
Pod undocumented
103 0 my $self = shift;
104 0 my ($collide, $proxy) = @_;
105 0 ▶ $collide = defined $collide && $collide ? "TRUE" : "FALSE";
Branch: 1 branch
BranchTrueFalseTotal
defined $collide && $collide ? : 0 0 0
Condition0%0/3
defined $collide and $collide
!ll&&!rl&&r
000
MC/DC0%0/2
defined $collide and $collide
defined $collide $collide
Truth table0%0/3
A and B
A= defined $collideB= $collide
ABresult
0X0
100
111
106 0 $self->Collision($collide, $proxy);
107 0 return $self;
108 }
109  
110 0 ▶sub collision_end {
Subroutine collision_end: not called CC=1 SCAR=6.9
Pod undocumented
111 0 my $self = shift;
112 0 $self->EndChildren->End($_[0]); # close [ and {
113 0 return $self;
114 }
115  
116 0 ▶sub group_begin {
Subroutine group_begin: not called CC=1 SCAR=6.9
Pod undocumented
117 0 my $self = shift;
118 0 $self->Group(@_);
119 0 return $self;
120 }
121  
122 0 ▶sub group_end {
Subroutine group_end: not called CC=1 SCAR=6.9
Pod undocumented
123 0 my $self = shift;
124 0 $self->EndChildren->End($_[0]); # close [ and {
125 0 return $self;
126 }
127  
128 0 ▶sub lod_begin {
Subroutine lod_begin: not called CC=1 SCAR=6.9
Pod undocumented
129 0 my $self = shift;
130 0 $self->LOD(@_);
131 0 return $self;
132 }
133  
134 0 ▶sub lod_end {
Subroutine lod_end: not called CC=1 SCAR=6.9
Pod undocumented
135 0 my $self = shift;
136 0 $self->EndChildren->End($_[0]); # close [ and {
137 0 return $self;
138 }
139  
140 0 ▶sub switch_begin {
Subroutine switch_begin: not called CC=1 SCAR=6.9
Pod undocumented
141 0 my $self = shift;
142 0 $self->Switch(@_);
143 0 return $self;
144 }
145  
146 0 ▶sub switch_end {
Subroutine switch_end: not called CC=1 SCAR=6.9
Pod undocumented
147 0 my $self = shift;
148 0 $self->EndChildren->End($_[0]); # close [ and {
149 0 return $self;
150 }
151  
152 0 ▶sub at {
Subroutine at: not called CC=1 SCAR=6.9
Pod undocumented
153 0 my $self = shift;
154 0 $self->transform_begin(@_);
155 0 return $self;
156 }
157  
158 0 ▶sub back {
Subroutine back: not called CC=1 SCAR=6.9
Pod undocumented
159 0 my $self = shift;
160 0 $self->transform_end;
161 0 return $self;
162 }
163  
164 0 ▶sub transform_begin {
Subroutine transform_begin: not called CC=29 SCAR=67.7
Pod undocumented
165 0 my $self = shift;
166 0 my (@transform_list) = @_;
167 0 my @transform;
168 0 ▶ if (ref($transform_list[0])) {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $transform_list[0]) { } 0 0 0
169 0 @transform = @{$transform_list[0]};
170 } else {
171 0 @transform = @transform_list;
172 }
173 0 ▶ return $self->Transform unless @transform;
Branch: 1 branch
BranchTrueFalseTotal
unless @transform 0 0 0
174 0 my ($item, $key, $value);
175 0 my ($x,$y,$z,$angle,$t,$r,$s,$o,$c,$bbs,$bbc);
176 0 foreach $item (@transform) {
177 0 ▶ next if !defined $item or $item eq "";
Branch: 1 branch
BranchTrueFalseTotal
if not defined $item or $item eq "" 0 0 0
Condition0%0/3
not defined $item or $item eq ""
l!l&&r!l&&!r
000
MC/DC0%0/2
not defined $item or $item eq ""
not defined $item $item eq ""
Truth table0%0/3
not(A) or B
A= not defined $itemB= $item eq ""
ABresult
1X1
011
000
178 0 ▶ ($key,$value) = ref($item) ? @$item : split(/\s*=\s*/,$item);
Branch: 1 branch
BranchTrueFalseTotal
ref $item ? : 0 0 0
179 0 ▶ unless ($value) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($value) 0 0 0
180 0 ($x,$y,$z) = split(/\s/,$key);
181 0 ▶ $x=0 unless defined $x;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $x 0 0 0
182 0 ▶ $y=0 unless defined $y;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $y 0 0 0
183 0 ▶ $z=0 unless defined $z;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $z 0 0 0
184 0 $t = "$x $y $z";
185 }
186 MODE: {
187 0 ▶ if ($key eq "t" || $key eq "translation") { $t = $value; last MODE; }
Branch: 1 branch
BranchTrueFalseTotal
if ($key eq "t" or $key eq "translation") 0 0 0
Condition0%0/3
$key eq "t" or $key eq "translation"
l!l&&r!l&&!r
000
MC/DC0%0/2
$key eq "t" or $key eq "translation"
$key eq "t" $key eq "translation"
Truth table0%0/3
A or B
A= $key eq "t"B= $key eq "translation"
ABresult
1X1
011
000
188 0 ▶ if ($key eq "r" || $key eq "rotation") { $r = $value; last MODE; }
Branch: 1 branch
BranchTrueFalseTotal
if ($key eq "r" or $key eq "rotation") 0 0 0
Condition0%0/3
$key eq "r" or $key eq "rotation"
l!l&&r!l&&!r
000
MC/DC0%0/2
$key eq "r" or $key eq "rotation"
$key eq "r" $key eq "rotation"
Truth table0%0/3
A or B
A= $key eq "r"B= $key eq "rotation"
ABresult
1X1
011
000
189 0 ▶ if ($key eq "c" || $key eq "center") { $c = $value; last MODE; }
Branch: 1 branch
BranchTrueFalseTotal
if ($key eq "c" or $key eq "center") 0 0 0
Condition0%0/3
$key eq "c" or $key eq "center"
l!l&&r!l&&!r
000
MC/DC0%0/2
$key eq "c" or $key eq "center"
$key eq "c" $key eq "center"
Truth table0%0/3
A or B
A= $key eq "c"B= $key eq "center"
ABresult
1X1
011
000
190 0 ▶ if ($key eq "s" || $key eq "scale") { $s = $value; last MODE; }
Branch: 1 branch
BranchTrueFalseTotal
if ($key eq "s" or $key eq "scale") 0 0 0
Condition0%0/3
$key eq "s" or $key eq "scale"
l!l&&r!l&&!r
000
MC/DC0%0/2
$key eq "s" or $key eq "scale"
$key eq "s" $key eq "scale"
Truth table0%0/3
A or B
A= $key eq "s"B= $key eq "scale"
ABresult
1X1
011
000
191 0 ▶ if ($key eq "so" || $key eq "scaleOrientation") { $o = $value; last MODE; }
Branch: 1 branch
BranchTrueFalseTotal
if ($key eq "so" or $key eq "scaleOrientation") 0 0 0
Condition0%0/3
$key eq "so" or $key eq "scaleOrientation"
l!l&&r!l&&!r
000
MC/DC0%0/2
$key eq "so" or $key eq "scaleOrientation"
$key eq "so" $key eq "scaleOrientation"
Truth table0%0/3
A or B
A= $key eq "so"B= $key eq "scaleOrientation"
ABresult
1X1
011
000
192 0 ▶ if ($key eq "bbs" || $key eq "bboxSize") { $bbs = $value; last MODE; }
Branch: 1 branch
BranchTrueFalseTotal
if ($key eq "bbs" or $key eq "bboxSize") 0 0 0
Condition0%0/3
$key eq "bbs" or $key eq "bboxSize"
l!l&&r!l&&!r
000
MC/DC0%0/2
$key eq "bbs" or $key eq "bboxSize"
$key eq "bbs" $key eq "bboxSize"
Truth table0%0/3
A or B
A= $key eq "bbs"B= $key eq "bboxSize"
ABresult
1X1
011
000
193 0 ▶ if ($key eq "bbc" || $key eq "bboxCenter") { $bbc = $value; last MODE; }
Branch: 1 branch
BranchTrueFalseTotal
if ($key eq "bbc" or $key eq "bboxCenter") 0 0 0
Condition0%0/3
$key eq "bbc" or $key eq "bboxCenter"
l!l&&r!l&&!r
000
MC/DC0%0/2
$key eq "bbc" or $key eq "bboxCenter"
$key eq "bbc" $key eq "bboxCenter"
Truth table0%0/3
A or B
A= $key eq "bbc"B= $key eq "bboxCenter"
ABresult
1X1
011
000
194 }
195 0 ▶ if ($key eq "r" || $key eq "rotation") {
Branch: 1 branch
BranchTrueFalseTotal
if ($key eq "r" or $key eq "rotation") 0 0 0
Condition0%0/3
$key eq "r" or $key eq "rotation"
l!l&&r!l&&!r
000
MC/DC0%0/2
$key eq "r" or $key eq "rotation"
$key eq "r" $key eq "rotation"
Truth table0%0/3
A or B
A= $key eq "r"B= $key eq "rotation"
ABresult
1X1
011
000
196 0 ($x,$y,$z,$angle) = split(/\s/,$value);
197 0 ▶ unless (defined $angle) { # if one param its the angle
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $angle) 0 0 0
198 0 $angle=$x;
199 0 $x=0;
200 0 $y=0;
201 0 $z=1;
202 }
203 0 ▶ $angle *= $PI/180 if $self->{'CONVERT'};
Branch: 1 branch
BranchTrueFalseTotal
if $self->{"CONVERT"} 0 0 0
204 0 $r = "$x $y $z $angle";
205 }
206 }
207 0 $self->Transform($t,$r,$s,$o,$c,$b);
208 0 return $self;
209 }
210  
211 0 ▶sub transform_end {
Subroutine transform_end: not called CC=3 SCAR=24.8
Pod undocumented
212 0 my $self = shift;
213 0 $self->EndTransform("Transform");
214 0 ▶ unless ($self->{'TAB'}) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($self->{"TAB"}) 0 0 0
215 0 for (@{$self->{'route'}}) { $self->ROUTE(@{$_}); }
216 0 $self->{'route'} = [];
217 }
218 0 return $self;
219 }
220  
221 0 ▶sub inline {
Subroutine inline: not called CC=1 SCAR=6.9
Pod undocumented
222 0 my $self = shift;
223 0 $self->Inline(@_);
224 0 return $self;
225 }
226  
227 #--------------------------------------------------------------------
228 # VRML Methods
229 #--------------------------------------------------------------------
230  
231 0 ▶sub background {
Subroutine background: not called CC=19 SCAR=59.4
Pod undocumented
232 0 my $self = shift;
233 0 my %hash = @_;
234 0 my ($key,$value,@list);
235 0 ▶ if (defined $hash{'skyColor'}) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $hash{"skyColor"}) 0 0 0
236 0 ▶ if (ref($hash{'skyColor'}) eq "ARRAY") {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $hash{'skyColor'} eq 'ARRAY') { } 0 0 0
237 0 @list = ();
238 0 for $key (@{$hash{'skyColor'}}) {
239 0 $value = rgb_color($key);
240 0 push(@list, $value);
241 }
242 0 $hash{'skyColor'} = "[ ".join(", ",@list)." ]";
243 0 ▶ if (defined $hash{'skyAngle'}) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $hash{"skyAngle"}) 0 0 0
244 0 ▶ if (ref($hash{'skyAngle'}) eq "ARRAY") {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $hash{'skyAngle'} eq 'ARRAY') { } 0 0 0
245 0 @list = ();
246 0 for $key (@{$hash{'skyAngle'}}) {
247 0 ▶ $key *= $PI/180 if $self->{'CONVERT'};
Branch: 1 branch
BranchTrueFalseTotal
if $self->{"CONVERT"} 0 0 0
248 0 push(@list, $key);
249 }
250 0 $hash{'skyAngle'} = "[ ".join(", ",@list)." ]";
251 } else {
252 0 ▶ $hash{'skyAngle'} *= $PI/180 if $self->{'CONVERT'};
Branch: 1 branch
BranchTrueFalseTotal
if $self->{"CONVERT"} 0 0 0
253 }
254 }
255 } else {
256 0 $hash{'skyColor'} = rgb_color($hash{'skyColor'});
257 }
258 }
259 0 ▶ if (defined $hash{'groundColor'}) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $hash{"groundColor"}) 0 0 0
260 0 ▶ if (ref($hash{'groundColor'}) eq "ARRAY") {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $hash{'groundColor'} eq 'ARRAY') { } 0 0 0
261 0 @list = ();
262 0 for $key (@{$hash{'groundColor'}}) {
263 0 $value = rgb_color($key);
264 0 push(@list, $value);
265 }
266 0 $hash{'groundColor'} = "[ ".join(", ",@list)." ]";
267 0 ▶ if (defined $hash{'groundAngle'}) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $hash{"groundAngle"}) 0 0 0
268 0 ▶ if (ref($hash{'groundAngle'}) eq "ARRAY") {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $hash{'groundAngle'} eq 'ARRAY') { } 0 0 0
269 0 @list = ();
270 0 for $key (@{$hash{'groundAngle'}}) {
271 0 ▶ $key *= $PI/180 if $self->{'CONVERT'};
Branch: 1 branch
BranchTrueFalseTotal
if $self->{"CONVERT"} 0 0 0
272 0 push(@list, $key);
273 }
274 0 $hash{'groundAngle'} = "[ ".join(", ",@list)." ]";
275 } else {
276 0 ▶ $hash{'groundAngle'} *= $PI/180 if $self->{'CONVERT'};
Branch: 1 branch
BranchTrueFalseTotal
if $self->{"CONVERT"} 0 0 0
277 }
278 }
279 } else {
280 0 $hash{'groundColor'} = rgb_color($hash{'groundColor'});
281 }
282 }
283 0 ▶ foreach $key (keys %hash) { $hash{$key} = "\"$hash{$key}\"" if $key =~
Branch: 1 branch
BranchTrueFalseTotal
if $key =~ /Url$/ 0 0 0
284 /Url$/; }
285 0 $self->Background(%hash);
286 0 return $self;
287 }
288  
289 0 ▶sub backgroundcolor {
Subroutine backgroundcolor: not called CC=3 SCAR=24.8
Pod undocumented
290 0 my $self = shift;
291 0 my ($skyColorString, $groundColorString) = @_;
292 0 my ($skyColor, $groundColor);
293 0 ▶ $skyColor = rgb_color($skyColorString) if defined $skyColorString;
Branch: 1 branch
BranchTrueFalseTotal
if defined $skyColorString 0 0 0
294 0 ▶ $groundColor = rgb_color($groundColorString) if defined $groundColorString;
Branch: 1 branch
BranchTrueFalseTotal
if defined $groundColorString 0 0 0
295 0 $self->Background(skyColor => $skyColor, groundColor => $groundColor);
296 0 return $self;
297 }
298  
299 0 ▶sub backgroundimage {
Subroutine backgroundimage: not called CC=2 SCAR=17.9
Pod undocumented
300 0 my $self = shift;
301 0 my ($url) = @_;
302 0 ▶ return unless $url;
Branch: 1 branch
BranchTrueFalseTotal
unless $url 0 0 0
303 0 $self->Background(
304 frontUrl => "\"$url\"",
305 leftUrl => "\"$url\"",
306 rightUrl => "\"$url\"",
307 backUrl => "\"$url\"",
308 bottomUrl => "\"$url\"",
309 topUrl => "\"$url\""
310 );
311 0 return $self;
312 }
313  
314 0 ▶sub title {
Subroutine title: not called CC=3 SCAR=24.8
Pod undocumented
315 0 my $self = shift;
316 0 my $title = shift;
317 0 ▶ return unless defined $title;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $title 0 0 0
318 0 ▶ my $quote = $self->{'BROWSER'} =~ /$supported{'quote'}/i ? '\\"' : "'";
Branch: 1 branch
BranchTrueFalseTotal
$self->{'BROWSER'} =~ /$VRML::VRML2::supported{'quote'}/i ? : 0 0 0
319 0 $title =~ s/"/$quote/g;
320 0 $self->WorldInfo($title);
321 0 return $self;
322 }
323  
324 0 ▶sub info {
Subroutine info: not called CC=3 SCAR=24.8
Pod undocumented
325 0 my $self = shift;
326 0 my ($info) = @_;
327 0 ▶ my $quote = $self->{'BROWSER'} =~ /$supported{'quote'}/i ? '\\"' : "'";
Branch: 1 branch
BranchTrueFalseTotal
$self->{'BROWSER'} =~ /$VRML::VRML2::supported{'quote'}/i ? : 0 0 0
328 0 ▶ if (defined $info) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $info) 0 0 0
329 0 $info =~ s/"/$quote/g;
330 0 $self->WorldInfo(undef, $info);
331 }
332 0 return $self;
333 }
334  
335 0 ▶sub worldinfo {
Subroutine worldinfo: not called CC=4 SCAR=30.0
Pod undocumented
336 0 my $self = shift;
337 0 my ($title, $info) = @_;
338 0 ▶ my $quote = $self->{'BROWSER'} =~ /$supported{'quote'}/i ? '\\"' : "'";
Branch: 1 branch
BranchTrueFalseTotal
$self->{'BROWSER'} =~ /$VRML::VRML2::supported{'quote'}/i ? : 0 0 0
339 0 ▶ $title =~ s/"/$quote/g if defined $title;
Branch: 1 branch
BranchTrueFalseTotal
if defined $title 0 0 0
340 0 ▶ $info =~ s/"/$quote/g if defined $info;
Branch: 1 branch
BranchTrueFalseTotal
if defined $info 0 0 0
341 0 $self->WorldInfo($title, $info);
342 0 return $self;
343 }
344  
345 0 ▶sub navigationinfo {
Subroutine navigationinfo: not called CC=3 SCAR=24.8
Pod undocumented
346 0 my $self = shift;
347 0 my ($type, $speed, $headlight, $visibilityLimit, $avatarSize) = @_;
348 0 ▶ $headlight = defined $headlight && !$headlight ? "FALSE" : "TRUE";
Branch: 1 branch
BranchTrueFalseTotal
defined $headlight && !$headlight ? : 0 0 0
Condition0%0/3
defined $headlight and not $headlight
!ll&&!rl&&r
000
MC/DC0%0/2
defined $headlight and not $headlight
defined $headlight not $headlight
Truth table0%0/3
A and not(B)
A= defined $headlightB= not $headlight
ABresult
0X0
100
111
349 0 $self->NavigationInfo($type, $speed, $headlight, $visibilityLimit,
350 $avatarSize);
351 0 return $self;
352 }
353 #--------------------------------------------------------------------
354  
355 0 ▶sub viewpoint_begin {
Subroutine viewpoint_begin: not called CC=4 SCAR=30.0
Pod undocumented
356 0 my $self = shift;
357 0 my ($whichChild) = @_;
358 0 ▶ $whichChild = (defined $whichChild && $whichChild > 0) ? $whichChild-1 : 0;
Branch: 1 branch
BranchTrueFalseTotal
defined $whichChild && $whichChild > 0 ? : 0 0 0
Condition0%0/3
defined $whichChild and $whichChild > 0
!ll&&!rl&&r
000
MC/DC0%0/2
defined $whichChild and $whichChild > 0
defined $whichChild $whichChild > 0
Truth table0%0/3
A and B
A= defined $whichChildB= $whichChild > 0
ABresult
0X0
100
111
359 0 $self->{'TAB_VIEW'} = $self->{'TAB'};
360 0 $self->{'viewpoint_begin'} = $#{$self->{'VRML'}}+1 unless defined
361 0 ▶ $self->{'viewpoint_begin'};
Branch: 1 branch
BranchTrueFalseTotal
unless defined $self->{"viewpoint_begin"} 0 0 0
362 0 return $self;
363 }
364  
365 0 ▶sub viewpoint_end {
Subroutine viewpoint_end: not called CC=1 SCAR=6.9
Pod undocumented
366 0 my $self = shift;
367 0 splice(@{$self->{'VRML'}}, $self->{'viewpoint_begin'}, 0,
368 0 @{$self->{'viewpoint'}});
369 0 $self->{'viewpoint'} = [];
370 0 return $self;
371 }
372  
373 0 ▶sub viewpoint_auto_set {
Subroutine viewpoint_auto_set: not called CC=6 SCAR=37.4
Pod undocumented
374 0 my $self = shift;
375 0 my $factor = shift;
376 0 ▶ $factor = 1 unless defined $factor;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $factor 0 0 0
377 0 ▶ if (defined $self->{'viewpoint_set'}) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $self->{'viewpoint_set'}) { } 0 0 0
378 0 my $x = ($self->{'Xmax'}+$self->{'Xmin'})/2;
379 0 my $y = ($self->{'Ymax'}+$self->{'Ymin'})/2;
380 0 my $z = ($self->{'Zmax'}+$self->{'Zmin'})/2;
381 0 my $dx = abs($self->{'Xmax'}-$x); # todo calculate angle
382 0 my $dy = abs($self->{'Ymax'}-$y);
383 0 my $dz = abs($self->{'Zmax'}-$z);
384 0 my $dist = 0;
385 0 ▶ $dist = $dx if $dx > $dist;
Branch: 1 branch
BranchTrueFalseTotal
if $dx > $dist 0 0 0
386 0 ▶ $dist = $dy if $dy > $dist;
Branch: 1 branch
BranchTrueFalseTotal
if $dy > $dist 0 0 0
387 0 ▶ $dist = $dz if $dz > $dist;
Branch: 1 branch
BranchTrueFalseTotal
if $dz > $dist 0 0 0
388 0 my $offset = $#{$self->{'viewpoint'}}+1;
389 0 $self->viewpoint_set("$x $y $z",$dist*$factor,60);
390 0 @_ = splice(@{$self->{'viewpoint'}}, $offset);
391 0 splice(@{$self->{'viewpoint'}}, $self->{'viewpoint_set'}, $#_+1, @_);
392 } else {
393 0 $self->viewpoint_set(@_);
394 }
395 0 return $self;
396 }
397  
398 0 ▶sub viewpoint_set {
Subroutine viewpoint_set: not called CC=10 SCAR=47.0
Pod undocumented
399 0 my $self = shift;
400 0 my ($center, $distance, $fieldOfView) = @_;
401 0 $self->{'viewpoint_set'} = $#{$self->{'viewpoint'}}+1 unless defined
402 0 ▶ $self->{'viewpoint_set'};
Branch: 1 branch
BranchTrueFalseTotal
unless defined $self->{"viewpoint_set"} 0 0 0
403 0 ▶ my ($x, $y, $z) = $self->string_to_array($center) if defined $center;
Branch: 1 branch
BranchTrueFalseTotal
if defined $center 0 0 0
404 0 ▶ my ($dx, $dy, $dz) = defined $distance ? $self->string_to_array($distance) : (0,0,0);
Branch: 1 branch
BranchTrueFalseTotal
defined $distance ? : 0 0 0
405 0 ▶ $x = 0 unless defined $x;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $x 0 0 0
406 0 ▶ $y = 0 unless defined $y;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $y 0 0 0
407 0 ▶ $z = 0 unless defined $z;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $z 0 0 0
408 0 ▶ $dx = 1 unless defined $dx;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $dx 0 0 0
409 0 ▶ $dy = $dx unless defined $dy;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $dy 0 0 0
410 0 ▶ $dz = $dx unless defined $dz;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $dz 0 0 0
411 0 $self->viewpoint("Front", "$x $y ".($z+$dz), "0 0 1 0",$fieldOfView);
412 0 $self->viewpoint("Right", ($x+$dx)." $y $z", "0 1 0 90",$fieldOfView);
413 0 $self->viewpoint("Back", "$x $y ".($z-$dz), "0 1 0 180",$fieldOfView);
414 0 $self->viewpoint("Left", ($x-$dx)." $y $z", "0 1 0 -90",$fieldOfView);
415 0 $self->viewpoint("Top", "$x ".($y+$dy)." $z", "1 0 0 -90",$fieldOfView);
416 0 $self->viewpoint("Bottom", "$x ".($y-$dy)." $z", "1 0 0 90",$fieldOfView);
417 0 return $self;
418 }
419  
420 0 ▶sub viewpoint {
Subroutine viewpoint: not called CC=14 SCAR=53.5
Pod undocumented
421 0 my $self = shift;
422 0 my ($description, $position, $orientation, $fieldOfView, $jump) = @_;
423 0 ▶ if (defined $orientation) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $orientation) 0 0 0
424 0 ▶ if ($orientation !~ /\s/) {
Branch: 1 branch
BranchTrueFalseTotal
if (not $orientation =~ /\s/) { } 0 0 0
425 0 my %val = ("FRONT" => "0 0 1 0", "BACK" => "0 1 0 3.14",
426 "RIGHT" => "0 1 0 1.57", "LEFT" => "0 1 0 -1.57",
427 "TOP" => "1 0 0 -1.57", "BOTTOM" => "1 0 0 1.57");
428 0 my $string = uc($orientation);
429 0 undef $orientation;
430 0 $orientation = $val{$string};
431 0 ▶ $orientation .= " # $string" if $orientation && $self->{'DEBUG'};
Branch: 1 branch
BranchTrueFalseTotal
if $orientation and $self->{"DEBUG"} 0 0 0
Condition0%0/3
$orientation and $self->{"DEBUG"}
!ll&&!rl&&r
000
MC/DC0%0/2
$orientation and $self->{"DEBUG"}
$orientation $self->{"DEBUG"}
Truth table0%0/3
A and B
A= $orientationB= $self->{"DEBUG"}
ABresult
0X0
100
111
432 } else {
433 0 my ($x,$y,$z,$angle) = $self->string_to_array($orientation);
434 0 ▶ if (defined $angle) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $angle) 0 0 0
435 0 ▶ $angle *= $PI/180 if $self->{'CONVERT'};
Branch: 1 branch
BranchTrueFalseTotal
if $self->{"CONVERT"} 0 0 0
436 0 $orientation = "$x $y $z $angle";
437 }
438 }
439 }
440 0 ▶ $fieldOfView *= $PI/180 if defined $fieldOfView && $self->{'CONVERT'};
Branch: 1 branch
BranchTrueFalseTotal
if defined $fieldOfView and $self->{"CONVERT"} 0 0 0
Condition0%0/3
defined $fieldOfView and $self->{"CONVERT"}
!ll&&!rl&&r
000
MC/DC0%0/2
defined $fieldOfView and $self->{"CONVERT"}
defined $fieldOfView $self->{"CONVERT"}
Truth table0%0/3
A and B
A= defined $fieldOfViewB= $self->{"CONVERT"}
ABresult
0X0
100
111
441 0 ▶ if (defined $jump) { $jump = $jump ? "TRUE" : "FALSE"; }
Branch: 2 branches
BranchTrueFalseTotal
if (defined $jump) 0 0 0
$jump ? : 0 0 0
442 0 ▶ $self->{'TAB_VIEW'} = $self->{'TAB'} unless $self->{'TAB_VIEW'};
Branch: 1 branch
BranchTrueFalseTotal
unless $self->{"TAB_VIEW"} 0 0 0
443 0 ▶ if ($description =~ /^#/) {
Branch: 1 branch
BranchTrueFalseTotal
if ($description =~ /^#/) 0 0 0
444 0 $description =~ s/^#//;
445 0 my ($name) = $description;
446 0 $name =~ s/[\x00-\x20\x22\x23\x27\x2b-\x2e\x30-\x39\x5b-\x5d\x7b\x7d\x7f]/_/g;
447 0 push @{$self->{'viewpoint'}}, $self->{'TAB_VIEW'}."DEF $name\n";
448 }
449 0 $self->Viewpoint($description, $position, $orientation, $fieldOfView,
450 $jump);
451 0 push @{$self->{'viewpoint'}}, pop @{$self->{'VRML'}};
452 0 ▶ unless (defined $self->{'viewpoint_begin'}) {
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $self->{"viewpoint_begin"}) 0 0 0
453 0 splice(@{$self->{'VRML'}}, @{$self->{'VRML'}}, 0,
454 0 @{$self->{'viewpoint'}});
455 0 $self->{'viewpoint'} = [];
456 }
457 0 return $self;
458 }
459  
460 #--------------------------------------------------------------------
461  
462 0 ▶sub directionallight {
Subroutine directionallight: not called CC=4 SCAR=30.0
Pod undocumented
463 0 my $self = shift;
464 0 my ($direction, $intensity, $ambientIntensity, $color, $on) = @_;
465 0 ▶ if (defined $on) { $on = $on ? "TRUE" : "FALSE"; }
Branch: 2 branches
BranchTrueFalseTotal
if (defined $on) 0 0 0
$on ? : 0 0 0
466 0 ▶ $color = rgb_color($color) if defined $color;
Branch: 1 branch
BranchTrueFalseTotal
if defined $color 0 0 0
467 0 $self->DirectionalLight($direction, $intensity, $ambientIntensity, $color,
468 $on);
469 0 return $self;
470 }
471  
472 #--------------------------------------------------------------------
473  
474 0 ▶sub line {
Subroutine line: not called CC=33 SCAR=70.2
Pod undocumented
475 0 my $self = shift;
476 0 my ($from,$to,$radius,$appearance,$order) = @_;
477 0 my ($x1,$y1,$z1) = $self->string_to_array($from);
478 0 my ($x2,$y2,$z2) = $self->string_to_array($to);
479 0 my ($t, $r, $length);
480  
481 0 ▶ $x1 = 0 unless $x1;
Branch: 1 branch
BranchTrueFalseTotal
unless $x1 0 0 0
482 0 ▶ $x2 = 0 unless $x2;
Branch: 1 branch
BranchTrueFalseTotal
unless $x2 0 0 0
483 0 ▶ $y1 = 0 unless $y1;
Branch: 1 branch
BranchTrueFalseTotal
unless $y1 0 0 0
484 0 ▶ $y2 = 0 unless $y2;
Branch: 1 branch
BranchTrueFalseTotal
unless $y2 0 0 0
485 0 ▶ $z1 = 0 unless $z1;
Branch: 1 branch
BranchTrueFalseTotal
unless $z1 0 0 0
486 0 ▶ $z2 = 0 unless $z2;
Branch: 1 branch
BranchTrueFalseTotal
unless $z2 0 0 0
487 0 my $dx=$x1-$x2;
488 0 my $dy=$y1-$y2;
489 0 my $dz=$z1-$z2;
490 0 ▶ $order = "" unless defined $order;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $order 0 0 0
491 0 ▶ $self->comment('line("'.join('", "',@_).'")') if $self->{'DEBUG'};
Branch: 1 branch
BranchTrueFalseTotal
if $self->{"DEBUG"} 0 0 0
492 0 $self->Group();
493 0 ▶ if (defined $radius && $radius>0) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $radius and $radius > 0) { } 0 0 0
Condition0%0/3
defined $radius and $radius > 0
!ll&&!rl&&r
000
MC/DC0%0/2
defined $radius and $radius > 0
defined $radius $radius > 0
Truth table0%0/3
A and B
A= defined $radiusB= $radius > 0
ABresult
0X0
100
111
494 0 ▶ if ($dx && $order =~ /x/i) {
Branch: 1 branch
BranchTrueFalseTotal
if ($dx and $order =~ /x/i) 0 0 0
Condition0%0/3
$dx and $order =~ /x/i
!ll&&!rl&&r
000
MC/DC0%0/2
$dx and $order =~ /x/i
$dx $order =~ /x/i
Truth table0%0/3
A and B
A= $dxB= $order =~ /x/i
ABresult
0X0
100
111
495 0 ▶ $t = ($x1-($dx/2))." $y1 $z1" if $order =~ /^x$/i;
Branch: 1 branch
BranchTrueFalseTotal
if $order =~ /^x$/i 0 0 0
496 0 ▶ $t = ($x1-($dx/2))." $y1 $z1" if $order =~ /^x../i;
Branch: 1 branch
BranchTrueFalseTotal
if $order =~ /^x../i 0 0 0
497 0 ▶ $t = ($x1-($dx/2))." $y2 $z1" if $order =~ /yxz/i;
Branch: 1 branch
BranchTrueFalseTotal
if $order =~ /yxz/i 0 0 0
498 0 ▶ $t = ($x1-($dx/2))." $y1 $z2" if $order =~ /zxy/i;
Branch: 1 branch
BranchTrueFalseTotal
if $order =~ /zxy/i 0 0 0
499 0 ▶ $t = ($x1-($dx/2))." $y2 $z2" if $order =~ /..x$/i;
Branch: 1 branch
BranchTrueFalseTotal
if $order =~ /..x$/i 0 0 0
500 0 $self->Transform($t,"0 0 1 ". $PI_2);
501 0 ▶ $self->Shape(sub{$self->Cylinder($radius,abs($dx))},
Subroutine __ANON__: not called CC=1 SCAR=6.9
502 0 ▶ sub{$self->appearance($appearance)});
Subroutine __ANON__: not called CC=1 SCAR=6.9
503 0 $self->EndTransform;
504 }
505 0 ▶ if ($dy && $order =~ /y/i) {
Branch: 1 branch
BranchTrueFalseTotal
if ($dy and $order =~ /y/i) 0 0 0
Condition0%0/3
$dy and $order =~ /y/i
!ll&&!rl&&r
000
MC/DC0%0/2
$dy and $order =~ /y/i
$dy $order =~ /y/i
Truth table0%0/3
A and B
A= $dyB= $order =~ /y/i
ABresult
0X0
100
111
506 0 ▶ $t = "$x1 ".($y1-($dy/2))." $z1" if $order =~ /^y$/i;
Branch: 1 branch
BranchTrueFalseTotal
if $order =~ /^y$/i 0 0 0
507 0 ▶ $t = "$x1 ".($y1-($dy/2))." $z1" if $order =~ /^y../i;
Branch: 1 branch
BranchTrueFalseTotal
if $order =~ /^y../i 0 0 0
508 0 ▶ $t = "$x2 ".($y1-($dy/2))." $z1" if $order =~ /xyz/i;
Branch: 1 branch
BranchTrueFalseTotal
if $order =~ /xyz/i 0 0 0
509 0 ▶ $t = "$x1 ".($y1-($dy/2))." $z2" if $order =~ /zyx/i;
Branch: 1 branch
BranchTrueFalseTotal
if $order =~ /zyx/i 0 0 0
510 0 ▶ $t = "$x2 ".($y1-($dy/2))." $z2" if $order =~ /..y$/i;
Branch: 1 branch
BranchTrueFalseTotal
if $order =~ /..y$/i 0 0 0
511 0 $self->Transform($t);
512 0 ▶ $self->Shape(sub{$self->Cylinder($radius,abs($dy))},
Subroutine __ANON__: not called CC=1 SCAR=6.9
513 0 ▶ sub{$self->appearance($appearance)});
Subroutine __ANON__: not called CC=1 SCAR=6.9
514 0 $self->EndTransform;
515 }
516 0 ▶ if ($dz && $order =~ /z/i) {
Branch: 1 branch
BranchTrueFalseTotal
if ($dz and $order =~ /z/i) 0 0 0
Condition0%0/3
$dz and $order =~ /z/i
!ll&&!rl&&r
000
MC/DC0%0/2
$dz and $order =~ /z/i
$dz $order =~ /z/i
Truth table0%0/3
A and B
A= $dzB= $order =~ /z/i
ABresult
0X0
100
111
517 0 ▶ $t = "$x1 $y1 ".($z1-($dz/2)) if $order =~ /^z$/i;
Branch: 1 branch
BranchTrueFalseTotal
if $order =~ /^z$/i 0 0 0
518 0 ▶ $t = "$x1 $y1 ".($z1-($dz/2)) if $order =~ /^z../i;
Branch: 1 branch
BranchTrueFalseTotal
if $order =~ /^z../i 0 0 0
519 0 ▶ $t = "$x1 $y2 ".($z1-($dz/2)) if $order =~ /yzx/i;
Branch: 1 branch
BranchTrueFalseTotal
if $order =~ /yzx/i 0 0 0
520 0 ▶ $t = "$x2 $y1 ".($z1-($dz/2)) if $order =~ /xzy/i;
Branch: 1 branch
BranchTrueFalseTotal
if $order =~ /xzy/i 0 0 0
521 0 ▶ $t = "$x2 $y2 ".($z1-($dz/2)) if $order =~ /..z$/i;
Branch: 1 branch
BranchTrueFalseTotal
if $order =~ /..z$/i 0 0 0
522 0 $self->Transform($t,"1 0 0 ". $PI_2);
523 0 ▶ $self->Shape(sub{$self->Cylinder($radius,abs($dz))},
Subroutine __ANON__: not called CC=1 SCAR=6.9
524 0 ▶ sub{$self->appearance($appearance)});
Subroutine __ANON__: not called CC=1 SCAR=6.9
525 0 $self->EndTransform;
526 }
527 0 ▶ unless ($order) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($order) 0 0 0
528 0 $length = sqrt($dx*$dx + $dy*$dy + $dz*$dz);
529 0 $t = ($x1-($dx/2))." ".($y1-($dy/2))." ".($z1-($dz/2));
530 0 $r = "$dx ".($dy+$length)." $dz ".$PI;
531 0 $self->Transform($t,$r);
532 0 ▶ $self->Shape(sub{$self->Cylinder($radius,$length)},
Subroutine __ANON__: not called CC=1 SCAR=6.9
533 0 ▶ sub{$self->appearance($appearance)});
Subroutine __ANON__: not called CC=1 SCAR=6.9
534 0 $self->EndTransform;
535 }
536 } else {
537 0 my $color = rgb_color($appearance);
538 0 ▶ $self->Shape(sub{$self->IndexedLineSet(
Subroutine __ANON__: not called CC=1 SCAR=6.9
539 0 ▶ sub{$self->Coordinate($from,$to)},
Subroutine __ANON__: not called CC=1 SCAR=6.9
540 0 "0 1","Color { color [ $color ] }",undef,"FALSE")});
541 }
542 0 $self->EndChildren->End("line");
543 0 return $self;
544 }
545  
546 #--------------------------------------------------------------------
547  
548 1 ▶sub box {
Subroutine box: called CC=1 SCAR=0.0
Pod undocumented
549 1 my $self = shift;
550 1 my ($dimension, $appearance) = @_;
551 1 my ($width,$height,$depth) = $self->string_to_array($dimension);
552 $self->Shape(
553 1 ▶ sub{$self->Box("$width $height $depth")},
Subroutine __ANON__: called CC=1 SCAR=0.0
554 1 ▶ sub{$self->appearance($appearance)}
Subroutine __ANON__: called CC=1 SCAR=0.0
555 1 );
556 1 return $self;
557 }
558  
559 1 ▶sub cone {
Subroutine cone: called CC=1 SCAR=0.0
Pod undocumented
560 1 my $self = shift;
561 1 my ($dimension, $appearance) = @_;
562 1 my ($radius, $height) = $self->string_to_array($dimension);
563 $self->Shape(
564 1 ▶ sub{$self->Cone($radius, $height)},
Subroutine __ANON__: called CC=1 SCAR=0.0
565 1 ▶ sub{$self->appearance($appearance)}
Subroutine __ANON__: called CC=1 SCAR=0.0
566 1 );
567 1 return $self;
568 }
569  
570 1 ▶sub cube {
Subroutine cube: called CC=3 SCAR=11.1
Pod undocumented
571 1 my $self = shift;
572 1 my ($dimension, $appearance) = @_;
573 1 my ($width,$height,$depth) = $self->string_to_array($dimension);
574 1 ▶ $height = $width unless defined $height;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $height 1 0 1
575 1 ▶ $depth = $width unless defined $depth;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $depth 1 0 1
576 $self->Shape(
577 1 ▶ sub{$self->Box("$width $height $depth")},
Subroutine __ANON__: called CC=1 SCAR=0.0
578 1 ▶ sub{$self->appearance($appearance)}
Subroutine __ANON__: called CC=1 SCAR=0.0
579 1 );
580 1 return $self;
581 }
582  
583 1 ▶sub cylinder {
Subroutine cylinder: called CC=9 SCAR=30.0
Pod undocumented
584 1 my $self = shift;
585 1 my ($dimension, $appearance, $top, $side, $bottom, $inside) = @_;
586 1 my ($radius, $height) = $self->string_to_array($dimension);
587 1 ▶ $top = $top ? "TRUE" : "FALSE" if defined $top;
Branch: 2 branches
BranchTrueFalseTotal
if defined $top 0 1 1
$top ? : 0 0 0
588 1 ▶ $side = $side ? "TRUE" : "FALSE" if defined $side;
Branch: 2 branches
BranchTrueFalseTotal
if defined $side 0 1 1
$side ? : 0 0 0
589 1 ▶ $bottom = $bottom ? "TRUE" : "FALSE" if defined $bottom;
Branch: 2 branches
BranchTrueFalseTotal
if defined $bottom 0 1 1
$bottom ? : 0 0 0
590 1 ▶ if (defined $inside && $inside) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $inside and $inside) { } 0 1 1
Condition33%1/3
defined $inside and $inside
!ll&&!rl&&r
100
MC/DC0%0/2
defined $inside and $inside
defined $inside $inside
Truth table33%1/3
A and B
A= defined $insideB= $inside
ABresult
0X0
100
111
591 0 my $crossSection = "1.00 0.00, 0.92 0.38, 0.71 0.71, 0.38 0.92, 0.00 1.00, -0.38 0.92, -0.71 0.71, -0.92 0.38, -1.00 0.0, -0.92 -0.38, -0.71 -0.71, -0.38 -0.92, 0.00 -1.00, 0.38 -0.92, 0.71 -0.71, 0.92 -0.38, 1.00 0.00";
592 0 $height /= 2;
593 $self->Shape(
594 0 ▶ sub{$self->Extrusion([$crossSection], ["0 -$height 0", "0 $height 0"], ["$radius $radius", "$radius $radius"], undef, $top, $bottom, 0.5, "FALSE")},
Subroutine __ANON__: not called CC=1 SCAR=6.9
595 0 ▶ sub{$self->appearance($appearance)}
Subroutine __ANON__: not called CC=1 SCAR=6.9
596 )
597 0 } else {
598 $self->Shape(
599 1 ▶ sub{$self->Cylinder($radius, $height, $top, $side, $bottom)},
Subroutine __ANON__: called CC=1 SCAR=0.0
600 1 ▶ sub{$self->appearance($appearance)}
Subroutine __ANON__: called CC=1 SCAR=0.0
601 )
602 1 }
603 1 return $self;
604 }
605  
606 0 ▶sub elevationgrid {
Subroutine elevationgrid: not called CC=12 SCAR=50.5
Pod undocumented
607 0 my $self = shift;
608 0 my ($height, $color, $xDimension, $zDimension, $xSpacing, $zSpacing,
609 $creaseAngle, $colorPerVertex, $solid) = @_;
610 0 ▶ $xDimension = ($$height[0] =~ s/([+-]?\d+\.?\d*)/$1/g) unless defined $xDimension;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $xDimension 0 0 0
611 0 ▶ $zDimension = @$height unless defined $zDimension;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $zDimension 0 0 0
612 0 ▶ $xSpacing = 1 unless defined $xSpacing;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $xSpacing 0 0 0
613 0 ▶ $zSpacing = $xSpacing unless defined $zSpacing;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $zSpacing 0 0 0
614 0 ▶ $creaseAngle *= $PI/180 if defined $creaseAngle && $self->{'CONVERT'};
Branch: 1 branch
BranchTrueFalseTotal
if defined $creaseAngle and $self->{"CONVERT"} 0 0 0
Condition0%0/3
defined $creaseAngle and $self->{"CONVERT"}
!ll&&!rl&&r
000
MC/DC0%0/2
defined $creaseAngle and $self->{"CONVERT"}
defined $creaseAngle $self->{"CONVERT"}
Truth table0%0/3
A and B
A= defined $creaseAngleB= $self->{"CONVERT"}
ABresult
0X0
100
111
615 0 ▶ $colorPerVertex = $colorPerVertex ? "TRUE" : "FALSE" if defined $colorPerVertex;
Branch: 2 branches
BranchTrueFalseTotal
if defined $colorPerVertex 0 0 0
$colorPerVertex ? : 0 0 0
616 0 ▶ $solid = $solid ? "TRUE" : "FALSE" if defined $solid;
Branch: 2 branches
BranchTrueFalseTotal
if defined $solid 0 0 0
$solid ? : 0 0 0
617 0 ▶ if (ref($color) eq "ARRAY") {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $color eq 'ARRAY') { } 0 0 0
618 $self->Shape(
619 0 ▶ sub{$self->ElevationGrid($xDimension, $zDimension, $xSpacing, $zSpacing,
Subroutine __ANON__: not called CC=1 SCAR=6.9
620 $height, $creaseAngle, $color, $colorPerVertex, $solid)}
621 )
622 0 } else {
623 $self->Shape(
624 0 ▶ sub{$self->ElevationGrid($xDimension, $zDimension, $xSpacing, $zSpacing,
Subroutine __ANON__: not called CC=1 SCAR=6.9
625 $height, $creaseAngle, undef, $colorPerVertex, $solid)},
626 0 ▶ sub{$self->appearance($color)}
Subroutine __ANON__: not called CC=1 SCAR=6.9
627 )
628 0 }
629 0 return $self;
630 }
631  
632 0 ▶sub indexedfaceset {
Subroutine indexedfaceset: not called CC=2 SCAR=17.9
Pod undocumented
633 0 my $self = shift;
634 0 my ($coord, $coordIndex, $appearance, $color, $colorIndex) = @_;
635 0 ▶ $colorIndex = [0..$#{@$color}] unless defined $colorIndex;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $colorIndex 0 0 0
636 0 my @color = split(",",$appearance);
637 $self->Shape(
638 0 ▶ sub{$self->IndexedFaceSet(
Subroutine __ANON__: not called CC=1 SCAR=6.9
639 0 ▶ sub{$self->Coordinate($coord)}, $coordIndex,
Subroutine __ANON__: not called CC=1 SCAR=6.9
640 0 ▶ sub{$self->color(@color)}, $colorIndex, "FALSE")
Subroutine __ANON__: not called CC=1 SCAR=6.9
641 },
642 0 ▶ sub{$self->appearance($appearance)}
Subroutine __ANON__: not called CC=1 SCAR=6.9
643 0 );
644 0 return $self;
645 }
646  
647 0 ▶sub pointset {
Subroutine pointset: not called CC=1 SCAR=6.9
Pod undocumented
648 0 my $self = shift;
649 0 my ($coord, $color) = @_;
650 $self->Shape(
651 0 ▶ sub{$self->PointSet(
Subroutine __ANON__: not called CC=1 SCAR=6.9
652 0 ▶ sub{$self->Coordinate(@$coord)},
Subroutine __ANON__: not called CC=1 SCAR=6.9
653 0 ▶ sub{$self->color(@$color)})
Subroutine __ANON__: not called CC=1 SCAR=6.9
654 0 }
655 0 );
656 0 return $self;
657 }
658  
659 0 ▶sub pyramid {
Subroutine pyramid: not called CC=6 SCAR=37.4
Pod undocumented
660 0 my $self = shift;
661 0 my ($dimension, $appearance) = @_;
662 0 my ($width,$height,$depth) = $self->string_to_array($dimension);
663 0 ▶ my $x_2 = $width ? $width/2 : 1;
Branch: 1 branch
BranchTrueFalseTotal
$width ? : 0 0 0
664 0 ▶ my $y_2 = $height ? $height/2 : 1;
Branch: 1 branch
BranchTrueFalseTotal
$height ? : 0 0 0
665 0 ▶ my $z_2 = defined $depth ? $depth/2 : $x_2;
Branch: 1 branch
BranchTrueFalseTotal
defined $depth ? : 0 0 0
666 0 ▶ my @color = split(",",$appearance) if $appearance;
Branch: 1 branch
BranchTrueFalseTotal
if $appearance 0 0 0
667 0 my @color_prop = ();
668 0 ▶ @color_prop = (sub{$self->color(@color)},[0..4],"FALSE") if $#color > 0;
Subroutine __ANON__: not called CC=1 SCAR=6.9
Branch: 1 branch
BranchTrueFalseTotal
if $#color > 0 0 0 0
669 $self->Shape(
670 0 ▶ sub{$self->IndexedFaceSet(
Subroutine __ANON__: not called CC=1 SCAR=6.9
671 0 ▶ sub{$self->Coordinate("-$x_2 -$y_2 $z_2", "$x_2 -$y_2 $z_2",
Subroutine __ANON__: not called CC=1 SCAR=6.9
672 "$x_2 -$y_2 -$z_2", "-$x_2 -$y_2 -$z_2", "0 $y_2 0")},
673 0 ["0, 1, 4","1, 2, 4","2, 3, 4","3, 0, 4","0, 3, 2, 1"],
674 @color_prop)
675 0 ▶ },sub{$self->appearance($appearance)}
Subroutine __ANON__: not called CC=1 SCAR=6.9
676 0 );
677 0 return $self;
678 }
679  
680 1 ▶sub sphere {
Subroutine sphere: called CC=1 SCAR=0.0
Pod undocumented
681 1 my $self = shift;
682 1 my ($radius, $appearance) = @_;
683 $self->Shape(
684 1 ▶ sub{$self->Sphere($radius)},
Subroutine __ANON__: called CC=1 SCAR=0.0
685 1 ▶ sub{$self->appearance($appearance)}
Subroutine __ANON__: called CC=1 SCAR=0.0
686 1 );
687 1 return $self;
688 }
689  
690 0 ▶sub torus {
Subroutine torus: not called CC=15 SCAR=54.8
Pod undocumented
691 0 my $self = shift;
692 0 my ($dimension, $appearance, $beginCap, $endCap, $angle) = @_;
693 0 my ($r1, $r2, $from, $to, $dstep) = $self->string_to_array($dimension);
694 0 $self->comment("torus($r1, $r2, $from, $to, $dstep)");
695 0 ▶ $r2 ||= 0.5;
Condition0%0/2
$r2 ||= "0.5"
l!l
00
MC/DC0%0/1
$r2 ||= "0.5"
$r2
Truth table0%0/2
A
A= $r2
Aresult
11
00
696 0 ▶ $from ||= 0;
Condition0%0/2
$from ||= 0
l!l
00
MC/DC0%0/1
$from ||= 0
$from
Truth table0%0/2
A
A= $from
Aresult
11
00
697 0 ▶ $from *= $PI/180 if $self->{'CONVERT'};
Branch: 1 branch
BranchTrueFalseTotal
if $self->{"CONVERT"} 0 0 0
698 0 ▶ $to ||= 0;
Condition0%0/2
$to ||= 0
l!l
00
MC/DC0%0/1
$to ||= 0
$to
Truth table0%0/2
A
A= $to
Aresult
11
00
699 0 ▶ $to *= $PI/180 if $self->{'CONVERT'};
Branch: 1 branch
BranchTrueFalseTotal
if $self->{"CONVERT"} 0 0 0
700 0 ▶ $dstep ||= 10;
Condition0%0/2
$dstep ||= 10
l!l
00
MC/DC0%0/1
$dstep ||= 10
$dstep
Truth table0%0/2
A
A= $dstep
Aresult
11
00
701 0 ▶ $dstep *= $PI/180 if $self->{'CONVERT'};
Branch: 1 branch
BranchTrueFalseTotal
if $self->{"CONVERT"} 0 0 0
702 0 ▶ $beginCap = $beginCap ? "TRUE" : "FALSE" if defined $beginCap;
Branch: 2 branches
BranchTrueFalseTotal
if defined $beginCap 0 0 0
$beginCap ? : 0 0 0
703 0 ▶ $endCap = $endCap ? "TRUE" : "FALSE" if defined $endCap;
Branch: 2 branches
BranchTrueFalseTotal
if defined $endCap 0 0 0
$endCap ? : 0 0 0
704 0 my $crossSection = "1.00 0.00, 0.92 0.38, 0.71 0.71, 0.38 0.92, 0.00 1.00, -0.38 0.92, -0.71 0.71, -0.92 0.38, -1.00 0.0, -0.92 -0.38, -0.71 -0.71, -0.38 -0.92, 0.00 -1.00, 0.38 -0.92, 0.71 -0.71, 0.92 -0.38, 1.00 0.00";
705 0 my $alpha = $from;
706 0 my @spine = ();
707 0 my @scale = ();
708 0 ▶ for (my $i=0; $i<360; $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i < 360) 0 0 0
709 #radius1 + radius2*Math.cos(alpha)) * Math.cos(beta)
710 0 push @spine, sprintf("%.2f",$r1*cos($alpha))." 0 ".sprintf("%.2f",$r1*sin($alpha));
711 0 push @scale, "$r2 $r2";
712 0 $alpha += $dstep;
713 0 ▶ last if $alpha>$to;
Branch: 1 branch
BranchTrueFalseTotal
if $alpha > $to 0 0 0
714 }
715 0 ▶ if ($from == $to) {
Branch: 1 branch
BranchTrueFalseTotal
if ($from == $to) { } 0 0 0
716 0 push @spine, $spine[0];
717 } else {
718 0 push @spine, sprintf("%.2f",$r1*cos($to))." 0 ".sprintf("%.2f",$r1*sin($to));
719 0 push @scale, "$r2 $r2";
720 }
721 #push @scale, "$r2 $r2";
722 $self->Shape(
723 0 ▶ sub{$self->Extrusion([$crossSection], [@spine], [@scale], undef, $beginCap, $endCap, 0.5, "FALSE")},
Subroutine __ANON__: not called CC=1 SCAR=6.9
724 0 ▶ sub{$self->appearance($appearance)}
Subroutine __ANON__: not called CC=1 SCAR=6.9
725 0 );
726 0 return $self;
727 }
728  
729 1 ▶sub text {
Subroutine text: called CC=4 SCAR=15.9
Pod undocumented
730 1 my $self = shift;
731 1 my ($string, $appearance, $font, $align) = @_;
732 1 my ($size, $family, $style, $language);
733 1 ▶ my $quote = $self->{'BROWSER'} =~ /$supported{'quote'}/i ? '\\"' : "'";
Branch: 1 branch
BranchTrueFalseTotal
$self->{'BROWSER'} =~ /$VRML::VRML2::supported{'quote'}/i ? : 0 1 1
734 1 ▶ if (defined $string) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $string) 1 0 1
735 1 ▶ if (ref($string)) {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $string) { } 0 1 1
736 0 map { s/"/$quote/g } @$string;
737 0 $string = '["'.join('","',@$string).'"]';
738 } else {
739 1 $string =~ s/"/$quote/g;
740 1 $string = "\"$string\"";
741 }
742 }
743 1 ▶ $self->Shape(sub{
Subroutine __ANON__: called CC=5 SCAR=20.4
744 1 ▶ if (defined $font || defined $align) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $font or defined $align) { } 1 0 1
Condition33%1/3
defined $font or defined $align
l!l&&r!l&&!r
100
MC/DC0%0/2
defined $font or defined $align
defined $font defined $align
Truth table33%1/3
A or B
A= defined $fontB= defined $align
ABresult
1X1
011
000
745 1 ▶ if (defined $font) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $font) 1 0 1
746 1 ($size, $family, $style, $language) = split(/\s+/,$font,4); # local variable !!!
747 }
748 1 ▶ if (defined $align) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $align) 0 1 1
749 0 $align =~ s/LEFT/BEGIN/i;
750 0 $align =~ s/CENTER/MIDDLE/i;
751 0 $align =~ s/RIGHT/END/i;
752 }
753 1 ▶ $self->Text($string,sub{$self->FontStyle($size, $family, $style,
Subroutine __ANON__: called CC=1 SCAR=0.0
754 1 $align, $language)});
755 } else {
756 0 $self->Text($string);
757 1 ▶ }},sub{$self->appearance($appearance)}
Subroutine __ANON__: called CC=1 SCAR=0.0
758 1 );
759 1 return $self;
760 }
761  
762 0 ▶sub billtext {
Subroutine billtext: not called CC=1 SCAR=6.9
Pod undocumented
763 0 my $self = shift;
764 0 my @param = @_;
765 0 ▶ $self->Billboard("0 0 0",sub{$self->text(@param)}); # don't use @_
Subroutine __ANON__: not called CC=1 SCAR=6.9
766 }
767  
768 #--------------------------------------------------------------------
769  
770 0 ▶sub color {
Subroutine color: not called CC=2 SCAR=17.9
Pod undocumented
771 0 my $self = shift;
772 0 my ($rgb, $comment, @colors);
773 0 for (@_) {
774 0 ($rgb, $comment) = rgb_color($_);
775 0 push(@colors, $rgb);
776 }
777 0 $self->Color(@colors);
778 0 return $self;
779 }
780 #--------------------------------------------------------------------
781  
782 6 ▶sub appearance {
Subroutine appearance: called CC=29 SCAR=51.3
Pod undocumented
783 6 my $self = shift;
784 6 my ($appearance_list) = @_;
785 6 ▶ return $self->_put("Appearance {}\n") unless $appearance_list;
Branch: 1 branch
BranchTrueFalseTotal
unless $appearance_list 0 6 6
786 6 my ($item, $color, $multi_color, $key, $value, @values, $num_color,
787 %material, $def, $defmat, $deftex, $textureTransform);
788 6 my $texture = "";
789 ITEM:
790 6 foreach $item (split(/\s*;\s*/,$appearance_list)) {
791 6 ▶ ($key,$value) = ref($item) ? @$item : split(/\s*=\s*/,$item,2);
Branch: 1 branch
BranchTrueFalseTotal
ref $item ? : 0 6 6
792 # ($key,$value) = split(/\s*=\s*/,$item,2);
793 6 ▶ unless ($value) { # color only
Branch: 1 branch
BranchTrueFalseTotal
unless ($value) 6 0 6
794 6 $value = $key;
795 6 $key = "diffuseColor";
796 }
797 MODE: {
798 0 ▶ if ($key eq "d") { $key = "diffuseColor"; last MODE; }
Branch: 1 branch
BranchTrueFalseTotal
if ($key eq "d") 0 6 6
799 0 ▶ if ($key eq "e") { $key = "emissiveColor"; last MODE; }
Branch: 1 branch
BranchTrueFalseTotal
if ($key eq "e") 0 6 6
800 0 ▶ if ($key eq "s") { $key = "specularColor"; last MODE; }
Branch: 1 branch
BranchTrueFalseTotal
if ($key eq "s") 0 6 6
801 0 ▶ if ($key eq "ai") { $key = "ambientIntensity"; last MODE; }
Branch: 1 branch
BranchTrueFalseTotal
if ($key eq "ai") 0 6 6
802 0 ▶ if ($key eq "sh") { $key = "shininess"; last MODE; }
Branch: 1 branch
BranchTrueFalseTotal
if ($key eq "sh") 0 6 6
803 0 ▶ if ($key eq "tr") { $key = "transparency"; last MODE; }
Branch: 1 branch
BranchTrueFalseTotal
if ($key eq "tr") 0 6 6
804 0 ▶ if ($key eq "tex") { $texture = $value; next ITEM; }
Branch: 1 branch
BranchTrueFalseTotal
if ($key eq "tex") 0 6 6
805 0 ▶ if ($key eq "textrans") { $textureTransform = $value; next ITEM; }
Branch: 1 branch
BranchTrueFalseTotal
if ($key eq "textrans") 0 6 6
806 0 ▶ if ($key eq "def") { $def = $value; next ITEM; }
Branch: 1 branch
BranchTrueFalseTotal
if ($key eq "def") 0 6 6
807 0 ▶ if ($key eq "deftex") { $deftex = $value; next ITEM; }
Branch: 1 branch
BranchTrueFalseTotal
if ($key eq "deftex") 0 6 6
808 0 ▶ if ($key eq "defmat") { $defmat = $value; next ITEM; }
Branch: 1 branch
BranchTrueFalseTotal
if ($key eq "defmat") 0 6 6
809 6 ▶ if ($key eq "use") {
Branch: 1 branch
BranchTrueFalseTotal
if ($key eq "use") 0 6 6
810 0 $self->use($value);
811 0 return $self;
812 }
813 }
814 6 ▶ if ($key eq "diffuseColor" | $key eq "emissiveColor" | $key eq
Branch: 1 branch
BranchTrueFalseTotal
if ($key eq 'diffuseColor' | $key eq 'emissiveColor' | $key eq 'specularColor') { } 6 0 6
815 "specularColor") {
816 6 ▶ if ($value =~ /,/) { # multi color field
Branch: 1 branch
BranchTrueFalseTotal
if ($value =~ /,/) { } 0 6 6
817 0 foreach $color (split(/\s*,\s*/,$value)) {
818 0 ($num_color,$color) = rgb_color($color);
819 0 $value = $num_color;
820 0 ▶ $value .= " # $color" if $color && $self->{'DEBUG'};
Branch: 1 branch
BranchTrueFalseTotal
if $color and $self->{"DEBUG"} 0 0 0
Condition0%0/3
$color and $self->{"DEBUG"}
!ll&&!rl&&r
000
MC/DC0%0/2
$color and $self->{"DEBUG"}
$color $self->{"DEBUG"}
Truth table0%0/3
A and B
A= $colorB= $self->{"DEBUG"}
ABresult
0X0
100
111
821 0 push @values, $value;
822 }
823 0 $material{$key} = $values[0]; # ignore foll. colors
824 0 $multi_color = 1;
825 } else {
826 6 ($num_color,$color) = rgb_color($value);
827 6 $value = $num_color;
828 6 ▶ $value .= " # $color" if $color && $self->{'DEBUG'};
Branch: 1 branch
BranchTrueFalseTotal
if $color and $self->{"DEBUG"} 0 6 6
Condition33%1/3
$color and $self->{"DEBUG"}
!ll&&!rl&&r
060
MC/DC0%0/2
$color and $self->{"DEBUG"}
$color $self->{"DEBUG"}
Truth table33%1/3
A and B
A= $colorB= $self->{"DEBUG"}
ABresult
0X0
100
111
829 6 $material{$key} = $value;
830 }
831 } else {
832 0 $material{$key} = $value;
833 }
834 }
835 6 ▶ $self->def($def) if $def;
Branch: 1 branch
BranchTrueFalseTotal
if $def 0 6 6
836 $self->Appearance(
837 6 ▶ %material ? sub{$self->def($defmat) if $defmat; $self->Material(%material)} : undef,
Subroutine __ANON__: called CC=2 SCAR=7.2
Branch: 1 branch
BranchTrueFalseTotal
if $defmat 0 6 6
838 0 ▶ $texture =~ /\.gif|\.jpg|\.png|\.bmp/i ? sub{$self->def($deftex) if $deftex; $self->ImageTexture($self->string_to_array($texture))} : undef ||
Subroutine __ANON__: not called CC=2 SCAR=17.9
Branch: 1 branch
BranchTrueFalseTotal
if $deftex 0 0 0
839 0 ▶ $texture =~ /\.avi|\.mpg|\.mov/i ? sub{$self->def($deftex) if $deftex;
Subroutine __ANON__: not called CC=2 SCAR=17.9
Branch: 1 branch
BranchTrueFalseTotal
if $deftex 0 0 0
840 0 $self->MovieTexture($self->string_to_array($texture))} : undef,
841 6 ▶ $textureTransform
Branch: 3 branches
BranchTrueFalseTotal
%material ? : 6 0 6
$texture =~ /\.gif|\.jpg|\.png|\.bmp/i ? : 0 6 6
undef || $texture =~ /\.avi|\.mpg|\.mov/i ? : 0 6 6
Condition33%1/3
undef or $texture =~ /\.avi|\.mpg|\.mov/i
l!l&&r!l&&!r
006
MC/DC0%0/2
undef or $texture =~ /\.avi|\.mpg|\.mov/i
undef $texture =~ /\.avi|\.mpg|\.mov/i
Truth table33%1/3
A or B
A= undefB= $texture =~ /\.avi|\.mpg|\.mov/i
ABresult
1X1
011
000
842 );
843 6 return $self;
844 }
845  
846 #--------------------------------------------------------------------
847  
848 0 ▶sub sound {
Subroutine sound: not called CC=4 SCAR=30.0
Pod undocumented
849 0 my $self = shift;
850 0 ▶ return $self->_put(qq{# CALL: ->sound("url", "description", ...)\n})
Branch: 1 branch
BranchTrueFalseTotal
unless @_ 0 0 0
851 unless @_;
852 0 my ($url, $description, $location, $direction, $intensity, $loop, $pitch) =
853 @_;
854 0 ▶ $loop = defined $loop && $loop ? "TRUE" : "FALSE";
Branch: 1 branch
BranchTrueFalseTotal
defined $loop && $loop ? : 0 0 0
Condition0%0/3
defined $loop and $loop
!ll&&!rl&&r
000
MC/DC0%0/2
defined $loop and $loop
defined $loop $loop
Truth table0%0/3
A and B
A= defined $loopB= $loop
ABresult
0X0
100
111
855 0 ▶ $self->Sound(sub{$self->DEF($description)->AudioClip($url, $description,
Subroutine __ANON__: not called CC=1 SCAR=6.9
856 0 $loop, $pitch)->_trim}, $location, $direction, $intensity, 100 );
857 0 return $self;
858 }
859  
860 #--------------------------------------------------------------------
861  
862 0 ▶sub cylindersensor {
Subroutine cylindersensor: not called CC=2 SCAR=17.9
Pod undocumented
863 0 my $self = shift;
864 0 ▶ return $self->_put(qq{# CALL: ->cylindersensor("name")\n}) unless @_;
Branch: 1 branch
BranchTrueFalseTotal
unless @_ 0 0 0
865 0 my ($name) = shift;
866 0 $self->def($name)->CylinderSensor(@_)->_trim;
867 0 return $self;
868 }
869  
870 0 ▶sub planesensor {
Subroutine planesensor: not called CC=2 SCAR=17.9
Pod undocumented
871 0 my $self = shift;
872 0 ▶ return $self->_put(qq{# CALL: ->planesensor("name")\n}) unless @_;
Branch: 1 branch
BranchTrueFalseTotal
unless @_ 0 0 0
873 0 my $name = shift;
874 0 $self->def($name)->PlaneSensor(@_)->_trim;
875 0 return $self;
876 }
877  
878 0 ▶sub proximitysensor {
Subroutine proximitysensor: not called CC=2 SCAR=17.9
Pod undocumented
879 0 my $self = shift;
880 0 ▶ return $self->_put(qq{# CALL: ->proximitysensor("name")\n}) unless @_;
Branch: 1 branch
BranchTrueFalseTotal
unless @_ 0 0 0
881 0 my $name = shift;
882 0 $self->def($name)->ProximitySensor(@_)->_trim;
883 0 return $self;
884 }
885  
886 0 ▶sub spheresensor {
Subroutine spheresensor: not called CC=2 SCAR=17.9
Pod undocumented
887 0 my $self = shift;
888 0 ▶ return $self->_put(qq{# CALL: ->spheresensor("name")\n}) unless @_;
Branch: 1 branch
BranchTrueFalseTotal
unless @_ 0 0 0
889 0 my $name = shift;
890 0 $self->def($name)->SphereSensor(@_)->_trim;
891 0 return $self;
892 }
893  
894 0 ▶sub timesensor {
Subroutine timesensor: not called CC=2 SCAR=17.9
Pod undocumented
895 0 my $self = shift;
896 0 ▶ return $self->_put(qq{# CALL: ->timesensor("name")\n}) unless @_;
Branch: 1 branch
BranchTrueFalseTotal
unless @_ 0 0 0
897 0 my $name = shift;
898 0 $self->def($name)->TimeSensor(@_)->_trim;
899 0 return $self;
900 }
901  
902 0 ▶sub touchsensor {
Subroutine touchsensor: not called CC=2 SCAR=17.9
Pod undocumented
903 0 my $self = shift;
904 0 ▶ return $self->_put(qq{# CALL: ->touchsensor("name")\n}) unless @_;
Branch: 1 branch
BranchTrueFalseTotal
unless @_ 0 0 0
905 0 my $name = shift;
906 0 $self->def($name)->TouchSensor(@_)->_trim;
907 0 return $self;
908 }
909  
910 0 ▶sub visibitysensor {
Subroutine visibitysensor: not called CC=2 SCAR=17.9
Pod undocumented
911 0 my $self = shift;
912 0 ▶ return $self->_put(qq{# CALL: ->visibitysensor("name")\n}) unless @_;
Branch: 1 branch
BranchTrueFalseTotal
unless @_ 0 0 0
913 0 my $name = shift;
914 0 $self->def($name)->VisibilitySensor(@_)->_trim;
915 0 return $self;
916 }
917  
918 #--------------------------------------------------------------------
919  
920 0 ▶sub interpolator {
Subroutine interpolator: not called CC=2 SCAR=17.9
Pod undocumented
921 0 my $self = shift;
922 0 ▶ return $self->_put(qq{# CALL: ->interpolator("name","type",
Branch: 1 branch
BranchTrueFalseTotal
unless @_ 0 0 0
923 [keys],[keyValues])\n}) unless @_;
924 0 my $name = shift;
925 0 my $type = shift;
926 0 $type .= "Interpolator";
927 0 $self->def($name)->$type(@_)->_trim;
928 0 return $self;
929 }
930  
931 #--------------------------------------------------------------------
932 # other
933 #--------------------------------------------------------------------
934  
935 0 ▶sub route {
Subroutine route: not called CC=2 SCAR=17.9
Pod undocumented
936 # ROUTEs must be outside of nodes
937 # collect them
938 0 my $self = shift;
939 0 ▶ if ($self->{'TAB'}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->{'TAB'}) { } 0 0 0
940 0 push @{$self->{'route'}}, [$_[0],$_[1]];
941 } else {
942 0 $self->ROUTE($_[0],$_[1]);
943 }
944 0 return $self;
945 }
946  
947 0 ▶sub def {
Subroutine def: not called CC=4 SCAR=30.0
Pod undocumented
948 0 my $self = shift;
949 0 my ($name, $code) = @_;
950 0 ▶ $name = "DEF_".(++$self->{'ID'}) unless defined $name;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $name 0 0 0
951 0 $self->DEF($name);
952 0 ▶ if (defined $code) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $code) 0 0 0
953 0 ▶ if (ref($code) eq "CODE") {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $code eq 'CODE') { } 0 0 0
954 0 $self->{'TAB'} .= "\t";
955 0 my $pos = $#{$self->{'VRML'}}+1;
956 0 &$code;
957 0 $self->_trim($pos);
958 0 chop($self->{'TAB'});
959 } else {
960 0 $self->_put($code);
961 }
962 }
963 0 return $self;
964 }
965  
966 0 ▶sub use {
Subroutine use: not called CC=2 SCAR=17.9
Pod undocumented
967 0 my $self = shift;
968 0 ▶ return $self->_put(qq{# CALL: ->use("name")\n}) unless @_;
Branch: 1 branch
BranchTrueFalseTotal
unless @_ 0 0 0
969 0 my ($name) = @_;
970 0 $self->USE($name);
971 0 return $self;
972 }
973  
974 1 1;
975  
976 __END__
« VRML/VRML1.pm ↑ Summary VRML/Color.pm »