我想弄清楚正确的触发。 eq./function确定以下内容: 两个方向向量 (已确定) 之间的角度变化(单位为DEGREES) ,表示两条线段。 这用于SHAPE RECOGTNITION(由用户在屏幕上手绘)的上下文中。
基本上,
a)如果用户绘制(粗糙)形状,例如圆形,椭圆形或矩形等,组成该形状的线条被细分为20点(xy对)。
b)我有这些线段的每一个的DirectionVector。
c)所以开始一个LINE SEGMENT(x0,y0),就是前一行的END点(以形成一个像矩形的闭合形状,比方说)。
那么,我的问题是,给定上下文(即确定多边形的类型), 如何找到两个DIRECTION VECTORS之间的角度变化(可用作x和y的两个浮点值)?
我见过很多不同的触发器。 方程式,我正在寻求澄清。
非常感谢大家!
I am trying to figure out the correct trig. eq./function to determine the following: The Angle-change (in DEGREES) between two DIRECTION VECTORS(already determined), that represent two line-segment. This is used in the context of SHAPE RECOGTNITION (hand drawn by user on screen).
SO basically,
a) if the user draws a (rough) shape, such as a circle, or oval, or rectangle etc - the lines that makes up that shape are broken down in to say.. 20 points(x-y pairs).
b) I have the DirectionVector for each of these LINE SEGMENTS.
c) So the BEGINNING of a LINE SEGMENT(x0,y0), will the END points of the previous line(so as to form a closed shape like a rectangle, let's say).
SO, my question is , given the context(i.e. determinign the type of a polygon), how does one find the angle-change between two DIRECTION VECTORS(available as two floating point values for x and y) ???
I have seen so many different trig. equations and I'm seeking clarity on this.
Thanks so much in advance folks!
最满意答案
如果(x1,y1)是第一个方向向量而(x2,y2)是第二个方向向量,则它成立:
cos(alpha)=(x1 * x2 + y1 * y2)/(sqrt(x1 * x1 + y1 * y1)* sqrt(x2 * x2 + y2 * y2))
sqrt表示平方根。
查看http://en.wikipedia.org/wiki/Dot_product
特别是“几何表示”一节。
If (x1,y1) is the first direction vector and (x2,y2) is the second one, it holds:
cos( alpha ) = (x1 * x2 + y1 * y2) / ( sqrt(x1*x1 + y1*y1) * sqrt(x2*x2 + y2*y2) )
sqrt means the square root.
Look up http://en.wikipedia.org/wiki/Dot_product
Especially the section "Geometric Representation".
更多推荐
发布评论