math.geom2d.line
Class LineArc2D

Package class diagram package LineArc2D
java.lang.Object
  extended by math.geom2d.curve.AbstractContinuousCurve2D
      extended by math.geom2d.curve.AbstractSmoothCurve2D
          extended by math.geom2d.line.AbstractLine2D
              extended by math.geom2d.line.LineArc2D
All Implemented Interfaces:
Serializable, Cloneable, CirculinearContinuousCurve2D, CirculinearCurve2D, CirculinearElement2D, CirculinearShape2D, ContinuousCirculinearCurve2D, ContinuousCurve2D, Curve2D, SmoothCurve2D, ContinuousOrientedCurve2D, OrientedCurve2D, SmoothOrientedCurve2D, LinearShape2D, Shape2D

public class LineArc2D
extends AbstractLine2D
implements SmoothOrientedCurve2D, Cloneable

LineArc2D is a generic class to represent edges, straight lines, and rays. It is defined like other linear shapes: origin point, and direction vector. Moreover, two internal variables t0 and t1 define the limit of the object (with t0

Author:
dlegland
See Also:
Serialized Form

Field Summary
protected  double t0
           
protected  double t1
           
 
Fields inherited from class math.geom2d.line.AbstractLine2D
dx, dy, x0, y0
 
Fields inherited from interface math.geom2d.Shape2D
ACCURACY
 
Constructor Summary
LineArc2D(double x1, double y1, double dx, double dy, double t0, double t1)
          Construct a line arc by the parameters of the supporting line and two positions on the line.
LineArc2D(LineArc2D line)
          Construction by copy of another line arc
LineArc2D(LinearShape2D line, double t0, double t1)
          Construct a line arc contained in the same straight line as first argument, with bounds of arc given by t0 and t1
LineArc2D(Point2D point1, Point2D point2, double t0, double t1)
           
 
Method Summary
 GeneralPath appendPath(GeneralPath path)
          Appends a line to the current path.
 LineArc2D 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).
 boolean contains(Point2D pt)
          Checks if the shape contains the given point.
 LineArc2D create(Point2D p1, Point2D p2, double t0, double t1)
          Static factory for creating a new LineArc2D
 boolean equals(Object obj)
           
 Box2D getBoundingBox()
          Returns the bounding box of the shape.
 Collection<? extends LineArc2D> getContinuousCurves()
          Returns the collection of continuous curves which constitute this curve.
 Point2D getFirstPoint()
          Return the first point of the edge.
 GeneralPath getGeneralPath()
           
 Point2D getLastPoint()
          Return the last point of the edge.
 double getLength()
          Returns the length of the line arc.
 LineArc2D 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.
 Point2D getPoint(double t)
          Gets the point from a parametric representation of the curve.
 Point2D getPoint1()
          Return the first point of the line arc.
 Point2D getPoint2()
          Return the last point of the line arc.
 LineArc2D getReverseCurve()
          Returns the line arc which have the same trace, but has the inverse parameterization.
 Collection<Point2D> getSingularPoints()
          Returns an empty set of Point2D, as a smooth curve does not have singular points by definition.
 LineArc2D getSubCurve(double t0, double t1)
          Returns a new LineArc2D, which is the portion of this LineArc2D delimited by parameters t0 and t1.
 double getT0()
          Returns the parameter of the first point of the line arc, arbitrarily set to 0.
 double getT1()
          Returns the parameter of the last point of the line arc, arbitrarily set to 1.
 double getX1()
           
 double getX2()
           
 double getY1()
           
 double getY2()
           
 boolean isBounded()
          return true if both t0 and t1 are different from infinity.
 boolean isSingular(double pos)
          Returns always false, as a smooth curve does not have singular points by definition.
 String toString()
           
 LineArc2D transform(AffineTransform2D trans)
          Transforms the curve by an affine transform.
 
Methods inherited from class math.geom2d.line.AbstractLine2D
clip, getBuffer, getCartesianEquation, getCurvature, getDistance, getDistance, getHorizontalAngle, getIntersection, getIntersection, getIntersections, getLength, getOrigin, getParallel, getParametric, getPerpendicular, getPolarCoefficients, getPosition, getPosition, getPositionOnLine, getPositionOnLine, getProjectedPoint, getProjectedPoint, getSignedDistance, getSignedDistance, getSignedPolarCoefficients, getSmoothPieces, getSupportingLine, getSymmetric, getSymmetric, getTangent, getVector, getWindingAngle, isClosed, isColinear, isColinear, isEmpty, isInside, isParallel, isParallel, project, supportContains, transform
 
Methods inherited from class math.geom2d.curve.AbstractSmoothCurve2D
getLeftTangent, getRightTangent
 
Methods inherited from class math.geom2d.curve.AbstractContinuousCurve2D
draw, getAsAWTShape, getAsPolyline, wrapCurve
 
Methods inherited from class java.lang.Object
finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface math.geom2d.domain.SmoothOrientedCurve2D
clip
 
