# Javadoc on fastmath asin and acos

I think (math isn’t my strong point) that the javadoc for FastMath#acos and FastMath#asin is a bit misleading. Shouldn’t the return value be an angle and the argument a value?

Also, I added some docs for FastMath#sin and FastMath#cos since they were lacking.

[patch]

# This patch file was generated by NetBeans IDE

Index: src/core/com/jme3/math/FastMath.java

— src/core/com/jme3/math/FastMath.java Base (BASE)

+++ src/core/com/jme3/math/FastMath.java Locally Modified (Based On LOCAL)

@@ -410,12 +410,12 @@

}

/**

• ``````* Returns the arc cosine of an angle given in radians.&lt;br&gt;<br />
``````
• ``````* Returns the arc cosine of a value.&lt;br&gt;<br />
``````
• Special cases:
• <ul><li>If fValue is smaller than -1, then the result is PI.
• <li>If the argument is greater than 1, then the result is 0.</ul>
• ``````* @param fValue The angle, in radians.<br />
``````
• ``````* @return fValue's acos<br />
``````
• ``````* @param fValue The value to arc cosine.<br />
``````
• ``````* @return The angle, in radians.<br />
``````
• @see java.lang.Math#acos(double)

*/

public static float acos(float fValue) {

@@ -431,12 +431,12 @@

}

/**
• ``````* Returns the arc sine of an angle given in radians.&lt;br&gt;<br />
``````
• ``````* Returns the arc sine of a value.&lt;br&gt;<br />
``````
• Special cases:
• <ul><li>If fValue is smaller than -1, then the result is -HALF_PI.
• <li>If the argument is greater than 1, then the result is HALF_PI.</ul>
• ``````* @param fValue The angle, in radians.<br />
``````
• ``````* @return fValue's asin<br />
``````
• ``````* @param fValue The value to arc sine.<br />
``````
• ``````* @return the angle in radians.<br />
``````
• @see java.lang.Math#asin(double)

*/

public static float asin(float fValue) {

@@ -504,12 +504,12 @@

}

/**
• ``````* Returns sine of a value.<br />
``````
• ``````* Returns sine of an angle.<br />
``````

*

• note: code from wiki posting on java.net by jeffpk

*
• @param fValue
• ``````*            The value to sine, in radians.<br />
``````
• ``````*            The angle to sine, in radians.<br />
``````
• @return The sine of fValue.
• @see java.lang.Math#sin(double)

*/

@@ -523,10 +523,10 @@

}

/**
• ``````* Returns cos of a value.<br />
``````
• ``````* Returns cos of an angle.<br />
``````

*

• @param fValue
• ``````*            The value to cosine, in radians.<br />
``````
• ``````*            The angle to cosine, in radians.<br />
``````
• @return The cosine of fValue.
• @see java.lang.Math#cos(double)

*/

@@ -534,10 +534,22 @@

return sin2(fValue + HALF_PI);

}

• /**
• ``````* Returns cosine of an angle. Direct call to java.lang.Math<br />
``````
• ``````* @see Math#cos(double)<br />
``````
• ``````* @param v The angle to cosine.<br />
``````
• ``````* @return  the cosine of the angle.<br />
``````
• ``````*/<br />
``````

public static float cos(float v) {

return (float) Math.cos(v);

}

• /**
• ``````* Returns the sine of an angle. Direct call to java.lang.Math<br />
``````
• ``````* @see Math#sin(double)<br />
``````
• ``````* @param v The angle to sine.<br />
``````
• ``````* @return the sine of the angle.<br />
``````
• ``````*/<br />
``````

public static float sin(float v) {

return (float) Math.sin(v);

}

[/patch]

2 Likes