Skip to content

Commit

Permalink
enable catalog minsep narrowing
Browse files Browse the repository at this point in the history
  • Loading branch information
zeddie888 committed Nov 16, 2023
1 parent 0d284cd commit e4e94c8
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 14 deletions.
2 changes: 2 additions & 0 deletions src/io.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -952,6 +952,8 @@ PipelineOutput Pipeline::Go(const PipelineInput &input) {
// (human centipede) until there are no more stages set.
PipelineOutput result;

std::cerr << *input.InputCamera() << std::endl;

const Image *inputImage = input.InputImage();
const Stars *inputStars = input.InputStars();
const StarIdentifiers *inputStarIds = input.InputStarIds();
Expand Down
28 changes: 14 additions & 14 deletions src/star-utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,23 +35,23 @@ Catalog NarrowCatalog(const Catalog &catalog, int maxMagnitude, int maxStars, fl

// TODO: bug? Why remove both i and j
// remove stars that are too close to each other
// std::set<int> tooCloseIndices;
// // filter out stars that are too close together
// // easy enough to n^2 brute force, the catalog isn't that big
// for (int i = 0; i < (int)result.size(); i++) {
// for (int j = i + 1; j < (int)result.size(); j++) {
// if (AngleUnit(result[i].spatial.Normalize(), result[j].spatial.Normalize()) < minSeparation) {
// tooCloseIndices.insert(i);
// tooCloseIndices.insert(j);
// }
// }
// }
std::set<int> tooCloseIndices;
// filter out stars that are too close together
// easy enough to n^2 brute force, the catalog isn't that big
for (int i = 0; i < (int)result.size(); i++) {
for (int j = i + 1; j < (int)result.size(); j++) {
if (AngleUnit(result[i].spatial.Normalize(), result[j].spatial.Normalize()) < minSeparation) {
tooCloseIndices.insert(i);
tooCloseIndices.insert(j);
}
}
}

// // Erase all the stars whose indices are in tooCloseIndices from the result.
// // Loop backwards so indices don't get messed up as we iterate.
// for (auto it = tooCloseIndices.rbegin(); it != tooCloseIndices.rend(); it++) {
// result.erase(result.begin() + *it);
// }
for (auto it = tooCloseIndices.rbegin(); it != tooCloseIndices.rend(); it++) {
result.erase(result.begin() + *it);
}

// and finally limit to n brightest stars
if (maxStars < (int)result.size()) {
Expand Down

0 comments on commit e4e94c8

Please sign in to comment.