移除一些调试的代码
This commit is contained in:
25
core.py
25
core.py
@@ -1,5 +1,6 @@
|
||||
import math
|
||||
import ezdxf
|
||||
import numba
|
||||
import numpy as np
|
||||
|
||||
gCAD = None
|
||||
@@ -41,15 +42,15 @@ class Draw:
|
||||
|
||||
|
||||
# 圆交点
|
||||
def solve_circle_intersection(rs, rc, hgav, hcav, dgc):
|
||||
def solve_circle_intersection(rs, rc, h_gav, h_cav, dgc):
|
||||
# 用牛顿法求解
|
||||
x = rc # 初始值
|
||||
y = rc # 初始值
|
||||
for bar in range(0, 10):
|
||||
A = [[-2 * x, -2 * (y - hgav)], [-2 * (x - dgc), -2 * (y - hcav)]]
|
||||
A = [[-2 * x, -2 * (y - h_gav)], [-2 * (x - dgc), -2 * (y - h_cav)]]
|
||||
b = [
|
||||
x ** 2 + (y - hgav) ** 2 - rs ** 2,
|
||||
(x - dgc) ** 2 + (y - hcav) ** 2 - rc ** 2,
|
||||
x ** 2 + (y - h_gav) ** 2 - rs ** 2,
|
||||
(x - dgc) ** 2 + (y - h_cav) ** 2 - rc ** 2,
|
||||
]
|
||||
X_set = np.linalg.solve(A, b)
|
||||
x += X_set[0]
|
||||
@@ -115,9 +116,6 @@ def intersection_angle(dgc, h_gav, h_cav, i_curt, u_ph): # 暴露弧的角度
|
||||
rc, rg, dgc, h_cav
|
||||
) # 暴露圆和补雷线的交点
|
||||
np_circle_intersection = np.array(circle_intersection)
|
||||
# TODO to be removed
|
||||
if not circle_intersection:
|
||||
abc = 123
|
||||
theta2_line = np_circle_intersection - np.array([dgc, h_cav])
|
||||
theta2 = math.atan(theta2_line[1] / theta2_line[0])
|
||||
np_circle_line_intersection = np.array(circle_line_intersection)
|
||||
@@ -133,11 +131,6 @@ def distance_point_line(point_x, point_y, line_x, line_y, k) -> float:
|
||||
|
||||
def func_calculus_pw(theta, max_w):
|
||||
w_fineness = 0.01
|
||||
r_pw = 0
|
||||
# TODO to be removed
|
||||
if int(max_w / w_fineness) < 0:
|
||||
abc = 123
|
||||
pass
|
||||
w_samples, d_w = np.linspace(0, max_w, int(max_w / w_fineness), retstep=True)
|
||||
cal_w_np = abs(angel_density(w_samples)) * np.sin(theta - (w_samples - math.pi / 2))
|
||||
r_pw = np.sum((cal_w_np[:-1] + cal_w_np[1:])) / 2 * d_w
|
||||
@@ -155,19 +148,11 @@ def calculus_bd(theta, rc, rs, rg, dgc, h_cav, h_gav): # 对θ进行积分
|
||||
if d_to_rs < rs: # 相交
|
||||
# 要用过直线上一点到暴露弧的切线
|
||||
new_k = tangent_line_k(line_x, line_y, 0, h_gav, rs, init_k=k)
|
||||
# TODO to be removed
|
||||
if not new_k:
|
||||
a = 12
|
||||
tangent_line_k(line_x, line_y, 0, h_gav, rs, init_k=k)
|
||||
if new_k >= 0:
|
||||
max_w = math.atan(new_k) # 用于保护弧相切的角度
|
||||
elif new_k < 0:
|
||||
max_w = math.atan(new_k) + math.pi
|
||||
# TODO to be removed
|
||||
if max_w < 0:
|
||||
abc = 123
|
||||
tangent_line_k(line_x, line_y, 0, h_gav, rs, init_k=k)
|
||||
# TODO to be removed
|
||||
# global gCount
|
||||
# gCount = gCount+1
|
||||
# if gCount % 100 == 0:
|
||||
|
||||
Reference in New Issue
Block a user