27 |
|
#define CONSTRAINTS_CONTRAINTPAIR_HPP |
28 |
|
|
29 |
|
#include "primitives/StuntDouble.hpp" |
30 |
+ |
#include "constraints/ConstraintElem.hpp" |
31 |
|
namespace oopse { |
32 |
|
|
32 |
– |
//for the time being, ConstraintElem is just StuntDouble class |
33 |
– |
//Laterly, ConstraintElem will be an adapter class of StuntDouble |
34 |
– |
typedef StuntDouble ConstraintElem; |
33 |
|
|
36 |
– |
|
34 |
|
/** |
35 |
|
* @class ConstraintPair |
36 |
|
* @todo document |
42 |
|
ConstraintPair(ConstraintElem* elem1, ConstraintElem* elem2, double len) |
43 |
|
: consElem1_(elem1), consElem2_(elem2), dist2(len*len) { } |
44 |
|
|
45 |
+ |
~ConstraintPair() { |
46 |
+ |
delete consElem1_; |
47 |
+ |
delete consElem2_; |
48 |
+ |
} |
49 |
|
/** Return the first constraint elemet */ |
50 |
|
ConstraintElem* getConsElem1() {return consElem1_;} |
51 |
|
|
52 |
|
/** Retunr the second constraint element */ |
53 |
|
ConstraintElem* getConsElem2() {return consElem2_;} |
54 |
|
|
55 |
< |
|
55 |
> |
bool isMoved() { return consElem1_->getMoved() || consElem2_->getMoved(); } |
56 |
|
double getConsDistSquare() {return dist2;} |
57 |
|
|
58 |
|
private: |