29 #include <boost/make_shared.hpp> 30 #include <boost/range/irange.hpp> 45 std::vector<VotingResultCalculatorPtr> calculatorPerThread;
46 std::vector<boost::shared_ptr<boost::thread>>
threads;
47 for (
int i : boost::irange(0,
nThreads)) {
55 return v1->weight > v2->weight;
68 for (
int i : boost::irange(0,
nThreads)) {
70 threads.push_back(boost::make_shared<boost::thread>(&
VotingSpace::calcResult,
this, i, calculatorPerThread[i]));
74 for (
int i : boost::irange(0,
nThreads)) {
88 if (calculator->computeVotingResult(result, votingBin->votes))
124 voteFromReferenceObjectExists =
false;
134 int minXIdx = binXIdx - 1;
135 int minYIdx = binYIdx - 1;
136 int minZIdx = binZIdx - 1;
137 int maxXIdx = binXIdx + 1;
138 int maxYIdx = binYIdx + 1;
139 int maxZIdx = binZIdx + 1;
142 if (sphereCenter->eigen.x() - binCenter->eigen.x() >
offsetOfSphere) {
144 }
else if (sphereCenter->eigen.x() - binCenter->eigen.x() < -
offsetOfSphere) {
147 if (sphereCenter->eigen.y() - binCenter->eigen.y() >
offsetOfSphere) {
149 }
else if (sphereCenter->eigen.y() - binCenter->eigen.y() < -
offsetOfSphere) {
152 if (sphereCenter->eigen.z() - binCenter->eigen.z() >
offsetOfSphere) {
154 }
else if (sphereCenter->eigen.z() - binCenter->eigen.z() < -
offsetOfSphere) {
162 for (
int xIdx = minXIdx; xIdx <= maxXIdx; xIdx++)
164 XIndexToYIndex::iterator yzGridIt =
voteGrid.find(xIdx);
170 for (
int yIdx = minYIdx; yIdx <= maxYIdx; yIdx++)
172 YIndexToZIndex::iterator zGridIt = yzGrid.find(yIdx);
173 if (zGridIt == yzGrid.end()) {
178 for (
int zIdx = minZIdx; zIdx <= maxZIdx; zIdx++)
180 ZIndexToVotingBinPtr::iterator votingBinIt = zGrid.find(zIdx);
181 if (votingBinIt == zGrid.end()) {
187 double squaredDistance;
190 for (TypeToInnerMap::iterator typeIt = votingBinPtr->votes.begin();
191 typeIt != votingBinPtr->votes.end(); typeIt++)
194 for (IdToVoteMap::iterator idIt = typeIt->second.begin();
195 idIt != typeIt->second.end(); idIt++)
198 VotedPosePtrs& mapForCurrentTypeAndId = currentVoteMap[typeIt->first][idIt->first];
202 voteFromReferenceObjectExists =
true;
204 for (VotedPosePtrs::iterator votedPosePtrsIt = idIt->second.begin();
205 votedPosePtrsIt != idIt->second.end(); votedPosePtrsIt++)
207 votedPosePtr = (*votedPosePtrsIt);
209 votedPosePtr->pose->point);
212 mapForCurrentTypeAndId.push_back(votedPosePtr);
219 return currentVoteMap;
230 result = (int)round(temp);
239 result = ((int)round(temp)) + 1;
VotingBinPtr getBin(double x, double y, double z)
std::vector< std::vector< VotingResultPtr > > resultsPerThread
boost::shared_ptr< VotingBin > VotingBinPtr
static bool isSelfVote(const VoteSpecifierPtr &vote)
void calcResult(int i, VotingResultCalculatorPtr &calculator)
SOCI_EMPTY_DECL empty_backend_factory const empty
VotingResultPtrs fillAndEvalVotingSpace(VotedPosePtrs &votes, bool enabledSelfVoteCheck)
boost::shared_ptr< Point > PointPtr
int discretizeToBins(double x)
const double squaredRadius
boost::shared_ptr< VotingResult > VotingResultPtr
std::vector< VotedPosePtr > VotedPosePtrs
boost::shared_ptr< VotedPose > VotedPosePtr
std::map< std::string, IdToVoteMap > TypeToInnerMap
static double getSquaredDistanceBetweenPoints(const PointPtr &p1, const PointPtr &p2)
std::vector< boost::shared_ptr< boost::thread > > threads
std::map< int, ZIndexToVotingBinPtr > YIndexToZIndex
const double offsetOfSphere
std::map< int, VotingBinPtr > ZIndexToVotingBinPtr
boost::shared_ptr< VotingResultCalculator > VotingResultCalculatorPtr
std::vector< std::vector< VotingBinPtr > > votingBinsPerThread
std::vector< VotingResultPtr > VotingResultPtrs
static constexpr double epsilon
boost::shared_ptr< VotingSpace > VotingSpacePtr
this namespace contains all generally usable classes.
TypeToInnerMap collectVotesInSphere(PointPtr ¢erPtr, bool &voteFromReferenceObjectExists)