Draw line using its angle and radius in iphone
I want to draw line from one point to another unknown point.I want to find this unknown point using its angle and radius from current point. Then i want to draw between these two points as line..
Can anyone help me?
Thanks in advance...
Note:
I already开发者_开发技巧 used these method
x2 = x1 - length * cos(angle)
y2 = y1 - length * sin(angle)
But these found point is not correct for some angle...
Some things to check:
- The use of
-
and+
after... = x1
and... = y1
depends on the angular coordinate system you want to use. Make sure you've got this right. - Likewise
cos
andsin
may need to be swapped. - Is
angle
in radians? If it's in degrees, it won't work.
Note that I'm not suggesting you have points 1 and 2 wrong. It's impossible to say without knowing how you want your geometry to function, and what coordinate system you're using. Plus, the iPhone SDKs are a bit schizophrenic in this regard.
精彩评论