1 Star 0 Fork 0

王丽颖/DashboardCalibrationRecognition

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
angle.py 778 Bytes
一键复制 编辑 原始数据 按行查看 历史
Davion 提交于 2021-09-07 16:19 . add
# -*- coding: utf-8 -*-
# @Time : 2021/5/26 9:42
# @Author : Davion.W
# @Email : wangwei@pmlabs.com.cn
# @File : angle.py
import math
AB = [1, -3, 5, -1]
CD = [4, 1, 4.5, 4.5]
EF = [2, 5, -2, 6]
PQ = [-3, -4, 1, -6]
def angle(v1, v2):
dx1 = v1[2] - v1[0]
dy1 = v1[3] - v1[1]
dx2 = v2[2] - v2[0]
dy2 = v2[3] - v2[1]
angle1 = math.atan2(dy1, dx1)
angle1 = int(angle1 * 180 / math.pi)
# print(angle1)
angle2 = math.atan2(dy2, dx2)
angle2 = int(angle2 * 180 / math.pi)
# print(angle2)
if angle1 * angle2 >= 0:
included_angle = abs(angle1 - angle2)
else:
included_angle = abs(angle1) + abs(angle2)
if included_angle > 180:
included_angle = 360 - included_angle
return included_angle
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/xxzhewly/DashboardCalibrationRecognition.git
git@gitee.com:xxzhewly/DashboardCalibrationRecognition.git
xxzhewly
DashboardCalibrationRecognition
DashboardCalibrationRecognition
master

搜索帮助