public class SpiralGrid extends java.lang.Object implements RGrid
| Constructor and Description |
|---|
SpiralGrid(float x,
float y,
float angleSteps,
float startAngle,
float rotations,
java.lang.Integer dir,
float startRadius,
float endRadius)
Builds a new grid.
|
| Modifier and Type | Method and Description |
|---|---|
java.lang.Float |
elementSize(java.lang.Integer index)
Calculates and returns the size of an element of the grid.
|
java.lang.Float |
getAngle(java.lang.Integer index)
Returns the angle of an element with the given index.
|
java.lang.Float |
getAngleSteps()
Returns the angle distance for each element.
|
processing.core.PVector[] |
getCoordinates()
Returns all positions of all elements in the grid.
|
java.lang.Float |
getEndRadius()
Returns the radius which describes the position of the last element of
this grid.
|
java.lang.Float |
getHeight()
Returns the current height of the grid.
|
java.lang.Float |
getHeight(java.lang.Integer i)
Returns the current height of the grid.
|
java.lang.Float |
getPadding()
Returns the space between the elements of the grid.
|
java.lang.Float |
getRadius(java.lang.Integer index)
Returns the the radius (= distance from center) of an element with the
given index.
|
java.lang.Integer |
getRotationDirection()
Returns the direction of rotation for this grid. 1=clockwise,
-1=anti-clockwise.
|
java.lang.Float |
getRotations()
Returns the number of rotations of this spiral.
|
java.lang.Float |
getStartAngle()
Returns the angle that describes the position of the first element of
this grid.
|
java.lang.Float |
getStartRadius()
Returns the radius which describes the position of the first element of
this grid.
|
java.lang.Float |
getWidth()
Returns the width of the element at the given index.
|
java.lang.Float |
getWidth(java.lang.Integer i)
Returns the current width of the grid.
|
java.lang.Float |
getX()
Returns the current x-position of the grid.
|
java.lang.Float |
getX(java.lang.Integer index)
Returns the x-position of the element at the given index.
|
java.lang.Float |
getY()
Returns the current y-position of the grid.
|
java.lang.Float |
getY(java.lang.Integer index)
Returns the y-position of the element at the given index.
|
SpiralGrid |
setAngleSteps(float radians)
Sets the angle distance between each element (in radians).
|
SpiralGrid |
setAngleStepsDeg(float degrees)
Sets the angle distance between each element (in degrees).
|
SpiralGrid |
setEndRadius(float r)
Sets the radius where the spiral ends.
|
SpiralGrid |
setPadding(float padding)
Sets the padding (space between elements of the grid).
|
SpiralGrid |
setRotationDirection(java.lang.Integer dir)
Sets the direction of the rotation.
|
SpiralGrid |
setRotations(float r)
Sets the number of rotations the spiral should make.
|
SpiralGrid |
setSize(java.lang.Integer size)
Sets the number of elements which will be placed on the grid.
|
SpiralGrid |
setStartAngle(float radians)
Set the position of the first element of the grid.
|
SpiralGrid |
setStartAngleDeg(float degrees)
Set the position of the first element of the grid.
|
SpiralGrid |
setStartRadius(float r)
Sets the radius where the spiral starts.
|
SpiralGrid |
setX(float x)
Set to x-position of the grid.
|
SpiralGrid |
setY(float y)
Set to y-position of the grid.
|
java.lang.Integer |
size()
Returns the number of elements in the grid.
|
public SpiralGrid(float x,
float y,
float angleSteps,
float startAngle,
float rotations,
java.lang.Integer dir,
float startRadius,
float endRadius)
x - The center x-location of this grid.y - The center y-location of this grid.angleSteps - The angle distance for each element (in radians).startAngle - The angle where the grid starts (in radians). The startAngle
defines where the first element will positioned.rotations - The number of rotations of this spiral.dir - The direction of the rotation of the spiral. For dir=1 the
spiral will rotate clockwise, for dir -1 anti-clockwise.startRadius - The radius where the spiral starts.endRadius - The radius where the spiral ends.public SpiralGrid setRotations(float r)
r - The number of rotations (>= 0.01)public SpiralGrid setStartAngle(float radians)
radians - The angle which describes the position of the first element
(in radian).public SpiralGrid setStartAngleDeg(float degrees)
degrees - The angle which describes the position of the first element
(in degrees).public SpiralGrid setRotationDirection(java.lang.Integer dir)
dir - Clockwise for dir >= 0, anti-clockwise for dir < 0.public SpiralGrid setAngleSteps(float radians)
radians - The angle.public SpiralGrid setAngleStepsDeg(float degrees)
degrees - The angle.public SpiralGrid setX(float x)
RGridpublic SpiralGrid setY(float y)
RGridpublic SpiralGrid setEndRadius(float r)
r - The ending radius.public SpiralGrid setStartRadius(float r)
r - The starting radius.public SpiralGrid setSize(java.lang.Integer size)
size - The number of elements for this grid.public SpiralGrid setPadding(float padding)
setPadding in interface RGridpadding - The new padding of this grid (percentage based on elementSize(Integer)) [0, 1].public processing.core.PVector[] getCoordinates()
RGridgetCoordinates in interface RGridpublic java.lang.Integer size()
RGrid
for (int i = 0; i < myGrid.size(); i++) {
float x = myGrid.getX(i);
float y = myGrid.getY(i):
}
public java.lang.Float getRotations()
public java.lang.Float getStartAngle()
public java.lang.Integer getRotationDirection()
public java.lang.Float getAngleSteps()
public java.lang.Float getX()
RGridpublic java.lang.Float getY()
RGridpublic java.lang.Float getWidth()
RGridpublic java.lang.Float getHeight()
RGridpublic java.lang.Float getEndRadius()
public java.lang.Float getStartRadius()
public java.lang.Float getAngle(java.lang.Integer index)
index - The index of the element [0, size()]public java.lang.Float getRadius(java.lang.Integer index)
index - The index of the element [0, size()]public java.lang.Float getX(java.lang.Integer index)
RGrid
for (int i = 0; i < myGrid.size(); i++) {
float x = myGrid.getX(i);
float y = myGrid.getY(i):
}
public java.lang.Float getY(java.lang.Integer index)
RGrid
for (int i = 0; i < myGrid.size(); i++) {
float x = myGrid.getX(i);
float y = myGrid.getY(i):
}
public java.lang.Float getPadding()
getPadding in interface RGridpublic java.lang.Float elementSize(java.lang.Integer index)
index - The index of the element [0, size()]public java.lang.Float getWidth(java.lang.Integer i)
RGrid