|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.geotools.math.Line
Equation of a line in a two dimensional space (x,y).
A line has an equation of the form y=ax+b.
At the difference of Line2D
(which are bounded by (x1,y1)
and (x2,y2) points), objects extends toward infinity.
The equation parameters for a object can bet set at construction
time or using one of the methods. The y value
can be computed for a given x value using the y(double)
method. Method
x(double)
compute the converse and should work even if the line is vertical.
Point2D
,
Line2D
,
Plane
,
Serialized FormConstructor Summary | |
Line()
Construct an initially unitialized line. |
|
Line(double slope,
double y0)
Construct a line with the specified slope and offset. |
Method Summary | |
java.lang.Object |
clone()
Returns a clone of this line. |
boolean |
equals(java.lang.Object object)
Compare this object with the specified one for equality. |
double |
getSlope()
Returns the slope. |
double |
getX0()
Returns the x value for y==0. |
double |
getY0()
Returns the y value for x==0. |
int |
hashCode()
Returns a hash code value for this line. |
java.awt.geom.Point2D |
intersectionPoint(Line line)
Returns the intersection point between this line and the specified one. |
java.awt.geom.Point2D |
intersectionPoint(java.awt.geom.Line2D line)
Returns the intersection point between this line and the specified bounded line. |
java.awt.geom.Line2D |
isoscelesTriangleBase(java.awt.geom.Point2D summit,
double sideLength)
Compute the base of a isosceles triangle having the specified summit and side length. |
java.awt.geom.Point2D |
nearestColinearPoint(java.awt.geom.Point2D point)
Returns the nearest point on this line from the specified point. |
double |
setLine(double[] x,
double[] y)
Given a set of data points , , fit them to a straight line y=b+mx in a least-squares senses. |
void |
setLine(double slope,
double y0)
Set the slope and offset for this line. |
void |
setLine(java.awt.geom.Line2D line)
Set a line colinear with the specified line segment. |
void |
setLine(java.awt.geom.Point2D p1,
java.awt.geom.Point2D p2)
Set a line through the specified point. |
java.lang.String |
toString()
Returns a string representation of this line. |
void |
translate(double dx,
double dy)
Translate the line. |
double |
x(double y)
Compute x=f-1(y). |
double |
y(double x)
Compute y=f(x). |
Methods inherited from class java.lang.Object |
finalize, getClass, notify, notifyAll, wait, wait, wait |
Constructor Detail |
public Line()
Double.NaN
.
public Line(double slope, double y0)
slope
- The slope.y0
- The y value at x==0.setLine(double, double)
Method Detail |
public void setLine(double slope, double y0)
slope
- The slope.y0
- The y value at x==0.setLine(Point2D, Point2D)
,
setLine(Line2D)
,
setLine(double[], double[])
public void setLine(java.awt.geom.Line2D line)
line
- The line segment.setLine(Point2D,Point2D)
public void setLine(java.awt.geom.Point2D p1, java.awt.geom.Point2D p2)
p1
- Coordinate of the first point.p2
- Coordinate of the second point.setLine(Line2D)
public double setLine(double[] x, double[] y) throws javax.vecmath.MismatchedSizeException
Reference: Linear Regression Curve Fitting.
x
- Vector of x values (independant variable).y
- Vector of y values (dependant variable).
javax.vecmath.MismatchedSizeException
- if x and y don't have the same length.public void translate(double dx, double dy)
dx
- The horizontal translation.dy
- The vertical translation.public final double y(double x)
x
- The x value.
x(double)
public final double x(double y)
y
- The y value.
y(double)
public final double getY0()
public final double getX0()
public final double getSlope()
public java.awt.geom.Point2D intersectionPoint(Line line)
line
- The line to intersect.
public java.awt.geom.Point2D intersectionPoint(java.awt.geom.Line2D line)
Line2D
do not extends toward infinities), then this
method returns .
line
- The bounded line to intersect.
public java.awt.geom.Point2D nearestColinearPoint(java.awt.geom.Point2D point)
point
- An arbitrary point.
public java.awt.geom.Line2D isoscelesTriangleBase(java.awt.geom.Point2D summit, double sideLength)
summit
- The summit of the isosceles triangle.sideLength
- The length for the two sides of the isosceles triangle.
public java.lang.String toString()
"y=m*x+b"
.
public boolean equals(java.lang.Object object)
public int hashCode()
public java.lang.Object clone()
clone
in interface org.opengis.util.Cloneable
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |