File size: 1,865 Bytes
8efb4bd | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 | #ifndef TRANSFORMATIONANDSCORE_H
#define TRANSFORMATIONANDSCORE_H
#include <RigidTrans3.h>
#include <vector>
#define NO_OF_RANGES 8
typedef struct pointsAndSurface_t {
int count_;
float surface_;
} pointsAndSurface;
template <class SCORE_T> class TransformationAndScore_T {
public:
const RigidTrans3 &trans() { return refFrame_; }
float score() { return score_.totalScore_; }
RigidTrans3 refFrame_;
SCORE_T score_;
float dist_; // for debug
static void outputTrans(std::vector<TransformationAndScore_T *> &transformations);
};
template <class SCORE_T> std::ostream &operator<<(std::ostream &s, const TransformationAndScore_T<SCORE_T> &ts) {
return s << ts.refFrame_ << " " << ts.score_ << " , " << ts.dist_ << " , " << ((ts.dist_ == 0) ? 1 : 0);
}
template <class SCORE_T> std::istream &operator>>(std::istream &s, TransformationAndScore_T<SCORE_T> &ts) {
char c;
return s >> c >> ts.score_ >> c >> c >> ts.refFrame_ >> c >> c >> ts.dist_;
}
class Score {
public:
Score() { init(); }
void init() {
totalScore_ = 0;
resCount1_ = resCount2_ = 0;
interfaceSurface_ = maxPenetrate_ = s_ = c_ = e_ = 0.0;
for (int i = 0; i < NO_OF_RANGES; i++) {
ps_[i].count_ = 0;
ps_[i].surface_ = 0;
}
}
float totalScore_;
pointsAndSurface ps_[NO_OF_RANGES];
int resCount1_;
int resCount2_;
float interfaceSurface_;
float maxPenetrate_;
float s_, c_, e_;
Score *referenceScore_;
friend std::ostream &operator<<(std::ostream &s, const Score &score) { return s << score.totalScore_; }
friend std::istream &operator>>(std::istream &s, Score &ts);
};
// #define CLUSTER_DEBUG
typedef TransformationAndScore_T<Score> TransformationAndScore;
#endif
|