Claude: Normelen durchziehen

This commit is contained in:
chk
2026-06-01 18:34:31 +02:00
parent 6655fc6f02
commit a38886ce03
19 changed files with 799 additions and 307 deletions

View File

@@ -1201,6 +1201,14 @@ def print_observation_weight_summary(obs_weights: Dict[Tuple[int, int], float])
)
def serialize_vec3(v: Any) -> List[float]:
arr = np.asarray(v, dtype=np.float64).reshape(3)
n = np.linalg.norm(arr)
if n > 1e-12:
arr = arr / n
return [float(x) for x in arr]
# ===================================================================
# Main
# ===================================================================
@@ -1310,12 +1318,14 @@ def main() -> None:
initial_output_markers = []
for marker_id, position in sorted(initial_pos.items()):
normal = marker_meta.get(marker_id, {}).get("normal", None)
initial_output_markers.append(
{
"marker_id": int(marker_id),
"position_m": [float(x) for x in position],
"position_mm": [float(x * 1000.0) for x in position],
"link": marker_to_link.get(marker_id, "unknown"),
"normal": serialize_vec3(normal) if normal is not None else None,
}
)
@@ -1370,12 +1380,14 @@ def main() -> None:
output_markers = []
for marker_id, position in sorted(optimized_pos.items()):
normal = marker_meta.get(marker_id, {}).get("normal", None)
output_markers.append(
{
"marker_id": int(marker_id),
"position_m": [float(x) for x in position],
"position_mm": [float(x * 1000.0) for x in position],
"link": marker_to_link.get(marker_id, "unknown"),
"normal": serialize_vec3(normal) if normal is not None else None,
}
)