Analogous to "normalizeAngle" in "MathUtils"
--------------------------------------------

                 Key: MATH-561
                 URL: https://issues.apache.org/jira/browse/MATH-561
             Project: Commons Math
          Issue Type: Wish
            Reporter: Gilles
            Assignee: Gilles
            Priority: Minor
             Fix For: 3.0


I'd like to create a "reduce" method in "MathUtils", similar to 
"normalizeAngle" but more general:
{code}
/**
 * Reduce to the primary interval {@code [offset offset+period)}.
 *
 * @param a Value to reduce.
 * @param period Period.
 * @param offset Offset.
 */
public static double reduce(double a,
                            double period,
                            double offset) {
    return a - period * FastMath.floor((a - offset) / period);
}
{code}
Thus the "period" parameter the is not fixed to 2π, as is the case in 
"normalizeAngle".


--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

Reply via email to