网络上的一切都太复杂了。
所以,我有一个由三个点的数组定义的三角形,和由两个点定义的线段。点 = 3 个浮点数。我想知道它们是否相交。交叉点也会有帮助,但没有那么多。
每个案例有 5 个坐标(15 个浮点数)。我只需要 python 代码或数学公式,希望能提供一些入门信息。
请,关于 python:以这样的方式开始代码:
plane = [[float(input('plane coord1 x:'), float(input('plane coord1 y:'), float(input('plane coord1 z:')], [float(input('plane coord2 x:'), float(input('plane coord2 y:'), float(input('plane coord2 z:')], [float(input('plane coord3 x:'), float(input('plane coord3 y:'), float(input('plane coord3 z:')]]
line = [[float(input('line coord1 x:'), float(input('line coord1 y:'), float(input('line coord1 z:')], [float(input('line coord2 x:'), float(input('line coord2 y:'), float(input('line coord2 z:')]]
Run Code Online (Sandbox Code Playgroud)
或这个:
plane = [[x1,y1,z1], [x2,y2,z2], [x3,y3,z3]]
line = [[X1,Y1,Z1], [X2,Y2,Z2]]
Run Code Online (Sandbox Code Playgroud)