|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.awt.geom.Line2D
java.awt.geom.Line2D.Double
net.sf.latexdraw.glib.models.impl.LLine
class LLine
Defines a model of a line. This model must be used only to define other models.
It is not a shape. See the LLines class for the shape.
This file is part of LaTeXDraw.
Copyright (c) 2005-2012 Arnaud BLOUIN
LaTeXDraw is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
Foundation; either version 2 of the License, or (at your option) any later version.
LaTeXDraw is distributed without any warranty; without even the implied
warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
02/14/2008
Nested Class Summary |
---|
Nested classes/interfaces inherited from class java.awt.geom.Line2D |
---|
java.awt.geom.Line2D.Double, java.awt.geom.Line2D.Float |
Field Summary | |
---|---|
protected double |
a
The director coefficient of the line (y=ax+b). |
protected double |
b
y=ax+b. |
private static long |
serialVersionUID
|
Fields inherited from class java.awt.geom.Line2D.Double |
---|
x1, x2, y1, y2 |
Constructor Summary | |
---|---|
protected |
LLine(double x1,
double y1,
double x2,
double y2)
Constructs a line from the specified coordinates. |
protected |
LLine(double b,
IPoint p1)
Creates a line by creating a second point with: |
protected |
LLine(IPoint p1,
IPoint p2)
Constructs a line from the specified Point2D objects. |
Method Summary | |
---|---|
IPoint[] |
findPoints(double x,
double y,
double distance)
Gets the points which are on the line and at the distance "distance" of the point "p" of the line. |
IPoint[] |
findPoints(IPoint p,
double distance)
Gets the points which are on the line and at the distance "distance" of the point "p" of the line. |
IPoint[] |
findPoints(java.awt.geom.Point2D p,
double distance)
Gets the points which are on the line and at the distance "distance" of the point "p" of the line. |
double |
getA()
|
double |
getB()
|
IPoint |
getBottomRightPoint()
|
IPoint |
getIntersection(ILine l)
|
IPoint |
getIntersectionSegment(ILine l)
|
double |
getLineAngle()
Computes the angle of the line. |
IPoint |
getMiddlePt()
|
ILine |
getPerpendicularLine(IPoint pt)
Creates the line which is perpendicular to the current line at the point pt. |
IPoint |
getPoint1()
|
IPoint |
getPoint2()
|
IPoint |
getTopLeftPoint()
|
double |
getXWithEquation(double y)
Gets the X-coordinate thanks to the equation of the line and the Y-coordinate of the point. |
double |
getYWithEquation(double x)
Gets the Y-coordinate thanks to the equation of the line and the X-coordinate of the point. |
boolean |
isDot()
|
boolean |
isHorizontalLine()
|
boolean |
isVerticalLine()
|
void |
setLine(double x1,
double y1,
double x2,
double y2)
Sets the position of the line. |
void |
setP1(double x,
double y)
Sets the coordinates of the first point. |
void |
setP1(IPoint pt)
Sets the first point. |
void |
setP2(double x,
double y)
Sets the coordinates of the second point. |
void |
setP2(IPoint pt)
Sets the second point. |
void |
setX1(double x1)
Sets the x coordinate of the first point. |
void |
setX2(double x2)
Sets the x coordinate of the second point. |
void |
setY1(double y1)
Sets the y coordinate of the first point. |
void |
setY2(double y2)
Sets the y coordinate of the second point. |
void |
updateAandB()
Update the y-intercept b and slope a . |
Methods inherited from class java.awt.geom.Line2D.Double |
---|
getBounds2D, getP1, getP2, getX1, getX2, getY1, getY2 |
Methods inherited from class java.awt.geom.Line2D |
---|
clone, contains, contains, contains, contains, getBounds, getPathIterator, getPathIterator, intersects, intersects, intersectsLine, intersectsLine, linesIntersect, ptLineDist, ptLineDist, ptLineDist, ptLineDistSq, ptLineDistSq, ptLineDistSq, ptSegDist, ptSegDist, ptSegDist, ptSegDistSq, ptSegDistSq, ptSegDistSq, relativeCCW, relativeCCW, relativeCCW, setLine, setLine |
Methods inherited from class java.lang.Object |
---|
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface net.sf.latexdraw.glib.models.interfaces.ILine |
---|
getX1, getX2, getY1, getY2 |
Field Detail |
---|
private static final long serialVersionUID
protected double a
protected double b
Constructor Detail |
---|
protected LLine(double x1, double y1, double x2, double y2)
x1
- the X coordinate of the start point.y1
- the Y coordinate of the start point.x2
- the X coordinate of the end point.y2
- the Y coordinate of the end point.
java.lang.IllegalArgumentException
- If one of the given coordinate is not valid.protected LLine(double b, IPoint p1)
b
- y = ax+ bp1
- The first point.
java.lang.IllegalArgumentException
- If one of the given parameter is not valid.protected LLine(IPoint p1, IPoint p2)
Point2D
objects.
p1
- the start Point2D
of this line segment.p2
- the end Point2D
of this line segment.
java.lang.IllegalArgumentException
- If one of the given points is not valid.Method Detail |
---|
public void setLine(double x1, double y1, double x2, double y2)
ILine
setLine
in interface ILine
setLine
in class java.awt.geom.Line2D.Double
x1
- The x coordinate of the first point.y1
- The y coordinate of the first point.x2
- The x coordinate of the second point.y2
- The y coordinate of the second point.public void updateAandB()
ILine
b
and slope a
.
updateAandB
in interface ILine
public double getXWithEquation(double y)
ILine
getXWithEquation
in interface ILine
y
- The Y-coordinate of the point.
public double getYWithEquation(double x)
ILine
getYWithEquation
in interface ILine
x
- The X-coordinate of the point.
public IPoint[] findPoints(java.awt.geom.Point2D p, double distance)
ILine
findPoints
in interface ILine
p
- The point of reference.distance
- The distance between p and the points we must find.
public IPoint[] findPoints(IPoint p, double distance)
ILine
findPoints
in interface ILine
p
- The point of reference.distance
- The distance between p and the points we must find.
public IPoint[] findPoints(double x, double y, double distance)
ILine
findPoints
in interface ILine
x
- The x-coordinate of the point of reference.y
- The y-coordinate of the point of reference.distance
- The distance between p and the points we must find.
public ILine getPerpendicularLine(IPoint pt)
ILine
getPerpendicularLine
in interface ILine
pt
- The point of crossing between the two lines.
public boolean isVerticalLine()
isVerticalLine
in interface ILine
public boolean isHorizontalLine()
isHorizontalLine
in interface ILine
public IPoint getIntersection(ILine l)
getIntersection
in interface ILine
l
- The second lines
public IPoint getMiddlePt()
getMiddlePt
in interface ILine
public IPoint getIntersectionSegment(ILine l)
getIntersectionSegment
in interface ILine
l
- The second line.
public IPoint getTopLeftPoint()
getTopLeftPoint
in interface ILine
public IPoint getBottomRightPoint()
getBottomRightPoint
in interface ILine
public double getA()
getA
in interface ILine
public double getB()
getB
in interface ILine
public IPoint getPoint1()
getPoint1
in interface ILine
public IPoint getPoint2()
getPoint2
in interface ILine
public void setP1(IPoint pt)
ILine
setP1
in interface ILine
pt
- The new first point.public void setP1(double x, double y)
ILine
setP1
in interface ILine
x
- The new x coordinate of the first point.y
- The new y coordinate of the first point.public void setP2(IPoint pt)
ILine
setP2
in interface ILine
pt
- The new second point.public void setP2(double x, double y)
ILine
setP2
in interface ILine
x
- The new x coordinate of the second point.y
- The new y coordinate of the second point.public void setX1(double x1)
ILine
setX1
in interface ILine
x1
- The new x coordinate of the first point.public void setX2(double x2)
ILine
setX2
in interface ILine
x2
- The new x coordinate of the second point.public void setY1(double y1)
ILine
setY1
in interface ILine
y1
- The new y coordinate of the first point.public void setY2(double y2)
ILine
setY2
in interface ILine
y2
- The new y coordinate of the second point.public double getLineAngle()
ILine
getLineAngle
in interface ILine
public boolean isDot()
isDot
in interface ILine
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |