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


Java FastMath.asin方法代碼示例

本文整理匯總了Java中com.jme3.math.FastMath.asin方法的典型用法代碼示例。如果您正苦於以下問題:Java FastMath.asin方法的具體用法?Java FastMath.asin怎麽用?Java FastMath.asin使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在com.jme3.math.FastMath的用法示例。


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

示例1: updateAngle

import com.jme3.math.FastMath; //導入方法依賴的package包/類
private void updateAngle() {
    Vector3f temp, higher, lower;
    if (point2.y > point1.y) {
        temp = point2;
        higher = point2;
        lower = point1;
    } else {
        temp = point1;
        higher = point1;
        lower = point2;
    }
    temp = temp.clone().setY(lower.y);

    float angle = ((FastMath.asin(temp.distance(higher) / lower.distance(higher))) * FastMath.RAD_TO_DEG);

    angleText.setText(angle + " degrees");
    angleText.setLocalTranslation(new Vector3f().interpolateLocal(point1, point2, 0.5f));

    if (line.getParent() == null) {
        parent.attachChild(line);
        parent.attachChild(angleText);
    }
    ((Line) line.getMesh()).updatePoints(point1, point2);
}
 
開發者ID:jMonkeyEngine,項目名稱:sdk,代碼行數:25,代碼來源:SlopeTerrainTool.java

示例2: doRotateCamera

import com.jme3.math.FastMath; //導入方法依賴的package包/類
protected void doRotateCamera(Vector3f axis, float amount) {
    if (axis.equals(cam.getLeft())) {
        float elevation = -FastMath.asin(cam.getDirection().y);
        amount = Math.min(Math.max(elevation + amount,
                -FastMath.HALF_PI), FastMath.HALF_PI)
                - elevation;
    }
    rot.fromAngleAxis(amount, axis);
    cam.getLocation().subtract(focus, vector);
    rot.mult(vector, vector);
    focus.add(vector, cam.getLocation());

    Quaternion curRot = cam.getRotation().clone();
    cam.setRotation(rot.mult(curRot));
    java.awt.EventQueue.invokeLater(new Runnable() {

        public void run() {

            SceneViewerTopComponent svtc = SceneViewerTopComponent.findInstance();
            if (svtc != null) {
                CameraToolbar.getInstance().switchToView(View.User);
            }

        }
    });
}
 
開發者ID:jMonkeyEngine,項目名稱:sdk,代碼行數:27,代碼來源:AbstractCameraController.java

示例3: doRotateCamera

import com.jme3.math.FastMath; //導入方法依賴的package包/類
public void doRotateCamera(Vector3f axis, float amount) {        
    if (!rotationEnabled || !canRotate) {
        return;
    }
    if (axis.equals(cam.getLeft())) {
        float elevation = -FastMath.asin(cam.getDirection().y);
        amount = Math.min(Math.max(elevation + amount, -FastMath.HALF_PI), FastMath.HALF_PI)
                - elevation;
    }
    rot.fromAngleAxis(amount, axis);
    cam.getLocation().subtract(focus, vector);
    rot.mult(vector, vector);
    focus.add(vector, cam.getLocation());

    Quaternion curRot = cam.getRotation().clone();
    cam.setRotation(rot.mult(curRot));
    
    view = View.user;
}
 
開發者ID:huliqing,項目名稱:LuoYing,代碼行數:20,代碼來源:BestEditCamera.java

示例4: updateAngle

import com.jme3.math.FastMath; //導入方法依賴的package包/類
private void updateAngle() {
    Vector3f temp, higher, lower;
    Vector3f point2 = p2.getTarget().getWorldTranslation();
    Vector3f point1 = p1.getTarget().getWorldTranslation();
    if (point2.y > point1.y) {
        temp = point2;
        higher = point2;
        lower = point1;
    } else {
        temp = point1;
        higher = point1;
        lower = point2;
    }
    temp = temp.clone().setY(lower.y);

    float angle = ((FastMath.asin(temp.distance(higher) / lower.distance(higher))) * FastMath.RAD_TO_DEG);
    angleText.setText(angle + "");
    angleText.setLocalTranslation(new Vector3f().interpolateLocal(point1, point2, 0.5f));

    if (line.getParent() == null) {
        edit.getEditRoot().attachChild(line);
        edit.getEditRoot().attachChild(angleText);
    }
    ((Line) line.getMesh()).updatePoints(point1, point2);
}
 
開發者ID:huliqing,項目名稱:LuoYing,代碼行數:26,代碼來源:SlopeTool.java


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