|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.partnersoft.v3x.graphics.VectorLib
public class VectorLib
A library class with handy static methods for manipulating vector coordinates.
| Field Summary | |
|---|---|
static double |
defaultAccuracy
|
static double |
eighteenthpi
|
static double |
halfpi
|
static double |
pi
|
static double |
threehalfpi
|
static double |
twopi
|
| Constructor Summary | |
|---|---|
VectorLib()
|
|
| Method Summary | |
|---|---|
static double |
angle(Coord2D p1,
Coord2D p2)
Returns the angle of a line. |
static double |
angle(double x1,
double y1,
double x2,
double y2)
Returns the angle of a line. |
static double |
angle(DoublePoint p1,
DoublePoint p2)
Returns the angle of a line. |
static double |
angleBetween(double theta1,
double theta2)
Calculates the shortest difference, in canonical radians, between two angles. |
static Coord2D |
average(Coord2D p1,
Coord2D p2)
Returns the average of two points. |
static double |
calculateAngle(Coord3D junior,
Coord3D pops)
Calculates the angle in radians of the line from pops->junior |
static TurnVector |
calculateVector(Coord3D junior,
Coord3D pops,
Coord3D gramps)
Calculates the turn vector (distance + angle) of the line from pops->junior as compared to the line from gramps->pops. |
static TurnVector |
calculateVectorFromNorth(Coord3D junior,
Coord3D pops)
Calculates the turn vector (distance + angle) of the line from pops->junior as compared to the line from due south to pops. |
static double |
canonicalAngle(double original)
Translates an angle in radians into canonical (0 < theta < 2*pi) |
static boolean |
covers(double x1,
double y1,
double width1,
double height1,
double x2,
double y2,
double width2,
double height2)
Returns true if the first rectangle completely covers the second. |
static double |
deflectionAngle(double original)
Translates an angle in radians into deflection (-pi < theta < pi) |
static double |
degreesToRadians(double degrees)
Translates an angle in degrees to an angle in radians. |
static double |
distance(Coord2D p1,
Coord2D p2)
Returns the distance between two points. |
static double |
distance(Coord3D p1,
Coord3D p2)
Returns the distance between two points. |
static double |
distance(double x1,
double y1,
double x2,
double y2)
Returns the distance between two 2D points. |
static double |
distance(DoublePoint p1,
DoublePoint p2)
Returns the distance between two DoublePoints. |
static AngleFormat |
getDefaultAngleFormat()
|
static Coord3D |
getSecondPoint(double distance,
double angle,
Coord3D originalLocation)
returns a second point (perhaps a better name??) |
static boolean |
inside(double x1,
double y1,
double width,
double height,
double x2,
double y2)
Returns true if the coordinate is inside the rectangle. |
static boolean |
overlaps(double x1,
double y1,
double width1,
double height1,
double x2,
double y2,
double width2,
double height2)
Returns true if the given rectangles overlap. |
static double |
radiansToDegrees(double radians)
Translates an angle in radians into an angle in degrees. |
static double |
roundAngle(double original)
|
static double |
roundAngle(double original,
int divisions)
|
static void |
setDefaultAngleFormat(AngleFormat newFormat)
|
static DoublePoint |
shootBearingAndRange(double x,
double y,
double bearing,
double range)
Calculates a second point using bearing and range. |
static double |
slope(double x1,
double x2,
double y1,
double y2)
Returns the slope of a line. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final double pi
public static final double twopi
public static final double halfpi
public static final double threehalfpi
public static final double eighteenthpi
public static double defaultAccuracy
| Constructor Detail |
|---|
public VectorLib()
| Method Detail |
|---|
public static TurnVector calculateVectorFromNorth(Coord3D junior,
Coord3D pops)
public static TurnVector calculateVector(Coord3D junior,
Coord3D pops,
Coord3D gramps)
public static double roundAngle(double original)
public static double roundAngle(double original,
int divisions)
public static double calculateAngle(Coord3D junior,
Coord3D pops)
public static double canonicalAngle(double original)
public static double angleBetween(double theta1,
double theta2)
public static double deflectionAngle(double original)
public static double radiansToDegrees(double radians)
public static double degreesToRadians(double degrees)
public static boolean overlaps(double x1,
double y1,
double width1,
double height1,
double x2,
double y2,
double width2,
double height2)
public static boolean covers(double x1,
double y1,
double width1,
double height1,
double x2,
double y2,
double width2,
double height2)
public static boolean inside(double x1,
double y1,
double width,
double height,
double x2,
double y2)
public static double distance(Coord3D p1,
Coord3D p2)
public static Coord3D getSecondPoint(double distance,
double angle,
Coord3D originalLocation)
public static DoublePoint shootBearingAndRange(double x,
double y,
double bearing,
double range)
public static double distance(Coord2D p1,
Coord2D p2)
public static double distance(double x1,
double y1,
double x2,
double y2)
public static double distance(DoublePoint p1,
DoublePoint p2)
public static double angle(Coord2D p1,
Coord2D p2)
public static double angle(double x1,
double y1,
double x2,
double y2)
public static double angle(DoublePoint p1,
DoublePoint p2)
public static Coord2D average(Coord2D p1,
Coord2D p2)
public static double slope(double x1,
double x2,
double y1,
double y2)
public static void setDefaultAngleFormat(AngleFormat newFormat)
public static AngleFormat getDefaultAngleFormat()
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||