Class RMLine
- java.lang.Object
- 
- com.inductiveautomation.rm.graphics.RMLine
 
- 
- All Implemented Interfaces:
- java.lang.Cloneable
 - Direct Known Subclasses:
- RMQuadratic
 
 public class RMLine extends java.lang.Object implements java.lang.CloneableThis class models a simple line, providing methods for extracting points, distance calculation, bisection, hit detection and such.
- 
- 
Constructor SummaryConstructors Constructor Description RMLine()Creates a new line.RMLine(double x1, double y1, double x2, double y2)Creates a new line for the given x & y start/end points.RMLine(RMPoint startPoint, RMPoint endPoint)Creates a new line for the given start point and end point.
 - 
Method SummaryAll Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description RMLineclone()Standard clone implementation.doublegetAngle(double t)Returns the angle at given parametric point (in degrees).floatgetArcLength()Returns the total arc length of the segmentfloatgetArcLength(float t)Returns the arc length of the segment up to parametric value tfloatgetArcLength(float start, float end)Returns the arc length of the segment in range [start..end]RMRectgetBounds()Returns the bounds of the line.voidgetBounds(java.awt.geom.Rectangle2D aRect)Get bounds of line in given rect.doublegetDistance(RMPoint aPoint)Returns the minimum distance from the given point to this segment.doublegetDistanceLine(RMPoint aPoint)Returns the minimum distance from the given point to this line.doublegetDistanceLineSquared(double anX, double aY)Returns the minimum distance from the given point to this line, squared.static doublegetDistanceLineSquared(double p0x, double p0y, double p1x, double p1y, double p2x, double p2y)Returns the distance from the given point components (p0) to the given line components (p1->p2).RMLinegetHead(double t)Returns a new line from this line's start point to given parametric location t (defined from 0-1) on this line.RMHitInfogetHitInfo(RMBezier aBezier)Returns a hit info object for this line and the given bezier.RMHitInfogetHitInfo(RMLine aLine)Returns a hit info object for this line and the given line.RMHitInfogetHitInfo(RMQuadratic aCurve)Returns a hit info object for this line and the given bezier curve.doublegetLastX()Returns the last x.doublegetLastY()Returns the last y.doublegetMaxX()Returns the max x point of this line.doublegetMaxY()Returns the max y point of this line.doublegetMinX()Returns the min x point of this line.doublegetMinY()Returns the min y point of this line.floatgetParameterForLength(float l)Returns parametric point t that corresponds to a given length along the curve.RMPointgetPoint(double t)Returns the point on this line at the parametric location t (defined from 0-1).RMPointgetPoint(double t, RMPoint aPoint)Returns the point on this line at the parametric location t (defined from 0-1).intgetPointCount()Returns the point count of segment.doublegetPointX(int anIndex)Returns the x of point at given index.doublegetPointY(int anIndex)Returns the y of point at given index.RMLinegetTail(double t)Returns a new line from given parametric location t (defined from 0-1) on this line to this line's end point.doublegetTangent(double t, RMSize tan)Return the tangent at given point.voidsetEnd(double t)Reset this curve's end point to the given parametric location (0-1).voidsetStart(double t)Reset this curve's start point to the given parametric location (0-1).java.lang.StringtoString()Returns a string representation of this line.
 
- 
- 
- 
Method Detail- 
getPointpublic final RMPoint getPoint(double t) Returns the point on this line at the parametric location t (defined from 0-1).
 - 
getPointpublic RMPoint getPoint(double t, RMPoint aPoint) Returns the point on this line at the parametric location t (defined from 0-1).
 - 
getPointCountpublic int getPointCount() Returns the point count of segment.
 - 
getPointXpublic double getPointX(int anIndex) Returns the x of point at given index.
 - 
getPointYpublic double getPointY(int anIndex) Returns the y of point at given index.
 - 
getLastXpublic double getLastX() Returns the last x.
 - 
getLastYpublic double getLastY() Returns the last y.
 - 
getDistancepublic double getDistance(RMPoint aPoint) Returns the minimum distance from the given point to this segment.
 - 
getDistanceLinepublic double getDistanceLine(RMPoint aPoint) Returns the minimum distance from the given point to this line.
 - 
getDistanceLineSquaredpublic double getDistanceLineSquared(double anX, double aY)Returns the minimum distance from the given point to this line, squared.
 - 
getDistanceLineSquaredpublic static double getDistanceLineSquared(double p0x, double p0y, double p1x, double p1y, double p2x, double p2y)Returns the distance from the given point components (p0) to the given line components (p1->p2).
 - 
getMinXpublic double getMinX() Returns the min x point of this line.
 - 
getMinYpublic double getMinY() Returns the min y point of this line.
 - 
getMaxXpublic double getMaxX() Returns the max x point of this line.
 - 
getMaxYpublic double getMaxY() Returns the max y point of this line.
 - 
getBoundspublic final RMRect getBounds() Returns the bounds of the line.
 - 
getBoundspublic void getBounds(java.awt.geom.Rectangle2D aRect) Get bounds of line in given rect.
 - 
getHeadpublic RMLine getHead(double t) Returns a new line from this line's start point to given parametric location t (defined from 0-1) on this line.
 - 
getTailpublic RMLine getTail(double t) Returns a new line from given parametric location t (defined from 0-1) on this line to this line's end point.
 - 
setEndpublic void setEnd(double t) Reset this curve's end point to the given parametric location (0-1).
 - 
setStartpublic void setStart(double t) Reset this curve's start point to the given parametric location (0-1).
 - 
getHitInfopublic RMHitInfo getHitInfo(RMLine aLine) Returns a hit info object for this line and the given line.
 - 
getHitInfopublic RMHitInfo getHitInfo(RMQuadratic aCurve) Returns a hit info object for this line and the given bezier curve. HitInfo._index is overloaded to contain number of hits.
 - 
getHitInfopublic RMHitInfo getHitInfo(RMBezier aBezier) Returns a hit info object for this line and the given bezier.
 - 
toStringpublic java.lang.String toString() Returns a string representation of this line.- Overrides:
- toStringin class- java.lang.Object
 
 - 
getArcLengthpublic float getArcLength() Returns the total arc length of the segment
 - 
getArcLengthpublic float getArcLength(float t) Returns the arc length of the segment up to parametric value t
 - 
getArcLengthpublic float getArcLength(float start, float end)Returns the arc length of the segment in range [start..end]
 - 
getAnglepublic double getAngle(double t) Returns the angle at given parametric point (in degrees).
 - 
getTangentpublic double getTangent(double t, RMSize tan)Return the tangent at given point.
 - 
getParameterForLengthpublic float getParameterForLength(float l) Returns parametric point t that corresponds to a given length along the curve. l is in the range [0-1] (ie. percentage of total arclength). For a line, l == t.
 - 
clonepublic RMLine clone() Standard clone implementation.- Overrides:
- clonein class- java.lang.Object
 
 
- 
 
-