|
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)
x0 , y0 ) and
(x1 , y1 ). |
|
Math.cosDegrees(theta)
angle
is expressed in degrees. |
|
Math.distance(x, y)
x , y ). |
|
Math.distance(x0, y0, x1, y1)
x0 , y0 ) and
(x1 , y1 ). |
|
Math.round(n)
double value to the nearest int . |
|
Math.sinDegrees(theta)
angle
is expressed in degrees. |
|
Math.tanDegrees(theta)
angle
is expressed in degrees. |
|
Math.toDegrees(radians)
|
|
Math.toRadians(degrees)
|
Method Detail |
---|
Math.angle(x0, y0, x1, y1)
x0
, y0
) and
(x1
, y1
).
Usage: | theta = Math.angle(x0, y0, x1, y1) | ||||||||
Parameters: |
| ||||||||
Returns: | The angle formed by the line segment from
(x0 , y0 ) to
(x1 , y1 )
|
Math.cosDegrees(theta)
angle
is expressed in degrees.
Usage: | c = Math.cosDegrees(angle) | ||
Parameter: |
| ||
Returns: | The trigonometric cosine of the angle |
Math.distance(x, y)
x
, y
).
Usage: | d = Math.distance(x, y) | ||||
Parameters: |
| ||||
Returns: | The distance from the origin to the point
(x , y )
|
Math.distance(x0, y0, x1, y1)
x0
, y0
) and
(x1
, y1
).
Usage: | d = Math.distance(x0, y0, x1, y1) | ||||||||
Parameters: |
| ||||||||
Returns: | The distance between the points
(x0 , y0 ) and
(x1 , y1 )
|
Math.round(n)
double
value to the nearest int
.
Usage: | n = Math.round(x) | ||
Parameter: |
| ||
Returns: | The nearest int value
|
Math.sinDegrees(theta)
angle
is expressed in degrees.
Usage: | s = Math.sinDegrees(angle) | ||
Parameter: |
| ||
Returns: | The trigonometric sine of the angle |
Math.tanDegrees(theta)
angle
is expressed in degrees.
Usage: | t = Math.tanDegrees(angle) | ||
Parameter: |
| ||
Returns: | The trigonometric tangent of the angle |
Math.toDegrees(radians)
Math
class, but was added only in JDK1.2, which is not
supported in all browsers.
Usage: | degrees = Math.toDegrees(radians) | ||
Parameter: |
| ||
Returns: | The equivalent angle in degrees |
Math.toRadians(degrees)
Math
class, but was added only in JDK1.2, which is not
supported in all browsers.
Usage: | radians = Math.toRadians(degrees) | ||
Parameter: |
| ||
Returns: | The equivalent angle in radians |
|