|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectrcssjava.geom.Line
public class Line
Implementation of 2d line
Constructor Summary | |
---|---|
Line(double a,
double b,
double c)
Construct line given the three coefficients in ay + bx + c = 0 . |
Method Summary | |
---|---|
double |
getA()
Get a coefficient |
double |
getB()
Get a coefficient |
double |
getC()
Get a coefficient |
double |
getDistanceToPoint(VecPosition pos)
Get euclidean distance between a given point and the closest point on the line to that point |
VecPosition |
getIntersection(Line line)
Get intersecton with a line |
VecPosition |
getIntersection(LineSegment ls)
Get intersecton with a line segment |
VecPosition |
getPointOnLineClosestTo(VecPosition pos)
Get point on line with smallest euclidean distance to given point |
double |
getSlope()
Get slope |
Line |
getTangentLine(VecPosition pos)
Get line orthogonal to this that passes through the given point |
double |
getXGivenY(double y)
Get the x coordinate on the line for a given y coordinate |
double |
getYGivenX(double x)
Get the y coordinate on the line for a given x coordinate |
double |
getYIntercept()
Get y-intercept |
static Line |
makeLineFromTwoPoints(VecPosition pos1,
VecPosition pos2)
Create the line that passes through the two given points |
java.lang.String |
toString()
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public Line(double a, double b, double c)
ay + bx + c = 0
.
a
- a coefficientb
- b coefficientc
- c coefficientMethod Detail |
---|
public double getA()
public double getB()
public double getC()
public double getSlope()
m
in y = mx + b
public double getYIntercept()
b
in y = mx + b
public VecPosition getIntersection(LineSegment ls)
ls
- line segment
null
if nonepublic VecPosition getIntersection(Line line)
line
- another line
null
if nonepublic Line getTangentLine(VecPosition pos)
pos
- intersection point
public VecPosition getPointOnLineClosestTo(VecPosition pos)
pos
- point to which closest should be determined
public double getDistanceToPoint(VecPosition pos)
pos
- point to which closest should be determined
public double getYGivenX(double x)
x
- x coordinate
public double getXGivenY(double y)
y
- y coordinate
public static Line makeLineFromTwoPoints(VecPosition pos1, VecPosition pos2)
pos1
- first pointpos2
- second point
public java.lang.String toString()
toString
in class java.lang.Object
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |