Ok, have been scratching my head a bit on this one...
It should be simple enough as it is a right angle triangle that I am working on..
(Actually it's for stair cases)
What I need to be able to find is the Hypotenuse..
Simple enough ? I thought so as well...
hyp = Opposite / Sin(34)
which if am understanding things right, the php should look like..
$hyp = $oppo / sin(35);
ok, so then I realised I was getting degrees not radians..
so used.. deg2rad()
$hyp = $oppo / deg2rad(sin(35));
and guess what, the answer I get does not match what I expect to see, I have used my daughters GCSE revision books to check the results, using :-
$hyp = 15 / deg2rad(sin(35));
$hyp should = 26.151 (or there abouts)
However I get -2007.17299864 !!!! not quite what was expecting..
I hate trig unless its for calculus. When working in radians, 15/sin(35) is -35.0317748. When working in degrees it is 26.15170193. Have you ran though the math with a calculator before writing the program?
PHP's sin($x) expects the value to be in radians. So, you should always send it in radians.
You can convert any angle in degrees to radians with this simple formula.
Worked perfect thanks for the help :D
|All times are GMT. The time now is 06:09 PM.|
Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0