133 int numEdgeRatioBins,
143 for (
int i = 0; i < k; i++)
154 while (i < k_ && indices_[i] + 1 == (i + 1 < k_ ? indices_[i + 1] : n_)) {
157 if (i == k_)
return false;
160 for (
int j = 0; j < i; j++)
165 const std::vector<int>&
indices()
const {
return indices_; }
169 std::vector<int> indices_;
179template <
typename SpatialAccessor>
181 for (
int i = 0; i < numStars; i++) {
182 for (
int j = i + 1; j < numStars; j++) {
183 if (spatial(i) * spatial(j) <= cosMaxFov)
return false;
190template <
typename SpatialAccessor>
192 std::vector<decimal> edgeLengths;
193 for (
int i = 0; i < numStars; i++) {
194 for (
int j = i + 1; j < numStars; j++) {
195 edgeLengths.push_back((spatial(j) - spatial(i)).Magnitude());
198 std::sort(edgeLengths.begin(), edgeLengths.end());
199 decimal longestEdgeLen = edgeLengths.back();
200 std::vector<decimal> edgeRatios;
201 for (
size_t i = 0; i < edgeLengths.size() - 1; i++) {
202 edgeRatios.push_back(edgeLengths[i] / longestEdgeLen);
CatalogStar(decimal raj2000, decimal dej2000, decimal magnitude, int name)
Create a CatalogStar using its celestial/spherical coordinates.
int name
A unique number which unambiguously identifies the catalog star.
decimal magnitude
The apparent magnitude of the star (e.g., Sirius = -1.46, Polaris = 1.98).
Vec3 spatial
The point on the unit sphere where the star lies.
CatalogStar(Vec3 spatial, decimal magnitude, int name)
CombinationIterator(int k, int n)
const std::vector< int > & indices() const
decimal weight
A weight indicating the confidence of this idenification. Often just 1.
bool operator==(const StarIdentifier &other) const
int catalogIndex
An index into an array of CatalogStar objects.
StarIdentifier(int starIndex, int catalogIndex, int weight)
StarIdentifier(int starIndex, int catalogIndex)
Sets StarIdentifier.weight = 1.
int starIndex
An index into an array of Star objects.
Star(decimal x, decimal y, decimal radiusX, decimal radiusY, decimal magnitude)
decimal radiusY
Approximate vertical radius of the bright area in pixels.
Star()
Create a zeroed-out star. Fields should be set immediately after construction.
Vec2 position
The (x,y) pixel coordinates in the image (top left is 0,0).
Star(decimal x, decimal y, decimal radiusX)
Convenience constructor that sets Star.radiusY = radiusX and Star.magnitude = 0.
decimal radiusX
Approximate horizontal radius of the bright area in pixels.
decimal magnitude
A relative measure of magnitude of the star.
Three dimensional vector with decimaling point components.
bool AllPairsWithinFov(int numStars, SpatialAccessor spatial, decimal cosMaxFov)
std::vector< StarIdentifier > StarIdentifiers
void SerializeCatalog(SerializeContext *ser, const Catalog &catalog, bool inclMagnitude, bool inclName)
Serialize the catalog to buffer.
size_t TetraFindPatternIndex(const int *patternEdgeRatios, size_t numRatios, int numEdgeRatioBins, size_t tableSize)
Catalog DeserializeCatalog(DeserializeContext *des, bool *inclMagnitudeReturn, bool *inclNameReturn)
Deserialize a catalog.
std::vector< Star > Stars
Vec3 SphericalToSpatial(decimal ra, decimal de)
Convert from right ascension & declination to a 3d point on the unit sphere.
std::vector< decimal > TetraEdgeRatios(int numStars, SpatialAccessor spatial)
Catalog NarrowCatalog(const Catalog &catalog, decimal maxMagnitude, int maxStars, decimal minSeparation)
Remove unwanted stars from an unfiltered catalog.
Catalog::const_iterator FindNamedStar(const Catalog &catalog, int name)
Return a pointer to the star with the given name, or NULL if not found.
std::vector< CatalogStar > Catalog
decimal MagToBrightness(decimal mag)
returns some relative brightness measure, which is proportional to the total number of photons receiv...
static constexpr int numPatternStars
A two dimensional vector with decimaling point components.