10 #ifndef __FEATURE_H_30112004_1121__ 11 #define __FEATURE_H_30112004_1121__ 17 template <
typename FAMILYMARKER,
typename TYPEMARKER = FAMILYMARKER,
23 : d_family(f), d_type(t){};
26 : d_family(f), d_type(t), d_loc(loc){};
28 const FAMILYMARKER &
getFamily()
const {
return d_family; };
29 void setFamily(
const FAMILYMARKER &f) { d_family = f; };
31 const TYPEMARKER &
getType()
const {
return d_type; };
32 void setType(
const TYPEMARKER &t) { d_type = t; };
34 const LOCTYPE &
getLoc()
const {
return d_loc; };
35 void setLoc(
const LOCTYPE &loc) { d_loc = loc; };
37 const std::vector<LOCTYPE> &
getDirs()
const {
return d_dirs; };
38 std::vector<LOCTYPE> &
getDirs() {
return d_dirs; };
41 FAMILYMARKER d_family;
44 std::vector<LOCTYPE> d_dirs;
47 template <
typename FAMILYMARKER,
typename TYPEMARKER = FAMILYMARKER,
53 : d_weightSum(0.0), d_family(f), d_type(t){};
55 const FAMILYMARKER &
getFamily()
const {
return d_family; };
56 void setFamily(
const FAMILYMARKER &f) { d_family = f; };
58 const TYPEMARKER &
getType()
const {
return d_type; };
59 void setType(
const TYPEMARKER &t) { d_type = t; };
62 PRECONDITION(d_weights.size() == d_locs.size(),
"weight/locs mismatch");
64 for (
unsigned int i = 0; i < d_weights.size(); i++) {
65 LOCTYPE tmp = *d_locs[i];
66 tmp *= d_weights[i] / d_weightSum;
71 void addPoint(
const LOCTYPE *p,
double weight = 1.0) {
73 d_weights.push_back(weight);
74 d_weightSum += weight;
82 const std::vector<LOCTYPE> &
getDirs()
const {
return d_dirs; };
83 std::vector<LOCTYPE> &
getDirs() {
return d_dirs; };
87 FAMILYMARKER d_family;
89 std::vector<double> d_weights;
90 std::vector<const LOCTYPE *> d_locs;
92 std::vector<LOCTYPE> d_dirs;
void setFamily(const FAMILYMARKER &f)
ImplicitFeature(const FAMILYMARKER &f, const TYPEMARKER &t)
const LOCTYPE & getLoc() const
void setFamily(const FAMILYMARKER &f)
const std::vector< LOCTYPE > & getDirs() const
const FAMILYMARKER & getFamily() const
const TYPEMARKER & getType() const
std::vector< LOCTYPE > & getDirs()
ExplicitFeature(const FAMILYMARKER &f, const TYPEMARKER &t, const LOCTYPE &loc)
void setType(const TYPEMARKER &t)
const FAMILYMARKER & getFamily() const
std::vector< LOCTYPE > & getDirs()
const std::vector< LOCTYPE > & getDirs() const
ExplicitFeature(const FAMILYMARKER &f, const TYPEMARKER &t)
#define PRECONDITION(expr, mess)
void addPoint(const LOCTYPE *p, double weight=1.0)
const TYPEMARKER & getType() const
void setLoc(const LOCTYPE &loc)
void setType(const TYPEMARKER &t)