 # add degree-based trigonometric methods to the Math class

#### Details

• Type: Enhancement
• Status: Closed
• Priority: P4
• Resolution: Won't Fix
• Affects Version/s: 1.1
• Fix Version/s: None
• Component/s:
• Labels:
• Subcomponent:
• CPU:
generic
• OS:
generic

#### Description

The trigonometric methods on the java.lang.Math class which take
an angle measured in radians are fairly standard for a math
package.

Unfortunately, some common angles, such as multiples of 90 degrees
other than 0.0, cannot be represented exactly in radians. Also,
entering constant values for such angles in source code is not
straight-forward since the developer must enter something like
"Math.PI / 2.0" for 90 degrees, which is not as straight-forward
or easy to remember for casual developers than the equivalent
angle notated in degrees. Additionally, the inability to represent
multiples of 90 degrees in radian form means that methods such as
sin() and cos() can never return exactly 0.0 for angles other than
0.0 since they can never be given an angle which exactly warrants

Since multiples of 90 degrees (and other simple angles such as 30,
45, and 60 degrees) are fairly common in many mid-level graphics
programs, it would be nice if we could make such programming both
easier and more accurate by providing trigonometric functions which
operate on angle arguments measured in degrees.

A suggestion would be to add the following methods:

Math.sinDegrees(double degrees);
Math.cosDegrees(double degrees);
Math.tanDegrees(double degrees);
Math.asinDegrees(double v); // return value in degrees
Math.acosDegrees(double v); // return value in degrees
Math.atanDegrees(double v); // return value in degrees
Math.atan2Degrees(double v); // return value in degrees

Note that the name "atan2Degrees" could be confusing, somehow
implying that the function converts "something" to degrees
which is a common usage for the numeral 2 embedded in the
middle of a function name. I don't think we use that convention
in Java code anywhere, but I've seen it in other code bases.
On the other hand, other than a semantic jarring if one reads
the name of the method out loud, the meaning of such a method
should be readily obvious to those familiar with standard
trigonometric packages.

#### People

• Assignee: Joe Darcy
Reporter: Jim Graham