FAQ
Cover
This is the archive Discourse for the Processing (ALPHA) software.
Please visit the new Processing forum for current information.

   Processing 1.0 _ALPHA_
   Programming Questions & Help
   Syntax
(Moderators: fry, REAS)
   Trigonometry... Inverse Cosine?
« Previous topic | Next topic »

Pages: 1 
   Author  Topic: Trigonometry... Inverse Cosine?  (Read 774 times)
aadigi


Trigonometry... Inverse Cosine?
« on: Apr 2nd, 2004, 7:40pm »

My trigonometry skills are pretty shoddy, but I need an invserse cosine function. Is there some kind of roundabout way to build one using the existing Processing trig tools? Any other solutions? Thanks.
 
-Aaron
 
justo


Re: Trigonometry... Inverse Cosine?
« Reply #1 on: Apr 2nd, 2004, 10:47pm »

you can usually rearrange things to use atan or atan2, both of which processing supports, but if all else fails you can just use Math.acos().
 
 
edit: my mistake...only processing only has an atan2() method. your best bet would be Math.acos() then.
« Last Edit: Apr 2nd, 2004, 10:47pm by justo »  
aadigi


Re: Trigonometry... Inverse Cosine?
« Reply #2 on: Apr 2nd, 2004, 11:12pm »

Oh hey... thats nice... I didn't realize I automatically had access to the Java Math class. Thanks!
 
aadigi


Re: Trigonometry... Inverse Cosine?
« Reply #3 on: Apr 2nd, 2004, 11:37pm »

K... one more problem. The Math.acos() function wants doubles and i'm feeding it floats and getting errors. Processing doesn't seem to have a function to convert variables to doubles. Is there some kind of equivalent avaliable in the Java Math library or something? Thanks.
 
-Aaron
 
fry


WWW
Re: Trigonometry... Inverse Cosine?
« Reply #4 on: Apr 3rd, 2004, 2:00am »

it's probably upset that you're getting doubles *back*, not that you're putting them in. it'll upgrade floats to doubles but not the other way 'round. just cast what comes back from acos:
 
float ac = (float) Math.acos(blah);
 
Pages: 1 

« Previous topic | Next topic »