문제

Who is a math wiz and wants to check my math?

I'm trying to find the placement of a point(x,y) on the circumference of a circle in degrees. If I use x=radius*cos(Q)+xOrigin, I end up with arccos((x/2)-xOrigin) = Q which gives me the angle in radians. Then I go D = Q(180/Pi) to get degrees, but I keep coming up about 3-5 degrees off of target.

What's up with that?

도움이 되었습니까?

해결책

Your formula for Q should be

Q = acos((x-xOrigin)/radius)

Note that acos returns an angle between 0 and pi; if the angle is in the third or fourth quadrant you'll need to subtract the angle from 2 * pi.

Without knowing the actual values that are coming up wrong, it's hard to tell if that's the only problem. Your conversion from radians to degrees is correct.

다른 팁

Most modern programming languages have atan2() somewhere, which takes a rise and a run and spits out the angle in radians in all four quadrants.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top