Hello,
I am trying to convert a PR-Tree algorithm from C++ to C (if anyone knows of a ready-made C one I'll be very grateful). However, this algorithm has a lot of templates and classes, is there a way to convert them to C?
The following is an example:
Code:
#define box_t box_type<coord_t,dim>
template<class coord_t, size_t dim>
class box_type {
public:
size_t id; // used as bid of child when act as bounding boxes
coord_t lo_[dim];
coord_t hi_[dim];
// each box has a unique id, assigned by the application.
inline bool intersect(box_t& t) {
for (size_t i=0; i<dim; i++) {
if (t.lo_[i] > hi_[i] || t.hi_[i] < lo_[i]) return false;
}
return true;
}
inline bool contain(box_t& t) {
for (size_t i=0; i<dim; i++) {
if (t.lo_[i] < lo_[i] || t.hi_[i] > hi_[i]) return false;
}
return true;
}
};
Thanks for helping.
Alan