开发者

Draw line using its angle and radius in iphone

开发者 https://www.devze.com 2022-12-29 15:18 出处:网络
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..

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:

  1. 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.
  2. Likewise cos and sin may need to be swapped.
  3. 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.

0

精彩评论

暂无评论...
验证码 换一张
取 消