本文介绍了得到的线段的端点由两个矩形的交点定义的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在路口的算法之间两架飞机

但都没有返回正确的结果。

but all not return correct results

我在3D 2矩形每个定义的三个点,我想在路口等线的两个点,这两个点的交汇点结束我做以下步骤:

I have two rectangle in 3D each defined by three points , I want to get the two points on the line of intersection such that the two points at the end of the intersectionI do the following steps:

  • 将每个矩形两个平面,采用三点
  • 得到行方向做正常的每架飞机的叉积

我想获得线路的实际结束点所在的平面的边界

I want to get the actual end points of line that lie on the boundary of the plane

最好的问候

推荐答案

您提供最有可能的链接是否具有正确的解决方案:)你有没有正确地改变你的三分信息的斧头+到+锆+ D = 0的形式?检查所有的点满足这个公式。如果你有正确的{A,B,C,D},则很容易为链接描述来计算剩下的..

The link you provided most probably has the correct solution :)Did you correctly transform your three points info the Ax+By+Cz+D = 0 form? Check if all those points satisfy this formula. If you have the correct {A, B, C, D} then it's easy to calculate the rest as described in the link..

这里是说明如何开始使用3点这个公式的链接。

Here is a link which explains how to get this formula using 3 points.

好吧,这里一个简单的总结:

Ok, here a simple summary:

  • 在空间鉴于三个点(X1,Y1,Z1),(X2,Y2,Z2),(X3,Y3,Z3),计算的:

  • Given three points in space (x1,y1,z1), (x2,y2,z2), (x3,y3,z3), calculate this:

A = Y1(Z2 - Z3)+ Y2(Z3 - Z1)+ Y3(Z1 - Z2)

A = y1 (z2 - z3) + y2 (z3 - z1) + y3 (z1 - z2)

B = Z1(X2 - X3)+ Z2(X3 - X1)+ Z3(X1 - X2)

B = z1 (x2 - x3) + z2 (x3 - x1) + z3 (x1 - x2)

C = X1(Y2 - Y3)+ X2(Y3 - Y1)+ X3(Y1 - Y2)

C = x1 (y2 - y3) + x2 (y3 - y1) + x3 (y1 - y2)

D = - (X1(Y2 Z3 - Y3 Z2)+ X2(Y3 Z1 - Y1 Z3)+ X3(Y1 Z2 - Y2 Z1))

D = -(x1 (y2 z3 - y3 z2) + x2 (y3 z1 - y1 z3) + x3 (y1 z2 - y2 z1))

有两个平面。这意味着你有A1,B1,C1,D1和A2,B2,C2,D2

for both planes. Which means you have A1, B1, C1, D1 and A2, B2, C2, D2.

使用A,B,C,D计算如下:

Using A, B, C, D calculate this:

X1 = 0

Z1 =(B2 / B1)* D1 - D2)/(C2 - C1 * B2 / B1)

z1 = (B2/B1)*D1 - D2)/(C2 - C1*B2/B1)

Y1 =(-C1 * Z1 - D1)/ B1

y1 = (-C1 * z1 - D1) / B1

那么这样的:

X2 =一定的价值。

x2 = some value..

Z2 =(B2 / B1)*(A 1 * 2 + D 1) - A 2 * X 2 - D 2)/(C 2 - C 1 * B2 / B1)

z2 = (B2/B1)*(A1 * x2 + D1) - A2 * x2 - D2)/(C2 - C1*B2/B1)

Y2 =(-C1 * Z2 -A1 * X2 - D1)/ B1

y2 = (-C1 * z2 -A1 * x2 - D1) / B1

基本上只是结合在这两个环节中描述这两种方法。

Basically just combine both ways described in those two links..

这篇关于得到的线段的端点由两个矩形的交点定义的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-13 13:54