Work on placements

This commit is contained in:
Thomas Krijnen
2019-09-01 10:36:49 +02:00
parent ca2a4f243d
commit 2e7c43f590
3 changed files with 78 additions and 10 deletions
+11 -1
View File
@@ -45,8 +45,18 @@ struct matrix4 : public item {
Eigen::Matrix4d components;
matrix4() : components(Eigen::Matrix4d::Identity()), tag(IDENTITY) {}
matrix4(const Eigen::Matrix4d& c) : components(c), tag(OTHER) {}
matrix4() : components(Eigen::Matrix4d::Identity()), tag(IDENTITY) {}
matrix4(const Eigen::Vector3d& o, const Eigen::Vector3d& z, const Eigen::Vector3d& x) : tag(AFFINE_WO_SCALE) {
auto X = x.normalized();
auto Y = z.cross(x).normalized();
auto Z = z.normalized();
components <<
X(0), Y(0), Z(0), o(0),
X(1), Y(1), Z(1), o(0),
X(2), Y(2), Z(2), o(0),
0, 0, 0, 1.;
}
virtual item* clone() const { return new matrix4(*this); }
virtual kinds kind() const { return MATRIX4; }