|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectmath.geom2d.curve.AbstractContinuousCurve2D
math.geom2d.curve.AbstractSmoothCurve2D
math.geom2d.line.AbstractLine2D
public abstract class AbstractLine2D
Base class for straight curves, such as straight lines, rays, or edges.
Internal representation of straight objects is parametric: (x0, y0) is a point in the object, and (dx, dy) is a direction vector of the line.
If the line is defined by two point, we can set (x0,y0) to the first point, and (dx,dy) to the vector (p1, p2).
Then, coordinates for a point (x,y) such as x=x0+t*dx and y=y0+t=dy, t between 0 and 1 give a point inside p1 and p2, t<0 give a point 'before' p1, and t>1 give a point 'after' p2, so it is convenient to easily manage edges, rays and straight lines.
| Field Summary |
|---|
| Fields inherited from interface math.geom2d.Shape2D |
|---|
ACCURACY |
| Method Summary | |
|---|---|
CirculinearDomain2D |
buffer(double dist)
Computes the buffer of the shape, formed by the set of points located at a distance from the shape that is lower or equal to d. |
double[] |
cartesianEquation()
Returns the coefficient of the Cartesian representation of the line. |
CurveSet2D<? extends AbstractLine2D> |
clip(Box2D box)
When a curve is clipped, the result is a set of curves. |
abstract AbstractLine2D |
clone()
Ensures public declaration of clone(), and ensures valid return type. |
boolean |
contains(Point2D p)
Checks if the shape contains the given point. |
java.util.Collection<? extends AbstractLine2D> |
continuousCurves()
Returns a collection of lines containing only this line. |
double |
curvature(double t)
Returns 0 as for every straight object. |
Vector2D |
direction()
Returns the direction vector of this linear shape. |
double |
distance(double x,
double y)
Returns the distance of the StraightObject2d to the given point. |
double |
distance(Point2D p)
Returns the distance of the StraightObject2d to the given point. |
static Point2D |
getIntersection(AbstractLine2D line1,
AbstractLine2D line2)
Returns the unique intersection of two straight objects. |
Point2D |
getSymmetric(double x,
double y)
Return the symmetric of point with coordinate (x, y) relative to this straight line. |
Point2D |
getSymmetric(Point2D p)
Return the symmetric of point p relative to this straight line. |
double |
horizontalAngle()
Gets Angle with axis (O,i), counted counter-clockwise. |
Point2D |
intersection(LinearShape2D line)
Returns the unique intersection with a linear shape. |
java.util.Collection<Point2D> |
intersections(LinearShape2D line)
Returns the intersection points of the curve with the specified line. |
boolean |
isClosed()
Always returns false, because we can not come back to starting point if we always go straight... |
static boolean |
isColinear(AbstractLine2D line1,
AbstractLine2D line2)
Tests if the two linear objects are located on the same straight line. |
boolean |
isColinear(LinearShape2D linear)
Tests if the given linear shape is parallel to this shape. |
boolean |
isEmpty()
Returns false, unless both dx and dy equal 0. |
boolean |
isInside(Point2D p)
Returns true if the given point lies to the left of the line when traveling along the line in the direction given by its direction vector. |
static boolean |
isParallel(AbstractLine2D line1,
AbstractLine2D line2)
Tests if the two linear objects are parallel. |
boolean |
isParallel(LinearShape2D line)
Tests if the this object is parallel to the given one. |
double |
length()
|
double |
length(double pos)
|
Point2D |
origin()
Returns the origin point of this linear shape. |
StraightLine2D |
parallel(Point2D point)
Creates a straight line parallel to this object, and going through the given point. |
double[][] |
parametric()
Returns the matrix of parametric representation of the line. |
StraightLine2D |
perpendicular(Point2D point)
Creates a straight line perpendicular to this object, and going through the given point. |
double[] |
polarCoefficients()
Returns polar coefficients of this linear shape. |
double[] |
polarCoefficientsSigned()
Returns the signed polar coefficients. |
double |
position(double distance)
|
double |
position(Point2D point)
Returns the position of the point on the line arc. |
double |
positionOnLine(double x,
double y)
Computes position on the line of the point given by (x,y). |
double |
positionOnLine(Point2D point)
|
double |
project(Point2D point)
Returns the position of the closest point on the line arc. |
Point2D |
projectedPoint(double x,
double y)
Returns the projection of point p on the line. |
Point2D |
projectedPoint(Point2D p)
Returns the projection of point p on the line. |
double |
signedDistance(double x,
double y)
Returns the signed distance of the StraightObject2d to the given point. |
double |
signedDistance(Point2D p)
Returns the signed distance of the StraightObject2d to the given point. |
java.util.Collection<? extends AbstractLine2D> |
smoothPieces()
Returns a collection of lines containing only this line. |
AbstractLine2D |
subCurve(double t0,
double t1)
Returns a new AbstractLine2D, which is the portion of this AbstractLine2D delimited by parameters t0 and t1. |
StraightLine2D |
supportingLine()
Returns the straight line that contains this linear shape. |
Vector2D |
tangent(double t)
Returns the tangent of the curve at the given position. |
abstract AbstractLine2D |
transform(AffineTransform2D transform)
Transforms the curve by an affine transform. |
CirculinearElement2D |
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.curve.AbstractSmoothCurve2D |
|---|
isSingular, leftTangent, normal, rightTangent, singularPoints, vertices |
| Methods inherited from class math.geom2d.curve.AbstractContinuousCurve2D |
|---|
asAwtShape, asPolyline, draw, firstPoint, lastPoint |
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface math.geom2d.circulinear.CirculinearElement2D |
|---|
parallel |
| Methods inherited from interface math.geom2d.curve.SmoothCurve2D |
|---|
normal |
| Methods inherited from interface math.geom2d.curve.ContinuousCurve2D |
|---|
appendPath, asPolyline, leftTangent, rightTangent |
| Methods inherited from interface math.geom2d.curve.Curve2D |
|---|
asAwtShape, draw, firstPoint, getT0, getT1, isSingular, lastPoint, point, singularPoints, t0, t1, vertices |
| Methods inherited from interface math.geom2d.Shape2D |
|---|
boundingBox, contains, isBounded |
| Methods inherited from interface math.geom2d.GeometricObject2D |
|---|
almostEquals |
| Method Detail |
|---|
public static Point2D getIntersection(AbstractLine2D line1,
AbstractLine2D line2)
public static boolean isColinear(AbstractLine2D line1,
AbstractLine2D line2)
public static boolean isParallel(AbstractLine2D line1,
AbstractLine2D line2)
public boolean isColinear(LinearShape2D linear)
public boolean isParallel(LinearShape2D line)
public double[][] parametric()
[ x0 dx ]
[ y0 dy ]
It can be easily extended to higher dimensions and/or higher polynomial forms.
public double[] cartesianEquation()
ax+by+c=0
public double[] polarCoefficients()
public double[] polarCoefficientsSigned()
public double positionOnLine(Point2D point)
public double positionOnLine(double x,
double y)
If the point does not belong to the line, the method returns the position of its projection on the line.
public Point2D projectedPoint(Point2D p)
p - a point outside the line (if point p lies on the line, it is
returned)
public Point2D projectedPoint(double x,
double y)
x - coordinate x of point to be projectedy - coordinate y of point to be projected
public Point2D getSymmetric(Point2D p)
p - a point outside the line (if point p lies on the line, it is
returned)
public Point2D getSymmetric(double x,
double y)
x - x-coordinate of point to be projectedy - y-coordinate of point to be projected
public StraightLine2D parallel(Point2D point)
point - the point to go through
public StraightLine2D perpendicular(Point2D point)
point - the point to go through
public Point2D origin()
origin in interface LinearShape2Dpublic Vector2D direction()
direction in interface LinearShape2Dpublic double horizontalAngle()
horizontalAngle in interface LinearShape2Dpublic Point2D intersection(LinearShape2D line)
intersection in interface LinearShape2Dpublic StraightLine2D supportingLine()
LinearShape2D
supportingLine in interface LinearShape2Dpublic double length()
length in interface CirculinearCurve2Dpublic double length(double pos)
length in interface CirculinearCurve2Dpublic double position(double distance)
position in interface CirculinearCurve2Dpublic CirculinearElement2D transform(CircleInversion2D inv)
CirculinearShape2D
transform in interface CirculinearContinuousCurve2Dtransform in interface CirculinearCurve2Dtransform in interface CirculinearElement2Dtransform in interface CirculinearShape2Dinv - the circle inversion
public CirculinearDomain2D buffer(double dist)
CirculinearShape2D
buffer in interface CirculinearShape2Ddist - the maximal distance between a point of the buffer and the
shape
public double windingAngle(Point2D point)
OrientedCurve2D
windingAngle in interface OrientedCurve2Dpoint - a point of the plane
public double signedDistance(Point2D p)
signedDistance in interface OrientedCurve2Dp - a point of the plane
public double signedDistance(double x,
double y)
signedDistance in interface OrientedCurve2Dx - x-coord of a pointy - y-coord of a point
public boolean isInside(Point2D p)
isInside in interface OrientedCurve2Dp - the point to test
public Vector2D tangent(double t)
SmoothCurve2D
tangent in interface SmoothCurve2Dt - a position on the curve
SmoothCurve2D.normal(double)public double curvature(double t)
curvature in interface ContinuousCurve2Dt - the position on the curve
public boolean isClosed()
isClosed in interface ContinuousCurve2Dpublic java.util.Collection<? extends AbstractLine2D> smoothPieces()
smoothPieces in interface CirculinearContinuousCurve2DsmoothPieces in interface ContinuousCurve2DsmoothPieces in class AbstractSmoothCurve2Dpublic java.util.Collection<Point2D> intersections(LinearShape2D line)
intersections in interface Curve2Dpublic double position(Point2D point)
If point does not belong to line, returns Double.NaN.
t = (xp - x0)/dx <\code>, or equivalently: t = (yp - y0)/dy <\code>.
point - a point belonging to the curve
Curve2D.point(double)
public double project(Point2D point)
If point does not belong to line, returns t0, or t1, depending on which
one is the closest.
t = (xp - x0)/dx <\code>, or equivalently: t = (yp - y0)/dy <\code>.
point - a point to project
public AbstractLine2D subCurve(double t0,
double t1)
subCurve in interface CirculinearContinuousCurve2DsubCurve in interface CirculinearCurve2DsubCurve in interface CirculinearElement2DsubCurve in interface ContinuousCurve2DsubCurve in interface Curve2DsubCurve in interface SmoothCurve2DsubCurve in interface ContinuousOrientedCurve2DsubCurve in interface SmoothOrientedCurve2DsubCurve in interface LinearElement2Dt0 - position of the start of the sub-curvet1 - position of the end of the sub-curve
public java.util.Collection<? extends AbstractLine2D> continuousCurves()
continuousCurves in interface CirculinearCurve2DcontinuousCurves in interface Curve2DcontinuousCurves in class AbstractContinuousCurve2Dpublic double distance(Point2D p)
distance in interface Shape2D
public double distance(double x,
double y)
distance in interface Shape2Dx - the x-coordinate of the pointy - the y-coordinate of the point
public boolean contains(Point2D p)
Shape2D
contains in interface Shape2Dpublic boolean isEmpty()
isEmpty in interface Shape2Dpublic abstract AbstractLine2D transform(AffineTransform2D transform)
Curve2D
transform in interface ContinuousCurve2Dtransform in interface Curve2Dtransform in interface SmoothCurve2Dtransform in interface ContinuousOrientedCurve2Dtransform in interface OrientedCurve2Dtransform in interface SmoothOrientedCurve2Dtransform in interface LinearElement2Dtransform in interface LinearShape2Dtransform in interface Shape2Dtransform - an affine transform
public CurveSet2D<? extends AbstractLine2D> clip(Box2D box)
Curve2D
clip in interface CirculinearContinuousCurve2Dclip in interface CirculinearCurve2Dclip in interface CirculinearElement2Dclip in interface ContinuousCurve2Dclip in interface Curve2Dclip in interface SmoothCurve2Dclip in interface ContinuousOrientedCurve2Dclip in interface OrientedCurve2Dclip in interface SmoothOrientedCurve2Dclip in interface LinearElement2Dclip in interface Shape2Dbox - the clipping box
public abstract AbstractLine2D clone()
clone in interface Curve2Dclone in class AbstractSmoothCurve2D
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||