# -*- coding: utf-8 -*- """노선 추천 균형 종단에 곡선부 확폭 — PLAN 77-7. 빼면 확정 뒤 본 설계(확폭 있음)와 성토가 1.7배로 벌어졌다(랩탑 메인 노선 267 실측). 추천 측점 확폭 = B05 측점 생성과 같은 `_plan_radii` · `_curve_widenings`. """ import numpy as np from B05_Profile.B05_Profile_Engine_RouteInitial_Profile import _widenings from config.config_system_design import curve_widening_m def _route() -> tuple[np.ndarray, np.ndarray, np.ndarray]: straight = [(x, 0.0) for x in np.arange(0.0, 60.0, 2.0)] radius = 15.0 arc = [ (60.0 + radius * np.sin(t), radius - radius * np.cos(t)) for t in np.linspace(0.0, np.pi / 2, 30) ] xy = np.asarray(straight + arc + [(75.0, 15.0 + d) for d in np.arange(2.0, 60.0, 2.0)]) chain = np.concatenate([[0.0], np.cumsum(np.hypot(*np.diff(xy, axis=0).T))]) at = np.append(np.arange(0.0, chain[-1], 5.0), chain[-1]) return xy, chain, at def test_곡선_측점은_확폭_직선은_없음(): xy, chain, at = _route() rows = _widenings(xy, chain, at) assert len(rows) == len(at) on_curve = [row for a, row in zip(at, rows) if 64.0 < a < 80.0] assert on_curve and all(row["curve_widening_m"] > 0 for row in on_curve) assert max(row["curve_widening_m"] for row in on_curve) == curve_widening_m(15.0) assert all(row["curve_outer_side"] in ("left", "right") for row in on_curve) straight = [row for a, row in zip(at, rows) if a < 40.0] assert all(row["curve_widening_m"] == 0 for row in straight)