|
JClass 4.5.0 API Documentation |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--com.klg.jclass.swing.gauge.GaugeUtil
This class contains common methods for performing linear transformations.
Constructor Summary | |
GaugeUtil()
|
Method Summary | |
static double |
angleToValue(double angle,
double startValue,
double stopValue,
double startAngle,
double stopAngle)
Given an angle, returns the closest scale value. |
static double |
arcAngle(double startAngle,
double stopAngle)
Java uses the notion of startAngle and arcAngle to draw arcs,
so this method returns the arcAngle from startAngle and stopAngle . |
static double |
distanceBetweenAngles(double a1,
double a2)
Returns the difference of two angles. |
static double |
fromRadians(double radians)
Converts radians to degrees. |
static Rectangle |
getExtrema(Polygon p)
Returns a Rectangle , where x = min_x, y = min_y,
width = max_x and height = max_y. |
static double |
normalizeAngle(double angle)
Returns the angle between 0° and 360° corresponding to the inputted angle |
static double |
pointToAngle(double x,
double y,
double x_orig,
double y_orig)
Returns an angle given a point and the origin. |
static Polygon |
rotate(Polygon p,
double degrees)
2D rotation of points. |
static Polygon |
scale(Polygon p,
double xAmount,
double yAmount)
Scales an object. |
static double |
toRadians(double degrees)
Converts degrees to radians. |
static Polygon |
translate(Polygon p,
int xamount,
int yamount)
Translate a 2D polygon. |
static double |
valueToAngle(double value,
double start_value,
double stop_value,
double start_angle,
double stop_angle)
Converts a double value to an angle in degrees. |
Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
Constructor Detail |
public GaugeUtil()
Method Detail |
public static double valueToAngle(double value, double start_value, double stop_value, double start_angle, double stop_angle)
value
- start_value
- stop_value
- start_angle
- stop_angle
- public static double pointToAngle(double x, double y, double x_orig, double y_orig)
x
- y
- x_orig
- y_orig
- public static double angleToValue(double angle, double startValue, double stopValue, double startAngle, double stopAngle)
angle
- An anglestartValue
- The circular scale's start valuestopValue
- The circular scale's stop valuestartAngle
- The circular scale's start anglestopAngle
- The circular scale's stop anglepublic static double distanceBetweenAngles(double a1, double a2)
a1
- An anglea2
- An anglepublic static double arcAngle(double startAngle, double stopAngle)
startAngle
and arcAngle
to draw arcs,
so this method returns the arcAngle
from startAngle
and stopAngle
.startAngle
- stopAngle
- public static double normalizeAngle(double angle)
angle
- Any anglepublic static double toRadians(double degrees)
degrees
- public static double fromRadians(double radians)
radians
- The radians to be converted to degreespublic static Rectangle getExtrema(Polygon p)
Rectangle
, where x = min_x, y = min_y,
width = max_x and height = max_y.p
- The input polygonpublic static Polygon scale(Polygon p, double xAmount, double yAmount)
p
- the input polygonxAmount
- the amount by which the width is to be scaledyAmount
- the amount by which the height is to be scaledpublic static Polygon rotate(Polygon p, double degrees)
p
- The input polygondegrees
- The number of degrees to rotate this polygonpublic static Polygon translate(Polygon p, int xamount, int yamount)
p
- The input polygonxamount
- The amount by which the polygon will be shifted
horizontallyyamount
- The amount by which the polygon will be shifted vertically
|
Copyright© 1999-2000 KL Group Inc. All rights reserved. |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |