Reuse constant defined in "Commons Numbers".
This commit is contained in:
parent
4bb1787631
commit
9087575eec
|
@ -17,7 +17,7 @@
|
|||
package org.apache.commons.math4.legacy.analysis.interpolation;
|
||||
|
||||
import org.apache.commons.math4.legacy.util.FastMath;
|
||||
import org.apache.commons.math4.legacy.util.MathUtils;
|
||||
import org.apache.commons.numbers.angle.PlaneAngleRadians;
|
||||
|
||||
/**
|
||||
* Utility class for the {@link MicrosphereProjectionInterpolator} algorithm.
|
||||
|
@ -58,7 +58,7 @@ public class InterpolatingMicrosphere2D extends InterpolatingMicrosphere {
|
|||
|
||||
// Generate the microsphere normals.
|
||||
for (int i = 0; i < size; i++) {
|
||||
final double angle = i * MathUtils.TWO_PI / size;
|
||||
final double angle = i * PlaneAngleRadians.TWO_PI / size;
|
||||
|
||||
add(new double[] { FastMath.cos(angle),
|
||||
FastMath.sin(angle) },
|
||||
|
|
|
@ -27,12 +27,6 @@ import org.apache.commons.math4.legacy.exception.util.LocalizedFormats;
|
|||
*
|
||||
*/
|
||||
public final class MathUtils {
|
||||
/**
|
||||
* \(2\pi\)
|
||||
* @since 2.1
|
||||
*/
|
||||
public static final double TWO_PI = 2 * FastMath.PI;
|
||||
|
||||
/**
|
||||
* \(\pi^2\)
|
||||
* @since 3.4
|
||||
|
|
|
@ -21,7 +21,7 @@ import java.util.ArrayList;
|
|||
import org.apache.commons.math4.legacy.analysis.MultivariateMatrixFunction;
|
||||
import org.apache.commons.math4.legacy.analysis.MultivariateVectorFunction;
|
||||
import org.apache.commons.math4.legacy.util.FastMath;
|
||||
import org.apache.commons.math4.legacy.util.MathUtils;
|
||||
import org.apache.commons.numbers.angle.PlaneAngleRadians;
|
||||
|
||||
/**
|
||||
* Class that models a circle.
|
||||
|
@ -111,7 +111,7 @@ class CircleProblem {
|
|||
|
||||
final double[] model = new double[points.size() * 2];
|
||||
|
||||
final double deltaTheta = MathUtils.TWO_PI / resolution;
|
||||
final double deltaTheta = PlaneAngleRadians.TWO_PI / resolution;
|
||||
for (int i = 0; i < points.size(); i++) {
|
||||
final double[] p = points.get(i);
|
||||
final double px = p[0];
|
||||
|
@ -124,7 +124,7 @@ class CircleProblem {
|
|||
// Find the angle for which the circle passes closest to the
|
||||
// current point (using a resolution of 100 points along the
|
||||
// circumference).
|
||||
for (double theta = 0; theta <= MathUtils.TWO_PI; theta += deltaTheta) {
|
||||
for (double theta = 0; theta <= PlaneAngleRadians.TWO_PI; theta += deltaTheta) {
|
||||
final double currentX = cx + r * FastMath.cos(theta);
|
||||
final double currentY = cy + r * FastMath.sin(theta);
|
||||
final double dX = currentX - px;
|
||||
|
|
|
@ -23,7 +23,7 @@ import org.apache.commons.statistics.distribution.UniformContinuousDistribution;
|
|||
import org.apache.commons.rng.UniformRandomProvider;
|
||||
import org.apache.commons.rng.simple.RandomSource;
|
||||
import org.apache.commons.math4.legacy.util.FastMath;
|
||||
import org.apache.commons.math4.legacy.util.MathUtils;
|
||||
import org.apache.commons.numbers.angle.PlaneAngleRadians;
|
||||
|
||||
/**
|
||||
* Factory for generating a cloud of points that approximate a circle.
|
||||
|
@ -56,7 +56,7 @@ public class RandomCirclePointGenerator {
|
|||
this.radius = radius;
|
||||
cX = new NormalDistribution(x, xSigma).createSampler(rng);
|
||||
cY = new NormalDistribution(y, ySigma).createSampler(rng);
|
||||
tP = new UniformContinuousDistribution(0, MathUtils.TWO_PI).createSampler(rng);
|
||||
tP = new UniformContinuousDistribution(0, PlaneAngleRadians.TWO_PI).createSampler(rng);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in New Issue