| line |
true |
false |
branch |
|
106
|
0 |
3 |
if (mag < NV_tolerance) |
|
108
|
2 |
1 |
else if (fabs(mag - 1) > NV_tolerance) |
|
122
|
4 |
0 |
for (vec= sp->mat+6, pvec= sp->mat; vec > sp->mat; pvec= vec, vec -= 3) { |
|
123
|
4 |
0 |
if (fabs(m3s_vector_dotprod(vec,vec) - 1) > NV_tolerance) |
|
125
|
0 |
0 |
if (m3s_vector_dotprod(vec,pvec) > NV_tolerance) |
|
213
|
0 |
0 |
for (cur= space; cur; cur= cur->parent) |
|
215
|
0 |
0 |
for (cur= space; cur; cur= cur->parent) |
|
217
|
0 |
0 |
if (!(depth == -1)) croak("assertion failed: depth == -1"); |
|
229
|
0 |
4 |
if (space->parent == parent) |
|
234
|
6 |
2 |
while (common_parent && common_parent->n_parents >= space->n_parents) |
|
|
4 |
2 |
while (common_parent && common_parent->n_parents >= space->n_parents) |
|
237
|
15 |
3 |
while (space->n_parents && space->parent != common_parent) { |
|
|
14 |
1 |
while (space->n_parents && space->parent != common_parent) { |
|
242
|
10 |
4 |
if (common_parent && common_parent->n_parents + 1 == space->n_parents) |
|
|
1 |
9 |
if (common_parent && common_parent->n_parents + 1 == space->n_parents) |
|
247
|
1 |
3 |
if (parent == common_parent) |
|
250
|
0 |
3 |
if (!(parent != NULL)) croak("assertion failed: parent != NULL"); |
|
252
|
2 |
3 |
while (sp_tmp.parent != common_parent) |
|
274
|
0 |
9 |
if (mag_sq == 0) |
|
276
|
9 |
0 |
scale= (fabs(mag_sq - 1) > NV_tolerance)? 1/sqrt(mag_sq) : 1; |
|
287
|
1 |
8 |
if (mag_sq < NV_tolerance) { |
|
293
|
0 |
1 |
if (mag_sq == 0) |
|
303
|
27 |
9 |
for (vec=space->mat + 6; vec >= space->mat; vec-= 3) { |
|
351
|
3 |
3 |
if (space->is_normal == -1) |
|
353
|
3 |
3 |
if (!space->is_normal) { |
|
359
|
1 |
2 |
if (axis_idx == 0) { // around XV, Y -> Z |
|
366
|
1 |
1 |
} else if (axis_idx == 1) { // around YV, Z -> X |
|
392
|
150 |
0 |
if (mg->mg_ptr) { |
|
440
|
0 |
1212 |
if (!sv_isobject(obj)) { |
|
441
|
0 |
0 |
if (flags & OR_DIE) |
|
446
|
1210 |
2 |
if (SvMAGICAL(sv)) { |
|
448
|
1210 |
0 |
for (magic= SvMAGIC(sv); magic; magic = magic->mg_moremagic) |
|
449
|
1210 |
0 |
if (magic->mg_type == PERL_MAGIC_ext && magic->mg_virtual == &m3s_space_magic_vt) |
|
|
1210 |
0 |
if (magic->mg_type == PERL_MAGIC_ext && magic->mg_virtual == &m3s_space_magic_vt) |
|
453
|
2 |
0 |
if (flags & AUTOCREATE) { |
|
462
|
0 |
0 |
else if (flags & OR_DIE) |
|
474
|
0 |
148 |
if (!space) |
|
495
|
3 |
1 |
if (!SvPOK(buf)) |
|
498
|
3 |
1 |
if (len < size) { |
|
499
|
3 |
0 |
SvGROW(buf, size); |
|
|
3 |
0 |
SvGROW(buf, size); |
|
504
|
0 |
4 |
if ((intptr_t)p & NV_ALIGNMENT_MASK) { |
|
505
|
0 |
0 |
SvGROW(buf, size + NV_ALIGNMENT_MASK); |
|
|
0 |
0 |
SvGROW(buf, size + NV_ALIGNMENT_MASK); |
|
518
|
0 |
137 |
if ((intptr_t)SvPVX(buf) & NV_ALIGNMENT_MASK) { |
|
531
|
158 |
0 |
if (sv_isobject(vector) && SvPOK(SvRV(vector))) |
|
|
158 |
0 |
if (sv_isobject(vector) && SvPOK(SvRV(vector))) |
|
533
|
158 |
0 |
if (len != sizeof(NV)*3 || ((intptr_t)p & NV_ALIGNMENT_MASK) != 0) |
|
|
0 |
158 |
if (len != sizeof(NV)*3 || ((intptr_t)p & NV_ALIGNMENT_MASK) != 0) |
|
546
|
57 |
0 |
SV **el, *rv= SvROK(in)? SvRV(in) : NULL; |
|
550
|
0 |
57 |
if (!rv) |
|
556
|
26 |
31 |
if (SvPOK(rv) && SvCUR(rv) == sizeof(NV)*3) { |
|
|
26 |
0 |
if (SvPOK(rv) && SvCUR(rv) == sizeof(NV)*3) { |
|
563
|
23 |
8 |
else if (SvTYPE(rv) == SVt_PVAV) { |
|
566
|
2 |
21 |
if (n != 3 && n != 2) |
|
|
0 |
2 |
if (n != 3 && n != 2) |
|
569
|
2 |
21 |
if (component_sv) component_sv[2]= NULL; |
|
570
|
67 |
23 |
for (i=0; i < n; i++) { |
|
572
|
67 |
0 |
if (!el || !*el || !looks_like_number(*el)) |
|
|
67 |
0 |
if (!el || !*el || !looks_like_number(*el)) |
|
|
0 |
67 |
if (!el || !*el || !looks_like_number(*el)) |
|
575
|
5 |
62 |
if (component_sv) component_sv[i]= *el; |
|
582
|
8 |
0 |
else if (SvTYPE(rv) == SVt_PVHV) { |
|
585
|
24 |
8 |
for (i=0; i < 3; i++) { |
|
586
|
16 |
8 |
if ((el= hv_fetch(attrs, keys+(i<<1), 1, 0)) && *el && SvOK(*el)) { |
|
|
16 |
0 |
if ((el= hv_fetch(attrs, keys+(i<<1), 1, 0)) && *el && SvOK(*el)) { |
|
|
16 |
0 |
if ((el= hv_fetch(attrs, keys+(i<<1), 1, 0)) && *el && SvOK(*el)) { |
|
587
|
0 |
16 |
if (!looks_like_number(*el)) |
|
590
|
5 |
11 |
if (component_sv) component_sv[i]= *el; |
|
593
|
1 |
7 |
if (component_sv) component_sv[i]= NULL; |
|
602
|
0 |
0 |
else if (sv_derived_from(in, "PDL")) { |
|
609
|
0 |
0 |
PUSHMARK(SP); |
|
610
|
0 |
0 |
EXTEND(SP,1); |
|
615
|
0 |
0 |
if (pdl_dims) { |
|
617
|
0 |
0 |
if (count > 3) SP -= (count-3); |
|
618
|
0 |
0 |
pdl_dims[2]= (count > 2)? POPi : 0; |
|
619
|
0 |
0 |
pdl_dims[1]= (count > 1)? POPi : 0; |
|
620
|
0 |
0 |
pdl_dims[0]= (count > 0)? POPi : 0; |
|
621
|
0 |
0 |
if (pdl_dims[1] == 0) |
|
625
|
0 |
0 |
else if (count == 1) { |
|
631
|
0 |
0 |
FREETMPS; |
|
634
|
0 |
0 |
if (single_dim == 2 || single_dim == 3) { |
|
|
0 |
0 |
if (single_dim == 2 || single_dim == 3) { |
|
637
|
0 |
0 |
PUSHMARK(SP); |
|
638
|
0 |
0 |
EXTEND(SP,1); |
|
643
|
0 |
0 |
if (count > 3) SP -= (count-3); // should never happen |
|
644
|
0 |
0 |
vec[2]= (count > 2)? POPn : 0; |
|
645
|
0 |
0 |
vec[1]= (count > 1)? POPn : 0; |
|
646
|
0 |
0 |
vec[0]= (count > 0)? POPn : 0; |
|
648
|
0 |
0 |
FREETMPS; |
|
652
|
0 |
0 |
else if (!pdl_dims) |
|
665
|
0 |
5 |
if ((intptr_t)SvPVX(buf) & NV_ALIGNMENT_MASK) { |
|
678
|
11 |
0 |
if (sv_isobject(vector) && SvPOK(SvRV(vector))) |
|
|
11 |
0 |
if (sv_isobject(vector) && SvPOK(SvRV(vector))) |
|
680
|
11 |
0 |
if (len != sizeof(m3s_4space_projection_t) || ((intptr_t)p & NV_ALIGNMENT_MASK) != 0) |
|
|
0 |
11 |
if (len != sizeof(m3s_4space_projection_t) || ((intptr_t)p & NV_ALIGNMENT_MASK) != 0) |
|
695
|
848 |
21 |
while (cur && SvOK(cur)) { |
|
|
847 |
1 |
while (cur && SvOK(cur)) { |
|
698
|
847 |
0 |
SvROK(cur) && SvTYPE(SvRV(cur)) == SVt_PVHV |
|
|
847 |
0 |
SvROK(cur) && SvTYPE(SvRV(cur)) == SVt_PVHV |
|
699
|
0 |
847 |
&& (space= m3s_get_magic_space(cur, 0)) |
|
703
|
825 |
22 |
if (prev) { |
|
705
|
0 |
825 |
if (++depth > 964) { // Check for cycles in the graph |
|
706
|
0 |
0 |
if (!seen) seen= (HV*) sv_2mortal((SV*)newHV()); // hash will auto-garbage-collect |
|
708
|
0 |
0 |
if (!field || !*field) croak("BUG"); |
|
|
0 |
0 |
if (!field || !*field) croak("BUG"); |
|
709
|
0 |
0 |
if (SvOK(*field)) |
|
715
|
826 |
21 |
cur= field? *field : NULL; |
|
717
|
847 |
22 |
for (space= m3s_get_magic_space(space_sv, OR_DIE); space; space= space->parent) |
|
728
|
0 |
0 |
PUSHMARK(SP); |
|
729
|
0 |
0 |
EXTEND(SP, 3); |
|
732
|
0 |
0 |
if (dim == 3) PUSHs(sv_2mortal(newSVnv(vec[2]))); |
|
735
|
0 |
0 |
if (count != 1) croak("call to PDL::Core::pdl did not return an ndarray"); |
|
740
|
0 |
0 |
FREETMPS; |
|
751
|
0 |
0 |
PUSHMARK(SP); |
|
752
|
0 |
0 |
EXTEND(SP, 3); |
|
753
|
0 |
0 |
for (i= 0; i < 3; i++) { |
|
755
|
0 |
0 |
av_push(av, newSVnv(mat[transpose? i+0 : (i*3)+0])); |
|
756
|
0 |
0 |
av_push(av, newSVnv(mat[transpose? i+3 : (i*3)+1])); |
|
757
|
0 |
0 |
av_push(av, newSVnv(mat[transpose? i+6 : (i*3)+2])); |
|
762
|
0 |
0 |
if (count != 1) croak("call to PDL::Core::pdl did not return an ndarray"); |
|
767
|
0 |
0 |
FREETMPS; |
|
787
|
0 |
0 |
if (source) { |
|
788
|
0 |
0 |
if (sv_isobject(source)) { |
|
791
|
0 |
0 |
} else if (SvROK(source) && SvTYPE(source) == SVt_PVHV) { |
|
|
0 |
0 |
} else if (SvROK(source) && SvTYPE(source) == SVt_PVHV) { |
|
793
|
0 |
0 |
if ((field= hv_fetch(attrs, "xv", 2, 0)) && *field && SvOK(*field)) |
|
|
0 |
0 |
if ((field= hv_fetch(attrs, "xv", 2, 0)) && *field && SvOK(*field)) |
|
|
0 |
0 |
if ((field= hv_fetch(attrs, "xv", 2, 0)) && *field && SvOK(*field)) |
|
797
|
0 |
0 |
if ((field= hv_fetch(attrs, "yv", 2, 0)) && *field && SvOK(*field)) |
|
|
0 |
0 |
if ((field= hv_fetch(attrs, "yv", 2, 0)) && *field && SvOK(*field)) |
|
|
0 |
0 |
if ((field= hv_fetch(attrs, "yv", 2, 0)) && *field && SvOK(*field)) |
|
801
|
0 |
0 |
if ((field= hv_fetch(attrs, "zv", 2, 0)) && *field && SvOK(*field)) |
|
|
0 |
0 |
if ((field= hv_fetch(attrs, "zv", 2, 0)) && *field && SvOK(*field)) |
|
|
0 |
0 |
if ((field= hv_fetch(attrs, "zv", 2, 0)) && *field && SvOK(*field)) |
|
805
|
0 |
0 |
if ((field= hv_fetch(attrs, "origin", 6, 0)) && *field && SvOK(*field)) |
|
|
0 |
0 |
if ((field= hv_fetch(attrs, "origin", 6, 0)) && *field && SvOK(*field)) |
|
|
0 |
0 |
if ((field= hv_fetch(attrs, "origin", 6, 0)) && *field && SvOK(*field)) |
|
819
|
0 |
2 |
if (SvTYPE(SvRV(obj)) != SVt_PVHV) |
|
835
|
113 |
35 |
if (parent && SvOK(parent) && !m3s_get_magic_space(parent, 0)) |
|
|
113 |
0 |
if (parent && SvOK(parent) && !m3s_get_magic_space(parent, 0)) |
|
|
0 |
113 |
if (parent && SvOK(parent) && !m3s_get_magic_space(parent, 0)) |
|
840
|
113 |
35 |
if (parent && SvOK(parent)) |
|
|
113 |
0 |
if (parent && SvOK(parent)) |
|
858
|
14 |
89 |
if (x_or_vec) { |
|
859
|
4 |
10 |
M3S_VECLOAD(vec,x_or_vec,y,z,0); |
|
|
4 |
0 |
M3S_VECLOAD(vec,x_or_vec,y,z,0); |
|
860
|
11 |
3 |
if (ix < 3) space->is_normal= -1; |
|
871
|
1 |
12 |
if (space->is_normal == -1) |
|
873
|
9 |
4 |
RETVAL= space->is_normal; |
|
882
|
4 |
7 |
RETVAL= m3s_get_magic_space(space, OR_DIE)->n_parents; |
|
894
|
5 |
1 |
if (SvOK(parent)) { |
|
898
|
109 |
3 |
for (cur= psp3; cur; cur= cur->parent) |
|
899
|
2 |
107 |
if (cur == sp3) |
|
919
|
9 |
2 |
M3S_VECLOAD(vec,x_or_vec,y,z,0); |
|
|
9 |
0 |
M3S_VECLOAD(vec,x_or_vec,y,z,0); |
|
920
|
2 |
9 |
if (ix) { |
|
947
|
0 |
6 |
if (SvROK(xscale_or_vec) && yscale == NULL) { |
|
|
0 |
0 |
if (SvROK(xscale_or_vec) && yscale == NULL) { |
|
951
|
1 |
5 |
vec[1]= yscale? SvNV(yscale) : vec[0]; |
|
952
|
1 |
5 |
vec[2]= zscale? SvNV(zscale) : vec[0]; |
|
954
|
18 |
6 |
for (i= 0; i < 3; i++) { |
|
956
|
0 |
18 |
if (ix == 1) { |
|
958
|
0 |
0 |
if (m > 0) |
|
982
|
0 |
6 |
if (y) { |
|
983
|
0 |
0 |
if (!z) croak("Missing z coordinate in space->rotate(angle, x, y, z)"); |
|
1009
|
23 |
6 |
if (ix < 3) // Rotate around axis of parent |
|
1030
|
7 |
7 |
for (i= 1; i < items; i++) { |
|
1032
|
0 |
7 |
if (vectype == M3S_VECTYPE_PDLMULTI) { |
|
1034
|
0 |
0 |
if (!pdl_origin) { |
|
1040
|
0 |
0 |
PUSHMARK(SP); |
|
1042
|
0 |
0 |
EXTEND(SP, 4); |
|
1047
|
0 |
0 |
if (count != 1) croak("PDL->copy failed?"); |
|
1049
|
0 |
0 |
PUSHs(ix == 3? pdl_origin : &PL_sv_undef); |
|
1052
|
0 |
0 |
PUSHs(ix == 1? pdl_origin : &PL_sv_undef); |
|
1056
|
0 |
0 |
FREETMPS; |
|
1110
|
17 |
17 |
for (i= 1; i < items; i++) { |
|
1111
|
0 |
17 |
if (!SvROK(ST(i))) |
|
1132
|
12 |
4 |
for (j=0; j < 3; j++) |
|
1133
|
10 |
2 |
if (component_sv[j]) |
|
1141
|
0 |
0 |
if (!pdl_origin) { |
|
1147
|
0 |
0 |
PUSHMARK(SP); |
|
1148
|
0 |
0 |
EXTEND(SP, 4); |
|
1151
|
0 |
0 |
PUSHs(ix == 3? pdl_origin : &PL_sv_undef); |
|
1154
|
0 |
0 |
PUSHs(ix == 1? pdl_origin : &PL_sv_undef); |
|
1158
|
0 |
0 |
FREETMPS; |
|
1177
|
2 |
4 |
if (buffer) { |
|
1186
|
0 |
4 |
EXTEND(SP, 16); |
|
1214
|
2 |
0 |
if (fabs(w) < double_tolerance || fabs(h) < double_tolerance || fabs(d) < double_tolerance) |
|
|
2 |
0 |
if (fabs(w) < double_tolerance || fabs(h) < double_tolerance || fabs(d) < double_tolerance) |
|
|
0 |
2 |
if (fabs(w) < double_tolerance || fabs(h) < double_tolerance || fabs(d) < double_tolerance) |
|
1227
|
1 |
1 |
proj.frustum.centered= fabs(proj.frustum.m20) < double_tolerance && fabs(proj.frustum.m21) < double_tolerance; |
|
|
1 |
0 |
proj.frustum.centered= fabs(proj.frustum.m20) < double_tolerance && fabs(proj.frustum.m21) < double_tolerance; |
|
1273
|
5 |
6 |
if (!space) { /* user just wants the matrix itself */ |
|
1279
|
5 |
1 |
else if (proj->frustum.centered) { /* centered frustum, optimize by assuming m20 and m21 are zero */ |
|
1314
|
2 |
9 |
if (ix & 3) { /* packed something */ |
|
1316
|
1 |
1 |
if (ix & 1) { /* packed floats */ |
|
1320
|
16 |
1 |
for (i= 0; i < 16; i++) buf[i]= (float) dst[i]; |
|
1327
|
0 |
9 |
EXTEND(SP, 16); |
|
1328
|
144 |
9 |
for (i= 0; i < 16; i++) |
|
1346
|
34 |
3 |
M3S_VECLOAD(vec,vec_or_x,y,z,0); |
|
|
34 |
0 |
M3S_VECLOAD(vec,vec_or_x,y,z,0); |
|
1359
|
3 |
4 |
if (items == 2 && SvROK(ST(1))) { |
|
|
3 |
0 |
if (items == 2 && SvROK(ST(1))) { |
|
1362
|
4 |
0 |
else if (items & 1) { |
|
1363
|
3 |
4 |
for (i= 1; i < items; i+= 2) { |
|
1364
|
3 |
0 |
key= SvOK(ST(i))? SvPV_nolen(ST(i)) : ""; |
|
1365
|
1 |
2 |
if (strcmp(key, "x") == 0) ofs= 0; |
|
1366
|
1 |
1 |
else if (strcmp(key, "y") == 0) ofs= 1; |
|
1367
|
1 |
0 |
else if (strcmp(key, "z") == 0) ofs= 2; |
|
1370
|
0 |
3 |
if (!looks_like_number(ST(i+1))) |
|
1389
|
2 |
0 |
if (newval) { |
|
1400
|
0 |
117 |
EXTEND(SP, 3); |
|
1412
|
1 |
4 |
if (scale) { |
|
1413
|
1 |
0 |
if (m > 0) { |
|
1438
|
4 |
2 |
M3S_VECLOAD(vec2,vec2_or_x,y,z,0); |
|
|
3 |
1 |
M3S_VECLOAD(vec2,vec2_or_x,y,z,0); |
|
1439
|
1 |
5 |
if (ix == 0) { |
|
1443
|
4 |
1 |
} else if (ix == 1) { |
|
1464
|
3 |
1 |
if (looks_like_number(vec2_or_x)) { |
|
1466
|
2 |
1 |
vec2[1]= y? SvNV(y) : vec2[0]; |
|
1467
|
1 |
2 |
vec2[2]= z? SvNV(z) : y? 1 : vec2[0]; |
|
|
1 |
1 |
vec2[2]= z? SvNV(z) : y? 1 : vec2[0]; |
|
1486
|
3 |
3 |
M3S_VECLOAD(vec2,vec2_or_x,y,z,0); |
|
|
3 |
0 |
M3S_VECLOAD(vec2,vec2_or_x,y,z,0); |
|
1500
|
3 |
0 |
M3S_VECLOAD(vec2,vec2_or_x,y,z,0); |
|
|
3 |
0 |
M3S_VECLOAD(vec2,vec2_or_x,y,z,0); |
|
1514
|
1 |
1 |
if (!vec3_or_y) { // RET = vec1->cross(vec2) |
|
1518
|
1 |
0 |
} else if (z || !SvROK(vec2_or_x) || looks_like_number(vec2_or_x)) { // RET = vec1->cross(x,y,z) |
|
|
1 |
0 |
} else if (z || !SvROK(vec2_or_x) || looks_like_number(vec2_or_x)) { // RET = vec1->cross(x,y,z) |
|
|
0 |
1 |
} else if (z || !SvROK(vec2_or_x) || looks_like_number(vec2_or_x)) { // RET = vec1->cross(x,y,z) |
|
1521
|
0 |
0 |
vec2[2]= z? SvNV(z) : 0; |