Merge remote-tracking branches 'origin/sub_desktop_1' and 'origin/sub_laptop_1' into main_laptop_1
This commit is contained in:
@@ -148,3 +148,64 @@ def test_widening_without_curve_stays_zero() -> None:
|
||||
widenings, sides = _curve_widenings(chainage, [None] * 3, [None] * 3)
|
||||
assert widenings == [0.0, 0.0, 0.0]
|
||||
assert sides == [None, None, None]
|
||||
|
||||
|
||||
def test_design_curve_spans_from_curve_table() -> None:
|
||||
"""설계 곡선표의 시·종점이 노선 누가거리로 바뀌고, 회전 방향으로 바깥쪽이 갈린다."""
|
||||
from B05_Profile.B05_Profile_Engine_Sections_Core import _design_curve_spans
|
||||
|
||||
# ㄱ자 노선 — (0,0) → (100,0) → (100,100). 교점 (100,0) 에서 좌회전.
|
||||
line = np.array([[0.0, 0.0, 0.0], [100.0, 0.0, 0.0], [100.0, 100.0, 0.0]])
|
||||
chainage = np.array([0.0, 100.0, 200.0])
|
||||
curves = [
|
||||
{
|
||||
"start": [90.0, 0.0],
|
||||
"apex": [100.0, 0.0],
|
||||
"end": [100.0, 10.0],
|
||||
"radius_m": 12.0,
|
||||
}
|
||||
]
|
||||
spans = _design_curve_spans(line, chainage, curves)
|
||||
assert len(spans) == 1
|
||||
start, end, radius, side = spans[0]
|
||||
assert abs(start - 90.0) < 1e-6 and abs(end - 110.0) < 1e-6
|
||||
assert radius == 12.0
|
||||
# 좌회전이면 안쪽이 좌측이라 바깥은 우측이다.
|
||||
assert side == "right"
|
||||
# 노선에서 멀리 떨어진 곡선은 버린다.
|
||||
assert _design_curve_spans(line, chainage, [{**curves[0], "start": [90.0, 500.0]}]) == []
|
||||
|
||||
|
||||
def test_design_curve_widening_is_one_value_inside_the_curve() -> None:
|
||||
"""같은 곡선 안 측점은 설계 반경의 표값 하나를 쓰고, 앞뒤 10m 만 이어 준다."""
|
||||
from B05_Profile.B05_Profile_Engine_Sections_Core import _design_curve_widenings
|
||||
|
||||
# 곡선 100~140m, 설계 반경 16m(표값 1.5m). 측점 5m 간격.
|
||||
spans = [(100.0, 140.0, 16.0, "left")]
|
||||
chainage = np.arange(80.0, 165.0, 5.0)
|
||||
radii, sides, widenings = _design_curve_widenings(chainage, spans)
|
||||
table = dict(zip(chainage.tolist(), widenings, strict=True))
|
||||
# 곡선 안은 어디서나 같은 값 — 종전에는 측점마다 반경을 다시 재 값이 갈렸다.
|
||||
for station in (100.0, 110.0, 120.0, 130.0, 140.0):
|
||||
assert table[station] == 1.5, station
|
||||
# 앞뒤 10m 는 0 으로 잇는다.
|
||||
assert table[95.0] == 0.75 and table[145.0] == 0.75
|
||||
assert table[90.0] == 0.0 and table[150.0] == 0.0
|
||||
# 반경은 곡선 안에서만 남고, 테이퍼·직선 자리는 비어 있다.
|
||||
by_index = dict(zip(chainage.tolist(), radii, strict=True))
|
||||
assert by_index[120.0] == 16.0
|
||||
assert by_index[95.0] is None and by_index[90.0] is None
|
||||
# 방향은 곡선 것을 따라간다.
|
||||
assert sides[chainage.tolist().index(95.0)] == "left"
|
||||
|
||||
|
||||
def test_design_curve_widening_takes_the_wider_of_overlapping_curves() -> None:
|
||||
"""곡선이 겹치거나 붙어 있으면 확폭이 큰 쪽을 따른다."""
|
||||
from B05_Profile.B05_Profile_Engine_Sections_Core import _design_curve_widenings
|
||||
|
||||
spans = [(100.0, 120.0, 35.0, "left"), (118.0, 140.0, 12.0, "right")]
|
||||
chainage = np.array([110.0, 119.0, 130.0])
|
||||
_, sides, widenings = _design_curve_widenings(chainage, spans)
|
||||
assert widenings[0] == 0.5 # R=35 → 0.5m
|
||||
assert widenings[1] == 2.25 and sides[1] == "right" # 겹친 자리는 급한 곡선 값
|
||||
assert widenings[2] == 2.25
|
||||
|
||||
Reference in New Issue
Block a user