• 如果您觉得本站非常有看点,那么赶紧使用Ctrl+D 收藏吧

Java Quat类的典型用法和代码示例

java 2次浏览

本文整理汇总了Java中codechicken.lib.vec.Quat的典型用法代码示例。如果您正苦于以下问题:Java Quat类的具体用法?Java Quat怎么用?Java Quat使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。

Quat类属于codechicken.lib.vec包,在下文中一共展示了Quat类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: EnderDyeButton

点赞 3

import codechicken.lib.vec.Quat; //导入依赖的package包/类
public EnderDyeButton(int index) {
    button = index;

    verts = new Vector3[8];
    verts[0] = new Vector3(0, -0.25, -0.0625);
    verts[1] = new Vector3(0.125, -0.25, -0.0625);
    verts[2] = new Vector3(0.125, -0.25, 0);
    verts[3] = new Vector3(0, -0.25, 0);
    verts[4] = new Vector3(0, 0, -0.0625);
    verts[5] = new Vector3(0.125, 0, -0.0625);
    verts[6] = new Vector3(0.125, 0, 0);
    verts[7] = new Vector3(0, 0, 0);

    for (int i = 0; i < 8; i++) {
        verts[i].add(0.25 + 0.1875 * index, -0.375, 0.9375);
    }

    Quat quat2 = Quat.aroundAxis(1, 0, 0, -0.5 * 3.14159);
    for (int i = 0; i < 8; i++) {
        quat2.rotate(verts[i]);
    }
}
 

开发者ID:TheCBProject,
项目名称:EnderStorage,
代码行数:23,
代码来源:EnderDyeButton.java

示例2: getRotatedAttachment

点赞 2

import codechicken.lib.vec.Quat; //导入依赖的package包/类
public Vector3 getRotatedAttachment()
{
    Vector3 relPos = new Vector3(attachedX, attachedY, attachedZ);
    Quat rot = Quat.aroundAxis(0, 1, 0, (getEntityRotation()-attachedYaw)*torad);
    rot.rotate(relPos);
    return relPos;
}
 

开发者ID:TheCBProject,
项目名称:WirelessRedstone,
代码行数:8,
代码来源:EntityWirelessTracker.java

示例3: rotate

点赞 2

import codechicken.lib.vec.Quat; //导入依赖的package包/类
/**
 * @param angle in radians
 */
public void rotate(double px, double py, double pz, double ax, double ay, double az, double angle) {
    Quat quat = Quat.aroundAxis(ax, ay, az, angle);
    for (int i = 0; i < 8; i++) {
        verts[i].add(-px, -py, -pz);
        quat.rotate(verts[i]);
        verts[i].add(px, py, pz);
    }
}
 

开发者ID:TheCBProject,
项目名称:EnderStorage,
代码行数:12,
代码来源:EnderDyeButton.java

示例4: generateIcosahedron

点赞 2

import codechicken.lib.vec.Quat; //导入依赖的package包/类
private static void generateIcosahedron() {
    Vector3[] verts = new Vector3[12];

    verts[0] = new Vector3(-1, phi, 0);
    verts[1] = new Vector3(1, phi, 0);
    verts[2] = new Vector3(1, -phi, 0);
    verts[3] = new Vector3(-1, -phi, 0);

    verts[4] = new Vector3(0, -1, phi);
    verts[5] = new Vector3(0, 1, phi);
    verts[6] = new Vector3(0, 1, -phi);
    verts[7] = new Vector3(0, -1, -phi);

    verts[8] = new Vector3(phi, 0, -1);
    verts[9] = new Vector3(phi, 0, 1);
    verts[10] = new Vector3(-phi, 0, 1);
    verts[11] = new Vector3(-phi, 0, -1);

    Quat quat = Quat.aroundAxis(0, 0, 1, Math.atan(1 / phi));
    for (Vector3 vec : verts) {
        quat.rotate(vec);
    }

    icosahedron4 = CCModel.newModel(4, 60);
    icosahedron7 = CCModel.newModel(7, 80);

    i = 0;
    //top
    addIcosahedronTriangle(verts[1], 0.5, 0, verts[0], 0, 0.25, verts[5], 1, 0.25);
    addIcosahedronTriangle(verts[1], 0.5, 0, verts[5], 0, 0.25, verts[9], 1, 0.25);
    addIcosahedronTriangle(verts[1], 0.5, 0, verts[9], 0, 0.25, verts[8], 1, 0.25);
    addIcosahedronTriangle(verts[1], 0.5, 0, verts[8], 0, 0.25, verts[6], 1, 0.25);
    addIcosahedronTriangle(verts[1], 0.5, 0, verts[6], 0, 0.25, verts[0], 1, 0.25);
    //centre 1vert top
    addIcosahedronTriangle(verts[0], 0.5, 0.25, verts[11], 0, 0.75, verts[10], 1, 0.75);
    addIcosahedronTriangle(verts[5], 0.5, 0.25, verts[10], 0, 0.75, verts[4], 1, 0.75);
    addIcosahedronTriangle(verts[9], 0.5, 0.25, verts[4], 0, 0.75, verts[2], 1, 0.75);
    addIcosahedronTriangle(verts[8], 0.5, 0.25, verts[2], 0, 0.75, verts[7], 1, 0.75);
    addIcosahedronTriangle(verts[6], 0.5, 0.25, verts[7], 0, 0.75, verts[11], 1, 0.75);
    //centre 1vert bottom
    addIcosahedronTriangle(verts[2], 0.5, 0.75, verts[8], 0, 0.25, verts[9], 1, 0.25);
    addIcosahedronTriangle(verts[7], 0.5, 0.75, verts[6], 0, 0.25, verts[8], 1, 0.25);
    addIcosahedronTriangle(verts[11], 0.5, 0.75, verts[0], 0, 0.25, verts[6], 1, 0.25);
    addIcosahedronTriangle(verts[10], 0.5, 0.75, verts[5], 0, 0.25, verts[0], 1, 0.25);
    addIcosahedronTriangle(verts[4], 0.5, 0.75, verts[9], 0, 0.25, verts[5], 1, 0.25);
    //bottom
    addIcosahedronTriangle(verts[3], 0.5, 1, verts[2], 0, 0.75, verts[4], 1, 0.75);
    addIcosahedronTriangle(verts[3], 0.5, 1, verts[7], 0, 0.75, verts[2], 1, 0.75);
    addIcosahedronTriangle(verts[3], 0.5, 1, verts[11], 0, 0.75, verts[7], 1, 0.75);
    addIcosahedronTriangle(verts[3], 0.5, 1, verts[10], 0, 0.75, verts[11], 1, 0.75);
    addIcosahedronTriangle(verts[3], 0.5, 1, verts[4], 0, 0.75, verts[10], 1, 0.75);

    icosahedron4.computeNormals().smoothNormals();
    icosahedron7.computeNormals().smoothNormals();
}
 

开发者ID:TheCBProject,
项目名称:CodeChickenLib,
代码行数:56,
代码来源:CCModelLibrary.java


版权声明:本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系管理员进行删除。
喜欢 (0)