public class LineSegment2D extends AbstractLine2D implements Cloneable, CirculinearElement2D
dx, dy, x0, y0| Constructor and Description |
|---|
LineSegment2D(double x1,
double y1,
double x2,
double y2)
Define a new Edge with two extremities.
|
LineSegment2D(Point2D point1,
Point2D point2)
Define a new Edge with two extremities.
|
| Modifier and Type | Method and Description |
|---|---|
GeneralPath |
appendPath(GeneralPath path)
Appends a line to the current path.
|
LineSegment2D |
clone()
Ensures public declaration of clone(), and ensures valid return type.
|
boolean |
contains(double xp,
double yp)
Checks if the shape contains the planar point defined by (x,y).
|
static LineSegment2D |
create(Point2D p1,
Point2D p2)
Static factory for creating a new line segment between two points.
|
boolean |
equals(Object obj) |
Box2D |
getBoundingBox()
Returns the bounding box of the shape.
|
double |
getDistance(double x,
double y)
Get the distance of the point (x, y) to this edge.
|
static double |
getEdgeAngle(LineSegment2D edge1,
LineSegment2D edge2)
Returns angle between two edges sharing one vertex.
|
Point2D |
getFirstPoint()
Return the first point of the edge.
|
GeneralPath |
getGeneralPath()
deprecated
|
Point2D |
getLastPoint()
Return the last point of the edge.
|
double |
getLength()
Returns the length of the line segment.
|
StraightLine2D |
getMedian()
Return the median of the edge, that is the locus of points located at
equal distance of each vertex.
|
static StraightLine2D |
getMedian(LineSegment2D edge) |
Point2D |
getOtherPoint(Point2D point)
Return the opposite vertex of the edge.
|
LineSegment2D |
getParallel(double d)
Creates a new curve, formed by the points with parameterization:
p(t) = c(t) + d*n(t)/|n(t)|, with p(t) being a point of
the original curve, n(t) the normal of the curve, and |n| being the
norm of n.In the case of a continuous curve formed by several smooth circulinear elements, the parallels of contiguous elements are joined by a circle arc. |
Point2D |
getPoint(double t)
Gets the point from a parametric representation of the curve.
|
LineSegment2D |
getReverseCurve()
Returns the LineSegment which start from last point of this line segment,
and which ends at the fist point of this last segment.
|
double |
getSignedDistance(double x,
double y)
Get the signed distance of the StraightObject2d to the given point.
|
double |
getT0()
Returns the parameter of the first point of the edge, equals to 0.
|
double |
getT1()
Returns the parameter of the last point of the edge, equals to 1.
|
static boolean |
intersects(LineSegment2D edge1,
LineSegment2D edge2)
Checks if two line segment intersect.
|
boolean |
isBounded()
Returns true
|
void |
setLineSegment(double x1,
double y1,
double x2,
double y2)
Deprecated.
lines will become immutable in a future release
|
void |
setLineSegment(Point2D p1,
Point2D p2)
Deprecated.
lines will become immutable in a future release
|
String |
toString() |
LineSegment2D |
transform(AffineTransform2D trans)
Transforms the curve by an affine transform.
|
clip, contains, getBuffer, getCartesianEquation, getContinuousCurves, getCurvature, getDistance, getHorizontalAngle, getIntersection, getIntersection, getIntersections, getLength, getOrigin, getParallel, getParametric, getPerpendicular, getPolarCoefficients, getPosition, getPosition, getPositionOnLine, getPositionOnLine, getProjectedPoint, getProjectedPoint, getSignedDistance, getSignedPolarCoefficients, getSmoothPieces, getSubCurve, getSupportingLine, getSymmetric, getSymmetric, getTangent, getVector, getWindingAngle, isClosed, isColinear, isColinear, isEmpty, isInside, isParallel, isParallel, project, supportContains, transformgetLeftTangent, getRightTangent, getSingularPoints, isSingulardraw, getAsAWTShape, getAsPolyline, wrapCurvefinalize, getClass, hashCode, notify, notifyAll, wait, wait, waitclip, getSubCurve, transformgetSmoothPiecesgetContinuousCurves, getLength, getPositiongetBuffergetAsPolyline, getLeftTangent, getRightTangent, isClosedgetSignedDistance, getWindingAngle, isInsidedraw, getAsAWTShape, getIntersections, getPosition, getSingularPoints, isSingular, projectcontains, getDistance, isEmptygetCurvature, getTangentpublic LineSegment2D(Point2D point1, Point2D point2)
public LineSegment2D(double x1,
double y1,
double x2,
double y2)
public static final LineSegment2D create(Point2D p1, Point2D p2)
public static final StraightLine2D getMedian(LineSegment2D edge)
public static final double getEdgeAngle(LineSegment2D edge1, LineSegment2D edge2)
public static final boolean intersects(LineSegment2D edge1, LineSegment2D edge2)
edge1 - a line segmentedge2 - a line segmentpublic Point2D getOtherPoint(Point2D point)
point - one of the vertices of the edgepublic StraightLine2D getMedian()
@Deprecated public void setLineSegment(Point2D p1, Point2D p2)
@Deprecated public void setLineSegment(double x1, double y1, double x2, double y2)
public double getLength()
getLength in interface CirculinearCurve2DgetLength in class AbstractLine2Dpublic LineSegment2D getParallel(double d)
CirculinearCurve2D p(t) = c(t) + d*n(t)/|n(t)|, with p(t) being a point of
the original curve, n(t) the normal of the curve, and |n| being the
norm of n.getParallel in interface CirculinearContinuousCurve2DgetParallel in interface CirculinearCurve2DgetParallel in interface CirculinearElement2DgetParallel in interface ContinuousCirculinearCurve2Dd - the distance between the original curve and he parallel curve.public double getSignedDistance(double x,
double y)
AbstractLine2DgetSignedDistance in interface OrientedCurve2DgetSignedDistance in class AbstractLine2Dx - x-coord of a pointy - y-coord of a pointpublic Point2D getFirstPoint()
getFirstPoint in interface Curve2DgetFirstPoint in class AbstractContinuousCurve2Dpublic Point2D getLastPoint()
getLastPoint in interface Curve2DgetLastPoint in class AbstractContinuousCurve2Dpublic double getT0()
public double getT1()
public Point2D getPoint(double t)
Curve2Dpublic LineSegment2D getReverseCurve()
getReverseCurve in interface CirculinearContinuousCurve2DgetReverseCurve in interface CirculinearCurve2DgetReverseCurve in interface CirculinearElement2DgetReverseCurve in interface ContinuousCirculinearCurve2DgetReverseCurve in interface ContinuousCurve2DgetReverseCurve in interface Curve2DgetReverseCurve in interface SmoothCurve2DgetReverseCurve in interface ContinuousOrientedCurve2DgetReverseCurve in interface OrientedCurve2DgetReverseCurve in interface SmoothOrientedCurve2Dpublic boolean contains(double xp,
double yp)
Shape2Dpublic double getDistance(double x,
double y)
getDistance in interface Shape2DgetDistance in class AbstractLine2Dx - x-coordinate of the pointy - y-coordinate of the pointpublic LineSegment2D transform(AffineTransform2D trans)
Curve2Dtransform in interface ContinuousCurve2Dtransform in interface Curve2Dtransform in interface SmoothCurve2Dtransform in interface ContinuousOrientedCurve2Dtransform in interface OrientedCurve2Dtransform in interface SmoothOrientedCurve2Dtransform in interface LinearShape2Dtransform in interface Shape2Dtransform in class AbstractLine2Dtrans - an affine transformpublic Box2D getBoundingBox()
Shape2DgetBoundingBox in interface Shape2Dpublic GeneralPath appendPath(GeneralPath path)
appendPath in interface ContinuousCurve2Dpath - the path to modifypublic GeneralPath getGeneralPath()
public LineSegment2D clone()
AbstractLine2Dclone in interface Curve2Dclone in class AbstractLine2DCopyright © 2012 AMIS research group, Faculty of Mathematics and Physics, Charles University in Prague, Czech Republic. All Rights Reserved.