|
||||||||||
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 interface math.geom2d.Shape2D |
---|
ACCURACY |
Constructor Summary | |
---|---|
StraightLine2D()
Empty constructor: a straight line corresponding to horizontal axis. |
|
StraightLine2D(double a,
double b,
double c)
Defines a new straight line, from the coefficients of the cartesian equation. |
|
StraightLine2D(double xp,
double yp,
double dx,
double dy)
Defines a new Straight line going through the point (xp, yp) and with the direction dx, dy. |
|
StraightLine2D(LinearShape2D line)
Defines 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)
Defines 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)
Defines a new Straight line going through the given point, and with the specified direction given by angle. |
|
StraightLine2D(Point2D point,
double dx,
double dy)
Defines a new Straight line going through the given point, and with the specified direction vector. |
|
StraightLine2D(Point2D point1,
Point2D point2)
Defines a new Straight line going through the two given points. |
|
StraightLine2D(Point2D point,
Vector2D direction)
Defines a new Straight line going through the given point, and with the specified direction vector. |
Method Summary | |
---|---|
boolean |
almostEquals(GeometricObject2D obj,
double eps)
Checks if the two objects are similar up to a given threshold value. |
java.awt.geom.GeneralPath |
appendPath(java.awt.geom.GeneralPath path)
Append the path of the curve to the given path. |
Polyline2D |
asPolyline(int n)
Throws an exception when called. |
Box2D |
boundingBox()
Returns the bounding box of the shape. |
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. |
java.util.Collection<? extends StraightLine2D> |
continuousCurves()
Need to override to cast the type. |
static StraightLine2D |
create(Point2D point,
double angle)
Deprecated. since 0.11.1 |
static StraightLine2D |
create(Point2D p1,
Point2D p2)
Deprecated. since 0.11.1 |
static StraightLine2D |
create(Point2D origin,
Vector2D direction)
Deprecated. since 0.11.1 |
static StraightLine2D |
createCartesian(double a,
double b,
double c)
Returns a new Straight line, with the given coefficient of the cartesian equation (a*x + b*y + c = 0). |
static StraightLine2D |
createHorizontal(Point2D origin)
Creates a vertical straight line through the given point. |
static StraightLine2D |
createMedian(Point2D p1,
Point2D p2)
Creates a median between 2 points. |
static StraightLine2D |
createParallel(LinearShape2D linear,
double d)
Returns 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)
Returns a new Straight line, parallel to another straight object (ray, straight line or edge), and going through the given point. |
static StraightLine2D |
createPerpendicular(LinearShape2D linear,
Point2D point)
Returns a new Straight line, perpendicular to a straight object (ray, straight line or edge), and going through the given point. |
static StraightLine2D |
createVertical(Point2D origin)
Creates a vertical straight line through the given point. |
double |
distance(double x,
double y)
Returns the distance of the point (x, y) to this straight line. |
CirculinearDomain2D |
domain()
Returns the domain delimited by this boundary. |
boolean |
equals(java.lang.Object obj)
|
void |
fill(java.awt.Graphics2D g2)
Fills the interior of the boundary, using the Graphics current Paint. |
Point2D |
firstPoint()
Throws an infiniteShapeException |
java.awt.geom.GeneralPath |
getGeneralPath()
Throws an infiniteShapeException |
static Point2D |
getIntersection(Point2D p1,
Point2D p2,
Point2D p3,
Point2D p4)
Computes 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. |
double |
getT0()
Deprecated. replaced by t0() (since 0.11.1). |
double |
getT1()
Deprecated. replaced by t1() (since 0.11.1). |
boolean |
isBounded()
Always returns false, because a line is not bounded. |
boolean |
isSingular(double pos)
Returns false, whatever the position. |
Point2D |
lastPoint()
Throws an infiniteShapeException |
StraightLine2D |
parallel(double d)
Returns the parallel line located at a distance d from the line. |
StraightLine2D |
parallel(Point2D point)
Returns a new Straight line, parallel to another straight object (ray, straight line or edge), and going through the given point. |
StraightLine2D |
perpendicular(Point2D point)
Returns a new Straight line, parallel to another straight object (ray, straight line or edge), and going through the given point. |
Point2D |
point(double t)
Returns the point specified with the parametric representation of the line. |
StraightLine2D |
reverse()
Returns the straight line with same origin but with opposite direction vector. |
java.util.Collection<Point2D> |
singularPoints()
Returns an empty list of points. |
double |
t0()
Returns the parameter of the first point of the line, which is always Double.NEGATIVE_INFINITY. |
double |
t1()
Returns the parameter of the last point of the line, which is always Double.POSITIVE_INFINITY. |
java.lang.String |
toString()
|
StraightLine2D |
transform(AffineTransform2D trans)
Returns the transformed line. |
CircleLine2D |
transform(CircleInversion2D inv)
Transforms the shape by a circle inversion. |
double |
windingAngle(Point2D point)
Return the angle portion that the curve turn around the given point. |
Methods inherited from class math.geom2d.line.AbstractLine2D |
---|
buffer, cartesianEquation, clip, curvature, direction, distance, getIntersection, getSymmetric, getSymmetric, horizontalAngle, intersection, intersections, isClosed, isColinear, isColinear, isEmpty, isInside, isParallel, isParallel, length, length, origin, parametric, polarCoefficients, polarCoefficientsSigned, position, position, positionOnLine, positionOnLine, project, projectedPoint, projectedPoint, signedDistance, signedDistance, smoothPieces, subCurve, supportingLine, tangent |
Methods inherited from class math.geom2d.curve.AbstractSmoothCurve2D |
---|
leftTangent, normal, rightTangent, vertices |
Methods inherited from class math.geom2d.curve.AbstractContinuousCurve2D |
---|
asAwtShape, draw |
Methods inherited from class java.lang.Object |
---|
getClass, hashCode, notify, notifyAll, wait, wait, wait |
Methods inherited from interface math.geom2d.circulinear.CirculinearElement2D |
---|
clip, subCurve |
Methods inherited from interface math.geom2d.circulinear.CirculinearContinuousCurve2D |
---|
smoothPieces |
Methods inherited from interface math.geom2d.circulinear.CirculinearCurve2D |
---|
length, length, position |
Methods inherited from interface math.geom2d.circulinear.CirculinearShape2D |
---|
buffer |
Methods inherited from interface math.geom2d.curve.SmoothCurve2D |
---|
normal, tangent |
Methods inherited from interface math.geom2d.domain.Boundary2D |
---|
isInside |
Methods inherited from interface math.geom2d.curve.ContinuousCurve2D |
---|
curvature, isClosed, leftTangent, rightTangent |
Methods inherited from interface math.geom2d.domain.OrientedCurve2D |
---|
signedDistance, signedDistance |
Methods inherited from interface math.geom2d.curve.Curve2D |
---|
asAwtShape, draw, intersections, position, project, vertices |
Methods inherited from interface math.geom2d.Shape2D |
---|
distance, isEmpty |
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 |
---|
@Deprecated public static StraightLine2D create(Point2D point, double angle)
@Deprecated public static StraightLine2D create(Point2D p1, Point2D p2)
@Deprecated public static StraightLine2D create(Point2D origin, Vector2D direction)
public static StraightLine2D createHorizontal(Point2D origin)
public static StraightLine2D createVertical(Point2D origin)
public static StraightLine2D createMedian(Point2D p1, Point2D p2)
p1
- one pointp2
- another point
public static StraightLine2D createParallel(LinearShape2D line, Point2D point)
public static StraightLine2D createParallel(LinearShape2D linear, double d)
public static StraightLine2D createPerpendicular(LinearShape2D linear, Point2D point)
public static StraightLine2D createCartesian(double a, double b, double c)
public static Point2D getIntersection(Point2D p1, Point2D p2, Point2D p3, Point2D p4)
public StraightLine2D parallel(Point2D point)
parallel
in class AbstractLine2D
point
- the point to go through
public StraightLine2D parallel(double d)
parallel
in interface CircleLine2D
parallel
in interface CirculinearBoundary2D
parallel
in interface CirculinearContinuousCurve2D
parallel
in interface CirculinearContour2D
parallel
in interface CirculinearCurve2D
parallel
in interface CirculinearElement2D
d
- the distance between the original curve and he parallel curve.
DegeneratedLine2DException
- if line direction vector is nullpublic StraightLine2D perpendicular(Point2D point)
perpendicular
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 class AbstractLine2D
inv
- the circle inversion
public CirculinearDomain2D domain()
Boundary2D
domain
in interface CirculinearBoundary2D
domain
in interface Boundary2D
public void fill(java.awt.Graphics2D g2)
Boundary2D
fill
in interface Boundary2D
g2
- the Graphics to fill onpublic double windingAngle(Point2D point)
OrientedCurve2D
windingAngle
in interface OrientedCurve2D
windingAngle
in class AbstractLine2D
point
- a point of the plane
public Polyline2D asPolyline(int n)
asPolyline
in interface ContinuousCurve2D
asPolyline
in class AbstractContinuousCurve2D
n
- the number of line segments
n
line segments.ContinuousCurve2D.asPolyline(int)
public Point2D firstPoint()
firstPoint
in interface Curve2D
firstPoint
in class AbstractContinuousCurve2D
Curve2D.t0()
,
Curve2D.point(double)
public Point2D lastPoint()
lastPoint
in interface Curve2D
lastPoint
in class AbstractContinuousCurve2D
Curve2D.t1()
,
Curve2D.point(double)
public java.util.Collection<Point2D> singularPoints()
singularPoints
in interface Curve2D
singularPoints
in class AbstractSmoothCurve2D
Curve2D.singularPoints()
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 t0()
t0
in interface Curve2D
@Deprecated public double getT0()
getT0
in interface Curve2D
public double t1()
t1
in interface Curve2D
@Deprecated public double getT1()
getT1
in interface Curve2D
public Point2D point(double t)
point
in interface Curve2D
public java.util.Collection<? extends StraightLine2D> continuousCurves()
continuousCurves
in interface CirculinearBoundary2D
continuousCurves
in interface CirculinearCurve2D
continuousCurves
in interface Curve2D
continuousCurves
in interface Boundary2D
continuousCurves
in class AbstractLine2D
public StraightLine2D reverse()
reverse
in interface CircleLine2D
reverse
in interface CirculinearBoundary2D
reverse
in interface CirculinearContinuousCurve2D
reverse
in interface CirculinearContour2D
reverse
in interface CirculinearCurve2D
reverse
in interface CirculinearElement2D
reverse
in interface ContinuousCurve2D
reverse
in interface Curve2D
reverse
in interface SmoothCurve2D
reverse
in interface Boundary2D
reverse
in interface ContinuousOrientedCurve2D
reverse
in interface Contour2D
reverse
in interface OrientedCurve2D
reverse
in interface SmoothContour2D
reverse
in interface SmoothOrientedCurve2D
public java.awt.geom.GeneralPath appendPath(java.awt.geom.GeneralPath path)
ContinuousCurve2D
appendPath
in interface ContinuousCurve2D
path
- a path to modify
public boolean isBounded()
isBounded
in interface Shape2D
public double distance(double x, double y)
distance
in interface Shape2D
distance
in class AbstractLine2D
x
- the x-coordinate of the pointy
- the y-coordinate of the point
public Box2D boundingBox()
Shape2D
boundingBox
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 ContinuousOrientedCurve2D
transform
in interface Contour2D
transform
in interface OrientedCurve2D
transform
in interface SmoothContour2D
transform
in interface SmoothOrientedCurve2D
transform
in interface LinearElement2D
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 java.awt.geom.GeneralPath getGeneralPath()
public boolean almostEquals(GeometricObject2D obj, double eps)
GeometricObject2D
almostEquals
in interface GeometricObject2D
obj
- the object to compareeps
- a threshold value, for example the minimal coordinate difference
public java.lang.String toString()
toString
in class java.lang.Object
public boolean equals(java.lang.Object obj)
equals
in class java.lang.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 |