几何尺寸与公差论坛

 找回密码
 注册
查看: 538|回复: 0

geometryvector

[复制链接]
发表于 2009-9-9 14:31:34 | 显示全部楼层 |阅读模式
geometry/vector
i have three points in 3d space, p1, p2 and p3, defined by (x1, y1, z1), (x2, y2, z2) and (x3, y3, z3).  does anyone have a formula that calculates the angle between lines p1,p2 and p2, p3 and the angle of the plane, going through the points, relative to the x-y plane?
thanks, dik

the angle between two vectors in space is given by the relationship
cos theta = (u.v)/((abs u)*(abs v))
the numerator is the dot product of the vectors which is a scalar quantity, not a vector and is given by u1*v1 + u2*v2 + u3*v3
the denominator is the product of the absolute values of the magnitudes of the vector which are given by (individually) ((x^2)+(y^2)*(z^2))^0.5
good memory, streit..
i was racking my brain here because i knew i had used that before, but i didn't have any of my calc notes in the office.  
i guess i should say that u is the first vector, line p1,p2 in your case, and would be shown as (x2-x1, y2-y1, z2-z1)- assuming that p1 is the starting point.  v is the second vector, line p2, p3 in your case and is (x3-x2, y3-y2, z3-z2)- assuming that p2 is your starting point.
we'll give it a try... thanks, dik
if you post the coordinates, i'll see if my answer matches yours.
i believe there is a typo in your last expression where ... (y^2)+(z^2))^0.5
reading the question, i suspect dik wants p2 to be the starting point for both vectors.  this is not trivial because if you pick the wrong direction of the vectors, you could end up computing the supplemental angle (the angle necessary to obtain 180 degrees when aded to the original angle) rather than the angle of interest.  i re  
i believe you may be right in what dik is looking for, but i did qualify my expression by saying, "assuming the starting point is p1 (or p2)".
also, that would relate to the expression in my second post, not the last one that you reference in my first post.  the magnitude of the vector is the same regardless of the direction.
thinking on the solution further, since the third direction cosine is the cosine of the angle between the z-axis and the vector, the angle between the x-y plane and the vector is 90 degrees - acos(w), where 'w' is the direction cosine for the z term in the unit vector.
mag x ( u x i + v x j + w x k ) = vector cross product of (u,v)
a little old fashioned, but i believe it is the correct forumla.
i was thinking that if this gives the angle between the vectors, then if i add the two vectors to get a third vector and arbitrarily set the z component of this equal to zero to create a fourth vector.
if i use the method above to determine the angle between vectors 3 and 4, then this should be the angle to the x-y plane.  correct in my thinking?
dik
let's go back as s-eit did, and label our values so we can be sure what we are discussing.
the vector from p2 to p1 is u (capitol denotes vector quantity)
the vector from p2 to p3 is v
the angle between these two vectors may be determined from the relationship ...
u.v = u x v x cos (theta)
e.g. the dot product of u and v is equal to the magnitude of vector u (denoted 'u') times the magnitude of vector v (denoted 'v') times the cosine of the angle between the two vectors (denoted 'theta').
adding the two vectors together, u+v=h, will only give you a new vector (denoted 'h') that "closes the triangle."
if you need the angle of the plane formed by points p1, p2 & p3 to plane x-y, then you will need to take a step to compute the orientation of this p123 plane.  as it turns out, the cross product of two vectors yields a new vector that is perpendicular to the plane p123.  the angle between this plane, p123, and the x-y plane is the acos of the third direction cosine in the cross product.
vector w = u x v (vector u cross vector v)
this vector w is perpendicular to the plane p123.  the magnitude of vector w is denoted 'w'.  if the direction cosines of vector w are denoted by (a x i + b x j + c x k) then vector w may be expressed as w x (a x i + b x j + c x k).  the angle between plane p123 and the x-y plane is then equal to the acos(c).  this is not the same answer i gave earlier.  the answer i gave earlier was wrong.  it would have given you the complementary angle.
as with many problems in math, there are surely other methods to get the answer, but this is the most direct i can think of.
您需要登录后才可以回帖 登录 | 注册

本版积分规则

QQ|Archiver|小黑屋|几何尺寸与公差论坛

GMT+8, 2025-1-18 02:58 , Processed in 0.039452 second(s), 20 queries .

Powered by Discuz! X3.4 Licensed

© 2001-2023 Discuz! Team.

快速回复 返回顶部 返回列表