|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.partnersoft.geometry.xy.XyLineSegment
public class XyLineSegment
A line segment in (x, y) space. Has an explicit start and end point.
Copyright 2006-2007 Partner Software, Inc.
| Constructor Summary | |
|---|---|
XyLineSegment(double startX,
double startY,
double endX,
double endY)
Create a new line segment with the given starting and ending coordinates. |
|
XyLineSegment(XyPoint start,
XyPoint end)
Create a new line segment starting and ending at the given points. |
|
| Method Summary | |
|---|---|
XyLineSegment |
clippedTo(XyBounds bounds)
Clip this line to the given bounds. |
XyPoint |
closestPointTo(XyPoint nother)
Solves for the closest point to the segment. |
XyBounds |
getBounds()
Returns an XyBounds object representing the rectangular extents of this shape. |
XyPoint |
getCenterPoint()
Returns the midpoint, or center, of the segment. |
XyDirection |
getDirection()
Returns the direction of the line segment, treating it as a vector from start to end. |
XyPoint |
getEndPoint()
Returns the last point in the shape. |
double |
getLength()
Returns the length of the path. |
XyLine |
getLine()
The line this is a segment of. |
XyPoint |
getStartPoint()
Returns the first point in the shape. |
java.util.Iterator<XyPoint> |
iterator()
|
XyLineSegment |
scaledBy(double factor)
Return a scaled version of the shape by multiplying all coordinates by the given factor in both dimensions. |
java.util.List<XyPoint> |
splitAtIntervals(double... intervals)
Returns a list of points, determined by splitting this segment up using the sequence of intervals given. |
XyPolyline |
toPolyline()
Same as XyPath.toPolyline(XyAngle) with a default angle granularity of
1/60 circle (6 degrees, pi/30 radians). |
XyPolyline |
toPolyline(XyAngle granularity)
Converts this area to a polyline which approximates it in some fashion. |
XyVector |
toVector()
Returns the vector equivalent for this line segment. |
XyShape |
transformedBy(XyTransform transform)
Transform the shape using the given transform. |
XyLineSegment |
translatedBy(double offsetX,
double offsetY)
Translate the shape by adding all coordinates to the given x and y offsets. |
XyLineSegment |
withEndPoint(XyPoint newEnd)
Returns a modified version of this line segment with the given end point. |
XyLineSegment |
withStartPoint(XyPoint newStart)
Returns a modified version of this line segment with the given start point. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public XyLineSegment(XyPoint start,
XyPoint end)
public XyLineSegment(double startX,
double startY,
double endX,
double endY)
| Method Detail |
|---|
public XyLineSegment withStartPoint(XyPoint newStart)
public XyLineSegment withEndPoint(XyPoint newEnd)
public XyVector toVector()
public XyPoint closestPointTo(XyPoint nother)
public java.util.List<XyPoint> splitAtIntervals(double... intervals)
public XyLineSegment clippedTo(XyBounds bounds)
public double getLength()
XyPath
getLength in interface XyPath<XyLineSegment>public XyPolyline toPolyline(XyAngle granularity)
XyPathThe angle parameter allows a certain level of control of the output. Essentially it dictates the minimum angular granularity used to approximate curved paths. For example, an arc would be turned into a polyline by placing points around the arc's slice of a circle, separated by the given angle.
toPolyline in interface XyPath<XyLineSegment>public XyPolyline toPolyline()
XyPathXyPath.toPolyline(XyAngle) with a default angle granularity of
1/60 circle (6 degrees, pi/30 radians).
toPolyline in interface XyPath<XyLineSegment>public XyPoint getStartPoint()
XyPath
getStartPoint in interface XyPath<XyLineSegment>public XyPoint getEndPoint()
XyPath
getEndPoint in interface XyPath<XyLineSegment>public java.util.Iterator<XyPoint> iterator()
iterator in interface java.lang.Iterable<XyPoint>public XyBounds getBounds()
XyShape
getBounds in interface XyShape<XyLineSegment>public XyLineSegment scaledBy(double factor)
XyShape
scaledBy in interface XyShape<XyLineSegment>factor - scaling factor
public XyShape transformedBy(XyTransform transform)
XyShape
transformedBy in interface XyShape<XyLineSegment>transform - affine transform to apply.
public XyLineSegment translatedBy(double offsetX,
double offsetY)
XyShape
translatedBy in interface XyShape<XyLineSegment>offsetX - offset for the x dimensionoffsetY - offset for the y dimension
public XyLine getLine()
public XyPoint getCenterPoint()
public XyDirection getDirection()
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||