Java Code Examples for org.apache.commons.math3.util.MathUtils#normalizeAngle()

The following examples show how to use org.apache.commons.math3.util.MathUtils#normalizeAngle() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: NPEfix_00166_t.java    From coming with MIT License 5 votes vote down vote up
/** Reset the instance as if built from a line and an angle.
 * @param p point belonging to the line
 * @param alpha angle of the line with respect to abscissa axis
 */
public void reset(final Vector2D p, final double alpha) {
    this.angle   = MathUtils.normalizeAngle(alpha, FastMath.PI);
    cos          = FastMath.cos(this.angle);
    sin          = FastMath.sin(this.angle);
    originOffset = cos * p.getY() - sin * p.getX();
}
 
Example 2
Source File: NPEfix_00173_t.java    From coming with MIT License 5 votes vote down vote up
/** Reset the instance as if built from a line and an angle.
 * @param p point belonging to the line
 * @param alpha angle of the line with respect to abscissa axis
 */
public void reset(final Vector2D p, final double alpha) {
    this.angle   = MathUtils.normalizeAngle(alpha, FastMath.PI);
    cos          = FastMath.cos(this.angle);
    sin          = FastMath.sin(this.angle);
    originOffset = cos * p.getY() - sin * p.getX();
}
 
Example 3
Source File: NPEfix_00161_t.java    From coming with MIT License 5 votes vote down vote up
/** Copy constructor.
 * <p>The created instance is completely independent from the
 * original instance, it is a deep copy.</p>
 * @param line line to copy
 */
public Line(final Line line) {
    angle        = MathUtils.normalizeAngle(line.angle, FastMath.PI);
    cos          = FastMath.cos(angle);
    sin          = FastMath.sin(angle);
    originOffset = line.originOffset;
}
 
Example 4
Source File: NPEfix_00173_s.java    From coming with MIT License 5 votes vote down vote up
/** Copy constructor.
 * <p>The created instance is completely independent from the
 * original instance, it is a deep copy.</p>
 * @param line line to copy
 */
public Line(final Line line) {
    angle        = MathUtils.normalizeAngle(line.angle, FastMath.PI);
    cos          = FastMath.cos(angle);
    sin          = FastMath.sin(angle);
    originOffset = line.originOffset;
}
 
Example 5
Source File: Line.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
/** Reset the instance as if built from a line and an angle.
 * @param p point belonging to the line
 * @param alpha angle of the line with respect to abscissa axis
 */
public void reset(final Vector2D p, final double alpha) {
    this.angle   = MathUtils.normalizeAngle(alpha, FastMath.PI);
    cos          = FastMath.cos(this.angle);
    sin          = FastMath.sin(this.angle);
    originOffset = cos * p.getY() - sin * p.getX();
}
 
Example 6
Source File: Line.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
/** Copy constructor.
 * <p>The created instance is completely independent from the
 * original instance, it is a deep copy.</p>
 * @param line line to copy
 */
public Line(final Line line) {
    angle        = MathUtils.normalizeAngle(line.angle, FastMath.PI);
    cos          = line.cos;
    sin          = line.sin;
    originOffset = line.originOffset;
    tolerance    = line.tolerance;
    reverse      = null;
}
 
Example 7
Source File: Line.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
/** Reset the instance as if built from a line and an angle.
 * @param p point belonging to the line
 * @param alpha angle of the line with respect to abscissa axis
 */
public void reset(final Vector2D p, final double alpha) {
    this.angle   = MathUtils.normalizeAngle(alpha, FastMath.PI);
    cos          = FastMath.cos(this.angle);
    sin          = FastMath.sin(this.angle);
    originOffset = cos * p.getY() - sin * p.getX();
}
 
Example 8
Source File: NPEfix_00174_t.java    From coming with MIT License 5 votes vote down vote up
/** Copy constructor.
 * <p>The created instance is completely independent from the
 * original instance, it is a deep copy.</p>
 * @param line line to copy
 */
public Line(final Line line) {
    angle        = MathUtils.normalizeAngle(line.angle, FastMath.PI);
    cos          = FastMath.cos(angle);
    sin          = FastMath.sin(angle);
    originOffset = line.originOffset;
}
 
Example 9
Source File: NPEfix_00158_s.java    From coming with MIT License 5 votes vote down vote up
/** Copy constructor.
 * <p>The created instance is completely independent from the
 * original instance, it is a deep copy.</p>
 * @param line line to copy
 */
public Line(final Line line) {
    angle        = MathUtils.normalizeAngle(line.angle, FastMath.PI);
    cos          = FastMath.cos(angle);
    sin          = FastMath.sin(angle);
    originOffset = line.originOffset;
}
 
