master_pure
liu 1 year ago
commit 6c86d227e3

3
.idea/.gitignore vendored

@ -0,0 +1,3 @@
# 默认忽略的文件
/shelf/
/workspace.xml

@ -0,0 +1,23 @@
<component name="InspectionProjectProfileManager">
<profile version="1.0">
<option name="myName" value="Project Default" />
<inspection_tool class="PyPep8NamingInspection" enabled="true" level="WEAK WARNING" enabled_by_default="true">
<option name="ignoredErrors">
<list>
<option value="N801" />
<option value="N806" />
<option value="N802" />
</list>
</option>
</inspection_tool>
<inspection_tool class="PyUnresolvedReferencesInspection" enabled="true" level="WARNING" enabled_by_default="true">
<option name="ignoredIdentifiers">
<list>
<option value="float.*" />
<option value="int.__getitem__" />
<option value="int.*" />
</list>
</option>
</inspection_tool>
</profile>
</component>

@ -0,0 +1,6 @@
<component name="InspectionProjectProfileManager">
<settings>
<option name="USE_PROJECT_PROFILE" value="false" />
<version value="1.0" />
</settings>
</component>

@ -0,0 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectRootManager" version="2" project-jdk-name="Python 3.8 (pycharm) (2)" project-jdk-type="Python SDK" />
</project>

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/.idea/pure_自适应.iml" filepath="$PROJECT_DIR$/.idea/pure_自适应.iml" />
</modules>
</component>
</project>

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="PYTHON_MODULE" version="4">
<component name="NewModuleRootManager">
<content url="file://$MODULE_DIR$" />
<orderEntry type="jdk" jdkName="Python 3.8 (pycharm) (2)" jdkType="Python SDK" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="NimToolchainService">
<option name="rootPaths">
<list />
</option>
</component>
</project>

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="" vcs="Git" />
</component>
</project>

@ -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))
Loading…
Cancel
Save