Author Topic: Maths library or functions ??  (Read 170 times)

Bartw

  • Newbie
  • *
  • Posts: 29
    • View Profile
Maths library or functions ??
« on: February 16, 2017, 08:26:57 pm »
Hello

Are there any maths libraries for square root, sin/cos/tan etc?
I am gather there isn't but being hopeful.

Regards
Bart

Social Buttons


mc-Josh

  • Global Moderator
  • Newbie
  • *****
  • Posts: 27
    • View Profile
Re: Maths library or functions ??
« Reply #1 on: February 17, 2017, 10:21:03 am »
There are math functions in mcScript, they are part of the Float object which is documented in the mcScript User Guide (section 5.2.6 and 16.6).

See sample code below:

Code: [Select]
Dim someFloat As Float = 81
Dim someFloat2 As Float = 90
Dim sqrtOfFloat As Float = someFloat.Sqrt
Dim sinOfFloat As Float = someFloat2.Sin
Dim cosOfFloat As Float = someFloat2.Cos

Note: Sin and Cos are in Radians.
Like Like x 2 Informative Informative x 1 View List

Bartw

  • Newbie
  • *
  • Posts: 29
    • View Profile
Re: Maths library or functions ??
« Reply #2 on: February 19, 2017, 03:12:34 pm »
Awesome thank you.
Regards
Bart