|
-
Apr 15th, 2001, 02:33 PM
#1
Thread Starter
Member
i need to take the sin of an angel in degrees but VB does it in radians
so, how do i get VB to calculate trig functions in degrees instead of radians?
-
Apr 15th, 2001, 02:52 PM
#2
Banned
Code:
Pi= 3.141592654
AngleR = AngleD * Pi / 180
AngleD = AngleR * 180 / Pi
-
Apr 15th, 2001, 03:28 PM
#3
Thread Starter
Member
i don't understand how i am supposed to use that code
this is what i got:
a is the angle in degrees
s is the initian speed of the object
dh is really dh/dt, the rate of change of the height of the object with respect to time
a=45
dh=sin(a)*s
i need that dh (dh/dt) value for a formula,
my problem is it calculates sin(45) as .850935 when sin(45) in degrees is .7071
-
Apr 15th, 2001, 03:32 PM
#4
Monday Morning Lunatic
Convert the angle to radians THEN pass it to the trig functions. VB, like most things you'll encounter, uses radians because they are a much more practical type (they're based on REAL properties of a circle as opposed to the "hey, let's have 360 degrees in this thing" method)
I refuse to tie my hands behind my back and hear somebody say "Bend Over, Boy, Because You Have It Coming To You".
-- Linus Torvalds
-
Apr 15th, 2001, 03:33 PM
#5
Banned
Code:
AngleD is the angle in degrees and AngleR in Radians
Type:
dh=sin(a * Pi / 180) * s
-
Apr 15th, 2001, 03:34 PM
#6
Monday Morning Lunatic
Code:
Function Deg2Rad(dAngle As Double)
Deg2Rad = dAngle * (Pi / 180)
End Function
...
Code:
Debug.Print Sin(Deg2Rad(45))
I refuse to tie my hands behind my back and hear somebody say "Bend Over, Boy, Because You Have It Coming To You".
-- Linus Torvalds
-
Apr 15th, 2001, 03:38 PM
#7
Banned
Originally posted by parksie
Code:
Function Deg2Rad(dAngle As Double)
Deg2Rad = dAngle * (Pi / 180)
End Function
...
The parentisis aren't needed: Deg2Rad = dAngle * Pi / 180
It doesn't really matter...
-
Apr 15th, 2001, 03:39 PM
#8
Monday Morning Lunatic
Yeah, but I put them in because in my code I usually define the constant PIDIV180 to save VB having to recalculate it each time
I refuse to tie my hands behind my back and hear somebody say "Bend Over, Boy, Because You Have It Coming To You".
-- Linus Torvalds
-
Apr 15th, 2001, 03:46 PM
#9
Addicted Member
If you don't have a good memory of the value of pi
like me use...
Pi = 4*Atn(1)
-
Apr 15th, 2001, 11:01 PM
#10
Thread Starter
Member
Thanks For The Help
thanks guys, that code did the trick
my prog. works fine now
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
|