Hi all,
I have a strange result when I subtract two angle in radians!!!!
example :
<span class="syntaxdefault">axe </span><span class="syntaxkeyword">=</span><span class="syntaxdefault"> Geom</span><span class="syntaxkeyword">;;</span><span class="syntaxdefault">Vector3d</span><span class="syntaxkeyword">.new(-</span><span class="syntaxdefault">0.999782867743517</span><span class="syntaxkeyword">,</span><span class="syntaxdefault"> </span><span class="syntaxkeyword">-</span><span class="syntaxdefault">0.0208378829670674</span><span class="syntaxkeyword">,</span><span class="syntaxdefault"> 0.0</span><span class="syntaxkeyword">)<br /></span><span class="syntaxdefault">up </span><span class="syntaxkeyword">=</span><span class="syntaxdefault"> Geom</span><span class="syntaxkeyword">;;</span><span class="syntaxdefault">Vector3d</span><span class="syntaxkeyword">.new(</span><span class="syntaxdefault">0.00335712544250249</span><span class="syntaxkeyword">,</span><span class="syntaxdefault"> </span><span class="syntaxkeyword">-</span><span class="syntaxdefault">0.161071856847676</span><span class="syntaxkeyword">,</span><span class="syntaxdefault"> 0.98693697196954</span><span class="syntaxkeyword">)<br /></span><span class="syntaxdefault">axe</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">normalize</span><span class="syntaxkeyword">!<br /></span><span class="syntaxdefault">up</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">normalize</span><span class="syntaxkeyword">!<br /></span><span class="syntaxcomment"># (90 deg) = 1.5707963267948966 in rad<br />#(Math;;PI/2.0) = 90.0 in degrees, 1.5707963267949 in radians<br /><br /># angle between up-axe = 90.0 in degrees, 1.5707963267949 in radians<br /></span><span class="syntaxdefault">angle </span><span class="syntaxkeyword">=</span><span class="syntaxdefault"> </span><span class="syntaxkeyword">(</span><span class="syntaxdefault">Math</span><span class="syntaxkeyword">;;</span><span class="syntaxdefault">PI</span><span class="syntaxkeyword">/</span><span class="syntaxdefault">2.0</span><span class="syntaxkeyword">)</span><span class="syntaxdefault"> </span><span class="syntaxkeyword">+</span><span class="syntaxdefault"> </span><span class="syntaxkeyword">(</span><span class="syntaxdefault">up</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">angle_between axe</span><span class="syntaxkeyword">)<br /></span><span class="syntaxdefault">puts angle</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">radians </span><span class="syntaxcomment">#=> 180 degrees, 3.14159265358979 radians GOOD !!!<br /><br /></span><span class="syntaxdefault">angle </span><span class="syntaxkeyword">=</span><span class="syntaxdefault"> </span><span class="syntaxkeyword">(</span><span class="syntaxdefault">Math</span><span class="syntaxkeyword">;;</span><span class="syntaxdefault">PI</span><span class="syntaxkeyword">/</span><span class="syntaxdefault">2.0</span><span class="syntaxkeyword">)</span><span class="syntaxdefault"> </span><span class="syntaxkeyword">-</span><span class="syntaxdefault"> </span><span class="syntaxkeyword">(</span><span class="syntaxdefault">up</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">angle_between axe</span><span class="syntaxkeyword">)<br /></span><span class="syntaxdefault">puts angle</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">radians </span><span class="syntaxcomment">#=> 1.27222187258541e-014 BAD, 2.22044604925031e-016 in radians BAD </span><span class="syntaxdefault"></span>
can you help me ?