|
|
So here's how I got it to NOT crash, but my mapping results suck.
Remove all of the protective select () and mod () functions, and it will crash.
#version 3.8;
global_settings {assumed_gamma 1.0 }
#include "math.inc"
#declare Zoom = 300;
camera {
orthographic
location <0, 0, -50>
right x*image_width/Zoom
up y*image_height/Zoom
look_at <0, 0, 0>
rotate y*0
}
light_source {<10, 10, -20> rgb 1}
sky_sphere {pigment {rgb 1}}
#declare Image = pigment {image_map {"HyperbolicSoccerBall.jpg"} translate-0.5}
#declare f_Image = function {pigment {Image}}
#declare d2s = function (M, N, U, V) {
select (M,
select (2*(U*U + V*V - 2),
sgn (M) * sqrt (abs (-U*U -V*V + sqrt ((U*U + V*V)+(U*U + V*V + 4*U*U*V*V
*(U*U+V*V-2)) ) / (2*(U*U + V*V - 2))) ) / M,
M,
sgn (M) * sqrt (abs (-U*U -V*V + sqrt ((U*U + V*V)+(U*U + V*V + 4*U*U*V*V
*(U*U+V*V-2)) ) / (2*(U*U + V*V - 2))) ) / M
),
M,
select (2*(U*U + V*V - 2),
sgn (M) * sqrt (abs (-U*U -V*V + sqrt ((U*U + V*V)+(U*U + V*V + 4*U*U*V*V
*(U*U+V*V-2)) ) / (2*(U*U + V*V - 2))) ) / M,
M,
sgn (M) * sqrt (abs (-U*U -V*V + sqrt ((U*U + V*V)+(U*U + V*V + 4*U*U*V*V
*(U*U+V*V-2)) ) / (2*(U*U + V*V - 2))) ) / M
)
)
}
#local FF = 0.0000001;
#declare s2d = function (M, N, X, Y) {
select (mod (M+FF, 1),
sqrt ((X*X + Y*Y - 2*X*X*Y*Y)/((X*X + Y*Y)*(1 - X*X*Y*Y))),
M,
sqrt ((X*X + Y*Y - 2*X*X*Y*Y)/((X*X + Y*Y)*(1 - X*X*Y*Y)))
)
}
box {0, 1 translate -0.5 pigment {Image} translate -x}
//box {0, 1 translate -0.5 pigment {function {f_Image (d2s (x, y, x, y), d2s (y,
x, x, y), z).red}} }
//box {0, 1 translate -0.5 pigment {function {f_Image (s2d (x, y, x, y), s2d (y,
x, x, y), z).red}} translate x}
#declare Step = 0.01;
union {
#for (Y, 0, 1, Step)
#for (X, 0, 1, Step)
#declare C = f_Image (X, Y, 0).red;
#declare X2 = d2s (X, Y, X, Y)*Step;
#declare Y2 = d2s (Y, X, X, Y)*Step;
box {<X2, Y2, 0>, <X2+Step, Y2+Step, 1> pigment {rgb C}}
#end
#end
}
#local FF = 0.0000001;
#for (N, 0, 1, 0.1)
#debug concat ("mod (", str(N, 0, 1), ", 1) = ", str(mod (N+FF, 1), 0, 3),
"\n")
#end
Post a reply to this message
|
|