Class GMath

This class defines a variety of static mathematical methods that are useful for the graphics library. Note: The GMath class is not yet implemented.


Method Summary
Math.angle(x0, y0, x1, y1)
Computes the angle in degrees formed by a line segment from the point (x0y0) and (x1y1).
Math.cosDegrees(theta)
Returns the trigonometric cosine of its argument where angle is expressed in degrees.
Math.distance(x, y)
Computes the distance between the origin and the point (xy).
Math.distance(x0, y0, x1, y1)
Computes the distance between the points (x0y0) and (x1y1).
Math.round(n)
Rounds a double value to the nearest int.
Math.sinDegrees(theta)
Returns the trigonometric sine of its argument where angle is expressed in degrees.
Math.tanDegrees(theta)
Returns the trigonometric tangent of its argument where angle is expressed in degrees.
Math.toDegrees(radians)
Converts an angle from radians to degrees.
Math.toRadians(degrees)
Converts an angle from degrees to radians.
 

Method Detail

Math.angle(x0, y0, x1, y1)

Computes the angle in degrees formed by a line segment from the point (x0y0) and (x1y1).
Usage: theta = Math.angle(x0, y0, x1, y1) 
Parameters: 
x0  The x-coordinate of one point
y0  The y-coordinate of that point
x1  The x-coordinate of the other point
y1  The y-coordinate of that point
Returns: The angle formed by the line segment from (x0y0) to (x1y1)
 


Math.cosDegrees(theta)

Returns the trigonometric cosine of its argument where angle is expressed in degrees.
Usage: c = Math.cosDegrees(angle) 
Parameter: 
angle  An angle measured in degrees
Returns: The trigonometric cosine of the angle
 


Math.distance(x, y)

Computes the distance between the origin and the point (xy).
Usage: d = Math.distance(x, y) 
Parameters: 
 The x-coordinate of the point
 The y-coordinate of the point
Returns: The distance from the origin to the point (xy)
 


Math.distance(x0, y0, x1, y1)

Computes the distance between the points (x0y0) and (x1y1).
Usage: d = Math.distance(x0, y0, x1, y1) 
Parameters: 
x0  The x-coordinate of one point
y0  The y-coordinate of that point
x1  The x-coordinate of the other point
y1  The y-coordinate of that point
Returns: The distance between the points (x0y0) and (x1y1)
 


Math.round(n)

Rounds a double value to the nearest int.
Usage: n = Math.round(x) 
Parameter: 
 A double value
Returns: The nearest int value
 


Math.sinDegrees(theta)

Returns the trigonometric sine of its argument where angle is expressed in degrees.
Usage: s = Math.sinDegrees(angle) 
Parameter: 
angle  An angle measured in degrees
Returns: The trigonometric sine of the angle
 


Math.tanDegrees(theta)

Returns the trigonometric tangent of its argument where angle is expressed in degrees.
Usage: t = Math.tanDegrees(angle) 
Parameter: 
angle  An angle measured in degrees
Returns: The trigonometric tangent of the angle
 


Math.toDegrees(radians)

Converts an angle from radians to degrees. This method is defined in the Math class, but was added only in JDK1.2, which is not supported in all browsers.
Usage: degrees = Math.toDegrees(radians) 
Parameter: 
radians  An angle measured in radians
Returns: The equivalent angle in degrees
 


Math.toRadians(degrees)

Converts an angle from degrees to radians. This method is defined in the Math class, but was added only in JDK1.2, which is not supported in all browsers.
Usage: radians = Math.toRadians(degrees) 
Parameter: 
degrees  An angle measured in degrees
Returns: The equivalent angle in radians