Utils
Class GeoUtils
java.lang.Object
|
+--Utils.GeoUtils
- public abstract class GeoUtils
- extends java.lang.Object
Method Summary |
static int |
calculateGeneralDirection(int startX,
int startY,
int endX,
int endY)
|
static int |
calculateGeneralDirection(java.awt.geom.Line2D l1)
|
static double |
getAngle(double x1,
double y1,
double x2,
double y2)
Returns the angle between line (x1,y1)->(x2,y2) and the positive x-axis
in Radians |
static double |
getAngle(java.awt.geom.Line2D l)
|
static double |
getAngleDiff(double a1,
double a2)
|
static java.awt.geom.Line2D |
getAngledLine(double x,
double y,
double angle,
int length)
draw a line at "x","y" at angle "angle" and length "length". |
static java.lang.String |
getDirectionString(int dir)
|
static double |
getDistance(double x1,
double y1,
double x2,
double y2)
|
static double |
getDistance(double x,
double y,
java.awt.geom.Point2D p)
|
static double |
getDistance(java.awt.geom.Point2D p,
java.awt.geom.Point2D p2)
|
static java.awt.geom.Point2D |
getIntersectPoint(double x1,
double y1,
double x2,
double y2,
double x3,
double y3,
double x4,
double y4,
boolean infinite)
|
static java.awt.geom.Point2D |
getIntersectPoint(double x1,
double y1,
double x2,
double y2,
java.awt.geom.Line2D l2,
boolean infinite)
|
static java.awt.geom.Point2D |
getIntersectPoint(java.awt.geom.Line2D l1,
java.awt.geom.Line2D l2,
boolean infinite)
|
static java.awt.geom.Line2D |
getLastHalf(java.awt.geom.Line2D l)
|
static int |
getLeftDirection(int dir)
|
static java.awt.geom.Point2D |
getMidPoint(java.awt.geom.Point2D p1,
java.awt.geom.Point2D p2)
|
static int |
getOppositeDirection(int dir)
|
static java.awt.geom.Point2D |
getRectangleCenter(java.awt.Rectangle rect)
|
static int |
getRightDirection(int dir)
|
static double |
getXPointAtAngle(double x,
double angle,
double length)
Uses the SOHCAHTOA triangle to return the horizontal x point "length"
away from "x" at "angle" degrees. |
static double |
getYPointAtAngle(double y,
double angle,
double length)
Uses the SOHCAHTOA triangle to return the vertical y point "length"
away from "y" at "angle" degrees. |
static boolean |
isSamePoint(double x,
double y,
double x2,
double y2)
|
static boolean |
isSamePoint(double x,
double y,
java.awt.geom.Point2D p)
|
static boolean |
isSamePoint(java.awt.geom.Point2D p,
java.awt.geom.Point2D p2)
|
static boolean |
isSimilarAngles(double a1,
double a2,
double tol)
|
static java.awt.geom.Line2D |
reverseLine(java.awt.geom.Line2D l)
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
NORTHWEST
public static final int NORTHWEST
NORTH
public static final int NORTH
NORTHEAST
public static final int NORTHEAST
EAST
public static final int EAST
SOUTHEAST
public static final int SOUTHEAST
SOUTH
public static final int SOUTH
SOUTHWEST
public static final int SOUTHWEST
WEST
public static final int WEST
GeoUtils
public GeoUtils()
isSamePoint
public static boolean isSamePoint(double x,
double y,
double x2,
double y2)
isSamePoint
public static boolean isSamePoint(double x,
double y,
java.awt.geom.Point2D p)
isSamePoint
public static boolean isSamePoint(java.awt.geom.Point2D p,
java.awt.geom.Point2D p2)
getDistance
public static double getDistance(double x1,
double y1,
double x2,
double y2)
getDistance
public static double getDistance(double x,
double y,
java.awt.geom.Point2D p)
getDistance
public static double getDistance(java.awt.geom.Point2D p,
java.awt.geom.Point2D p2)
getMidPoint
public static java.awt.geom.Point2D getMidPoint(java.awt.geom.Point2D p1,
java.awt.geom.Point2D p2)
getAngle
public static double getAngle(double x1,
double y1,
double x2,
double y2)
- Returns the angle between line (x1,y1)->(x2,y2) and the positive x-axis
in Radians
getAngle
public static double getAngle(java.awt.geom.Line2D l)
getXPointAtAngle
public static double getXPointAtAngle(double x,
double angle,
double length)
- Uses the SOHCAHTOA triangle to return the horizontal x point "length"
away from "x" at "angle" degrees.
getYPointAtAngle
public static double getYPointAtAngle(double y,
double angle,
double length)
- Uses the SOHCAHTOA triangle to return the vertical y point "length"
away from "y" at "angle" degrees.
getAngledLine
public static java.awt.geom.Line2D getAngledLine(double x,
double y,
double angle,
int length)
- draw a line at "x","y" at angle "angle" and length "length".
reverseLine
public static java.awt.geom.Line2D reverseLine(java.awt.geom.Line2D l)
getLastHalf
public static java.awt.geom.Line2D getLastHalf(java.awt.geom.Line2D l)
getIntersectPoint
public static java.awt.geom.Point2D getIntersectPoint(double x1,
double y1,
double x2,
double y2,
java.awt.geom.Line2D l2,
boolean infinite)
getIntersectPoint
public static java.awt.geom.Point2D getIntersectPoint(java.awt.geom.Line2D l1,
java.awt.geom.Line2D l2,
boolean infinite)
getIntersectPoint
public static java.awt.geom.Point2D getIntersectPoint(double x1,
double y1,
double x2,
double y2,
double x3,
double y3,
double x4,
double y4,
boolean infinite)
calculateGeneralDirection
public static int calculateGeneralDirection(java.awt.geom.Line2D l1)
calculateGeneralDirection
public static int calculateGeneralDirection(int startX,
int startY,
int endX,
int endY)
getDirectionString
public static java.lang.String getDirectionString(int dir)
getOppositeDirection
public static int getOppositeDirection(int dir)
getRightDirection
public static int getRightDirection(int dir)
getLeftDirection
public static int getLeftDirection(int dir)
isSimilarAngles
public static boolean isSimilarAngles(double a1,
double a2,
double tol)
getAngleDiff
public static double getAngleDiff(double a1,
double a2)
getRectangleCenter
public static java.awt.geom.Point2D getRectangleCenter(java.awt.Rectangle rect)