public class EquiSpiralGrid extends java.lang.Object implements RGrid
| Constructor and Description |
|---|
EquiSpiralGrid(float x,
float y,
float startRadius,
float endRadius,
float elementDistance,
float rotations,
float startAngle,
int dir)
Builds a new grid.
|
| Modifier and Type | Method and Description |
|---|---|
processing.core.PVector |
get(int index)
Returns the location of the element with the given index.
|
java.lang.Float |
getAngle(java.lang.Integer index)
Returns the angle of an element with the given index.
|
processing.core.PVector[] |
getCoordinates()
Returns all positions of all elements in the grid.
|
java.lang.Float |
getElementDistance()
The distance each element will have to its neighbors.
|
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.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.
|
EquiSpiralGrid |
setElementDistance(float elementDistance)
Sets the distance of each element to its neighbors of this grid.
|
EquiSpiralGrid |
setEndRadius(float r)
Sets the radius where the spiral ends.
|
EquiSpiralGrid |
setPadding(float padding)
Sets the padding (space between elements of the grid).
|
EquiSpiralGrid |
setRotationDirection(int dir)
Sets the direction of the rotation.
|
EquiSpiralGrid |
setRotations(float r)
Sets the number of rotations the spiral should make.
|
EquiSpiralGrid |
setStartAngle(float a)
Set the position of the first element of the grid.
|
EquiSpiralGrid |
setStartRadius(float r)
Sets the radius where the spiral starts.
|
EquiSpiralGrid |
setX(float x)
Set to x-position of the grid.
|
EquiSpiralGrid |
setY(float y)
Set to y-position of the grid.
|
java.lang.Integer |
size()
Returns the number of elements in the grid.
|
public EquiSpiralGrid(float x,
float y,
float startRadius,
float endRadius,
float elementDistance,
float rotations,
float startAngle,
int dir)
x - The center x-location of this grid.y - The center y-location of this grid.startRadius - The radius where the spiral starts.endRadius - The radius where the spiral ends.elementDistance - The distance for each element on the grid.rotations - The number of rotations of this spiral.startAngle - The angle where the grid starts (in radians). The startAngle
defines where the first element will positioned.dir - The direction of the rotation of the spiral. For dir=1 the
spiral will rotate clockwise, for dir -1 anti-clockwise.public EquiSpiralGrid setX(float x)
RGridpublic EquiSpiralGrid setY(float y)
RGridpublic EquiSpiralGrid setStartRadius(float r)
r - The starting radius.public EquiSpiralGrid setEndRadius(float r)
r - The ending radius.public EquiSpiralGrid setElementDistance(float elementDistance)
elementDistance - The distance of each element to its neighbors (>= 1).public EquiSpiralGrid setStartAngle(float a)
a - The angle which describes the position of the first element
(in radian).public EquiSpiralGrid setRotations(float r)
r - The number of rotations (>= 0.01)public EquiSpiralGrid setRotationDirection(int dir)
dir - Clockwise for dir >= 0, anti-clockwise for dir < 0.public EquiSpiralGrid setPadding(float padding)
setPadding in interface RGridpadding - The new padding of this grid (percentage based on elementDistances()) [0, 1].public processing.core.PVector[] getCoordinates()
RGridgetCoordinates in interface RGridpublic java.lang.Float getX()
RGridpublic java.lang.Float getY()
RGridpublic java.lang.Float getWidth()
RGridpublic java.lang.Float getHeight()
RGridpublic java.lang.Float getStartRadius()
public java.lang.Float getEndRadius()
public java.lang.Float getElementDistance()
public java.lang.Float getStartAngle()
public java.lang.Integer getRotationDirection()
public java.lang.Float getRotations()
public java.lang.Float getPadding()
getPadding 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 getAngle(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 processing.core.PVector get(int index)
for (int i = 0; i < myGrid.size(); i++) {
PVector position = myGrid.get(index);
}
index - The index of the element.public java.lang.Float getWidth(java.lang.Integer i)
RGrid