2 |
|
{ |
3 |
|
Compute patterns for ambient position markers |
4 |
|
} |
5 |
+ |
odd(n) : .5*n - floor(.5*n) - .25; |
6 |
+ |
posangle(a) : if(-a, a + 2*PI, a) / DEGREE; |
7 |
|
{ Relative hit point } |
8 |
|
rpx = Px - arg(1); |
9 |
|
rpy = Py - arg(2); |
21 |
|
{ Calculation of positional gradient pattern } |
22 |
|
pgx = arg(4); pgy = arg(5); pgz = arg(6); |
23 |
|
posfunc = bound(0, 1 + (pgx*rpx + pgy*rpy + pgz*rpz), 2); |
24 |
+ |
{ corral flags and associated pattern } |
25 |
+ |
ux = arg(4); uy = arg(5); uz = arg(6); |
26 |
+ |
cflags = arg(7); |
27 |
+ |
vx = Ny*uz - Nz*uy; |
28 |
+ |
vy = Nz*ux - Nx*uz; |
29 |
+ |
vz = Nx*uy - Ny*ux; |
30 |
+ |
cflg(i) = if(odd(floor( cflags / 2^i )), 1, -1); |
31 |
+ |
corralled = cflg(floor(32/360*posangle( |
32 |
+ |
atan2(rpx*vx+rpy*vy+rpz*vz, rpx*ux+rpy*uy+rpz*uz) ))); |
33 |
|
|
34 |
|
{ Calculation of ellipse stencil for base } |
35 |
|
usx = arg(4); usy = arg(5); usz = arg(6); |