本文整理汇总了Java中net.jafama.FastMath.asin方法的典型用法代码示例。如果您正苦于以下问题:Java FastMath.asin方法的具体用法?Java FastMath.asin怎么用?Java FastMath.asin使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类net.jafama.FastMath
的用法示例。
在下文中一共展示了FastMath.asin方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: transformInverse
import net.jafama.FastMath; //导入方法依赖的package包/类
@Override
protected void transformInverse(int x, int y, float[] out) {
float dx = x - icentreX;
float dy = y - icentreY;
float x2 = dx * dx;
float y2 = dy * dy;
if (y2 >= (b2 - (b2 * x2) / a2)) {
out[0] = x;
out[1] = y;
} else {
float rRefraction = 1.0f / refractionIndex;
float z = (float) Math.sqrt((1.0f - x2 / a2 - y2 / b2) * (a * b));
float z2 = z * z;
float xAngle = (float) FastMath.acos(dx / Math.sqrt(x2 + z2));
float angle1 = ImageMath.HALF_PI - xAngle;
float angle2 = (float) FastMath.asin(FastMath.sin(angle1) * rRefraction);
angle2 = ImageMath.HALF_PI - xAngle - angle2;
out[0] = x - (float) FastMath.tan(angle2) * z;
float yAngle = (float) FastMath.acos(dy / Math.sqrt(y2 + z2));
angle1 = ImageMath.HALF_PI - yAngle;
angle2 = (float) FastMath.asin(FastMath.sin(angle1) * rRefraction);
angle2 = ImageMath.HALF_PI - yAngle - angle2;
out[1] = y - (float)FastMath.tan(angle2)*z;
}
}
示例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]));
}