edu.mit.sketch.uml
Class S_UMLLine

java.lang.Object
  |
  +--edu.mit.sketch.uml.S_UMLLine

public class S_UMLLine
extends Object

This class is a collection of static methods that are commonly used when doing line computations.


Constructor Summary
S_UMLLine()
           
 
Method Summary
static boolean aboveLine(double x, double y, double m, double b, double error)
          Given a line, represented by slope m, and y-intercept b, does a point, represented by x,y, rest above the line by at least a certain amount (the error).
static boolean aboveLine(Line l, Point p, double error)
           
static boolean aboveLine(Point p, double m, double b, double error)
          Given a line, represented by slope m, and y-intercept b, does a point, represented by x,y, rest above the line by at least a certain amount (the error).
static boolean belowLine(double x, double y, double m, double b, double error)
          Given a line, represented by slope m, and y-intercept b, does a point, represented by x,y, fall below the line by at least a certain amount (the error).
static boolean belowLine(Line l, Point p, double error)
           
static boolean belowLine(Point p, double m, double b, double error)
          Given a line, represented by slope m, and y-intercept b, does a point, represented by x,y, fall below the line by at least a certain amount (the error).
static double computeAngle(Point l1p1, Point l1p2, Point l2p1, Point l2p2)
          Computes the angles between the two lines
static int countIntersectingPointVector(Vector PointVector1, Vector PointVector2)
           
static int countIntersectingStrokeVector(Vector strokes1, Vector strokes2)
           
static double getB(double x, double y, double m)
          Returns the y-incercept of a line with slope m, passing through point x,y
static double getB(Point p, double m)
           
static Point getIntersectingPoint(Point start1, Point end1, Point start2, Point end2)
          Returns intersecting point of two lines (as if the two lines were infinite) Use isIntersecting to check if lines are actually intersecting
static double getSlope(double x1, double y1, double x2, double y2)
          Returns the slope of a line given two points on the line.
static double getSlope(Line l)
           
static double getSlope(Point p1, Point p2)
           
static boolean isIntersecting(Point start1, Point end1, Point start2, Point end2)
          Returns true if the two lines are intersecting
static boolean isIntersecting(Vector PointVector1, Vector PointVector2)
          Takes in a vector of points to see if the non-straight lines represented by these vectors intersect
static boolean leftOfLine(double x, double y, double m, double b, double error)
          Given a line, represented by slope m, and y-intercept b, does a point, represented by x,y, fall to the left of the line by at least a certain amount (the error).
static boolean leftOfLine(Line l, Point p, double error)
           
static boolean leftOfLine(Point p, double m, double b, double error)
          Given a line, represented by slope m, and y-intercept b, does a point, represented by x,y, fall to the left of the line by at least a certain amount (the error).
static boolean rightOfLine(double x, double y, double m, double b, double error)
          Given a line, represented by slope m, and y-intercept b, does a point, represented by x,y, fall to the right of the line by at least a certain amount (the error).
static boolean rightOfLine(Line l, Point p, double error)
           
static boolean rightOfLine(Point p, double m, double b, double error)
          Given a line, represented by slope m, and y-intercept b, does a point, represented by x,y, fall to the right of the line by at least a certain amount (the error).
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

S_UMLLine

public S_UMLLine()
Method Detail

getSlope

public static double getSlope(double x1,
                              double y1,
                              double x2,
                              double y2)
Returns the slope of a line given two points on the line.

getSlope

public static double getSlope(Line l)

getSlope

public static double getSlope(Point p1,
                              Point p2)

getB

public static double getB(double x,
                          double y,
                          double m)
Returns the y-incercept of a line with slope m, passing through point x,y

getB

public static double getB(Point p,
                          double m)

aboveLine

public static boolean aboveLine(Line l,
                                Point p,
                                double error)

belowLine

public static boolean belowLine(Line l,
                                Point p,
                                double error)

rightOfLine

public static boolean rightOfLine(Line l,
                                  Point p,
                                  double error)

leftOfLine

public static boolean leftOfLine(Line l,
                                 Point p,
                                 double error)

aboveLine

public static boolean aboveLine(double x,
                                double y,
                                double m,
                                double b,
                                double error)
Given a line, represented by slope m, and y-intercept b, does a point, represented by x,y, rest above the line by at least a certain amount (the error).

aboveLine

public static boolean aboveLine(Point p,
                                double m,
                                double b,
                                double error)
Given a line, represented by slope m, and y-intercept b, does a point, represented by x,y, rest above the line by at least a certain amount (the error).

belowLine

public static boolean belowLine(double x,
                                double y,
                                double m,
                                double b,
                                double error)
Given a line, represented by slope m, and y-intercept b, does a point, represented by x,y, fall below the line by at least a certain amount (the error).

belowLine

public static boolean belowLine(Point p,
                                double m,
                                double b,
                                double error)
Given a line, represented by slope m, and y-intercept b, does a point, represented by x,y, fall below the line by at least a certain amount (the error).

leftOfLine

public static boolean leftOfLine(double x,
                                 double y,
                                 double m,
                                 double b,
                                 double error)
Given a line, represented by slope m, and y-intercept b, does a point, represented by x,y, fall to the left of the line by at least a certain amount (the error).

leftOfLine

public static boolean leftOfLine(Point p,
                                 double m,
                                 double b,
                                 double error)
Given a line, represented by slope m, and y-intercept b, does a point, represented by x,y, fall to the left of the line by at least a certain amount (the error).

rightOfLine

public static boolean rightOfLine(double x,
                                  double y,
                                  double m,
                                  double b,
                                  double error)
Given a line, represented by slope m, and y-intercept b, does a point, represented by x,y, fall to the right of the line by at least a certain amount (the error).

rightOfLine

public static boolean rightOfLine(Point p,
                                  double m,
                                  double b,
                                  double error)
Given a line, represented by slope m, and y-intercept b, does a point, represented by x,y, fall to the right of the line by at least a certain amount (the error).

getIntersectingPoint

public static Point getIntersectingPoint(Point start1,
                                         Point end1,
                                         Point start2,
                                         Point end2)
Returns intersecting point of two lines (as if the two lines were infinite) Use isIntersecting to check if lines are actually intersecting

isIntersecting

public static boolean isIntersecting(Point start1,
                                     Point end1,
                                     Point start2,
                                     Point end2)
Returns true if the two lines are intersecting

isIntersecting

public static boolean isIntersecting(Vector PointVector1,
                                     Vector PointVector2)
Takes in a vector of points to see if the non-straight lines represented by these vectors intersect

countIntersectingPointVector

public static int countIntersectingPointVector(Vector PointVector1,
                                               Vector PointVector2)

countIntersectingStrokeVector

public static int countIntersectingStrokeVector(Vector strokes1,
                                                Vector strokes2)

computeAngle

public static double computeAngle(Point l1p1,
                                  Point l1p2,
                                  Point l2p1,
                                  Point l2p2)
Computes the angles between the two lines