确定旋转方向/朝/可变点上圆 [英] Determine rotation direction /toward/ variable point on a circle

查看:152
本文介绍了确定旋转方向/朝/可变点上圆的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

由于圆心:vectorA和圆的周长另一个向量:vectorB,你怎么能确定较短的路线vectorB翻译成的圆的周长另一点是可变的:vectorC?请问较短的路线是顺时针或逆时针旋转?

Given circle centre: vectorA and another Vector on the circle's perimeter:vectorB, how can you determine the shorter route for vectorB to translate to another point on the circle's perimeter that is variable:vectorC? Will the shorter route be clockwise or counter clockwise rotation?

如果它有助于想到一个时钟。如果时间是在时钟的外围,例如随机点。 6,以及分针位置是已知的,例如:。 4.是否手需要全天候的中心点顺时针或逆时针旋转,以达到随机点(6)?

If it helps think of a clock. If the times is a random point on the clock's perimeter eg. 6, and the minute hand position is known, eg. 4. Does the hand need to rotate around the clock's centre point clockwise or counter clockwise to reach the random point (6)?

另请参阅:
<一href="http://stackoverflow.com/questions/25902466/vec1-circle-centre-vec2-mousepos-find-the-point-on-the-circle-between-vec1/">Vec1 =圆心,VEC2 = mousePos结构,找到VEC 1之间的圈,VEC2

See also:
Vec1 = Circle centre, Vec2 = mousepos, find the point on the circle between Vec1, Vec2

推荐答案

三角形刚则计算卷绕方向ABC

  • 所以,如果你计算正常 N =(BA)×(CB)其中x是跨产品
  • 然后n.z签署确定方向
  • 新西兰元=((BX-AX)*(CY-BY)) - ((通过-AY)*(CX-BX))
  • 如果(n.z&LT; 0.0)DIR = CW其他DIR = CCW;
  • 这是所有你需要(CW表示顺时针和逆时针逆时针)
  • 在粗糙的,如果你的坐标系是不同的,然后旋转可以被否定
  • so if you compute normal n=(B-A)x(C-B) where x is cross product
  • then n.z sign determine the direction
  • n.z = ((B.x-A.x)*(C.y-B.y)) - ((B.y-A.y)*(C.x-B.x))
  • if (n.z<0.0) dir=CW else dir=CCW;
  • that is all you need (CW means clockwise and CCW counter clockwise)
  • of coarse if your coordinate system is different then the rotation can be negated

[注意事项]

  • 如果(NZ == 0)那么点B,C或者是相反的或相同
  • 在这样的方向并不重要,因为这两种方式的角距离是一样的
  • if (n.z==0) then the points B,C are either opposite or identical
  • so direction does not matter because both ways the angular distance is the same

这篇关于确定旋转方向/朝/可变点上圆的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