From 6c86d227e388dff6ff72b967f7b74a540948b810 Mon Sep 17 00:00:00 2001 From: liu <387636706@qq.com> Date: Thu, 27 Apr 2023 14:10:56 +0800 Subject: [PATCH] V0.1 --- .idea/.gitignore | 3 ++ .idea/inspectionProfiles/Project_Default.xml | 23 +++++++++ .../inspectionProfiles/profiles_settings.xml | 6 +++ .idea/misc.xml | 4 ++ .idea/modules.xml | 8 ++++ .idea/pure_自适应.iml | 8 ++++ .idea/toolchains.xml | 8 ++++ .idea/vcs.xml | 6 +++ 曲率.py | 48 +++++++++++++++++++ 9 files changed, 114 insertions(+) create mode 100644 .idea/.gitignore create mode 100644 .idea/inspectionProfiles/Project_Default.xml create mode 100644 .idea/inspectionProfiles/profiles_settings.xml create mode 100644 .idea/misc.xml create mode 100644 .idea/modules.xml create mode 100644 .idea/pure_自适应.iml create mode 100644 .idea/toolchains.xml create mode 100644 .idea/vcs.xml create mode 100644 曲率.py diff --git a/.idea/.gitignore b/.idea/.gitignore new file mode 100644 index 0000000..359bb53 --- /dev/null +++ b/.idea/.gitignore @@ -0,0 +1,3 @@ +# 默认忽略的文件 +/shelf/ +/workspace.xml diff --git a/.idea/inspectionProfiles/Project_Default.xml b/.idea/inspectionProfiles/Project_Default.xml new file mode 100644 index 0000000..6d1fbf4 --- /dev/null +++ b/.idea/inspectionProfiles/Project_Default.xml @@ -0,0 +1,23 @@ + + + + \ No newline at end of file diff --git a/.idea/inspectionProfiles/profiles_settings.xml b/.idea/inspectionProfiles/profiles_settings.xml new file mode 100644 index 0000000..105ce2d --- /dev/null +++ b/.idea/inspectionProfiles/profiles_settings.xml @@ -0,0 +1,6 @@ + + + + \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml new file mode 100644 index 0000000..60c8630 --- /dev/null +++ b/.idea/misc.xml @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml new file mode 100644 index 0000000..c863d70 --- /dev/null +++ b/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/pure_自适应.iml b/.idea/pure_自适应.iml new file mode 100644 index 0000000..e545c11 --- /dev/null +++ b/.idea/pure_自适应.iml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/toolchains.xml b/.idea/toolchains.xml new file mode 100644 index 0000000..4581420 --- /dev/null +++ b/.idea/toolchains.xml @@ -0,0 +1,8 @@ + + + + + + \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 0000000..35eb1dd --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/曲率.py b/曲率.py new file mode 100644 index 0000000..362462f --- /dev/null +++ b/曲率.py @@ -0,0 +1,48 @@ +import math + +A = [100.012, -9.789] +C = [100.076, -10.083] +B = [100.043, -9.937] +s = abs((A[0] * B[1] + B[0] * C[1] + C[0] * A[1] - A[1] * B[0] - B[1] * C[0] - C[1] * 1) / 2) +print('s',s) +a = abs(math.sqrt(abs(A[0] - C[0]) ** 2) + abs((A[1] - C[1]) ** 2)) +print('a',a) +b = abs(math.sqrt(abs(B[0] - C[0]) ** 2) + abs((B[1] - C[1]) ** 2)) +print('b',b) +c = abs(math.sqrt(a ** 2 + b ** 2)) +print('c',c) +k = 4 * s / (a * b * c) +print(k) + +# import numpy as np +# def get_arc_curve(pts): +# ''' +# 获取弧度值 +# :param pts: +# :return: +# ''' +# +# # 计算弦长 +# start = np.array(pts[0]) +# end = np.array(pts[len(pts) - 1]) +# l_arc = np.sqrt(np.sum(np.power(end - start, 2))) +# +# # 计算弧上的点到直线的最大距离 +# # 计算公式:\frac{1}{2a}\sqrt{(a+b+c)(a+b-c)(a+c-b)(b+c-a)} +# a = l_arc +# b = np.sqrt(np.sum(np.power(pts - start, 2), axis=1)) +# c = np.sqrt(np.sum(np.power(pts - end, 2), axis=1)) +# dist = np.sqrt((a + b + c) * (a + b - c) * (a + c - b) * (b + c - a)) / (2 * a) +# h = dist.max() +# +# # 计算曲率 +# r = ((a * a) / 4 + h * h) / (2 * h) +# +# return r +# +# +# if __name__ == '__main__': +# x = np.linspace(1, 100, 99).astype(np.int64) +# y = (x ** 2) +# xy = list(zip(x, y)) # list of points in 2D space +# print(get_arc_curve(xy))