Author Topic: Does mc-Studio Support Trig Functions?  (Read 331 times)

kbrooking

  • Full Member
  • ***
  • Posts: 104
    • View Profile
Does mc-Studio Support Trig Functions?
« 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?

Share on Facebook Share on Twitter


mc-John

  • Global Moderator
  • Full Member
  • *****
  • Posts: 212
    • View Profile
Re: Does mc-Studio Support Trig Functions?
« Reply #1 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

kbrooking

  • Full Member
  • ***
  • Posts: 104
    • View Profile
Re: Does mc-Studio Support Trig Functions?
« Reply #2 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

kbrooking

  • Full Member
  • ***
  • Posts: 104
    • View Profile
Re: Does mc-Studio Support Trig Functions?
« Reply #3 on: June 01, 2017, 09:02:49 pm »
 Uh... Never mind. I see it is in radians.  ::)