math.geom2d.line
Class LineArc2D
- java.lang.Object
-
- math.geom2d.curve.AbstractContinuousCurve2D
-
- math.geom2d.curve.AbstractSmoothCurve2D
-
- math.geom2d.line.AbstractLine2D
-
- math.geom2d.line.LineArc2D
-
- All Implemented Interfaces:
- java.lang.Cloneable, CirculinearContinuousCurve2D, CirculinearCurve2D, CirculinearElement2D, CirculinearShape2D, ContinuousCurve2D, Curve2D, SmoothCurve2D, ContinuousOrientedCurve2D, OrientedCurve2D, SmoothOrientedCurve2D, GeometricObject2D, LinearElement2D, LinearShape2D, Shape2D
public class LineArc2D extends AbstractLine2D implements SmoothOrientedCurve2D, java.lang.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- t0=0 and t1=1: this is an edge.
- t0=-inf and t1=inf: this is a straight line.
- t0=0 and t1=inf: this is a ray.
- t0=-inf and 0: this is an inverted ray.
-
-
Constructor Summary
Constructors Constructor and Description 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(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 t1LineArc2D(Point2D point1, Point2D point2, double t0, double t1)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method and Description booleanalmostEquals(GeometricObject2D obj, double eps)Checks if the two objects are similar up to a given threshold value.java.awt.geom.GeneralPathappendPath(java.awt.geom.GeneralPath path)Appends a line to the current path.Box2DboundingBox()Returns the bounding box of this line arc.LineArc2Dclone()Deprecated.use copy constructor instead (0.11.2)booleancontains(double xp, double yp)Checks if the shape contains the planar point defined by (x,y).booleancontains(Point2D pt)Checks if the shape contains the given point.java.util.Collection<? extends LineArc2D>continuousCurves()Returns a collection of lines containing only this line.static LineArc2Dcreate(Point2D p1, Point2D p2, double t0, double t1)Static factory for creating a new LineArc2Dbooleanequals(java.lang.Object obj)Point2DfirstPoint()Returns the first point of the edge.java.awt.geom.GeneralPathgetGeneralPath()doublegetT0()Deprecated.replaced by t0() (since 0.11.1).doublegetT1()Deprecated.replaced by t1() (since 0.11.1).doublegetX1()doublegetX2()doublegetY1()doublegetY2()booleanisBounded()Returns true if both t0 and t1 are different from infinity.booleanisSingular(double pos)Returns always false, as a smooth curve does not have singular points by definition.Point2DlastPoint()Returns the last point of the edge.doublelength()Returns the length of the line arc.LineArc2Dparallel(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.Point2Dpoint(double t)Returns the point located at the given position on the curve.LineArc2Dreverse()Returns the line arc which have the same trace, but has the inverse parameterization.java.util.Collection<Point2D>singularPoints()Returns an empty set of Point2D, as a smooth curve does not have singular points by definition.LineArc2DsubCurve(double t0, double t1)Returns a new LineArc2D, which is the portion of this LineArc2D delimited by parameters t0 and t1.doublet0()Returns the parameter of the first point of the line arc, arbitrarily set to 0.doublet1()Returns the parameter of the last point of the line arc, arbitrarily set to 1.java.lang.StringtoString()LineArc2Dtransform(AffineTransform2D trans)Transforms the curve by an affine transform.-
Methods inherited from class math.geom2d.line.AbstractLine2D
buffer, cartesianEquation, clip, curvature, direction, distance, distance, getIntersection, getSymmetric, getSymmetric, horizontalAngle, intersection, intersections, isClosed, isColinear, isColinear, isEmpty, isInside, isParallel, isParallel, length, origin, parallel, parametric, perpendicular, polarCoefficients, polarCoefficientsSigned, position, position, positionOnLine, positionOnLine, project, projectedPoint, projectedPoint, signedDistance, signedDistance, smoothPieces, supportingLine, tangent, transform, windingAngle
-
Methods inherited from class math.geom2d.curve.AbstractSmoothCurve2D
leftTangent, normal, rightTangent, vertices
-
Methods inherited from class math.geom2d.curve.AbstractContinuousCurve2D
asAwtShape, asPolyline, draw
-
Methods inherited from class java.lang.Object
getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface math.geom2d.domain.SmoothOrientedCurve2D
clip
-
Methods inherited from interface math.geom2d.curve.SmoothCurve2D
normal, tangent
-
Methods inherited from interface math.geom2d.curve.ContinuousCurve2D
asPolyline, curvature, isClosed, leftTangent, rightTangent, smoothPieces
-
Methods inherited from interface math.geom2d.domain.OrientedCurve2D
isInside, signedDistance, signedDistance, windingAngle
-
Methods inherited from interface math.geom2d.curve.Curve2D
asAwtShape, draw, intersections, position, project, vertices
-
-
-
-
Constructor Detail
-
LineArc2D
public LineArc2D(Point2D point1, Point2D point2, double t0, double t1)
- Parameters:
point1- the point located at t=0point2- the point located at t=1t0- the lower bound of line arc parameterizationt1- 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 linet0- the lower bound of line arc parameterizationt1- the upper bound of line arc parameterization
-
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 pointy1- the y-coordinate of the first pointdx- the x-coordinate of the direction vectordy- the y-coordinate of the direction vectort0- the starting position of the arct1- the ending position of the arc
-
-
Method Detail
-
create
public static LineArc2D create(Point2D p1, Point2D p2, double t0, double t1)
Static factory for creating a new LineArc2D- Since:
- 0.8.1
-
length
public double length()
Returns the length of the line arc.- Specified by:
lengthin interfaceCirculinearCurve2D- Overrides:
lengthin classAbstractLine2D- Returns:
- the length of the curve
-
getX1
public double getX1()
-
getY1
public double getY1()
-
getX2
public double getX2()
-
getY2
public double getY2()
-
parallel
public LineArc2D parallel(double d)
Description copied from interface:CirculinearCurve2DCreates 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:
parallelin interfaceCirculinearContinuousCurve2D- Specified by:
parallelin interfaceCirculinearCurve2D- Specified by:
parallelin interfaceCirculinearElement2D- Parameters:
d- the distance between the original curve and he parallel curve.- Returns:
- the parallel curve
-
t0
public double t0()
Returns the parameter of the first point of the line arc, arbitrarily set to 0.
-
getT0
@Deprecated public double getT0()
Deprecated. replaced by t0() (since 0.11.1).
-
t1
public double t1()
Returns the parameter of the last point of the line arc, arbitrarily set to 1.
-
getT1
@Deprecated public double getT1()
Deprecated. replaced by t1() (since 0.11.1).
-
point
public Point2D point(double t)
Description copied from interface:Curve2DReturns the point located at the given position on 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.
-
firstPoint
public Point2D firstPoint()
Returns the first point of the edge. In the case of a line, or a ray starting from -infinity, throws an UnboundedShape2DException.- Specified by:
firstPointin interfaceCurve2D- Overrides:
firstPointin classAbstractContinuousCurve2D- Returns:
- the last point of the arc
- See Also:
Curve2D.t0(),Curve2D.point(double)
-
lastPoint
public Point2D lastPoint()
Returns the last point of the edge. In the case of a line, or a ray ending at infinity, throws an UnboundedShape2DException.- Specified by:
lastPointin interfaceCurve2D- Overrides:
lastPointin classAbstractContinuousCurve2D- Returns:
- the last point of the arc
- See Also:
Curve2D.t1(),Curve2D.point(double)
-
singularPoints
public java.util.Collection<Point2D> singularPoints()
Description copied from class:AbstractSmoothCurve2DReturns an empty set of Point2D, as a smooth curve does not have singular points by definition.- Specified by:
singularPointsin interfaceCurve2D- Overrides:
singularPointsin classAbstractSmoothCurve2D- Returns:
- a collection of Point2D.
- See Also:
Curve2D.singularPoints()
-
isSingular
public boolean isSingular(double pos)
Description copied from class:AbstractSmoothCurve2DReturns always false, as a smooth curve does not have singular points by definition.- Specified by:
isSingularin interfaceCurve2D- Overrides:
isSingularin classAbstractSmoothCurve2D- 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)
-
continuousCurves
public java.util.Collection<? extends LineArc2D> continuousCurves()
Description copied from class:AbstractLine2DReturns a collection of lines containing only this line.- Specified by:
continuousCurvesin interfaceCirculinearCurve2D- Specified by:
continuousCurvesin interfaceCurve2D- Overrides:
continuousCurvesin classAbstractLine2D- Returns:
- a collection of continuous curves.
-
reverse
public LineArc2D reverse()
Returns the line arc which have the same trace, but has the inverse parameterization.- Specified by:
reversein interfaceCirculinearContinuousCurve2D- Specified by:
reversein interfaceCirculinearCurve2D- Specified by:
reversein interfaceCirculinearElement2D- Specified by:
reversein interfaceContinuousCurve2D- Specified by:
reversein interfaceCurve2D- Specified by:
reversein interfaceSmoothCurve2D- Specified by:
reversein interfaceContinuousOrientedCurve2D- Specified by:
reversein interfaceOrientedCurve2D- Specified by:
reversein interfaceSmoothOrientedCurve2D
-
subCurve
public LineArc2D subCurve(double t0, double t1)
Returns a new LineArc2D, which is the portion of this LineArc2D delimited by parameters t0 and t1.- Specified by:
subCurvein interfaceCirculinearContinuousCurve2D- Specified by:
subCurvein interfaceCirculinearCurve2D- Specified by:
subCurvein interfaceCirculinearElement2D- Specified by:
subCurvein interfaceContinuousCurve2D- Specified by:
subCurvein interfaceCurve2D- Specified by:
subCurvein interfaceSmoothCurve2D- Specified by:
subCurvein interfaceContinuousOrientedCurve2D- Specified by:
subCurvein interfaceSmoothOrientedCurve2D- Specified by:
subCurvein interfaceLinearElement2D- Overrides:
subCurvein classAbstractLine2D- Parameters:
t0- position of the start of the sub-curvet1- position of the end of the sub-curve- Returns:
- the portion of original curve comprised between t0 and t1.
-
isBounded
public boolean isBounded()
Returns true if both t0 and t1 are different from infinity.
-
boundingBox
public Box2D boundingBox()
Returns the bounding box of this line arc.- Specified by:
boundingBoxin interfaceShape2D- Returns:
- the bounding box of the shape.
-
contains
public boolean contains(Point2D pt)
Description copied from interface:Shape2DChecks if the shape contains the given point.- Specified by:
containsin interfaceShape2D- Overrides:
containsin classAbstractLine2D
-
contains
public boolean contains(double xp, double yp)Description copied from interface:Shape2DChecks if the shape contains the planar point defined by (x,y).
-
getGeneralPath
public java.awt.geom.GeneralPath getGeneralPath()
-
appendPath
public java.awt.geom.GeneralPath appendPath(java.awt.geom.GeneralPath path)
Appends a line to the current path. If t0 or t1 is infinite, throws a new UnboundedShape2DException.- Specified by:
appendPathin interfaceContinuousCurve2D- Parameters:
path- the path to modify- Returns:
- the modified path
-
transform
public LineArc2D transform(AffineTransform2D trans)
Description copied from interface:Curve2DTransforms the curve by an affine transform. The result is an instance of Curve2D.- Specified by:
transformin interfaceContinuousCurve2D- Specified by:
transformin interfaceCurve2D- Specified by:
transformin interfaceSmoothCurve2D- Specified by:
transformin interfaceContinuousOrientedCurve2D- Specified by:
transformin interfaceOrientedCurve2D- Specified by:
transformin interfaceSmoothOrientedCurve2D- Specified by:
transformin interfaceLinearElement2D- Specified by:
transformin interfaceLinearShape2D- Specified by:
transformin interfaceShape2D- Specified by:
transformin classAbstractLine2D- Parameters:
trans- an affine transform- Returns:
- the transformed shape
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
almostEquals
public boolean almostEquals(GeometricObject2D obj, double eps)
Description copied from interface:GeometricObject2DChecks if the two objects are similar up to a given threshold value. This method can be used to compare the results of geometric computations, that introduce errors due to numerical computations.- Specified by:
almostEqualsin interfaceGeometricObject2D- Parameters:
obj- the object to compareeps- a threshold value, for example the minimal coordinate difference- Returns:
- true if both object have the same value up to the threshold
-
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equalsin classjava.lang.Object
-
clone
@Deprecated public LineArc2D clone()
Deprecated. use copy constructor instead (0.11.2)- Specified by:
clonein interfaceCurve2D- Specified by:
clonein classAbstractLine2D
-
-
DMelt 3.0 © DataMelt by jWork.ORG