Skip to content

Instantly share code, notes, and snippets.

@ElectricImpSampleCode
Last active April 20, 2018 12:33
Show Gist options
  • Save ElectricImpSampleCode/a0120760d7c40bd2cb59 to your computer and use it in GitHub Desktop.
Save ElectricImpSampleCode/a0120760d7c40bd2cb59 to your computer and use it in GitHub Desktop.
Squirrel math cos() example
local hypotenuse = 5;
local angleInDegrees = 30;
local angleInRadians = (angleInDegrees * PI) / 180;
local cos = math.cos(angleInRadians);
local adjacentSide = cos * hypotenuse;
// 'adjacentSide' equals 4.33013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment