org.jbox2d.util.blob
Class BlobStructure

java.lang.Object
  extended by org.jbox2d.util.blob.BlobStructure
Direct Known Subclasses:
SquareLatticeStructure

public class BlobStructure
extends java.lang.Object

Class for a toroidal repeating blob structure. Should be subclassed with code to initialize the structure in appropriate ways, such as for a hexagonal lattice or a uniform grid.

Blobs are defined within an AABB from (0,0)->(1,1) that is then repeated to fill the full space after scaling (using the BlobMaker methods). The connections list keeps track of pairs of BlobPoints by index that are connected, and the connections* lists keep track of connections outside the AABB (to the corresponding points in the next regions).

Connections should only be defined once per pair.

This class does not allow for arbitrary repeated structures, but most structures of interest will be expressible as toroidally repeating in this way.


Constructor Summary
BlobStructure()
           
 
Method Summary
 void addConnection(int a, int b)
          Add a connection within two points in the fundamental domain.
 void addConnection(int a, int b, org.jbox2d.util.blob.BlobStructure.Region r)
          Add a connection between point at index a in the fundamental domain and point at index b in region r.
 int addPoint(BlobPoint p)
           
 float getSpringDamping()
           
 float getSpringFrequency()
           
 void setSpringDamping(float damp)
           
 void setSpringFrequency(float freq)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BlobStructure

public BlobStructure()
Method Detail

setSpringFrequency

public void setSpringFrequency(float freq)

getSpringFrequency

public float getSpringFrequency()

setSpringDamping

public void setSpringDamping(float damp)

getSpringDamping

public float getSpringDamping()

addPoint

public int addPoint(BlobPoint p)

addConnection

public void addConnection(int a,
                          int b)
Add a connection within two points in the fundamental domain.

Point indices can be obtained when points are added by storing the return value of the addPoint method.

Parameters:
a - The index in the connections ArrayList of the first point to be connected
b - The index in the connections ArrayList of the second point to be connected

addConnection

public void addConnection(int a,
                          int b,
                          org.jbox2d.util.blob.BlobStructure.Region r)
Add a connection between point at index a in the fundamental domain and point at index b in region r.

Point indices can be obtained when points are added by storing the return value of the addPoint method.

Parameters:
a -
b -
r -