--- a/src/gui_editactions.cpp Sun Aug 18 15:33:00 2013 +0300 +++ b/src/gui_editactions.cpp Sun Aug 18 16:04:36 2013 +0300 @@ -418,24 +418,23 @@ List<LDObject*> sel = g_win->sel(); List<vertex*> queue; const vertex rotpoint = rotPoint (sel); - const double angle = (pi * currentGrid().confs[Grid::Angle]->value) / 180; - - // ref: http://en.wikipedia.org/wiki/Transformation_matrix#Rotation_2 - const double cosangle = cos (angle), + const double angle = (pi * currentGrid().confs[Grid::Angle]->value) / 180, + cosangle = cos (angle), sinangle = sin (angle); + // ref: http://en.wikipedia.org/wiki/Transformation_matrix#Rotation_2 matrix transform ({ - (l* l * (1 - cosangle)) + cosangle, - (m* l * (1 - cosangle)) - (n* sinangle), - (n* l * (1 - cosangle)) + (m* sinangle), + (l * l * (1 - cosangle)) + cosangle, + (m * l * (1 - cosangle)) - (n * sinangle), + (n * l * (1 - cosangle)) + (m * sinangle), - (l* m * (1 - cosangle)) + (n* sinangle), - (m* m * (1 - cosangle)) + cosangle, - (n* m * (1 - cosangle)) - (l* sinangle), + (l * m * (1 - cosangle)) + (n * sinangle), + (m * m * (1 - cosangle)) + cosangle, + (n * m * (1 - cosangle)) - (l * sinangle), - (l* n * (1 - cosangle)) - (m* sinangle), - (m* n * (1 - cosangle)) + (l* sinangle), - (n* n * (1 - cosangle)) + cosangle + (l * n * (1 - cosangle)) - (m * sinangle), + (m * n * (1 - cosangle)) + (l * sinangle), + (n * n * (1 - cosangle)) + cosangle }); // Apply the above matrix to everything @@ -448,9 +447,13 @@ } } elif (obj->hasMatrix()) { LDMatrixObject* mo = dynamic_cast<LDMatrixObject*> (obj); + + // Transform the position vertex v = mo->position(); rotateVertex (v, rotpoint, transform); mo->setPosition (v); + + // Transform the matrix mo->setTransform (mo->transform() * transform); } elif (obj->getType() == LDObject::Vertex) { LDVertexObject* vert = static_cast<LDVertexObject*> (obj);