11 #ifndef __FEATURE_H_30112004_1121__ 12 #define __FEATURE_H_30112004_1121__ 18 template <
typename FAMILYMARKER,
typename TYPEMARKER = FAMILYMARKER,
24 : d_family(f), d_type(t){};
27 : d_family(f), d_type(t), d_loc(loc){};
29 const FAMILYMARKER &
getFamily()
const {
return d_family; };
30 void setFamily(
const FAMILYMARKER &f) { d_family = f; };
32 const TYPEMARKER &
getType()
const {
return d_type; };
33 void setType(
const TYPEMARKER &t) { d_type = t; };
35 const LOCTYPE &
getLoc()
const {
return d_loc; };
36 void setLoc(
const LOCTYPE &loc) { d_loc = loc; };
38 const std::vector<LOCTYPE> &
getDirs()
const {
return d_dirs; };
39 std::vector<LOCTYPE> &
getDirs() {
return d_dirs; };
42 FAMILYMARKER d_family;
45 std::vector<LOCTYPE> d_dirs;
48 template <
typename FAMILYMARKER,
typename TYPEMARKER = FAMILYMARKER,
54 : d_weightSum(0.0), d_family(f), d_type(t){};
56 const FAMILYMARKER &
getFamily()
const {
return d_family; };
57 void setFamily(
const FAMILYMARKER &f) { d_family = f; };
59 const TYPEMARKER &
getType()
const {
return d_type; };
60 void setType(
const TYPEMARKER &t) { d_type = t; };
63 PRECONDITION(d_weights.size() == d_locs.size(),
"weight/locs mismatch");
65 for (
unsigned int i = 0; i < d_weights.size(); i++) {
66 LOCTYPE tmp = *d_locs[i];
67 tmp *= d_weights[i] / d_weightSum;
72 void addPoint(
const LOCTYPE *p,
double weight = 1.0) {
74 d_weights.push_back(weight);
75 d_weightSum += weight;
83 const std::vector<LOCTYPE> &
getDirs()
const {
return d_dirs; };
84 std::vector<LOCTYPE> &
getDirs() {
return d_dirs; };
88 FAMILYMARKER d_family;
90 std::vector<double> d_weights;
91 std::vector<const LOCTYPE *> d_locs;
93 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)