在MATLAB中,已知一个点坐标和一个由三点组成的平面(这三点坐标已知),求这个点在这个平面上的投影坐标
题目
在MATLAB中,已知一个点坐标和一个由三点组成的平面(这三点坐标已知),求这个点在这个平面上的投影坐标
例如,已知点A,B,C,D,怎么求点D在平面ABC上的投影点坐标.
还有一点:怎么把这些三维坐标换算成平面ABC上的二维坐标
这是想用在一个程序里的,希望高手作答,能用编程语言简单实现
有请高手现身!
答案
You might want to review the linear algebra text book of freshman's course in most college.
First of all, let's make some vectors based on your given points:
b=B-A
c=C-A
d=D-A
, In other words, we simply let A be the original point. Vectors b, c, and d are connecting from A to B, to C, and to D, respectively. We are going to answer your questions based on these vectors.
To check if A, B, and C are not in a straight line, we simply need to check if vector b and c are independent. We use the rank of matrix with verctor b and c to determine:
r = rank([b c])
Here we assume b and c are column vectors. (If b and c are row vectors, r = rank([b;c]) in Matlab) Now, If r=2, vector b and c are independent, in other words, A, B and C are not in one straight line, they can determine a plane.
We assume b and c are independent now. We use the following steps to obtain a basis:
(1) take b as the first vector: v1 = b
(2) get the normal vector of the plane determined by b and c:
v3 = cross(b,c)
(3) get the third vector which is orthogonal to both v1 and v3:
v2 = cross(v3, v1)
*Note: v2 must be on the plane defined by b and c, or equavilently by A, B and C
(4) normalize v1, v2 and v3, we get:
e1 = v1 / norm(v1)
e2 = v2 / norm(v2)
e3 = v3 / norm(v3)
Then, e1, e2 and e3 form a basis of whole 3D spance.
To get the projection of D onto plane ABC, you can get the inner product of d and each vector of the basis :
p1 = dot(d,e1)
p2 = dot(d,e2)
p3 = dot(d,e3)
Then:
projectionOfDOntoABC = p1*e1+p2*e2+p3*e3
Finally, e1 and e2 form a basis of the plane ABC. You can use (p1,p2) as the coordinates with respect to the basis e1,e2 to refer a point on the plane.
举一反三
我想写一篇关于奥巴马的演讲的文章,写哪一篇好呢?为什么好
最新试题
- she is also happy that the pictures will wash off her car when it rains.
- 通常在灯泡中加入磷做脱氧剂,写出化学方程式.
- p是三角形abc所在平面外的一点,d.e分别是三角形pab和三角形pbc的重心,且ac=12,则de= ( A3B4C6D7)
- 有一圆柱形水池,底面圆的半径是1米,深3米,若在池的周围于底面抹一层水泥,抹水泥部分的面积是多少
- 由一个圆柱和一个圆锥组成的粮仓,每立方米可以放500千克的粮食,这个粮仓最多可以放多少粮食.单位:米
- 形容热闹非凡,人潮涌动的集市的成语
- What are you all keeping
- 请问sin(x+h)-sin x如何转换成2cos(x+h/2)sin h/2
- 秦始皇和汉武帝为加强对地方的控制,分别采取了什么措施?
- 挂钟在一点时敲一下,二点时敲两下,如此类推,十二时敲十二下,那么这只挂钟一昼夜内共敲多少下?
热门考点