diff options
author | Marius Kintel <marius@kintel.net> | 2011-10-04 01:41:43 (GMT) |
---|---|---|
committer | Marius Kintel <marius@kintel.net> | 2011-10-04 01:41:43 (GMT) |
commit | f5e0f3a531b0c8806e4ebc62cd91ca31275ae481 (patch) | |
tree | 98992f8b4f632ab8e29175eb362f4d3e03e06da3 /src/state.h | |
parent | 85948590ee0c6a353502c5493ecaf45730e08984 (diff) |
Rewrote some hard to read linear algebra code to use Eigen
Diffstat (limited to 'src/state.h')
-rw-r--r-- | src/state.h | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/src/state.h b/src/state.h index 69aee87..5dc74df 100644 --- a/src/state.h +++ b/src/state.h @@ -2,13 +2,14 @@ #define STATE_H_ #include <cstring> +#include "linalg.h" class State { public: State(const class AbstractNode *parent) : parentnode(parent), isprefix(false), ispostfix(false), numchildren(0) { - for (int i=0;i<16;i++) this->m[i] = i % 5 == 0 ? 1.0 : 0.0; + m = Transform3d::Identity(); for (int i=0;i<4;i++) this->c[i] = -1.0; } virtual ~State() {} @@ -17,14 +18,14 @@ public: void setPostfix(bool on) { this->ispostfix = on; } void setNumChildren(unsigned int numc) { this->numchildren = numc; } void setParent(const AbstractNode *parent) { this->parentnode = parent; } - void setMatrix(const double m[16]) { memcpy(this->m, m, 16*sizeof(double)); } + void setMatrix(const Transform3d &m) { this->m = m; } void setColor(const double c[4]) { memcpy(this->c, c, 4*sizeof(double)); } bool isPrefix() const { return this->isprefix; } bool isPostfix() const { return this->ispostfix; } unsigned int numChildren() const { return this->numchildren; } const AbstractNode *parent() const { return this->parentnode; } - const double *matrix() const { return this->m; } + const Transform3d &matrix() const { return this->m; } const double *color() const { return this->c; } private: @@ -34,7 +35,7 @@ private: unsigned int numchildren; // Transformation matrix and color. FIXME: Generalize such state variables? - double m[16]; + Transform3d m; double c[4]; }; |