summaryrefslogtreecommitdiff
path: root/src/csgterm.cc
diff options
context:
space:
mode:
authorMarius Kintel <marius@kintel.net>2011-10-04 01:41:43 (GMT)
committerMarius Kintel <marius@kintel.net>2011-10-04 01:41:43 (GMT)
commitf5e0f3a531b0c8806e4ebc62cd91ca31275ae481 (patch)
tree98992f8b4f632ab8e29175eb362f4d3e03e06da3 /src/csgterm.cc
parent85948590ee0c6a353502c5493ecaf45730e08984 (diff)
Rewrote some hard to read linear algebra code to use Eigen
Diffstat (limited to 'src/csgterm.cc')
-rw-r--r--src/csgterm.cc12
1 files changed, 4 insertions, 8 deletions
diff --git a/src/csgterm.cc b/src/csgterm.cc
index 8306aaf..16ef75f 100644
--- a/src/csgterm.cc
+++ b/src/csgterm.cc
@@ -47,10 +47,10 @@
*/
-CSGTerm::CSGTerm(const shared_ptr<PolySet> &polyset, const double matrix[16], const double color[4], const std::string &label)
+CSGTerm::CSGTerm(const shared_ptr<PolySet> &polyset, const Transform3d &matrix, const double color[4], const std::string &label)
: type(TYPE_PRIMITIVE), polyset(polyset), label(label), left(NULL), right(NULL)
{
- for (int i = 0; i < 16; i++) this->m[i] = matrix[i];
+ this->m = matrix;
for (int i = 0; i < 4; i++) this->color[i] = color[i];
refcounter = 1;
}
@@ -188,7 +188,7 @@ CSGChain::CSGChain()
{
}
-void CSGChain::add(const shared_ptr<PolySet> &polyset, double *m, double *color, CSGTerm::type_e type, std::string label)
+void CSGChain::add(const shared_ptr<PolySet> &polyset, const Transform3d &m, double *color, CSGTerm::type_e type, std::string label)
{
polysets.push_back(polyset);
matrices.push_back(m);
@@ -236,11 +236,7 @@ BoundingBox CSGChain::getBoundingBox() const
if (!psbox.isNull()) {
Eigen::Transform3d t;
// Column-major vs. Row-major
- t.matrix() <<
- matrices[i][0], matrices[i][4], matrices[i][8], matrices[i][12],
- matrices[i][1], matrices[i][5], matrices[i][9], matrices[i][13],
- matrices[i][2], matrices[i][6], matrices[i][10], matrices[i][14],
- matrices[i][3], matrices[i][7], matrices[i][11], matrices[i][15];
+ t = matrices[i];
bbox.extend(t * psbox.min());
bbox.extend(t * psbox.max());
}
contact: Jan Huwald // Impressum