由法向矢量XY平面定平面贴图坐标 [英] Mapping coordinates from plane given by normal vector to XY plane

查看:238
本文介绍了由法向矢量XY平面定平面贴图坐标的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

所以,我有此算法计算三维形状与平面与正常矢量给定的横截面。

So, I have this algorithm to calculate cross-section of 3D shape with plane given with normal vector.

然而,我国目前的问题是,该横截面被设置的3D点(全躺该给定平面上),并显示它,我需要映射这个坐标XY平面

However, my current problem is, that the cross-section is set of 3D points (all lying on that given plane) and to display it I need to map this coordinates to XY plane.

这完美的作品如果飞机正常的是一样的东西(0,0,C) - 我只是复制x和y坐标丢弃ž

This works perfect if the plane normal is something like (0,0,c) - I just copy x and y coordinates discarding z.

这里是我的问题:因为我不知道如何转换任何其他纯可能有人给我任何提示,我现在该怎么办

And here is my question: Since I have no idea how to convert any other plain could anybody give me any hint as to what should I do now?

推荐答案

您面板是由法向矢量定义

Your pane is defined by a normal vector

n=(xn,yn,zn)

有关坐标变换,我们需要2个基向量和零点窗格

For coordination transformation we need 2 base vectors and a zero point for the pane

基本载体

我们选择了那些自然装修到X / Y窗格(见后面的边缘的情况下):

We chose those "naturally" fitting to the x/y pane (see later for edge case):

b1=(1,0,zb1)
b2=(0,1,zb2)

和我们想

B1 x B2 = N * C (C常量标)

,以确保这两个是真正的基地

to make sure these two are really bases

现在解决这个问题:

b1 x b2= (0*zb2-zb1*1,zb1*0-1*zb2,1*1-0*0) = (zb1,zb2,1)
zb1*c=xn
zb2*c=yn
1*c=zn

c=zn,
zb2=yn/c=yn/zn
zb1=xn/c=xn/zn

b1=(1,0,yn/zn)
b2=(0,1,xn/zn)

和归一化

bv1=(1,0,yn/zn)*sqrt(1+(yn/zn*yn/zn))
bv2=(0,1,yn/zn)*sqrt(1+(xn/zn*xn/zn))

这是边缘的情况是,当锌= 0:在此情况下的法向矢量是平行于x / y的窗格并没有自然基矢量存在,的ind此情况下,必须通过一个审美的POV来选择基b1和b2的载体并通过同一个解决方案的过程,或只是选择了BV1和BV2。

An edge case is, when zn=0: In this case the normal vector is parallel to the x/y pane and no natural base vectors exist, ind this case you have to chose base b1 and b2 vectors by an esthetic POV and go through the same solution process or just chose bv1 and bv2.

零点

您不会说锚点为您的OQ窗格中的,但有必要从平行窗格无限系列区分的窗格中。

you spoke of no anchor point for your pane in the OQ, but it is necessary to differentiate your pane from the infinite family of parallel panes.

如果你的定位点为(0,0,0),这是一个完美的定位点的坐标变换和您的面板上有

If your anchor point is (0,0,0) this is a perfect anchor point for the coordinate transformation and your pane has

x*xn+y*yn+z*zn=0,
(y0,y0,z0)=(0,0,0)

如果没有,我假设你有一个定位点(XA,雅,ZA)和你的面板上有

If not, I assume you have an anchor point of (xa,ya,za) and your pane has

x*xn+y*yn+z*zn=d

与D const的标量。天作之合将是面板,由原始的零点正常投影定义到窗格的点:

with d const scalar. A natural fit would be the point of the pane, that is defined by normal projection of the original zero point onto the pane:

P0=(x0,y0,z0)

(x0, y0, z0) = c * (xn,yn,zn)

解决这个反对

Solving this against

x*xn+y*yn+z*zn=d

c*xn*xn+c*yn*yn+c*zn*zn=d

c=d/(xn*xn+yn*yn+zn*zn)

这样

P0=(x0,y0,z0)=c*(xn,yn,zn)

被发现。

最终转化

被重新presenting每一点的窗格(即那些你想显示站)

is achieved by representing every point of your pane (i.e. those points you want to show) as

P0+x'*bv1+y'*bv2

其中x'和y'是新的坐标。因为我们知道P0,BV1和BV2这是很微不足道的。如果我们不是在边缘的情况下,我们在bv1.y零,并进一步bv2.x降低的问题。

with x' and y' being the new coordinates. Since we know P0, bv1 and bv2 this is quite trivial. If we are not on the edge case, we have zeroes in bv1.y and bv2.x further reducing the problem.

x'和Y'是你想要的新坐标。

x' and y' are the new coordinates you want.

这篇关于由法向矢量XY平面定平面贴图坐标的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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