generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Scripters
Home Search
 

Re: Law of Cosines

Previous Thread :: Next Thread 
ninja900500 is not online. ninja900500
Joined: 27 Sep 2008
Total Posts: 2324
16 Jul 2015 08:09 PM
Hmmm, I can't make this script print the degree of angle C according to this image:

http://prntscr.com/7tlrkr

local function GetCos(a, b, c, Angle)
if Angle == "A" then
print(math.deg((b^2 + c^2 - a^2)/(2 * (b * c))))
elseif Angle == "B" then
print(math.deg((c^2 + a^2 - b^2)/(2 * (c * a))))
elseif Angle == "C" then
print(math.deg((a^2 + b^2 - c^2)/(2 * (a * b))))
end
end

GetCos(44, 29, 50, "C")
Report Abuse
ninja900500 is not online. ninja900500
Joined: 27 Sep 2008
Total Posts: 2324
16 Jul 2015 08:16 PM
nvm figured it
Report Abuse
TimeTicks is not online. TimeTicks
Joined: 27 Apr 2011
Total Posts: 27115
16 Jul 2015 08:17 PM
How?


"Talk is cheap. Show me the code." - Linus Torvalds
Report Abuse
ninja900500 is not online. ninja900500
Joined: 27 Sep 2008
Total Posts: 2324
16 Jul 2015 08:18 PM
local function GetCos(a, b, c, Angle)
if Angle == "A" then
print(math.deg(math.acos((b^2 + c^2 - a^2)/(2 * (b * c)))))
elseif Angle == "B" then
print(math.deg(math.acos((c^2 + a^2 - b^2)/(2 * (c * a)))))
elseif Angle == "C" then
print(math.deg(math.acos((a^2 + b^2 - c^2)/(2 * (a * b)))))
end
end

GetCos(44, 29, 50, "A")
Report Abuse
lordrambo is not online. lordrambo
Joined: 16 Jun 2009
Total Posts: 20628
16 Jul 2015 08:31 PM
You can't use math.cos?
Report Abuse
ninja900500 is not online. ninja900500
Joined: 27 Sep 2008
Total Posts: 2324
16 Jul 2015 08:40 PM
math cos gives me a weird radian
Report Abuse
lordrambo is not online. lordrambo
Joined: 16 Jun 2009
Total Posts: 20628
16 Jul 2015 08:46 PM
math.deg it and round it to whatever precision you wanted
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripters
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image