mc-Things

mc-Products => mc-Studio => Topic started by: kbrooking on May 31, 2017, 10:04:27 am

Title: Does mc-Studio Support Trig Functions?
Post by: kbrooking on May 31, 2017, 10:04:27 am
Does mc-Studio support trig functions such as sine (sin), cosine (cos), tangent (tan)...etc? If so, are there any sample code showing how to use them?
Title: Re: Does mc-Studio Support Trig Functions?
Post by: mc-John on June 01, 2017, 06:18:18 pm
All trig functions are defined as function on the float datatype. So if you have a value in variable calc you can get the Sin by the following statement:

dim mySin as float = calc.Sin()

When you type calc. followed by keys <ctrl><space> you get all  functions that you can use on a float including the trig functions
Title: Re: Does mc-Studio Support Trig Functions?
Post by: kbrooking on June 01, 2017, 08:53:07 pm
So either I'm doing something wrong or there is a problem with the math functions. For instance in the below code snippet...

Dim Deg2Rad as float
Dim sinlat1 as float
.
.
.
Deg2Rad = .5863985
sinlat1 = Deg2Rad.Sin()

When I execute this in the debugger, sinlat1 is equal to 0.5533648. However, when I use the calculator to find the Sine of .5863985, I get  0.010234
Title: Re: Does mc-Studio Support Trig Functions?
Post by: kbrooking on June 01, 2017, 09:02:49 pm
 Uh... Never mind. I see it is in radians.  ::)