Example 10
Source File: NPEfix_00167_s.java    From coming with MIT License 5 votes vote down vote up
/** Copy constructor.
 * <p>The created instance is completely independent from the
 * original instance, it is a deep copy.</p>
 * @param line line to copy
 */
public Line(final Line line) {
    angle        = MathUtils.normalizeAngle(line.angle, FastMath.PI);
    cos          = FastMath.cos(angle);
    sin          = FastMath.sin(angle);
    originOffset = line.originOffset;
}
 
Example 11
Source File: NPEfix_00163_t.java    From coming with MIT License 5 votes vote down vote up
/** Reset the instance as if built from a line and an angle.
 * @param p point belonging to the line
 * @param alpha angle of the line with respect to abscissa axis
 */
public void reset(final Vector2D p, final double alpha) {
    this.angle   = MathUtils.normalizeAngle(alpha, FastMath.PI);
    cos          = FastMath.cos(this.angle);
    sin          = FastMath.sin(this.angle);
    originOffset = cos * p.getY() - sin * p.getX();
}
 
Example 12
Source File: NPEfix_00173_s.java    From coming with MIT License 4 votes vote down vote up
/** Set the angle of the line.
 * @param angle new angle of the line with respect to the abscissa axis
 */
public void setAngle(final double angle) {
    this.angle = MathUtils.normalizeAngle(angle, FastMath.PI);
    cos        = FastMath.cos(this.angle);
    sin        = FastMath.sin(this.angle);
}
 
Example 13
Source File: NPEfix_00165_s.java    From coming with MIT License 4 votes vote down vote up
/** Set the angle of the line.
 * @param angle new angle of the line with respect to the abscissa axis
 */
public void setAngle(final double angle) {
    this.angle = MathUtils.normalizeAngle(angle, FastMath.PI);
    cos        = FastMath.cos(this.angle);
    sin        = FastMath.sin(this.angle);
}
 
Example 14
Source File: NPEfix_00169_t.java    From coming with MIT License 4 votes vote down vote up
/** Get the angle of the line.
 * @return the angle of the line with respect to the abscissa axis
 */
public double getAngle() {
    return MathUtils.normalizeAngle(angle, FastMath.PI);
}
 
Example 15
Source File: NPEfix_00169_t.java    From coming with MIT License 4 votes vote down vote up
/** Set the angle of the line.
 * @param angle new angle of the line with respect to the abscissa axis
 */
public void setAngle(final double angle) {
    this.angle = MathUtils.normalizeAngle(angle, FastMath.PI);
    cos        = FastMath.cos(this.angle);
    sin        = FastMath.sin(this.angle);
}
 
Example 16
Source File: NPEfix_00166_t.java    From coming with MIT License 4 votes vote down vote up
/** Set the angle of the line.
 * @param angle new angle of the line with respect to the abscissa axis
 */
public void setAngle(final double angle) {
    this.angle = MathUtils.normalizeAngle(angle, FastMath.PI);
    cos        = FastMath.cos(this.angle);
    sin        = FastMath.sin(this.angle);
}
 
Example 17
Source File: NPEfix_00165_s.java    From coming with MIT License 4 votes vote down vote up
/** Get the angle of the line.
 * @return the angle of the line with respect to the abscissa axis
 */
public double getAngle() {
    return MathUtils.normalizeAngle(angle, FastMath.PI);
}
 
Example 18
Source File: Line.java    From astor with GNU General Public License v2.0 4 votes vote down vote up
/** Get the angle of the line.
 * @return the angle of the line with respect to the abscissa axis
 */
public double getAngle() {
    return MathUtils.normalizeAngle(angle, FastMath.PI);
}
 
Example 19
Source File: Line.java    From astor with GNU General Public License v2.0 4 votes vote down vote up
/** Set the angle of the line.
 * @param angle new angle of the line with respect to the abscissa axis
 */
public void setAngle(final double angle) {
    this.angle = MathUtils.normalizeAngle(angle, FastMath.PI);
    cos        = FastMath.cos(this.angle);
    sin        = FastMath.sin(this.angle);
}
 
Example 20
Source File: S1Point.java    From astor with GNU General Public License v2.0 2 votes vote down vote up
/** Simple constructor.
 * Build a vector from its coordinates
 * @param alpha azimuthal angle \( \alpha \)
 * @see #getAlpha()
 */
public S1Point(final double alpha) {
    this(MathUtils.normalizeAngle(alpha, FastMath.PI),
         new Vector2D(FastMath.cos(alpha), FastMath.sin(alpha)));
}