You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Gilles (JIRA)" <ji...@apache.org> on 2011/04/22 11:52:05 UTC
[jira] [Created] (MATH-561) Analogous to "normalizeAngle" in
"MathUtils"
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
[jira] [Resolved] (MATH-561) Analogous to "normalizeAngle" in
"MathUtils"
Posted by "Gilles (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/MATH-561?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Gilles resolved MATH-561.
-------------------------
Resolution: Fixed
Revision 1097088.
[The image interval is actually [0, period); not [offset, period+offset), as first proposed.]
> 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