hopbin9 Posted July 23, 2011 Share Posted July 23, 2011 Hi guys, this is causing me some problems. Houdini is calculating this math incorrectly, and I don't understand why. In the hscript textport I get the following echo `2*cos($PI/6)` 1.99992 but if I do the same thing on a regular calculator, then I get the correct value 2*cos(PI/6) == 1.73 Why on earth is Houdini calculating this wrong? and can anyone else reproduce this problem? Quote Link to comment Share on other sites More sharing options...
hopbin9 Posted July 23, 2011 Author Share Posted July 23, 2011 I think cos($PI) should be -1, but in Houdini it's giving me 0.998497 I'm confused. Quote Link to comment Share on other sites More sharing options...
hopbin9 Posted July 23, 2011 Author Share Posted July 23, 2011 I was using this calculator. http://www.mathopenref.com/calculator.html Appears that it gives different results then the calculator with Windows. It's showing the same results for Houdini. What I'm trying to do is calculate the apothem (inradius) of a n-sided polygon. Quote Link to comment Share on other sites More sharing options...
hopbin9 Posted July 23, 2011 Author Share Posted July 23, 2011 ah, i got it. 2 * cos(deg($PI/6)) Had to convert from radian first. Quote Link to comment Share on other sites More sharing options...
Adam Ferestad Posted July 26, 2011 Share Posted July 26, 2011 Are the trig functions in Houdini calculated as Radian or Degree? I have always just assumed they are radians, though I have not used them all that much either. That will be some major knowledge for me eventually as I try to apply some of my math concepts to various parts of the program. Quote Link to comment Share on other sites More sharing options...
old school Posted July 26, 2011 Share Posted July 26, 2011 (edited) Hscript expressions are degrees. VEX/VOPs are in radians. See example file of an identical sine wave in SOPs vs VOPs. The not often used custom expressions are in radians. trig_deg_vs_rad_expr_vs_vex.hip Edited July 26, 2011 by old school Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.