|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.cybertory.MSS.PolygonFactory
An object instance of PolygonFactory is a factory to create polygons of a specified
degree of variability. The method createPolygon(float)
produces a Polygon
whose approximate radius is specified in
the call, centered at (0,0).
Pseudo-random polygons serve as polygons.
The formulae for calculating polar coordinates
(rn, Θn) representing the location of
Vertexn with the polygon centered at (0,0) are shown below.
Reference to variables passed into the constructor or method createPolygon
are in boldface.
(RADIUS)
rn = (1+dn) * R
d0 = v / (1+s)
dn = v + dn-1*s / (1+s)
where:
R
createPolygon(float)
method
dn
v
dn-1
s
(ANGLE)
Θ0 = 0
Θn = Θn-1 + (1 + v) * 2*Π/n
where:
Θn
Θn-1
v
n
Constructor Summary | |
PolygonFactory(java.util.Random rand,
float radiusVariability,
float radiusStickiness,
int approxNumVertices,
float angleVariability)
Constructor: See class documentation for formulas to see how these parameters are used. |
|
PolygonFactory(java.util.Random rand,
int variabilityLevel)
Constructor with pre-packaged variability parameters. |
Method Summary | |
void |
addAngleBias(AngleBias bias)
|
java.awt.Polygon |
createPolygon()
Creates a polygon with the default radius (which must have been set up with a previous call to setDefaultRadius(float) . |
java.awt.Polygon |
createPolygon(float refRadius)
Creates a polygon with the specified (approximate) radius. |
org.cybertory.MSS.PolarCoords[] |
createPolygonPolar()
|
org.cybertory.MSS.PolarCoords[] |
createPolygonPolar(float refRadius)
|
void |
setDefaultRadius(float defaultRadius)
Set up a default radius for use with calls to the createPolygon() without a radius parameter. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public PolygonFactory(java.util.Random rand, float radiusVariability, float radiusStickiness, int approxNumVertices, float angleVariability)
rand
- a random number generator objectradiusVariability
- a measure of polygon radius variabilityradiusStickiness
- how much the radius of one vertex effects the
radius of the subsequent vertexapproxNumVertices
- the approximate number of vertices in the
polygon polygon (affects smoothness)angleVariability
- a measure of variability of angles between
verticespublic PolygonFactory(java.util.Random rand, int variabilityLevel)
variabilityLevel
- one of the following constants:Method Detail |
public void addAngleBias(AngleBias bias)
public void setDefaultRadius(float defaultRadius)
createPolygon()
without a radius parameter.
defaultRadius
- default radius in pixelspublic org.cybertory.MSS.PolarCoords[] createPolygonPolar()
public org.cybertory.MSS.PolarCoords[] createPolygonPolar(float refRadius)
public java.awt.Polygon createPolygon()
setDefaultRadius(float)
.
Polygon
object for the polygon.public java.awt.Polygon createPolygon(float refRadius)
refRadius
- the reference (approximate) radius of the polygon
Polygon
object for the polygon.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |