本文整理汇总了Java中net.jafama.FastMath.atan方法的典型用法代码示例。如果您正苦于以下问题:Java FastMath.atan方法的具体用法?Java FastMath.atan怎么用?Java FastMath.atan使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类net.jafama.FastMath
的用法示例。
在下文中一共展示了FastMath.atan方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createArmSegments
import net.jafama.FastMath; //导入方法依赖的package包/类
public void createArmSegments() {
this.curveA = CalcUtil.randomize(this.curveAMu, this.curveASigma);
this.maxLengthY = CalcUtil.randomize(this.maxLengthYMu, this.maxLengthYSigma);
this.armSegments = new LinkedList<>();
for (float dy = 0; dy <= this.maxLengthY; dy += RocketBoss.ARM_SEGMENT_DIST) {
// calculate angle
float dxdy = this.fndy(dy);
float angle = (float) (2.0 * FastMath.atan(dxdy));
ArmSegment segment = new ArmSegment(this, this.fnVec(dy), angle);
this.armSegments.add(segment);
}
}
示例2: transformInverse
import net.jafama.FastMath; //导入方法依赖的package包/类
@Override
protected void transformInverse(int x, int y, float[] out) {
float dx = x - cx;
float dy = y - cy;
double r = Math.sqrt(dx * dx + dy * dy);
double theta = FastMath.atan2(dy, dx) + Math.PI;
double rd = 0.45 * Math.min(srcWidth, srcHeight);
// System.out.println(String.format("Sphere3DFilter::transformInverse: r = %.2f, rd = %.2f", r, rd));
if (r > rd) {
out[0] = -1;
out[1] = -1;
return;
}
double sa = FastMath.sin(alpha);
double sb = FastMath.sin(beta);
double ca = FastMath.cos(alpha);
double cb = FastMath.cos(beta);
double phi = FastMath.acos(r / rd);
double x0 = FastMath.cos(theta) * FastMath.cos(phi);
double y0 = FastMath.sin(theta) * FastMath.cos(phi);
double z0 = FastMath.sin(phi);
double x1 = ca * x0 + sa * y0;
double z1 = -sa * -sb * x0 + ca * -sb * y0 + cb * z0;
double y1 = cb * -sa * x0 + cb * ca * y0 + sb * z0;
// double theta1 = Math.atan(-x1 / y1) + (y1 > 0 ? Math.PI / 2 : 3 * Math.PI / 2);
double theta1 = FastMath.atan(-x1 / y1);
double phi1 = FastMath.asin(z1);
int X = srcWidth / 2;
int Y = srcHeight / 2;
// out[0] = Math.abs((float) (((theta1 * 2 + gamma) % (2 * Math.PI) - Math.PI) / Math.PI * X));
// out[1] = Math.abs((float) (-phi1 / (Math.PI / 2) * Y));
out[0] = (float) ((((((theta1 * 2) + gamma) % (2 * Math.PI)) - Math.PI) / Math.PI) * X);
out[1] = (float) (-phi1 / (Math.PI / 2) * Y);
// System.out.println(String.format("Sphere3DFilter::transformInverse: out[0] = %.2f, out[1] = %.2f", out[0], out[1]));
}