Methods inherited from interface math.geom2d.curve.SmoothCurve2D
getCurvature, getTangent
 
Methods inherited from interface math.geom2d.curve.ContinuousCurve2D
getAsPolyline, getLeftTangent, getRightTangent, getSmoothPieces, isClosed
 
Methods inherited from interface math.geom2d.domain.OrientedCurve2D
getSignedDistance, getSignedDistance, getWindingAngle, isInside
 
Methods inherited from interface math.geom2d.curve.Curve2D
draw, getAsAWTShape, getIntersections, getPosition, project
 
Methods inherited from interface math.geom2d.Shape2D
getDistance, getDistance, isEmpty
 

Field Detail

t0

protected double t0

t1

protected double t1
Constructor Detail

LineArc2D

public LineArc2D(Point2D point1,
                 Point2D point2,
                 double t0,
                 double t1)
Parameters:
point1 - the point located at t=0
point2 - the point located at t=1
t0 - the lower bound of line arc parameterization
t1 - the upper bound of line arc parameterization

LineArc2D

public LineArc2D(LinearShape2D line,
                 double t0,
                 double t1)
Construct a line arc contained in the same straight line as first argument, with bounds of arc given by t0 and t1

Parameters:
line - an object defining the supporting line
t0 - the lower bound of line arc parameterization
t1 - the upper bound of line arc parameterization

LineArc2D

public LineArc2D(LineArc2D line)
Construction by copy of another line arc

Parameters:
line - the line to copy

LineArc2D

public LineArc2D(double x1,
                 double y1,
                 double dx,
                 double dy,
                 double t0,
                 double t1)
Construct a line arc by the parameters of the supporting line and two positions on the line.

Parameters:
x1 - the x-coordinate of the first point
y1 - the y-coordinate of the first point
dx - the x-coordinate of the direction vector
dy - the y-coordinate of the direction vector
t0 - the starting position of the arc
t1 - the ending position of the arc
Method Detail

create

public LineArc2D create(Point2D p1,
                        Point2D p2,
                        double t0,
                        double t1)
Static factory for creating a new LineArc2D

Since:
0.8.1

getLength

public double getLength()
Returns the length of the line arc.

Specified by:
getLength in interface CirculinearCurve2D
Overrides:
getLength in class AbstractLine2D
Returns:
the length of the curve

getPoint1

public Point2D getPoint1()
Return the first point of the line arc. In the case of a line arc starting from -infinity, throws an UnboundedShapeException.

Returns:
the first point of the arc

getPoint2

public Point2D getPoint2()
Return the last point of the line arc. In the case of a line arc ending at infinity, throws an UnboundedShapeException.

Returns:
the last point of the arc.

getX1

public double getX1()

getY1

public double getY1()

getX2

public double getX2()

getY2

public double getY2()

getParallel

public LineArc2D getParallel(double d)
Description copied from interface: CirculinearCurve2D
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.

Specified by:
getParallel in interface CirculinearContinuousCurve2D
Specified by:
getParallel in interface CirculinearCurve2D
Specified by:
getParallel in interface CirculinearElement2D
Specified by:
getParallel in interface ContinuousCirculinearCurve2D
Parameters:
d - the distance between the original curve and he parallel curve.
Returns:
the parallel curve

getT0

public double getT0()
Returns the parameter of the first point of the line arc, arbitrarily set to 0.

Specified by:
getT0 in interface Curve2D

getT1

public double getT1()
Returns the parameter of the last point of the line arc, arbitrarily set to 1.

Specified by:
getT1 in interface Curve2D

getPoint

public Point2D getPoint(double t)
Description copied from interface: Curve2D
Gets the point from a parametric representation of the curve. If the parameter lies outside the definition range, the parameter corresponding to the closest bound is used instead. This method can be used to draw an approximated outline of a curve, by selecting multiple values for t and drawing lines between them.

Specified by:
getPoint in interface Curve2D

getFirstPoint

public Point2D getFirstPoint()
Return the first point of the edge. In the case of a line, or a ray starting from -infinity, returns Point2D.INFINITY_POINT.

Specified by:
getFirstPoint in interface Curve2D
Overrides:
getFirstPoint in class AbstractContinuousCurve2D
Returns:
the last point of the arc

getLastPoint

public Point2D getLastPoint()
Return the last point of the edge. In the case of a line, or a ray ending at infinity, returns Point2D.INFINITY_POINT.

Specified by:
getLastPoint in interface Curve2D
Overrides:
getLastPoint in class AbstractContinuousCurve2D
Returns:
the last point of the arc

getSingularPoints

public Collection<Point2D> getSingularPoints()
Description copied from class: AbstractSmoothCurve2D
Returns an empty set of Point2D, as a smooth curve does not have singular points by definition.

Specified by:
getSingularPoints in interface Curve2D
Overrides:
getSingularPoints in class AbstractSmoothCurve2D
Returns:
a collection of Point2D.
See Also:
Curve2D.getSingularPoints()

