|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object math.geom2d.curve.AbstractContinuousCurve2D math.geom2d.curve.AbstractSmoothCurve2D math.geom2d.line.AbstractLine2D math.geom2d.line.StraightLine2D
public class StraightLine2D
Implementation of a straight line. Such a line can be constructed using two points, a point and a parallel line or straight object, or with coefficient of the Cartesian equation.
Field Summary |
---|
Fields inherited from class math.geom2d.line.AbstractLine2D |
---|
dx, dy, x0, y0 |
Fields inherited from interface math.geom2d.Shape2D |
---|
ACCURACY |
Constructor Summary | |
---|---|
StraightLine2D()
Empty constructor: a straight line corresponding to horizontal axis. |
|
StraightLine2D(double a,
double b,
double c)
Define a new straight line, from the coefficients of the cartesian equation. |
|
StraightLine2D(double xp,
double yp,
double dx,
double dy)
Define a new Straight line going through the point (xp, yp) and with the direction dx, dy. |
|
StraightLine2D(LinearShape2D line)
Define a new Straight line at the same position and with the same direction than an other straight object (line, edge or ray). |
|
StraightLine2D(LinearShape2D line,
Point2D point)
Define a new Straight line, parallel to another straigth object (ray, straight line or edge), and going through the given point. |
|
StraightLine2D(Point2D point,
double angle)
Define a new Straight line going through the given point, and with the specified direction given by angle. |
|
StraightLine2D(Point2D point,
double dx,
double dy)
Define a new Straight line going through the given point, and with the specified direction vector. |
|
StraightLine2D(Point2D point1,
Point2D point2)
Define a new Straight line going through the two given points. |
|
StraightLine2D(Point2D point,
Vector2D direction)
Define a new Straight line going through the given point, and with the specified direction vector. |
Method Summary | |
---|---|
GeneralPath |
appendPath(GeneralPath path)
Append the path of the curve to the given path. |
StraightLine2D |
clone()
Ensures public declaration of clone(), and ensures valid return type. |
boolean |
contains(double x,
double y)
Returns true if the point (x, y) lies on the line, with precision given by Shape2D.ACCURACY. |
boolean |
contains(Point2D p)
Returns true if the point p lies on the line, with precision given by Shape2D.ACCURACY. |
static StraightLine2D |
create(Point2D point,
double angle)
Creates a straight line going through a point and with a given angle. |
static StraightLine2D |
create(Point2D p1,
Point2D p2)
Creates a straight line through 2 points. |
static StraightLine2D |
create(Point2D origin,
Vector2D direction)
Creates a straight line through a point and with a given direction vector. |
static StraightLine2D |
createCartesian(double a,
double b,
double c)
Return a new Straight line, with the given coefficient of the cartesian equation (a*x + b*y + c = 0). |
static StraightLine2D |
createCartesianLine2D(double a,
double b,
double c)
Deprecated. since 0.6.3, use createCartesian instead |
static StraightLine2D |
createMedian(Point2D p1,
Point2D p2)
Creates a median between 2 points. |
static StraightLine2D |
createMedian2D(Point2D p1,
Point2D p2)
Deprecated. since 0.6.3, use createMedian instead |
static StraightLine2D |
createOrthogonalLine2D(LinearShape2D linear,
Point2D point)
Deprecated. since 0.6.3, use createPerpendicular instead |
static StraightLine2D |
createParallel(LinearShape2D linear,
double d)
Return a new Straight line, parallel to another straight object (ray, straight line or edge), and going through the given point. |
static StraightLine2D |
createParallel(LinearShape2D line,
Point2D point)
Return a new Straight line, parallel to another straight object (ray, straight line or edge), and going through the given point. |
static StraightLine2D |
createParallelLine2D(LinearShape2D linear,
double d)
Deprecated. since 0.6.3, use createParallel() instead |
static StraightLine2D |
createParallelLine2D(LinearShape2D line,
Point2D point)
Deprecated. since 0.6.3, use createParallel() instead |
static StraightLine2D |
createPerpendicular(LinearShape2D linear,
Point2D point)
Return a new Straight line, perpendicular to a straight object (ray, straight line or edge), and going through the given point. |
static StraightLine2D |
createStraightLine2D(Point2D point,
double dx,
double dy)
Deprecated. since 0.6.3, use create() instead |
static StraightLine2D |
createStraightLine2D(Point2D p1,
Point2D p2)
Deprecated. use create(Point2D, Point2D) instead |
boolean |
equals(Object obj)
|
void |
fill(Graphics2D g2)
|
Polyline2D |
getAsPolyline(int n)
Throws an exception when called. |
Collection<ContinuousBoundary2D> |
getBoundaryCurves()
Returns the different continuous curves composing the boundary |
Box2D |
getBoundingBox()
Returns the bounding box of the shape. |
Collection<? extends StraightLine2D> |
getContinuousCurves()
Need to override to cast the type. |
double |
getDistance(double x,
double y)
Returns the distance of the point (x, y) to this straight line. |
Domain2D |
getDomain()
Returns the domain delimited by this boundary. |
Point2D |
getFirstPoint()
Throws an infiniteShapeException |
GeneralPath |
getGeneralPath()
Throws an infiniteShapeException |
static Point2D |
getIntersection(Point2D p1,
Point2D p2,
Point2D p3,
Point2D p4)
Compute the intersection point of the two (infinite) lines going through p1 and p2 for the first one, and p3 and p4 for the second one. |
Point2D |
getLastPoint()
Throws an infiniteShapeException |
StraightLine2D |
getParallel(double d)
Return the parallel line located at a distance d. |
StraightLine2D |
getParallel(Point2D point)
Returns a new Straight line, parallel to another straight object (ray, straight line or edge), and going through the given point. |
StraightLine2D |
getPerpendicular(Point2D point)
Return a new Straight line, parallel to another straigth object (ray, straight line or edge), and going through the given point. |
Point2D |
getPoint(double t)
Gets the point specified with the parametric representation of the line. |
StraightLine2D |
getReverseCurve()
Returns the straight line with same origin but with opposite direction vector. |
Collection<Point2D> |
getSingularPoints()
Returns an empty list of points. |
double |
getT0()
Returns the parameter of the first point of the line, which is always Double.NEGATIVE_INFINITY. |
double |
getT1()
Returns the parameter of the last point of the line, which is always Double.POSITIVE_INFINITY. |
double |
getWindingAngle(Point2D point)
Return the angle portion that the curve turn around the given point. |
boolean |
isBounded()
Always returns false, because a line is not bounded. |
boolean |
isSingular(double pos)
Returns false, whatever the position. |
void |
setCartesianEquation(double a,
double b,
double c)
Deprecated. lines will become imutable in a future release |
void |
setLine(double x0,
double y0,
double dx,
double dy)
Deprecated. lines will become imutable in a future release |
void |
setLine(LinearShape2D linear)
Deprecated. lines will become imutable in a future release |
void |
setLine(Point2D p1,
Point2D p2)
Deprecated. lines will become imutable in a future release |
void |
setPoints(double x1,
double y1,
double x2,
double y2)
Deprecated. lines will become imutable in a future release |
String |
toString()
|
StraightLine2D |
transform(AffineTransform2D trans)
Returns the transformed line. |
CircleLine2D |
transform(CircleInversion2D inv)
Transforms the shape by a circle inversion. |
Methods inherited from class math.geom2d.curve.AbstractSmoothCurve2D |
---|
getLeftTangent, getRightTangent |
Methods inherited from class math.geom2d.curve.AbstractContinuousCurve2D |
---|
draw, getAsAWTShape, wrapCurve |
Methods inherited from class java.lang.Object |
---|
finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Methods inherited from interface math.geom2d.circulinear.CirculinearElement2D |
---|
clip, getSubCurve |
Methods inherited from interface math.geom2d.circulinear.CirculinearContinuousCurve2D |
---|
getSmoothPieces |
Methods inherited from interface math.geom2d.curve.ContinuousCurve2D |
---|
getLeftTangent, getRightTangent, isClosed |
Methods inherited from interface math.geom2d.curve.Curve2D |
---|
draw, getAsAWTShape, getIntersections, getPosition, project |
Methods inherited from interface math.geom2d.Shape2D |
---|
getDistance, isEmpty |
Methods inherited from interface math.geom2d.curve.SmoothCurve2D |
---|
getCurvature, getTangent |
Methods inherited from interface math.geom2d.domain.Boundary2D |
---|
isInside |
Constructor Detail |
---|
public StraightLine2D()
public StraightLine2D(Point2D point1, Point2D point2)
public StraightLine2D(Point2D point, Vector2D direction)
public StraightLine2D(Point2D point, double dx, double dy)
public StraightLine2D(Point2D point, double angle)
public StraightLine2D(LinearShape2D line)
public StraightLine2D(double xp, double yp, double dx, double dy)
public StraightLine2D(LinearShape2D line, Point2D point)
public StraightLine2D(double a, double b, double c)
Method Detail |
---|
public static final StraightLine2D create(Point2D point, double angle)
public static final StraightLine2D create(Point2D p1, Point2D p2)
public static final StraightLine2D create(Point2D origin, Vector2D direction)
@Deprecated public static final StraightLine2D createStraightLine2D(Point2D p1, Point2D p2)
public static final StraightLine2D createMedian(Point2D p1, Point2D p2)
p1
- one pointp2
- another point
@Deprecated public static final StraightLine2D createMedian2D(Point2D p1, Point2D p2)
p1
- one pointp2
- another point
@Deprecated public static final StraightLine2D createStraightLine2D(Point2D point, double dx, double dy)
public static final StraightLine2D createParallel(LinearShape2D line, Point2D point)
@Deprecated public static final StraightLine2D createParallelLine2D(LinearShape2D line, Point2D point)
public static final StraightLine2D createParallel(LinearShape2D linear, double d)
@Deprecated public static final StraightLine2D createParallelLine2D(LinearShape2D linear, double d)
public static final StraightLine2D createPerpendicular(LinearShape2D linear, Point2D point)
@Deprecated public static final StraightLine2D createOrthogonalLine2D(LinearShape2D linear, Point2D point)
public static final StraightLine2D createCartesian(double a, double b, double c)
@Deprecated public static final StraightLine2D createCartesianLine2D(double a, double b, double c)
public static final Point2D getIntersection(Point2D p1, Point2D p2, Point2D p3, Point2D p4)
@Deprecated public void setLine(double x0, double y0, double dx, double dy)
@Deprecated public void setPoints(double x1, double y1, double x2, double y2)
@Deprecated public void setLine(Point2D p1, Point2D p2)
@Deprecated public void setLine(LinearShape2D linear)
@Deprecated public void setCartesianEquation(double a, double b, double c)
public StraightLine2D getParallel(Point2D point)
public StraightLine2D getParallel(double d)
getParallel
in interface CircleLine2D
getParallel
in interface CirculinearContinuousCurve2D
getParallel
in interface CirculinearContour2D
getParallel
in interface CirculinearCurve2D
getParallel
in interface CirculinearElement2D
getParallel
in interface ContinuousCirculinearCurve2D
d
- the distance between the original curve and he parallel curve.
public StraightLine2D getPerpendicular(Point2D point)
getPerpendicular
in class AbstractLine2D
point
- the point to go through
public CircleLine2D transform(CircleInversion2D inv)
CirculinearShape2D
transform
in interface CircleLine2D
transform
in interface CirculinearBoundary2D
transform
in interface CirculinearContinuousCurve2D
transform
in interface CirculinearContour2D
transform
in interface CirculinearCurve2D
transform
in interface CirculinearElement2D
transform
in interface CirculinearShape2D
transform
in interface ContinuousCirculinearCurve2D
transform
in class AbstractLine2D
inv
- the circle inversion
public Collection<ContinuousBoundary2D> getBoundaryCurves()
Boundary2D
getBoundaryCurves
in interface Boundary2D
public Domain2D getDomain()
Boundary2D
getDomain
in interface Boundary2D
public void fill(Graphics2D g2)
fill
in interface Boundary2D
public double getWindingAngle(Point2D point)
OrientedCurve2D
getWindingAngle
in interface OrientedCurve2D
getWindingAngle
in class AbstractLine2D
point
- a point of the plane
public Polyline2D getAsPolyline(int n)
getAsPolyline
in interface ContinuousCurve2D
getAsPolyline
in class AbstractContinuousCurve2D
n
- the number of line segments
n
line segments.public Point2D getFirstPoint()
getFirstPoint
in interface Curve2D
getFirstPoint
in class AbstractContinuousCurve2D
public Point2D getLastPoint()
getLastPoint
in interface Curve2D
getLastPoint
in class AbstractContinuousCurve2D
public Collection<Point2D> getSingularPoints()
getSingularPoints
in interface Curve2D
getSingularPoints
in class AbstractSmoothCurve2D
Curve2D.getSingularPoints()
public boolean isSingular(double pos)
isSingular
in interface Curve2D
isSingular
in class AbstractSmoothCurve2D
pos
- the position of the point on the curve
Curve2D.isSingular(double)
public double getT0()
getT0
in interface Curve2D
public double getT1()
getT1
in interface Curve2D
public Point2D getPoint(double t)
getPoint
in interface Curve2D
public Collection<? extends StraightLine2D> getContinuousCurves()
getContinuousCurves
in interface CirculinearBoundary2D
getContinuousCurves
in interface CirculinearCurve2D
getContinuousCurves
in interface Curve2D
getContinuousCurves
in class AbstractLine2D
public StraightLine2D getReverseCurve()
getReverseCurve
in interface CircleLine2D
getReverseCurve
in interface CirculinearBoundary2D
getReverseCurve
in interface CirculinearContinuousCurve2D
getReverseCurve
in interface CirculinearContour2D
getReverseCurve
in interface CirculinearCurve2D
getReverseCurve
in interface CirculinearElement2D
getReverseCurve
in interface ContinuousCirculinearCurve2D
getReverseCurve
in interface ContinuousCurve2D
getReverseCurve
in interface Curve2D
getReverseCurve
in interface SmoothCurve2D
getReverseCurve
in interface Boundary2D
getReverseCurve
in interface ContinuousBoundary2D
getReverseCurve
in interface ContinuousOrientedCurve2D
getReverseCurve
in interface OrientedCurve2D
getReverseCurve
in interface SmoothBoundary2D
getReverseCurve
in interface SmoothOrientedCurve2D
public GeneralPath appendPath(GeneralPath path)
ContinuousCurve2D
appendPath
in interface ContinuousCurve2D
path
- a path to modify
public boolean isBounded()
isBounded
in interface Shape2D
public double getDistance(double x, double y)
getDistance
in interface Shape2D
getDistance
in class AbstractLine2D
x
- x-coordinate of the pointy
- y-coordinate of the point
public Box2D getBoundingBox()
Shape2D
getBoundingBox
in interface Shape2D
public StraightLine2D transform(AffineTransform2D trans)
transform
in interface ContinuousCurve2D
transform
in interface Curve2D
transform
in interface SmoothCurve2D
transform
in interface Boundary2D
transform
in interface ContinuousBoundary2D
transform
in interface ContinuousOrientedCurve2D
transform
in interface OrientedCurve2D
transform
in interface SmoothBoundary2D
transform
in interface SmoothOrientedCurve2D
transform
in interface LinearShape2D
transform
in interface Shape2D
transform
in class AbstractLine2D
trans
- an affine transform
public boolean contains(double x, double y)
contains
in interface Shape2D
public boolean contains(Point2D p)
contains
in interface Shape2D
contains
in class AbstractLine2D
public GeneralPath getGeneralPath()
public String toString()
toString
in class Object
public boolean equals(Object obj)
equals
in class Object
public StraightLine2D clone()
AbstractLine2D
clone
in interface Curve2D
clone
in class AbstractLine2D
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |