當前位置: 首頁>>代碼示例>>Java>>正文


Java Quat類代碼示例

本文整理匯總了Java中glm.quat.Quat的典型用法代碼示例。如果您正苦於以下問題:Java Quat類的具體用法?Java Quat怎麽用?Java Quat使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


Quat類屬於glm.quat包,在下文中一共展示了Quat類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: cast

import glm.quat.Quat; //導入依賴的package包/類
public static Mat4 cast(Quat q, Mat4 res) {
    res.m00 = 1 - 2 * q.y * q.y - 2 * q.z * q.z;
    res.m01 = 2 * q.x * q.y + 2 * q.w * q.z;
    res.m02 = 2 * q.x * q.z - 2 * q.w * q.y;
    res.m03 = 0.0f;

    res.m10 = 2 * q.x * q.y - 2 * q.w * q.z;
    res.m11 = 1 - 2 * q.x * q.x - 2 * q.z * q.z;
    res.m12 = 2 * q.y * q.z + 2 * q.w * q.x;
    res.m13 = 0.0f;

    res.m20 = 2 * q.x * q.z + 2 * q.w * q.y;
    res.m21 = 2 * q.y * q.z - 2 * q.w * q.x;
    res.m22 = 1 - 2 * q.x * q.x - 2 * q.y * q.y;
    res.m23 = 0.0f;

    res.m30 = 0.0f;
    res.m31 = 0.0f;
    res.m32 = 0.0f;
    res.m33 = 1.0f;
    return res;
}
 
開發者ID:jfcameron,項目名稱:G2Dj,代碼行數:23,代碼來源:Mat4.java

示例2: calcMatrix

import glm.quat.Quat; //導入依賴的package包/類
/**
 * Generates the world-to-camera matrix for the view.
 *
 * @return
 */
@Override
public Mat4 calcMatrix() {

    Mat4 theMat = new Mat4(1.0f);

    /**
     * Remember: these transforms are in reverse order.
     *
     * In this space, we are facing in the correct direction. Which means
     * that the camera point is directly behind us by the radius number of
     * units.
     */
    theMat.translate(0.0f, 0.0f, -currView.radius());

    //Rotate the world to look in the right direction..
    Quat fullRotation = Glm.angleAxis_(currView.degSpinRotation(), new Vec3(0.0f, 0.0f, 1.0f));
    fullRotation.mul(currView.orient());

    theMat.mul(Mat4.cast_(fullRotation));

    // Translate the world by the negation of the lookat point, placing the origin at the lookat point.
    theMat.translate(currView.targetPos().negate_());

    return theMat;
}
 
開發者ID:java-graphics,項目名稱:java-unofficial-opengl-SDK,代碼行數:31,代碼來源:ViewPole.java

示例3: cast

import glm.quat.Quat; //導入依賴的package包/類
public static Mat3 cast(Quat q) {
    Mat3 result = new Mat3();
    result.m00 = 1 - 2 * q.y * q.y - 2 * q.z * q.z;
    result.m01 = 2 * q.x * q.y + 2 * q.w * q.z;
    result.m02 = 2 * q.x * q.z - 2 * q.w * q.y;

    result.m10 = 2 * q.x * q.y - 2 * q.w * q.z;
    result.m11 = 1 - 2 * q.x * q.x - 2 * q.z * q.z;
    result.m12 = 2 * q.y * q.z + 2 * q.w * q.x;

    result.m20 = 2 * q.x * q.z + 2 * q.w * q.y;
    result.m21 = 2 * q.y * q.z - 2 * q.w * q.x;
    result.m22 = 1 - 2 * q.x * q.x - 2 * q.y * q.y;
    return result;
}
 
開發者ID:jfcameron,項目名稱:G2Dj,代碼行數:16,代碼來源:Mat3.java

示例4: rotateViewDegrees

import glm.quat.Quat; //導入依賴的package包/類
public void rotateViewDegrees(Quat rot, boolean fromInitial) {
    if (!isDragging) {
        fromInitial = false;
    }
    if (view != null) {
        Quat viewQuat = Quat.cast_(view.calcMatrix());
        Quat invViewQuat = viewQuat.conjugate_();
        po.orientation((invViewQuat.mul(rot).mul(viewQuat).mul(fromInitial ? startDragOrient : po.orientation()))
                .normalize());
    } else {
        rotateWorldDegrees(rot, fromInitial);
    }
}
 
開發者ID:java-graphics,項目名稱:java-unofficial-opengl-SDK,代碼行數:14,代碼來源:ObjectPole.java

示例5: ViewData

import glm.quat.Quat; //導入依賴的package包/類
public ViewData(Vec3 targetPos, Quat orient, float radius, float degSpinRotation) {

        this.targetPos = targetPos;
        this.orient = orient;
        this.radius = radius;
        this.degSpinRotation = degSpinRotation;
    }
 
開發者ID:java-graphics,項目名稱:java-unofficial-opengl-SDK,代碼行數:8,代碼來源:ViewData.java

示例6: angleAxis_

import glm.quat.Quat; //導入依賴的package包/類
public static Quat angleAxis_(float degAngle, Vec3 v) {
    return Quat.angleAxis_(degAngle, v);
}
 
開發者ID:jfcameron,項目名稱:G2Dj,代碼行數:4,代碼來源:funcGeometric.java

示例7: angleAxis

import glm.quat.Quat; //導入依賴的package包/類
public static Quat angleAxis(float degAngle, Vec3 v, Quat res) {
    return Quat.angleAxis(degAngle, v, res);
}
 
開發者ID:jfcameron,項目名稱:G2Dj,代碼行數:4,代碼來源:funcGeometric.java

示例8: dot

import glm.quat.Quat; //導入依賴的package包/類
public static float dot(Quat v0, Quat v1) {
    return Quat.dot(v0, v1);
}
 
開發者ID:jfcameron,項目名稱:G2Dj,代碼行數:4,代碼來源:funcGeometric.java

示例9: cast_

import glm.quat.Quat; //導入依賴的package包/類
public static Mat4 cast_(Quat q) {
    return cast(q, new Mat4());
}
 
開發者ID:jfcameron,項目名稱:G2Dj,代碼行數:4,代碼來源:Mat4.java

示例10: ObjectData

import glm.quat.Quat; //導入依賴的package包/類
public ObjectData(Vec3 position, Quat orientation) {

        this.position = position;
        this.orientation = orientation;
    }
 
開發者ID:java-graphics,項目名稱:java-unofficial-opengl-SDK,代碼行數:6,代碼來源:ObjectData.java

示例11: orientation

import glm.quat.Quat; //導入依賴的package包/類
public Quat orientation() {
    return orientation;
}
 
開發者ID:java-graphics,項目名稱:java-unofficial-opengl-SDK,代碼行數:4,代碼來源:ObjectData.java

示例12: calcRotationQuat

import glm.quat.Quat; //導入依賴的package包/類
private Quat calcRotationQuat(int axis, float degAngle) {
    return Glm.angleAxis_(degAngle, axisVectors[axis]);
}
 
開發者ID:java-graphics,項目名稱:java-unofficial-opengl-SDK,代碼行數:4,代碼來源:ObjectPole.java

示例13: rotateWorldDegrees

import glm.quat.Quat; //導入依賴的package包/類
public void rotateWorldDegrees(Quat rot) {
    rotateViewDegrees(rot, false);
}
 
開發者ID:java-graphics,項目名稱:java-unofficial-opengl-SDK,代碼行數:4,代碼來源:ObjectPole.java

示例14: rotateLocalDegrees

import glm.quat.Quat; //導入依賴的package包/類
public void rotateLocalDegrees(Quat rot) {
    rotateLocalDegrees(rot, false);
}
 
開發者ID:java-graphics,項目名稱:java-unofficial-opengl-SDK,代碼行數:4,代碼來源:ObjectPole.java

示例15: mouseMove

import glm.quat.Quat; //導入依賴的package包/類
public void mouseMove(MouseEvent mouseEvent) {

        if (isDragging) {

            Vec2i position = new Vec2i(mouseEvent.getX(), mouseEvent.getY());

            Vec2i diff = position.sub_(prevMousePos);

            switch (rotateMode) {

                case RotateMode.DUAL_AXIS:                    
                    Quat rot = calcRotationQuat(Axis.Y, diff.x * rotateScale);
                    rot = calcRotationQuat(Axis.X, diff.y * rotateScale).mul(rot).normalize();
                    rotateViewDegrees(rot);

                    break;

                case RotateMode.BIAXIAL:

                    Vec2i initDiff = position.sub_(startDragMousePos);
                    int axis;
                    float degAngle;
                    if (Math.abs(initDiff.x) > Math.abs(initDiff.y)) {
                        axis = Axis.Y;
                        degAngle = initDiff.x * rotateScale;
                    } else {
                        axis = Axis.X;
                        degAngle = initDiff.y * rotateScale;
                    }

                    rot = calcRotationQuat(axis, degAngle);
                    rotateViewDegrees(rot, true);

                    break;

                case RotateMode.SPIN:

                    rotateViewDegrees(calcRotationQuat(Axis.Z, -diff.x * rotateScale));

                    break;
            }

            prevMousePos = position;
        }
    }
 
開發者ID:java-graphics,項目名稱:java-unofficial-opengl-SDK,代碼行數:46,代碼來源:ObjectPole.java


注:本文中的glm.quat.Quat類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。