isSingular

public boolean isSingular(double pos)
Description copied from class: AbstractSmoothCurve2D
Returns always false, as a smooth curve does not have singular points by definition.

Specified by:
isSingular in interface Curve2D
Overrides:
isSingular in class AbstractSmoothCurve2D
Parameters:
pos - the position of the point on the curve
Returns:
true if the point at this location is singular
See Also:
Curve2D.isSingular(double)

getContinuousCurves

public Collection<? extends LineArc2D> getContinuousCurves()
Description copied from interface: Curve2D
Returns the collection of continuous curves which constitute this curve.

Specified by:
getContinuousCurves in interface CirculinearCurve2D
Specified by:
getContinuousCurves in interface Curve2D
Overrides:
getContinuousCurves in class AbstractLine2D
Returns:
a collection of continuous curves.

getReverseCurve

public LineArc2D getReverseCurve()
Returns the line arc which have the same trace, but has the inverse parameterization.

Specified by:
getReverseCurve in interface CirculinearContinuousCurve2D
Specified by:
getReverseCurve in interface CirculinearCurve2D
Specified by:
getReverseCurve in interface CirculinearElement2D
Specified by:
getReverseCurve in interface ContinuousCirculinearCurve2D
Specified by:
getReverseCurve in interface ContinuousCurve2D
Specified by:
getReverseCurve in interface Curve2D
Specified by:
getReverseCurve in interface SmoothCurve2D
Specified by:
getReverseCurve in interface ContinuousOrientedCurve2D
Specified by:
getReverseCurve in interface OrientedCurve2D
Specified by:
getReverseCurve in interface SmoothOrientedCurve2D

getSubCurve

public LineArc2D getSubCurve(double t0,
                             double t1)
Returns a new LineArc2D, which is the portion of this LineArc2D delimited by parameters t0 and t1.

Specified by:
getSubCurve in interface CirculinearContinuousCurve2D
Specified by:
getSubCurve in interface CirculinearCurve2D
Specified by:
getSubCurve in interface CirculinearElement2D
Specified by:
getSubCurve in interface ContinuousCirculinearCurve2D
Specified by:
getSubCurve in interface ContinuousCurve2D
Specified by:
getSubCurve in interface Curve2D
Specified by:
getSubCurve in interface SmoothCurve2D
Specified by:
getSubCurve in interface ContinuousOrientedCurve2D
Specified by:
getSubCurve in interface SmoothOrientedCurve2D
Overrides:
getSubCurve in class AbstractLine2D
Parameters:
t0 - position of the start of the sub-curve
t1 - position of the end of the sub-curve
Returns:
the portion of original curve comprised between t0 and t1.

isBounded

public boolean isBounded()
return true if both t0 and t1 are different from infinity.

Specified by:
isBounded in interface Shape2D

getBoundingBox

public Box2D getBoundingBox()
Description copied from interface: Shape2D
Returns the bounding box of the shape.

Specified by:
getBoundingBox in interface Shape2D
Returns:
the bounding box of the shape.

contains

public boolean contains(Point2D pt)
Description copied from interface: Shape2D
Checks if the shape contains the given point.

Specified by:
contains in interface Shape2D
Overrides:
contains in class AbstractLine2D

contains

public boolean contains(double xp,
                        double yp)
Description copied from interface: Shape2D
Checks if the shape contains the planar point defined by (x,y).

Specified by:
contains in interface Shape2D

getGeneralPath

public GeneralPath getGeneralPath()

appendPath

public GeneralPath appendPath(GeneralPath path)
Appends a line to the current path. If t0 or t1 is infinite, throws a new UnboundedShapeException.

Specified by:
appendPath in interface ContinuousCurve2D
Parameters:
path - the path to modify
Returns:
the modified path

transform

public LineArc2D transform(AffineTransform2D trans)
Description copied from interface: Curve2D
Transforms the curve by an affine transform. The result is an instance of Curve2D.

Specified by:
transform in interface ContinuousCurve2D
Specified by:
transform in interface Curve2D
Specified by:
transform in interface SmoothCurve2D
Specified by:
transform in interface ContinuousOrientedCurve2D
Specified by:
transform in interface OrientedCurve2D
Specified by:
transform in interface SmoothOrientedCurve2D
Specified by:
transform in interface LinearShape2D
Specified by:
transform in interface Shape2D
Specified by:
transform in class AbstractLine2D
Parameters:
trans - an affine transform
Returns:
the transformed shape

toString

public String toString()
Overrides:
toString in class Object

equals

public boolean equals(Object obj)
Overrides:
equals in class Object

clone

public LineArc2D clone()
Description copied from class: AbstractLine2D
Ensures public declaration of clone(), and ensures valid return type.

Specified by:
clone in interface Curve2D
Specified by:
clone in class AbstractLine2D
Returns:
the cloned curve


Copyright © 2015 AMIS research group, Faculty of Mathematics and Physics, Charles University in Prague, Czech Republic. All Rights Reserved.