|
-
Feb 26th, 2009, 06:37 AM
#1
Thread Starter
New Member
using trig functions in vb.net
Hi every 1
Im building a maths program, to work out trig functions using sine, tan and opp. I made up one question asking the user to find the length of the opp side. The Hyp side has got 9cm(HYP) and the angle is 40 degrees and u need to find the size of X(OPP). I have dont the quesiton on pen and paper using a calculator and it works out to be 5.79cm.
When i do it vb.net it comes out as 54.7. This is the code im using to work it out using vb.net maths operators:
Public Function RatioSineFindingLength(ByVal length As Double, ByVal angle As Double) As Double
Dim lengthReturn As Double
lengthReturn = (length / (Sin(angle)))
Return lengthReturn
End Function
ANY HELP WOULD BE GREAT.
-
Feb 27th, 2009, 03:51 AM
#2
Re: using trig functions in vb.net
sine = opp / hyp -> opp = sine*hyp; your formula appears to be slightly messed up. I also wouldn't be surprised if there's a radian/degree conversion error--your calculator probably uses degrees while VB tends to use radians.
There are 2*pi radians in 360 degrees. Radians end up being much more natural than degrees. Hope something here helps.
The time you enjoy wasting is not wasted time.
Bertrand Russell
<- Remember to rate posts you find helpful.
-
Mar 2nd, 2009, 05:01 AM
#3
Thread Starter
New Member
Re: using trig functions in vb.net
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|