Suspected problems with Sin & Cos functions

H

hiram.upchurch

Hello - I am developing a graphics program for identifying flaws on
aircraft parts. I am trying to provide rotation of the drawing and
the flaws found on the screen. I am able to rotate the image nicely,
but not the flaw marking locations.

Using a trig function of the following: NewXpos = (currX *
cos(Angle)) - (currY * sin(Angle)) and
NewYpos = (currX * (sin(Angle)) + (currY * (cos(Angle)).

Problem comes in with the Sin and Cos functions in vb.Net. When I put
in any angle, I do not get the expected results as from a trig table.
Example: sin(45) = .7071 from the tables but in vb.net it comes back
with 0.85090352453411844 and cos(45) from the tables is also .7071 but
from vb.net it comes back as 0.52532198881772973.

My version info is as follows:

MS Visual Studio 2008 - Version 8.0.50727.762 - SP.050727-7600
MS .Net Frameword Version 2.0.50727

Is this perhaps a bug in vb.net??

Thanks for any and all assistance.
 
A

Andrew Morton

Problem comes in with the Sin and Cos functions in vb.Net. When I put
in any angle, I do not get the expected results as from a trig table.
Example: sin(45) = .7071 from the tables but in vb.net it comes back
with 0.85090352453411844 and cos(45) from the tables is also .7071 but
from vb.net it comes back as 0.52532198881772973.

The trig functions take their arguments as radians, not degrees.

Andrew
 
J

Jaap Bos

Hello - I am developing a graphics program for identifying flaws on
aircraft parts. I am trying to provide rotation of the drawing and
the flaws found on the screen. I am able to rotate the image nicely,
but not the flaw marking locations.

Using a trig function of the following: NewXpos = (currX *
cos(Angle)) - (currY * sin(Angle)) and
NewYpos = (currX * (sin(Angle)) + (currY * (cos(Angle)).

Problem comes in with the Sin and Cos functions in vb.Net. When I put
in any angle, I do not get the expected results as from a trig table.
Example: sin(45) = .7071 from the tables but in vb.net it comes back
with 0.85090352453411844 and cos(45) from the tables is also .7071 but
from vb.net it comes back as 0.52532198881772973.

My version info is as follows:

MS Visual Studio 2008 - Version 8.0.50727.762 - SP.050727-7600
MS .Net Frameword Version 2.0.50727

Is this perhaps a bug in vb.net??

Thanks for any and all assistance.

No bug, VB trigoniometrics is in radians, not in degrees!
Convert your angles first to radians (360 degrees=2*PI radians).

Greetings,

Jaap
 
S

Sam Salman

I am also suffering with the same Issue.
i want the answer in degree but it gives me in radian. and there is formula for converting the radian into degree i also followed this (radians * 180.0 / PI) to get answer in degree but it doesn't correct answer which i get from calculator. i am quite confuse what should i do?
can u please tell me how did u sorted out ur prob?
what u did to make your answer into degree?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top