Expand description
The geometry shared by the index builder and the index solver: the 4-star pattern descriptor, its quantised hash key, the canonical vertex order that gives a star correspondence, and the tangent-plane projection.
The descriptor is the six pairwise distances of a quad, sorted, divided by the
largest — the five ratios ASTAP’s quads use too (quads/). It is invariant to
translation, rotation, scale and reflection, so one index entry serves both image
parities. Unlike astrometry.net’s code space it does not say which star is which,
so the vertices are put in a canonical order (ascending total distance to the
other three), which both sides compute the same way; near-ties in that order are
the one ambiguity, and orderings enumerates the alternatives on the image
side. A wrong correspondence fails the affine shape check, so trying an extra
ordering costs a few multiplications, never a false match.
Any change to BINS, descriptor, key or canonical changes which
entries an index holds or how they hash, and must bump the format version in
format.rs.
Structs§
- Tangent
- A gnomonic tangent plane: its centre and local east and north unit vectors. Standard coordinates are radians, east and north positive.
Constants§
- BINS
- Quantisation bins per descriptor dimension. A bin is 1/128 = 0.0078 wide, about the hinted solver’s default quad tolerance (0.007).
- PROBE_
EPS - Probe the neighbouring bin when a ratio lies within this distance of a bin edge. Measurement noise can only move a ratio across an edge it is already close to, so only those dimensions need a second probe: typically one to four keys per quad instead of 3⁵.
Functions§
- canonical
- The canonical vertex order of a quad and its longest edge.
- descriptor
- The five sorted distance ratios of a quad, each in
(0, 1]. - fit_
affine - Least-squares affine map
q = A·p + tfrom pointspto pointsq, returned as[a, b, c, d, e, f]withqx = a·px + b·py + c,qy = d·px + e·py + f.Nonewhen the points are collinear or fewer than three. - invert_
affine - Invert an affine map;
Noneif singular. - key
- The descriptor’s home bucket: each ratio floored into one of
BINSbins, packed eight bits per dimension, first ratio most significant. - orderings
- The canonical order plus the alternatives that a near-tie makes possible: each
adjacent pair whose totals differ by less than
TIE_EPS(1.5 %) may be swapped. At most eight orders (three independent adjacent swaps). - probe_
keys - Every key a measured descriptor could have had in the index: the home bucket,
plus the neighbouring bin in any dimension within
PROBE_EPSof an edge. Written intoout, which is cleared first. - shape_
error - How far an affine map is from a similarity (rotation + uniform scale, either parity): the larger of the column-length mismatch and the columns’ cosine. Zero for a perfect similarity.
- unit
- Unit vector of (
ra,dec), radians.