<html><body><div style="color:#000; background-color:#fff; font-family:HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif;font-size:10pt"><div><span>Thanks David. That reduces the number of calculation.So I guess there isn't any vtk method I can call to get the angle.</span></div><div style="color: rgb(0, 0, 0); font-size: 13px; font-family: HelveticaNeue, 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: transparent; font-style: normal;"><span><br></span></div><div style="color: rgb(0, 0, 0); font-size: 13px; font-family: HelveticaNeue, 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: transparent; font-style: normal;"><span>Harold </span></div><div class="yahoo_quoted" style="display: block;"> <br> <br> <div style="font-family: HelveticaNeue, 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 10pt;"> <div style="font-family:
HelveticaNeue, 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 12pt;"> <div dir="ltr"> <font size="2" face="Arial"> On Friday, January 3, 2014 11:52 PM, David Cole <dlrdave@aol.com> wrote:<br> </font> </div> <div class="y_msg_container">Your "get_angle_new" is about as simple as it gets.<br clear="none"><br clear="none">I would do something like this, though:<br clear="none"><br clear="none"> double dot = vtkMath::Dot(v1, v2);<br clear="none"><br clear="none"> // Expect v1 and v2 to be normalized unit vectors, but sometimes <br clear="none">the dot product<br clear="none"> // exceeds 1 by just enough to cause errors when calling acos.<br clear="none"> // If it's greater than 1.0, or less than -1.0, clamp it:<br clear="none"> if (dot > 1.0)<br clear="none"> {<br clear="none"> dot = 1.0;<br clear="none">
}<br clear="none"> else if (dot < -1.0)<br clear="none"> {<br clear="none"> dot = -1.0;<br clear="none"> }<br clear="none"><br clear="none"> double angle = acos(dot);<br clear="none"><br clear="none"><br clear="none">HTH,<br clear="none">David C.<div class="yqt5979340456" id="yqtfd31176"><br clear="none"></div><br><br></div> </div> </div> </div> </div></body></html>