Esempio n. 1
0
static const OrientationInfoList& orientationInfoList()
{
    static OrientationInfoList list;
    if (list.size() == 0) {
        QMatrix rot90 = createRotMatrix(90);
        QMatrix hflip = createScaleMatrix(-1, 1);
        QMatrix vflip = createScaleMatrix(1, -1);

        list
                << OrientationInfo()
                << OrientationInfo(NORMAL, QMatrix(), JXFORM_NONE)
                << OrientationInfo(HFLIP, hflip, JXFORM_FLIP_H)
                << OrientationInfo(ROT_180, createRotMatrix(180), JXFORM_ROT_180)
                << OrientationInfo(VFLIP, vflip, JXFORM_FLIP_V)
                << OrientationInfo(TRANSPOSE, hflip * rot90, JXFORM_TRANSPOSE)
                << OrientationInfo(ROT_90, rot90, JXFORM_ROT_90)
                << OrientationInfo(TRANSVERSE, vflip * rot90, JXFORM_TRANSVERSE)
                << OrientationInfo(ROT_270, createRotMatrix(270), JXFORM_ROT_270)
                ;
    }
    return list;
}
Esempio n. 2
0
Matrix create3DTransformationMatrix
(
    Vector3 eye,
    Vector3 target,
    Vector3 up,
    double left,
    double top,
    double width,
    double height
)
{
    Matrix lookAt = createLookAtMatrix(eye, target, up);
    Matrix perspective = createRawPerspectiveMatrix();
    double minDim = std::min(width, height);
    Matrix scale = createScaleMatrix(minDim, -minDim, 1);
    Matrix viewport = createTranslateMatrix(left + width / 2.0, top + height / 2.0, 0);

    return lookAt % perspective % scale % viewport;
}