当前位置: 首页>>代码示例>>Java>>正文


Java FastMath.atan2方法代码示例

本文整理汇总了Java中org.apache.commons.math.util.FastMath.atan2方法的典型用法代码示例。如果您正苦于以下问题:Java FastMath.atan2方法的具体用法?Java FastMath.atan2怎么用?Java FastMath.atan2使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.commons.math.util.FastMath的用法示例。


在下文中一共展示了FastMath.atan2方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: guessPhi

import org.apache.commons.math.util.FastMath; //导入方法依赖的package包/类
/**
 * Estimate a first guess of the phase.
 */
private void guessPhi() {
    // initialize the means
    double fcMean = 0;
    double fsMean = 0;

    double currentX = observations[0].getX();
    double currentY = observations[0].getY();
    for (int i = 1; i < observations.length; ++i) {
        // one step forward
        final double previousX = currentX;
        final double previousY = currentY;
        currentX = observations[i].getX();
        currentY = observations[i].getY();
        final double currentYPrime = (currentY - previousY) / (currentX - previousX);

        double omegaX = omega * currentX;
        double cosine = FastMath.cos(omegaX);
        double sine = FastMath.sin(omegaX);
        fcMean += omega * currentY * cosine - currentYPrime * sine;
        fsMean += omega * currentY * sine + currentYPrime * cosine;
    }

    phi = FastMath.atan2(-fsMean, fcMean);
}
 
开发者ID:SpoonLabs,项目名称:astor,代码行数:28,代码来源:HarmonicFitter.java

示例2: reset

import org.apache.commons.math.util.FastMath; //导入方法依赖的package包/类
/** Reset the instance as if built from two points.
 * <p>The line is oriented from p1 to p2</p>
 * @param p1 first point
 * @param p2 second point
 */
public void reset(final Vector2D p1, final Vector2D p2) {
    final double dx = p2.getX() - p1.getX();
    final double dy = p2.getY() - p1.getY();
    final double d = FastMath.hypot(dx, dy);
    if (d == 0.0) {
        angle        = 0.0;
        cos          = 1.0;
        sin          = 0.0;
        originOffset = p1.getY();
    } else {
        angle        = FastMath.PI + FastMath.atan2(-dy, -dx);
        cos          = FastMath.cos(angle);
        sin          = FastMath.sin(angle);
        originOffset = (p2.getX() * p1.getY() - p1.getX() * p2.getY()) / d;
    }
}
 
开发者ID:SpoonLabs,项目名称:astor,代码行数:22,代码来源:Line.java

示例3: apply

import org.apache.commons.math.util.FastMath; //导入方法依赖的package包/类
/** {@inheritDoc} */
public Line apply(final Hyperplane<Euclidean2D> hyperplane) {
    final Line   line    = (Line) hyperplane;
    final double rOffset = c1X * line.cos + c1Y * line.sin + c11 * line.originOffset;
    final double rCos    = cXX * line.cos + cXY * line.sin;
    final double rSin    = cYX * line.cos + cYY * line.sin;
    final double inv     = 1.0 / FastMath.sqrt(rSin * rSin + rCos * rCos);
    return new Line(FastMath.PI + FastMath.atan2(-rSin, -rCos),
                    inv * rCos, inv * rSin,
                    inv * rOffset);
}
 
开发者ID:SpoonLabs,项目名称:astor,代码行数:12,代码来源:Line.java

示例4: value

import org.apache.commons.math.util.FastMath; //导入方法依赖的package包/类
/** {@inheritDoc} */
public double value(double x, double y) {
    return FastMath.atan2(x, y);
}
 
开发者ID:SpoonLabs,项目名称:astor,代码行数:5,代码来源:Atan2.java

示例5: getAlpha

import org.apache.commons.math.util.FastMath; //导入方法依赖的package包/类
/** Get the azimuth of the vector.
 * @return azimuth (&alpha;) of the vector, between -&pi; and +&pi;
 * @see #Vector3D(double, double)
 */
public double getAlpha() {
  return FastMath.atan2(y, x);
}
 
开发者ID:SpoonLabs,项目名称:astor,代码行数:8,代码来源:Vector3D.java

示例6: getArgument

import org.apache.commons.math.util.FastMath; //导入方法依赖的package包/类
/**
 * <p>Compute the argument of this complex number.
 * </p>
 * <p>The argument is the angle phi between the positive real axis and the point
 * representing this number in the complex plane. The value returned is between -PI (not inclusive)
 * and PI (inclusive), with negative values returned for numbers with negative imaginary parts.
 * </p>
 * <p>If either real or imaginary part (or both) is NaN, NaN is returned.  Infinite parts are handled
 * as java.Math.atan2 handles them, essentially treating finite parts as zero in the presence of
 * an infinite coordinate and returning a multiple of pi/4 depending on the signs of the infinite
 * parts.  See the javadoc for java.Math.atan2 for full details.</p>
 *
 * @return the argument of this complex number
 */
public double getArgument() {
    return FastMath.atan2(getImaginary(), getReal());
}
 
开发者ID:SpoonLabs,项目名称:astor,代码行数:18,代码来源:Complex.java

示例7: getAlpha

import org.apache.commons.math.util.FastMath; //导入方法依赖的package包/类
/** Get the azimuth of the vector.
 * @return azimuth (&alpha;) of the vector, between -&pi; and +&pi;
 * @see #Vector3D(double, double)
 */
public double getAlpha() {
    return FastMath.atan2(y, x);
}
 
开发者ID:SpoonLabs,项目名称:astor,代码行数:8,代码来源:Vector3D.java

示例8: getArgument

import org.apache.commons.math.util.FastMath; //导入方法依赖的package包/类
/**
 * Compute the argument of this complex number.
 * The argument is the angle phi between the positive real axis and
 * the point representing this number in the complex plane.
 * The value returned is between -PI (not inclusive)
 * and PI (inclusive), with negative values returned for numbers with
 * negative imaginary parts.
 * <br/>
 * If either real or imaginary part (or both) is NaN, NaN is returned.
 * Infinite parts are handled as {@code Math.atan2} handles them,
 * essentially treating finite parts as zero in the presence of an
 * infinite coordinate and returning a multiple of pi/4 depending on
 * the signs of the infinite parts.
 * See the javadoc for {@code Math.atan2} for full details.
 *
 * @return the argument of {@code this}.
 */
public double getArgument() {
    return FastMath.atan2(getImaginary(), getReal());
}
 
开发者ID:SpoonLabs,项目名称:astor,代码行数:21,代码来源:Complex.java


注:本文中的org.apache.commons.math.util.FastMath.atan2方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。