1 Star 0 Fork 0

mamh-mixed/python-cookbook

加入 Gitee
与超过 1400万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
Shortest Distance between Two Lines.py 558 Bytes
一键复制 编辑 原始数据 按行查看 历史
slowy07 提交于 2022-01-30 09:33 +08:00 . refactor: clean code
import math
import numpy as NP
LC1 = eval(input("Enter DRs of Line 1 : "))
LP1 = eval(input("Enter Coordinate through which Line 1 passes : "))
LC2 = eval(input("Enter DRs of Line 2 : "))
LP2 = eval(input("Enter Coordinate through which Line 2 passes : "))
a1, b1, c1, a2, b2, c2 = LC1[0], LC1[1], LC1[2], LC2[0], LC2[1], LC2[2]
x = NP.array(
[[LP2[0] - LP1[0], LP2[1] - LP1[1], LP2[2] - LP1[2]], [a1, b1, c1], [a2, b2, c2]]
)
y = math.sqrt(
(((b1 * c2) - (b2 * c1)) ** 2)
+ (((c1 * a2) - (c2 * a1)) ** 2)
+ (((a1 * b2) - (b1 * a2)) ** 2)
)
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/mamh-mixed/python-cookbook.git
git@gitee.com:mamh-mixed/python-cookbook.git
mamh-mixed
python-cookbook
python-cookbook
master

搜索帮助