math.geom2d.line
Class Ray2D
- java.lang.Object
-
- All Implemented Interfaces:
- java.lang.Cloneable, CirculinearContinuousCurve2D, CirculinearCurve2D, CirculinearElement2D, CirculinearShape2D, ContinuousCurve2D, Curve2D, SmoothCurve2D, ContinuousOrientedCurve2D, OrientedCurve2D, SmoothOrientedCurve2D, GeometricObject2D, LinearElement2D, LinearShape2D, Shape2D
public class Ray2D extends AbstractLine2D implements java.lang.Cloneable
Ray, or half-line, defined from an origin and a direction vector. It is composed of all points satisfying the parametric equation:
Withx(t) = x0+t*dx
y(t) = y0+t*dytcomprised between 0 and +INFINITY.
-
-
Constructor Summary
Constructors Constructor and Description Ray2D()Empty constructor for Ray2D.Ray2D(double x, double y, double angle)Creates a new Ray2D, originating from point(x, y)<\code>, and going in the direction specified byangle<\code> (in radians).Ray2D(double x1, double y1, double dx, double dy)Creates a new Ray2D, originating from point(x1,y1)<\code>, and going in the direction defined by vector(dx, dy)<\code>.Ray2D(LinearShape2D line)Define a new Ray, with same characteristics as given object.Ray2D(Point2D point, double angle)Creates a new Ray2D, originating from pointpoint<\code>, and going in the direction specified byangle<\code> (in radians).Ray2D(Point2D point, double dx, double dy)Creates a new Ray2D, originating from pointpoint<\code>, and going in the direction defined by vector(dx,dy)<\code>.Ray2D(Point2D point1, Point2D point2)Creates a new Ray2D, originating frompoint1<\code>, and going in the direction ofpoint2<\code>.Ray2D(Point2D point, Vector2D vector)Creates a new Ray2D, originating from pointpoint<\code>, and going in the direction specified byvector<\code>.
-
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)Throws an infiniteShapeExceptionBox2DboundingBox()Returns the bounding box of the shape.Ray2Dclone()Deprecated.use copy constructor instead (0.11.2)booleancontains(double x, double y)Checks if the shape contains the planar point defined by (x,y).static Ray2Dcreate(Point2D origin, Point2D target)Deprecated.since 0.11.1static Ray2Dcreate(Point2D origin, Vector2D direction)Deprecated.since 0.11.1booleanequals(java.lang.Object obj)Point2DfirstPoint()Returns the first point of the curve.java.awt.geom.GeneralPathgetGeneralPath()Throws an infiniteShapeExceptiondoublegetT0()Deprecated.replaced by t0() (since 0.11.1).doublegetT1()Deprecated.replaced by t1() (since 0.11.1).booleanisBounded()Always returns false, because a ray is not bounded.Ray2Dparallel(double d)Returns a new ray parallel to this one, at the given relative distance.Point2Dpoint(double t)Returns the point located at the given position on the curve.InvertedRay2Dreverse()Reverses this curve, and return the result as an instance of InvertedRay2D.doublet0()Get value of parameter t for the first point of the curve.doublet1()Returns the position of the last point of the ray, which is always Double.POSITIVE_INFINITY.java.lang.StringtoString()Ray2Dtransform(AffineTransform2D trans)Transforms the curve by an affine transform.-
Methods inherited from class math.geom2d.line.AbstractLine2D
buffer, cartesianEquation, clip, contains, continuousCurves, curvature, direction, distance, distance, getIntersection, getSymmetric, getSymmetric, horizontalAngle, intersection, intersections, isClosed, isColinear, isColinear, isEmpty, isInside, isParallel, isParallel, length, length, origin, parallel, parametric, perpendicular, polarCoefficients, polarCoefficientsSigned, position, position, positionOnLine, positionOnLine, project, projectedPoint, projectedPoint, signedDistance, signedDistance, smoothPieces, subCurve, supportingLine, tangent, transform, windingAngle
-
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, lastPoint
-
Methods inherited from class java.lang.Object
getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface math.geom2d.curve.SmoothCurve2D
normal
-
Methods inherited from interface math.geom2d.curve.ContinuousCurve2D
asPolyline, leftTangent, rightTangent
-
Methods inherited from interface math.geom2d.curve.Curve2D
asAwtShape, draw, isSingular, lastPoint, singularPoints, vertices
-
-
-
-
Constructor Detail
-
Ray2D
public Ray2D()
Empty constructor for Ray2D. Default is ray starting at origin, and having a slope of 1*dx and 0*dy.
-
Ray2D
public Ray2D(Point2D point1, Point2D point2)
Creates a new Ray2D, originating frompoint1<\code>, and going in the direction ofpoint2<\code>.
-
Ray2D
public Ray2D(double x1, double y1, double dx, double dy)Creates a new Ray2D, originating from point(x1,y1)<\code>, and going in the direction defined by vector(dx, dy)<\code>.
-
Ray2D
public Ray2D(Point2D point, double dx, double dy)
Creates a new Ray2D, originating from pointpoint<\code>, and going in the direction defined by vector(dx,dy)<\code>.
-
Ray2D
public Ray2D(Point2D point, Vector2D vector)
Creates a new Ray2D, originating from pointpoint<\code>, and going in the direction specified byvector<\code>.
-
Ray2D
public Ray2D(Point2D point, double angle)
Creates a new Ray2D, originating from pointpoint<\code>, and going in the direction specified byangle<\code> (in radians).
-
Ray2D
public Ray2D(double x, double y, double angle)Creates a new Ray2D, originating from point(x, y)<\code>, and going in the direction specified byangle<\code> (in radians).
-
Ray2D
public Ray2D(LinearShape2D line)
Define a new Ray, with same characteristics as given object.
-
-
Method Detail
-
create
@Deprecated public static Ray2D create(Point2D origin, Vector2D direction)
Deprecated. since 0.11.1Static factory for creating a new ray.
-
create
@Deprecated public static Ray2D create(Point2D origin, Point2D target)
Deprecated. since 0.11.1Static factory for creating a new ray, originating fromorigin<\code>, and going in the direction oftarget<\code>.
-
parallel
public Ray2D parallel(double d)
Returns a new ray parallel to this one, at the given relative distance.- 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
- See Also:
CirculinearCurve2D.parallel(double)
-
appendPath
public java.awt.geom.GeneralPath appendPath(java.awt.geom.GeneralPath path)
Throws an infiniteShapeException- Specified by:
appendPathin interfaceContinuousCurve2D- Parameters:
path- a path to modify- Returns:
- the modified path
-
getGeneralPath
public java.awt.geom.GeneralPath getGeneralPath()
Throws an infiniteShapeException
-
firstPoint
public Point2D firstPoint()
Description copied from interface:Curve2DReturns the first point of the curve. It must returns the same result aspoint(t0()).- Specified by:
firstPointin interfaceCurve2D- Overrides:
firstPointin classAbstractContinuousCurve2D- Returns:
- the first point of the curve
- See Also:
Curve2D.t0(),Curve2D.point(double)
-
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.
-
t0
public double t0()
Description copied from interface:Curve2DGet value of parameter t for the first point of the curve. It can be -Infinity, in this case the piece of curve is not bounded.
-
getT0
@Deprecated public double getT0()
Deprecated. replaced by t0() (since 0.11.1).
-
t1
public double t1()
Returns the position of the last point of the ray, which is always Double.POSITIVE_INFINITY.
-
getT1
@Deprecated public double getT1()
Deprecated. replaced by t1() (since 0.11.1).
-
reverse
public InvertedRay2D reverse()
Reverses this curve, and return the result as an instance of InvertedRay2D.- 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- See Also:
InvertedRay2D.reverse()
-
isBounded
public boolean isBounded()
Always returns false, because a ray is not bounded.
-
contains
public boolean contains(double x, double y)Description copied from interface:Shape2DChecks if the shape contains the planar point defined by (x,y).
-
boundingBox
public Box2D boundingBox()
Description copied from interface:Shape2DReturns the bounding box of the shape.- Specified by:
boundingBoxin interfaceShape2D- Returns:
- the bounding box of the shape.
-
transform
public Ray2D 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
-
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
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equalsin classjava.lang.Object
-
clone
@Deprecated public Ray2D clone()
Deprecated. use copy constructor instead (0.11.2)- Specified by:
clonein interfaceCurve2D- Specified by:
clonein classAbstractLine2D
-
-
DMelt 3.0 © DataMelt by jWork.ORG