|
|
On 12/15/2017 07:50 AM, Bald Eagle wrote:
> dick balaska <dic### [at] buckosoftcom> wrote:
>> On 05/29/2017 03:42 PM, dick balaska wrote:
>>
>> > Help, Math wizards, you're my only hope.
>>
>> I have started again to try to tackle this problem.
>>
>> Scott's solution gave me a vector, which is not what I need. :( I need
>> an angle.
>>
http://www.buckosoft.com/tteoac/video/testRenders/test3.mp4
Eureka!
The solution is to rotate it with the Cartesian result and then
translate it with scott's vcross-ish solution. i.e.
object {
myCyl
#local flOfs = <-0.4,-0.3,0.7>; // flashlight offset from camera
rotate VtoA(Lookat-Camera)
translate Camera+ssOffset(flOfs)
}
// Convert this vector into its angle
#macro VtoA(V)
#local _V=vnormalize(V);
#local rZ=degrees(acos(_V.z));
#local rY=0;
#local rX=0;
#if (_V.y != 0)
#local rY=degrees(atan2(_V.x,_V.y));
#else
#local rX=rZ;
#local rZ=0;
#end
<-rZ,rX,-rY>
#end
#macro ssOffset(bar)
#local newZ = vnormalize( Lookat-Camera );
#local newY = y;
#local newX = vnormalize(vcross(newY,newZ));
#local newY = vnormalize(vcross(newZ,newX));
#local barOut = bar.x * newX + bar.y * newY + bar.z * newZ;
barOut
#end
Post a reply to this message
|
|