| Modifier and Type | Field and Description |
|---|---|
protected processing.core.PApplet |
parent
The PApplet object for drawing thinks.
|
| Constructor and Description |
|---|
LineSegments(processing.core.PApplet parent,
java.util.ArrayList<processing.core.PVector> coordinates)
Builds a new LineSegments shape with the given parameters.
|
LineSegments(processing.core.PApplet parent,
processing.core.PVector[] coordinates)
Builds a new LineSegments shape with the given parameters.
|
| Modifier and Type | Method and Description |
|---|---|
void |
computeMinMax()
Forces to calculate the bounds of this shape and store them.
|
LineSegments |
copy()
Builds and returns a true copy of this shape.
|
LineSegments |
draw()
Draws the shape-
|
processing.core.PVector |
get(int i)
Returns the coordinate with index i.
|
float |
getArcLength()
Returns the arc length (sum of line lengths) of this shape.
|
Rect |
getBoundingBox()
Returns the bounding box of this shape (will mark the bounds of the
shape).
|
processing.core.PVector |
getCenter()
Returns the center coordinate of this shape.
|
processing.core.PVector[] |
getCoordinates()
Returns all coordinates that defines this shape.
|
Curve |
getCurve()
Converts this shape to a curve.
|
processing.core.PVector |
getEnd()
Returns the end coordinate for this shape.
|
float |
getLength()
Returns the length (distance from start to end) of this shape.
|
Line |
getLine()
Converts this shape to a line which shares the same start and end as this
shape.
|
Line |
getLine(int i)
Returns the line with the given index.
|
Line[] |
getLines()
Converts this shape to a lines (each segment will be a single line).
|
java.lang.Float |
getRotation()
Returns the angle of shape.
|
processing.core.PVector |
getStart()
Returns the start coordinate for this shape.
|
java.lang.Float |
getX()
Returns the x-position of the start coordinate for this shape.
|
java.lang.Float |
getY()
Returns the y-position of the start coordinate for this shape.
|
int |
lineSize()
Returns the number of lines for this LineSegments shape.
|
void |
removeIntersectingLines(java.util.ArrayList<Line> toRemove)
Removes all lines from the given set of lines that intersect with this
shape.
|
void |
removeIntersectingLines(java.util.ArrayList<Line> toRemove,
boolean ignoreStartEnd)
Removes all lines from the given set of lines that intersect with this
shape.
|
LineSegments |
rotate(float angle)
Turns the shape through the given angle.
|
LineSegments |
rotate(processing.core.PVector rotationCenter,
float angle)
Turns the shape through the given angle.
|
LineSegments |
scale(float scale)
Scale the shape by the given scaling factor.
|
LineSegments |
scale(processing.core.PVector scaleCenter,
float scale)
Scale the shape by the given scaling factor.
|
LineSegments |
scale(processing.core.PVector scaleCenter,
float scaleX,
float scaleY)
Scales the shape by the given scaling factors.
|
LineSegments |
set(int i,
float x,
float y)
Updates the position of the control point with the given index.
|
LineSegments |
set(int i,
processing.core.PVector p)
Updates the position of the control point with the given index.
|
LineSegments |
setLength(float length)
Sets the length of this shape.
|
LineSegments |
setLength(processing.core.PVector center,
float length)
Sets the length of this shape.
|
LineSegments |
setLocation(float x,
float y)
Translates the shape to the given location.
|
LineSegments |
setRotation(float angle)
Rotates the shape to the given angle (past rotations will be overridden).
|
LineSegments |
setRotation(processing.core.PVector rotationCenter,
float angle)
Rotates the shape to the given angle (past rotations will be overridden).
|
LineSegments |
setX(float x)
Translates the shape to the given x-location.
|
LineSegments |
setY(float y)
Translates the shape to the given y-location.
|
int |
size()
Returns the number of coordinates for this shape.
|
Curve |
toCurve()
Converts this shape to a curve.
|
Line |
toLine()
Converts this shape to a line which shares the same start and end as this
shape.
|
Line[] |
toLines()
Converts this shape to a lines (each segment will be a single line).
|
LineSegments |
translate(float x,
float y)
Translates the coordinates by the given parameters x, y ( "moves
the shape by x, y").
|
public LineSegments(processing.core.PApplet parent,
processing.core.PVector[] coordinates)
parent - The PApplet object.coordinates - The coordinates of this shapes. The first line will have its
start at coordinates[0] and its end at coordinates[1]. The
second line will have its start at coordinates[1] and its end
at coordinates[2] and so on. The number of coordinates should
be at least 2.public LineSegments(processing.core.PApplet parent,
java.util.ArrayList<processing.core.PVector> coordinates)
parent - The PApplet object.coordinates - The coordinates of this shapes. The first line will have its
start at coordinates.get(0) and its end at coordinates.get(1).
The second line will have its start at coordinates.get(1) and
its end at coordinates.get(2) and so on. The number of
coordinates should be at least 2.public int size()
RShape
for (int i = 0; i < myShape.size(); i++) {
PVector p = myShape.get(i);
}
public int lineSize()
public processing.core.PVector get(int i)
RShape
for (int i = 0; i < myShape.size(); i++) {
PVector p = myShape.get(i);
}
public Line getLine(int i)
for (int i = 0; i < myLineSegmentsShape.lineSize(); i++) {
myLineSegmentsShape.getLine(i).draw();
}
i - The index of the line [0, lineSize()).public processing.core.PVector getStart()
RShapepublic java.lang.Float getX()
RShapepublic java.lang.Float getY()
RShapepublic processing.core.PVector getEnd()
public float getLength()
public processing.core.PVector[] getCoordinates()
RShapegetCoordinates in interface RShapepublic Rect getBoundingBox()
RShapegetBoundingBox in interface RShapepublic float getArcLength()
public processing.core.PVector getCenter()
RShapepublic LineSegments copy()
RShapepublic java.lang.Float getRotation()
RShapegetRotation in interface RShapepublic LineSegments setRotation(float angle)
RShapesetRotation in interface RShapeangle - The target rotation angle.public LineSegments setRotation(processing.core.PVector rotationCenter, float angle)
RShapesetRotation in interface RShaperotationCenter - The rotation center.angle - The target rotation angle.public LineSegments setLength(float length)
length - The new length of the line (> 0).public LineSegments setLength(processing.core.PVector center, float length)
center - The control point for the scaling.length - The new length of the line (> 0).public LineSegments set(int i, processing.core.PVector p)
i - The index of the control point which will be updated [0,
size()).p - The new position of the control point.public LineSegments set(int i, float x, float y)
i - The index of the control point which will be updated [0,
size()).x - The new x-position of the control point.y - The new y-position of the control point.public LineSegments setX(float x)
RShapepublic LineSegments setY(float y)
RShapepublic LineSegments setLocation(float x, float y)
RShapesetLocation in interface RShapex - The new x-position of this shape.y - The new y-position of this shape.public LineSegments translate(float x, float y)
RShapepublic LineSegments rotate(float angle)
RShapepublic LineSegments rotate(processing.core.PVector rotationCenter, float angle)
RShapepublic LineSegments scale(float scale)
RShapepublic LineSegments scale(processing.core.PVector scaleCenter, float scale)
RShapepublic LineSegments scale(processing.core.PVector scaleCenter, float scaleX, float scaleY)
scaleCenter - The scaling center.scaleX - The horizontal scaling.scaleY - The vertical scaling.public void computeMinMax()
public void removeIntersectingLines(java.util.ArrayList<Line> toRemove)
toRemove - A set of lines.public void removeIntersectingLines(java.util.ArrayList<Line> toRemove, boolean ignoreStartEnd)
toRemove - A set of lines.ignoreStartEnd - If true, intersections that happen directly at the start or
the end of any line will be ignored (i.e. if the intersection
happens at start / end then the line will not be removed).public LineSegments draw()
RShapepublic Curve toCurve()
public Curve getCurve()
public Line toLine()
public Line getLine()
public Line[] toLines()
public Line[] getLines()