knn_graph — 3D geodesic op

Data kinds: pointsgraph

Call: import fullseye as fs; fs.ledger.knn_graph(points: numpy.ndarray, k: int = 8) -> Tuple[numpy.ndarray, numpy.ndarray] (to call the implementation directly, import geodesic3d; geodesic3d.knn_graph(points: numpy.ndarray, k: int = 8) -> Tuple[numpy.ndarray, numpy.ndarray]; from the registry, ops3d.get("knn_graph"))

Usage

Each point's k nearest-neighbour indices and Euclidean distances (excluding itself). → (idx (N,k) int, dist (N,k) float).

> The detailed description below is the original text — the summary and the headings are translated.

`scipy.spatial.cKDTree` で各点の k+1 近傍を引き、自分自身(距離 0)を除いた k 個を返す。

`idx[i, j] は点 i に j 番目に近い点の添字、dist[i, j]` はその Euclid 距離(座標の単位)で、

各行は距離の昇順。

• `points`: (N,3) など任意次元の座標(float64 に変換)。形状の検証はしない。

• `k: 近傍数(既定 8)。N-1 を超える値は黙って N-1` に切り詰める。

• N < 2 のときは例外を出さず、形 (N,0) の空配列を 2 つ返す。

罠: 座標が重複していると KD-tree が自己を列 0 に返さないことがある。その場合は行ごとに自己の

位置を探して除き、k+1 個の中に自己が無ければ最遠の 1 つを落とす(結果はやはり k 個)。

`geodesic_distances / farthest_point_sampling` はこの結果を隣接行列(有向 CSR、

Dijkstra 側で無向化)にして測地距離の近似に使う。

References (sample data, literature)

• Sample-data catalog (download URLs / licences) — 2-D uses skimage.data (BSD/public domain) plus synthetic images; 3-D lists download URLs for real data sources (Stanford, PDS, …).

• Operator provenance and references — the sources of the research/methods this op family came from.

Runnable examples (verified samples that actually call this op)

pcl_geodesicpy -3.11 examples_3d/pcl_geodesic.py

Ops the type connects to (they accept graph as input)

fuse_to_voxel

Same category (geodesic)

geodesic_distances · geodesic_mesh · farthest_point_sampling


*Provenance: geodesic3d.py — 3D operator registry. This per-op note is generated by tools/opdocs.py md (do not hand-edit).*

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