-
Notifications
You must be signed in to change notification settings - Fork 293
Description
Summary
I have a scenario where the function trace correctly finds the intersection. When I scale it up, it does not find the intersection anymore.
POV-Ray Version
- Incarnation: POV-Ray for UNIX (POV-Ray 3.7.0.4.unofficial)
Runtime Environment
- Operating system: Ubuntu 18.04.6 LTS
- Hardware architecture: x86-64
- CPU model: Intel(R) Core(TM) i7-8565U CPU @ 1.80GHz
Scene
#version 3.7;
global_settings { assumed_gamma 1.0 charset utf8 }
// Demonstration of a bug in povray
// The trace function (used with quite big numbers) has a false "no hit" result,
// which turns into a correct result when the scenario is scaled down
// loop with Base = 1000 results in "no hit"
// loop with Base = 1 give a correct result
#declare Base = 1000; // will not find the intersection
// #declare Base = 450; // will not find the intersection
// #declare Base = 400; // works
// #declare Base = 1 ; // works
#declare Earth = sphere { 0, Base };
#declare SatPos = <-Base,Base/2,-Base1.5>;
#declare SunPos = <-4500, 0, -4500>; // to be scaled to realistic length in the next step:
#declare Sun = SunPos(Base*23560/vlength(SunPos));
#debug concat("\nSun located at < ",vstr(3,Sun,", ",0,3)," >\n")
// a slightly red ball representing earth
sphere { Earth
pigment { color rgb <.5,1,.7> }
}
// a blueish satellite which will create a shadow on the "earth"
sphere { SatPos, Base/20
pigment { color rgb <.5,.5,1> }
}
// calculate position of shadow and create a red sphere there
#declare Norm = <0, 0, 0>;
#declare Shadow = trace(Earth,Sun,SatPos-Sun,Norm);
#if (vlength(Norm) != 0)
sphere { Shadow, Base/10 pigment { color rgb <1,.3,.3> } }
#else
#debug "Function trace did not found an intersection.\n"
#end
light_source { Sun, 1 }
camera { location <0,0,-10*Base> look_at 0 angle 30 }
Command Line Options
povray +P test-scalingbug.pov
Expected Behavior
The shadow of the smaller sphere ("satellite") falls on the bigger sphere ("earth") at a spot, which is calculated by trace and then marked by a small red sphere.
Actual Behavior
trace does not find that spot if the numbers (e.g. distance of light source) are big
Output
Sun located at < -16659435.765, 0.000, -16659435.765 >
Function trace did not found an intersection.