refactor(767-1): 안 쓰는 지면 필터 · 서피스 지움 — 필터 넷(CSF · 격자 최저 · PMF · RANSAC) · 표현 셋(TIN + Taubin 평활 · NURBS · meshfree) · 수치지형도 비교 방식 다섯 · 안 부르는 길 정리
- 필터 = 업체 분류 · 점진 TIN · 둘의 다듬기 판만 · 분석 허용 목록 = Ground 등록부(available_filters) 한 벌 - 표현 = DTM · implicit 만 · 평활 = DTM 만 · config 기본 목록 · PRECOMPUTE · 설정 사전 맞춤(설정 지문 바뀜 — 768 에서 다시 지음) - 등고선 = 격자 · 굳힌 격자만(삼각망 굽기 · 외곽 맞춤 · implicit RBF 폴백 걷음) · 표본기 · 경로 찾기 tin · nurbs · meshfree 갈래 걷음 - 수치지형도 = 라플라스만(TIN 둘 · TPS · ANUDEM형 · 다중해상도 걷음) · B04 단추 하나 - 안 부르는 길 — B04 JSON 점군 GET · ground-stats GET + TS · B07 옛 계획평면도(라이다) 짓기 · lidar_source · LIDAR_ID · plan_lidar 종류 이름 · SOURCE_FILTER_LABELS · MODEL_METHODS(py) · MESH_* 설정 - 옛 manifest 의 지운 갈래 줄은 DB 로 되살리지 않음 · 옛 csf 행은 미리보기 · 등고선 그대로 열림 · 지운 이름 요청 = 400 - 낡은 글 — Ground · Pipeline 머리 · WF1 「없으면 csf」 · B07 음영 기본 「csf」 → 빈 값 · 등고선 폴백 「csf」 → 404 · B04 3D 보기 처음값 · B05 Schema · B06 Prebuild · 씨닝 설명 - 시험 지움 2 — test_b04_contour_raster · test_b04_contour_equivalence(지운 삼각망 굽기 · 없는 프로젝트를 봐 건너뛰던 것) - 시험 덜어냄 — test_b04_ground_filters CSF · 격자 최저 네 경우(지운 필터) - 시험 고침 — 허용 목록 · 형 검사에 걸린 csf · tin · grid_min_z · meshfree · tin_sheet 견본을 ptd · implicit · laplace 로(54_22 · 238_1 · 443 · 342_2 · 346_3 · 351_1 · 442_2 · 271 + helper · 344_1 · 133_1 · 343_2 · 637 · 754_1 · 763_1 깨진 tin → 깨진 implicit · 763_3 · b05 둘 · b06 · sheet_surface TIN(도엽선) 경우 지움) · 이름만 바꿈(273_2 · 343_1 · 343_3 · 624_1) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
"""B04 지표면 스무딩 엔진 (DTM 가우시안+B-Spline, TIN Taubin).
|
||||
"""B04 지표면 스무딩 엔진 (DTM 가우시안+B-Spline).
|
||||
|
||||
원본 모델(npz)을 로드해 표고 Z만 평활화한 스무딩 모델과 프리뷰(GLB)를 만든다.
|
||||
XY 위치와 삼각형 연결은 원본을 유지한다.
|
||||
XY 격자는 원본을 유지한다.
|
||||
"""
|
||||
|
||||
import hashlib
|
||||
@@ -10,7 +10,6 @@ from pathlib import Path
|
||||
from typing import Any
|
||||
|
||||
import numpy as np
|
||||
import trimesh
|
||||
from scipy import ndimage
|
||||
from scipy.interpolate import RectBivariateSpline
|
||||
|
||||
@@ -104,48 +103,10 @@ def smooth_dtm(
|
||||
}
|
||||
|
||||
|
||||
def smooth_tin(
|
||||
context: TerrainContext, output_dir: Path, stem: str, original_model_path: Path
|
||||
) -> dict[str, Any]:
|
||||
"""TIN 삼각망에 Taubin 저수축 스무딩을 적용한다 (Z만 평활화)."""
|
||||
data = np.load(original_model_path)
|
||||
vertices, faces = data["vertices"], data["faces"]
|
||||
if len(vertices) < 3 or not len(faces):
|
||||
raise ValueError("TIN 스무딩을 수행할 삼각망 메쉬 데이터가 올바르지 않습니다.")
|
||||
|
||||
iterations = int(context.config.get("smoothing_tin_taubin_iterations", 10))
|
||||
lamb = float(context.config.get("smoothing_tin_taubin_lambda", 0.5))
|
||||
mu = float(context.config.get("smoothing_tin_taubin_mu", -0.53))
|
||||
mesh = trimesh.Trimesh(vertices=vertices, faces=faces, process=False)
|
||||
if iterations > 0:
|
||||
trimesh.smoothing.filter_taubin(mesh, lamb=lamb, nu=mu, iterations=iterations)
|
||||
|
||||
vertices_smooth = np.asarray(mesh.vertices, dtype=np.float32)
|
||||
# 지표면 스무딩은 리토폴로지가 아니다: XY·연결은 원본, Z만 평활화.
|
||||
vertices_smooth[:, :2] = np.asarray(vertices[:, :2], dtype=np.float32)
|
||||
faces_smooth = np.asarray(mesh.faces, dtype=np.uint32)
|
||||
|
||||
model_path = output_dir / f"{stem}_smooth.npz"
|
||||
preview_path = output_dir / f"{stem}_smooth_preview.glb"
|
||||
atomic_npz(model_path, vertices=vertices_smooth, faces=faces_smooth)
|
||||
write_glb(preview_path, vertices_smooth, faces_smooth, context.bounds)
|
||||
return {
|
||||
"model_file": model_path.name,
|
||||
"preview_file": preview_path.name,
|
||||
"preview_media_type": "model/gltf-binary",
|
||||
"vertex_count": int(len(vertices_smooth)),
|
||||
"face_count": int(len(faces_smooth)),
|
||||
"artifact_bytes": artifact_size(model_path, preview_path),
|
||||
"smoothing_signature": compute_smoothing_signature(context.config),
|
||||
}
|
||||
|
||||
|
||||
def run_smoothing(
|
||||
method: str, context: TerrainContext, output_dir: Path, stem: str, original_model_path: Path
|
||||
) -> dict[str, Any]:
|
||||
"""방식에 따라 적절한 스무딩 엔진을 수행한다."""
|
||||
if method == "dtm":
|
||||
return smooth_dtm(context, output_dir, stem, original_model_path)
|
||||
if method == "tin":
|
||||
return smooth_tin(context, output_dir, stem, original_model_path)
|
||||
raise ValueError(f"스무딩이 불가능한 지형 표현 방식입니다: {method}")
|
||||
|
||||
Reference in New Issue
Block a user