refract — 3D optics op

• Data kinds: vector × normals → normals

• Call: import fullseye as fs; fs.ledger.refract(d, n, eta1=1.0, eta2=1.5) (to call the implementation directly, import match3d; match3d.refract(d, n, eta1=1.0, eta2=1.5); from the registry, ops3d.get("refract"))

Usage

Snell refraction (vector form). d = the incident ray (toward the surface), n = the outward normal on the incident side, indices eta1 → eta2.

Computes exactly the bending of a ray passing through a transparent body. None on total internal reflection (TIR). For computing image distortion through glass/lenses/underwater. The contract is a single vector. An (N,3) batch also goes through, but if even 1 ray has TIR the whole batch is None (no per-ray mask). ★For a batch, do not loop 1 ray at a time;

use glassmirror.refract_rays —— it decides TIR per ray and returns (direction, TIR mask) (TIR rays are filled with specular reflection). This function is kept as the fail-closed entry point that "gives no answer if even 1 is missing".

d, n are normalised taking the last axis as the vector. Pass n on the incident side (the orientation where d·n < 0). Passing it reversed makes cos θi negative and a wrong direction is returned without an exception. The return value is a unit vector (eta·d + (eta·cosθi − cosθt)·n, eta = eta1/eta2). If eta1 == eta2, d is returned unchanged. To work with angles use snell_angle; for reflectance use fresnel_reflectance(cos_i, eta1, eta2).

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)

• snell_refraction — py -3.11 examples_3d/snell_refraction.py

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

icp_point2plane · compute_fpfh · shot_descriptor · fuse_to_voxel · reflect · normal_consistency · ransac_cylinder · orient_normals

Same category (optics)

reflect · fresnel_reflectance · normal_from_reflection · snell_angle


*Provenance: match3d.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.