From 564377e17ad2c1d581d8d60500328b27fc1426f2 Mon Sep 17 00:00:00 2001 From: Michael Kirsch Date: Sun, 2 Jun 2019 21:02:42 +0200 Subject: [PATCH] remove functions to directly manipulate the object; reordering rotation overloads --- xs/src/libslic3r/TransformationMatrix.cpp | 65 ----------------------- xs/src/libslic3r/TransformationMatrix.hpp | 35 ++---------- 2 files changed, 3 insertions(+), 97 deletions(-) diff --git a/xs/src/libslic3r/TransformationMatrix.cpp b/xs/src/libslic3r/TransformationMatrix.cpp index c9fff8045..e46962e7a 100644 --- a/xs/src/libslic3r/TransformationMatrix.cpp +++ b/xs/src/libslic3r/TransformationMatrix.cpp @@ -111,71 +111,6 @@ bool TransformationMatrix::inverse(TransformationMatrix &inverse) const return true; } -void TransformationMatrix::translate(double x, double y, double z) -{ - TransformationMatrix mat = mat_translation(x, y, z); - this->applyLeft(mat); -} - -void TransformationMatrix::translate(Vectorf3 const &vector) -{ - TransformationMatrix mat = mat_translation(vector.x, vector.y, vector.z); - this->applyLeft(mat); -} - -void TransformationMatrix::translateXY(Vectorf const &vector) -{ - TransformationMatrix mat = mat_translation(vector.x, vector.y, 0.0); - this->applyLeft(mat); -} - -void TransformationMatrix::scale(double factor) -{ - this->scale(factor, factor, factor); -} - -void TransformationMatrix::scale(double x, double y, double z) -{ - TransformationMatrix mat = mat_scale(x, y, z); - this->applyLeft(mat); -} - -void TransformationMatrix::scale(Vectorf3 const &vector) -{ - TransformationMatrix mat = mat_scale(vector.x, vector.y, vector.z); - this->applyLeft(mat); -} - -void TransformationMatrix::mirror(const Axis &axis) -{ - TransformationMatrix mat = mat_mirror(axis); - this->applyLeft(mat); -} - -void TransformationMatrix::mirror(const Vectorf3 & normal) -{ - TransformationMatrix mat = mat_mirror(normal); - this->applyLeft(mat); -} - -void TransformationMatrix::rotate(double angle_rad, const Axis & axis) -{ - TransformationMatrix mat = mat_rotation(angle_rad, axis); - this->applyLeft(mat); -} - -void TransformationMatrix::rotate(double angle_rad, const Vectorf3 & axis) -{ - TransformationMatrix mat = mat_rotation(angle_rad, axis); - this->applyLeft(mat); -} - -void TransformationMatrix::rotate(double q1, double q2, double q3, double q4) -{ - TransformationMatrix mat = mat_rotation(q1, q2, q3, q4); - this->applyLeft(mat); -} - void TransformationMatrix::applyLeft(const TransformationMatrix &left) { TransformationMatrix temp = multiply(left, *this); diff --git a/xs/src/libslic3r/TransformationMatrix.hpp b/xs/src/libslic3r/TransformationMatrix.hpp index edca88a1a..f7876c67a 100644 --- a/xs/src/libslic3r/TransformationMatrix.hpp +++ b/xs/src/libslic3r/TransformationMatrix.hpp @@ -35,35 +35,6 @@ public: /// returns the inverse of the matrix bool inverse(TransformationMatrix &inverse) const; - /// performs translation - void translate(double x, double y, double z); - void translate(Vectorf3 const &vector); - void translateXY(Vectorf const &vector); - - /// performs uniform scale - void scale(double factor); - - /// performs per-axis scale - void scale(double x, double y, double z); - - /// performs per-axis scale via vector - void scale(Vectorf3 const &vector); - - /// performs mirroring along given axis - void mirror(const Axis &axis); - - /// performs mirroring along given axis - void mirror(const Vectorf3 &normal); - - /// performs rotation around given axis - void rotate(double angle_rad, const Axis &axis); - - /// performs rotation around arbitrary axis - void rotate(double angle_rad, const Vectorf3 &axis); - - /// performs rotation defined by unit quaternion - void rotate(double q1, double q2, double q3, double q4); - /// multiplies the parameter-matrix from the left (this=left*this) void applyLeft(const TransformationMatrix &left); @@ -97,12 +68,12 @@ public: /// generates a rotation matrix around coodinate axis static TransformationMatrix mat_rotation(double angle_rad, const Axis &axis); - /// generates a rotation matrix defined by unit quaternion q1*i + q2*j + q3*k + q4 - static TransformationMatrix mat_rotation(double q1, double q2, double q3, double q4); - /// generates a rotation matrix around arbitrary axis static TransformationMatrix mat_rotation(double angle_rad, const Vectorf3 &axis); + /// generates a rotation matrix defined by unit quaternion q1*i + q2*j + q3*k + q4 + static TransformationMatrix mat_rotation(double q1, double q2, double q3, double q4); + /// generates a rotation matrix by specifying a vector (origin) that is to be rotated /// to be colinear with another vector (target) static TransformationMatrix mat_rotation(Vectorf3 origin, Vectorf3 target);