docs: 将仓库代码注释统一为中文
CI / docs-check (push) Canceled after 0s
CI / backend-test (push) Canceled after 0s
CI / service-test (push) Canceled after 0s
CI / frontend-test (push) Canceled after 0s
CI / rust-core (push) Canceled after 0s
CI / docs-check (pull_request) Canceled after 0s
CI / backend-test (pull_request) Canceled after 0s
CI / service-test (pull_request) Canceled after 0s
CI / frontend-test (pull_request) Canceled after 0s
CI / rust-core (pull_request) Canceled after 0s

This commit is contained in:
2026-09-10 00:40:56 +08:00
parent 51c592841d
commit d703ab64e3
249 changed files with 707 additions and 900 deletions
+4 -11
View File
@@ -226,13 +226,7 @@ _CURVE_MAX_REFINEMENT_EVALUATIONS = 8192
def _refine_crossing(tree, left, right, ymin, ymax, budget=None):
"""Adaptively check both halves of a crossing; None explicitly breaks a path.
A visible midpoint is not a continuity proof. Accept a visible chord only
when its midpoint error is within a quarter pixel; otherwise subdivide both
halves. Depth, evaluation and floating-point limits always break unresolved
intervals instead of joining them. Entirely off-screen triples can be culled.
"""
"""自适应检查路口的两半; None 明确中断了一条路径。可见的中点并不是连续性证明。仅当中点误差在四分之一像素以内时才接受可见弦;否则将两半细分。深度、求值和浮点限制总是打破未解决的间隔,而不是连接它们。完全不在屏幕外的三元组可以被剔除。"""
remaining = _REFINE_MAX_EVALUATIONS
if budget is None:
budget = [_REFINE_MAX_EVALUATIONS]
@@ -255,12 +249,11 @@ def _refine_crossing(tree, left, right, ymin, ymax, budget=None):
values = (a[1], y, b[1])
if all(math.isfinite(v) for v in values):
if max(values) < ymin or min(values) > ymax:
return [a, None, b] # No visible chord; do not connect across it.
return [a, None, b] # 无可见和弦;不要通过它连接。
error = abs(y - (a[1] / 2 + b[1] / 2))
if any(ymin <= v <= ymax for v in values) and error <= tolerance:
return [a, mid, b]
# Refine either side of a nonfinite midpoint too: dropping the whole
# interval would erase valid branches between the original samples.
# 也优化非有限中点的任一侧:删除整个间隔将擦除原始样本之间的有效分支。
first = refine(a, mid, depth + 1)
second = refine(mid, b, depth + 1)
return first + second[1:]
@@ -309,7 +302,7 @@ def _sample_segments(
continue
if prev_y is not None:
refined = _refine_crossing(tree, (prev_x, prev_y), (x, y), ymin, ymax, budget)
samples = refined[1:] # The previous endpoint is already in points.
samples = refined[1:] # 前一个端点已经以点为单位。
else:
samples = [(x, y)]
for sample in samples: