Exemplo n.º 1
0
void MatrixDisplayDlg::fillDialogWith(const ccGLMatrix& mat)
{
	m_mat = ccGLMatrixd(mat.data());

	int precision = ccGui::Parameters().displayedNumPrecision;

	//display as 4x4 matrix
	maxTextEdit->setText(mat.toString(precision));

	//display as rotation vector/angle
	{
		PointCoordinateType angle_rad;
		CCVector3 axis3D, t3D;
		mat.getParameters(angle_rad, axis3D, t3D);

		fillDialogWith(CCVector3d::fromArray(axis3D.u),angle_rad,CCVector3d::fromArray(t3D.u),precision);
	}
}
Exemplo n.º 2
0
void ccApplyTransformationDlg::updateAll(const ccGLMatrix& mat, bool textForm/*=true*/, bool axisAngleForm/*=true*/, bool eulerForm/*=true*/)
{
    if (textForm)
    {
        QString matText = mat.toString();
        matrixTextEdit->blockSignals(true);
        matrixTextEdit->setPlainText(matText);
        matrixTextEdit->blockSignals(false);
    }

    if (axisAngleForm)
    {
        rxAxisDoubleSpinBox->blockSignals(true);
        ryAxisDoubleSpinBox->blockSignals(true);
        rzAxisDoubleSpinBox->blockSignals(true);
        rAngleDoubleSpinBox->blockSignals(true);
        txAxisDoubleSpinBox->blockSignals(true);
        tyAxisDoubleSpinBox->blockSignals(true);
        tzAxisDoubleSpinBox->blockSignals(true);

        PointCoordinateType alpha = 0;
        CCVector3 axis,t;
        mat.getParameters(alpha,axis,t);

        rxAxisDoubleSpinBox->setValue(axis.x);
        ryAxisDoubleSpinBox->setValue(axis.y);
        rzAxisDoubleSpinBox->setValue(axis.z);
        rAngleDoubleSpinBox->setValue(alpha * CC_RAD_TO_DEG);
        txAxisDoubleSpinBox->setValue(t.x);
        tyAxisDoubleSpinBox->setValue(t.y);
        tzAxisDoubleSpinBox->setValue(t.z);

        rxAxisDoubleSpinBox->blockSignals(false);
        ryAxisDoubleSpinBox->blockSignals(false);
        rzAxisDoubleSpinBox->blockSignals(false);
        rAngleDoubleSpinBox->blockSignals(false);
        txAxisDoubleSpinBox->blockSignals(false);
        tyAxisDoubleSpinBox->blockSignals(false);
        tzAxisDoubleSpinBox->blockSignals(false);
    }

    if (eulerForm)
    {
        ePhiDoubleSpinBox   ->blockSignals(true);
        eThetaDoubleSpinBox ->blockSignals(true);
        ePsiDoubleSpinBox   ->blockSignals(true);
        etxAxisDoubleSpinBox->blockSignals(true);
        etyAxisDoubleSpinBox->blockSignals(true);
        etzAxisDoubleSpinBox->blockSignals(true);

        PointCoordinateType phi,theta,psi = 0;
        CCVector3 t;
        mat.getParameters(phi,theta,psi,t);

        ePhiDoubleSpinBox   ->setValue(phi * CC_RAD_TO_DEG);
        eThetaDoubleSpinBox ->setValue(theta * CC_RAD_TO_DEG);
        ePsiDoubleSpinBox   ->setValue(psi * CC_RAD_TO_DEG);
        etxAxisDoubleSpinBox->setValue(t.x);
        etyAxisDoubleSpinBox->setValue(t.y);
        etzAxisDoubleSpinBox->setValue(t.z);

        ePhiDoubleSpinBox   ->blockSignals(false);
        eThetaDoubleSpinBox ->blockSignals(false);
        ePsiDoubleSpinBox   ->blockSignals(false);
        etxAxisDoubleSpinBox->blockSignals(false);
        etyAxisDoubleSpinBox->blockSignals(false);
        etzAxisDoubleSpinBox->blockSignals(false);
    }
}