sphere_sdf — 3D sdf_csg op

• 데이터 종류: coordgrid → sdf

• 호출: import fullseye as fs; fs.ledger.sphere_sdf(grid, center, R)(구현을 직접 호출하려면 import sdf_ops; sdf_ops.sphere_sdf(grid, center, R), 원장에서 가져오려면 ops3d.get("sphere_sdf"))

사용법

구의 부호 거리장: |p - center| - R(안쪽 음·바깥쪽 양).

grid는 마지막 축이 3인 좌표 배열 (..., 3)(grid_coords의 출력이나 (N,3) 점군). center는 길이 3, R>=0은 반경. 반환값의 shape은 grid.shape[:-1]. 엄밀한 SDF (기울기 노름 1). sdf_offset(sphere_sdf(g,c,R), r) == sphere_sdf(g,c,R+r).

R < 0이거나 형태가 잘못된 grid / center는 ValueError.

계산: np.linalg.norm(grid - center, axis=-1) - R. 좌표의 단위가 그대로 거리의단위가 된다(grid_coords의 world 좌표를 넘기면 world 단위). 좌표의 성분 순서는 grid의 마지막 축의 순서(grid_coords라면 (x, y, z))이며, center도 같은 순서.

인수와 검증(ValueError):

• grid: 마지막 축이 3인 float 배열 (..., 3)(1-D의 (3,)도 가능. 0-D나마지막 축이 3 이외인 것은 거부).

• center: 요소 수 3(reshape(3)할 수 없으면 numpy의 ValueError).

• R: float()할 수 있는 스칼라. 회전 행렬 등을 넘긴 경우에도 ValueError (이 인수는 반경이지 자세가 아니다). R < 0은 거부, R = 0은중심으로부터의 거리장 그 자체.

반환값: grid.shape[:-1]의 float64(grid_coords의 출력이라면 (nx, ny, nz)). 중심에서 -R, 표면에서 0, 바깥쪽에서 양수.

활용처: grid_coords로 격자 → sphere_sdf / box_sdf → sdf_union / sdf_subtract로 CSG → <= 0을 점유로 하여 marching cubes(voxel_to_mesh 에 -sdf를 넘겨 iso=0 상당으로 등값면).

참고(샘플 데이터·문헌)

• 샘플 데이터 카탈로그(DL URL / 라이선스) —— 2-D 는 skimage.data(BSD/public)+ 합성, 3-D 는 실데이터 소스(Stanford/PDS 등)의 DL URL.

• 연산자의 내력·참고문헌 —— 이 연산자 족의 바탕이 된 연구/기법의 출처.

실행 가능한 예제(이 연산자를 실제로 호출하는 검증된 샘플)

• annotate3d_figure — py -3.11 examples_3d/annotate3d_figure.py

• gear_metrology — py -3.11 examples_3d/gear_metrology.py

• molecule_atom_count — py -3.11 examples_3d/molecule_atom_count.py

• procedural_hand — py -3.11 examples_3d/procedural_hand.py

• render_beauty — py -3.11 examples_3d/render_beauty.py

• sdf_csg — py -3.11 examples_3d/sdf_csg.py

• sfm_recon — py -3.11 examples_3d/sfm_recon.py

타입이 이어지는 다음 연산자(sdf 를 입력으로 받는 것)

sdf_to_occupancy · fuse_to_voxel · integrate · extract_surface_points · query_distance · sdf_union · sdf_intersect · sdf_subtract

같은 카테고리(sdf_csg)

grid_coords · box_sdf · plane_sdf · cylinder_sdf · torus_sdf · capsule_sdf · sdf_union · sdf_intersect


*Provenance: sdf_ops.py — 3D 연산자 레지스트리. 이 op 노트는 tools/opdocs.py md 가 자동 생성합니다(직접 편집하지 마세요).*

© 2026 Kazufumi Furuse — Fullseye operator documentation. Licensed under Apache-2.0.