dantay9 Posted July 14, 2009 Share Posted July 14, 2009 (edited) I am working with triangles and am finding one angle given a matching side and angle along with another side. To solve this, you would use law of sines. My triangle is a simple 45-45-90 so it is easily checked. The sides are 2, 2, and 2 radical 2 (2 * sqrt(2)). In my example, I have one side equal to 2, the hypotenuse equal to 2 radical 2, and the angle opposite the 2 equal to 45 degrees. I am trying to find the degrees of the angle opposite the hypotenuse (which ends up being 90). Here is what I am trying to use: $Side1 = 2 $Side3 = 2 * Sqrt(2) $Angle1 = 45 $Angle3 = _Degree(ASin(($Side3 * Sin(_Radian($Angle1))) / $Side1)) ConsoleWrite($Angle3 & @CRLF) If I remove the parameter for ASin and read the answer, it is 1. ConsoleWrite(($Side3 * Sin(_Radian($Angle1))) / $Side1 & @CRLF) If I do _Degree(ASin(1)), there is no problem. It returns 90. Can anyone confirm this? Am I missing something super easy or is this a bug? Edited July 14, 2009 by dantay9 Link to comment Share on other sites More sharing options...
Yashied Posted July 14, 2009 Share Posted July 14, 2009 Because this is a float number. ArcSin(X) - X can not be more 1. Try the following. $Angle3 = _Degree(ASin(Round(($Side3 * Sin(_Radian($Angle1))) / $Side1, 8))) PS. Why such complexity. The sum of angles of any triangle - 180. $Angle3 = 180 - $Angle1 - $Angle2 My UDFs: iKey | FTP Uploader | Battery Checker | Boot Manager | Font Viewer | UDF Keyword Manager | Run Dialog Replacement | USBProtect | 3D Axis | Calculator | Sleep | iSwitcher | TM | NetHelper | File Types Manager | Control Viewer | SynFolders | DLL Helper Animated Tray Icons UDF Library | Hotkeys UDF Library | Hotkeys Input Control UDF Library | Caret Shape UDF Library | Context Help UDF Library | Most Recently Used List UDF Library | Icons UDF Library | FTP UDF Library | Script Communications UDF Library | Color Chooser UDF Library | Color Picker Control UDF Library | IPHelper (Vista/7) UDF Library | WinAPI Extended UDF Library | WinAPIVhd UDF Library | Icon Chooser UDF Library | Copy UDF Library | Restart UDF Library | Event Log UDF Library | NotifyBox UDF Library | Pop-up Windows UDF Library | TVExplorer UDF Library | GuiHotKey UDF Library | GuiSysLink UDF Library | Package UDF Library | Skin UDF Library | AITray UDF Library | RDC UDF Library Appropriate path | Button text color | Gaussian random numbers | Header's styles (Vista/7) | ICON resource enumeration | Menu & INI | Tabbed string size | Tab's skin | Pop-up circular menu | Progress Bar without animation (Vista/7) | Registry export | Registry path jumping | Unique hardware ID | Windows alignment More... Link to comment Share on other sites More sharing options...
dantay9 Posted July 14, 2009 Author Share Posted July 14, 2009 (edited) Thank you Yashied. That works. I forgot Autoit shortens all values to a certain number of decimal places. The reason for the complexity is that I only know one angle and two sides. To solve this, you must use law of sines (if there is a matching side and angle) or law of cosines (if all else fails). Edited July 14, 2009 by dantay9 Link to comment Share on other sites More sharing options...
Yashied Posted July 14, 2009 Share Posted July 14, 2009 (edited) Thank you Yashied. That works. I forgot Autoit shortens all values to a certain number of decimal places. The reason for the complexity is that I only know one angle and two sides. To solve this, you must use law of sines (if there is a matching side and angle) or law of cosines (if all else fails).If it is rectangular triangle, you know two corners - 90 and another. Otherwise, the law of sinus and cosines are not working. They are only for rectangular triangles. Do you agree with me? Hence the third angle is equal to:$Angle3 = 180 - 90 - $Angle1 = 90 - $Angle1 (And you do not need ArcSin and ArcCos)EDIT:See this for more information. Edited July 14, 2009 by Yashied My UDFs: iKey | FTP Uploader | Battery Checker | Boot Manager | Font Viewer | UDF Keyword Manager | Run Dialog Replacement | USBProtect | 3D Axis | Calculator | Sleep | iSwitcher | TM | NetHelper | File Types Manager | Control Viewer | SynFolders | DLL Helper Animated Tray Icons UDF Library | Hotkeys UDF Library | Hotkeys Input Control UDF Library | Caret Shape UDF Library | Context Help UDF Library | Most Recently Used List UDF Library | Icons UDF Library | FTP UDF Library | Script Communications UDF Library | Color Chooser UDF Library | Color Picker Control UDF Library | IPHelper (Vista/7) UDF Library | WinAPI Extended UDF Library | WinAPIVhd UDF Library | Icon Chooser UDF Library | Copy UDF Library | Restart UDF Library | Event Log UDF Library | NotifyBox UDF Library | Pop-up Windows UDF Library | TVExplorer UDF Library | GuiHotKey UDF Library | GuiSysLink UDF Library | Package UDF Library | Skin UDF Library | AITray UDF Library | RDC UDF Library Appropriate path | Button text color | Gaussian random numbers | Header's styles (Vista/7) | ICON resource enumeration | Menu & INI | Tabbed string size | Tab's skin | Pop-up circular menu | Progress Bar without animation (Vista/7) | Registry export | Registry path jumping | Unique hardware ID | Windows alignment More... Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now