本文整理匯總了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);
}
示例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);
}
}
});
}
示例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;
}
示例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);
}