Exemple #1
0
void TaskProjGroup::rotateButtonClicked(void)
{
    if ( multiView && ui ) {
        const QObject *clicked = sender();

        // Any translation/scale/etc applied here will be ignored, as
        // DrawProjGroup::setFrontViewOrientation() only
        // uses it to set Direction and XAxisDirection.
        Base::Matrix4D m = multiView->viewOrientationMatrix.getValue();

        // TODO: Construct these directly
        Base::Matrix4D t;

        //TODO: Consider changing the vectors around depending on whether we're in First or Third angle mode - might be more intuitive? IR
        if ( clicked == ui->butTopRotate ) {
            t.rotX(M_PI / -2);
        } else if ( clicked == ui->butCWRotate ) {
            t.rotY(M_PI / -2);
        } else if ( clicked == ui->butRightRotate) {
            t.rotZ(M_PI / 2);
        } else if ( clicked == ui->butDownRotate) {
            t.rotX(M_PI / 2);
        } else if ( clicked == ui->butLeftRotate) {
            t.rotZ(M_PI / -2);
        } else if ( clicked == ui->butCCWRotate) {
            t.rotY(M_PI / 2);
        }
        m *= t;

        multiView->setFrontViewOrientation(m);
        Gui::Command::updateActive();
    }
}
Exemple #2
0
PyObject*  MeshPy::rotate(PyObject *args)
{
    double x,y,z;
    if (!PyArg_ParseTuple(args, "ddd",&x,&y,&z))
        return NULL;

    PY_TRY {
        Base::Matrix4D m;
        m.rotX(x);
        m.rotY(y);
        m.rotZ(z);
        getMeshObjectPtr()->getKernel().Transform(m);
    } PY_CATCH;

    Py_Return;
}