diff options
| author | Phillip <pacardon@u.washington.edu> | 2011-03-09 02:22:41 +0000 | 
|---|---|---|
| committer | Phillip <pacardon@u.washington.edu> | 2011-03-09 02:22:41 +0000 | 
| commit | 879b778599790f479edc41b60d80cceb13bbb3ea (patch) | |
| tree | 2e58224755c209c8dee4dc863c6a9ea31737c8cf /src/tesseract | |
| parent | 5316678773e76421749441c7234683ef6d588396 (diff) | |
Diffstat (limited to 'src/tesseract')
| -rw-r--r-- | src/tesseract/generators/BoxField.java | 60 | ||||
| -rw-r--r-- | src/tesseract/generators/GeneratorsMenu.java | 1 | 
2 files changed, 61 insertions, 0 deletions
| diff --git a/src/tesseract/generators/BoxField.java b/src/tesseract/generators/BoxField.java new file mode 100644 index 0000000..ccb07f5 --- /dev/null +++ b/src/tesseract/generators/BoxField.java @@ -0,0 +1,60 @@ +package tesseract.generators;
 +
 +import javax.vecmath.Vector3f;
 +
 +import com.sun.j3d.utils.geometry.Primitive;
 +
 +import tesseract.World;
 +import tesseract.objects.Box;
 +import tesseract.objects.PhysicalObject;
 +import tesseract.objects.Sphere;
 +
 +/**
 + * Generate a sphere field.
 + * 
 + * @author Phillip Cardon
 + */
 +public class BoxField extends MenuItem {
 +
 +	/**
 +	 * 
 +	 */
 +	private static final long serialVersionUID = 1L;
 +
 +	private static final int FIELD_SIZE = 4;
 +	
 +	private static final float BOX_SIZE = 0.025f;
 +	
 +	public BoxField(World theWorld) {
 +		super("Cube Field", theWorld);
 +	}
 +
 +	/**
 +	 * Generate the field.
 +	 * 
 +	 * @param theWorld Where to put them
 +	 */
 +	public void generate(final World theWorld) {
 +		final float start = 1.01f * 0.5f * FIELD_SIZE * BOX_SIZE; 
 +		//int num = 0;
 +		//Box box = new Box(SPHERE_SIZE, SPHERE_SIZE, SPHERE_SIZE, new Vector3f(x, y, z));
 +		//PhysicalObject s = new Sphere(SPHERE_SIZE, new Vector3f(0f, 0f, 0f));
 +		
 +		for (float x = -start; x <= +start; x += BOX_SIZE * 1.01f) {
 +			for (float y = -start; y <= +start; y += BOX_SIZE * 1.01f) {
 +				for (float z = -start; z <= +start; z += BOX_SIZE * 1.01f) {
 +					//PhysicalObject s = new Sphere(SPHERE_SIZE, new Vector3f(x, y, z));
 +					//theWorld.addObject(s);
 +					//Sphere s = new Sphere(SPHERE_SIZE, new Vector3f(x, y, z));
 +					Box box = new Box(BOX_SIZE, BOX_SIZE, BOX_SIZE, new Vector3f(x, y, z));
 +					theWorld.addObject(box);
 +					//num++;
 +					//break;
 +				}
 +				//break;
 +			}
 +			//break;
 +		}//*/
 +		//System.out.println(num + " Spheres added");
 +	}
 +}
 diff --git a/src/tesseract/generators/GeneratorsMenu.java b/src/tesseract/generators/GeneratorsMenu.java index 41cbc23..6e9bc22 100644 --- a/src/tesseract/generators/GeneratorsMenu.java +++ b/src/tesseract/generators/GeneratorsMenu.java @@ -25,5 +25,6 @@ public class GeneratorsMenu extends JMenu {  		// Build the menu of generators.  		add(new SphereField(theWorld));  		add(new ParticleField(theWorld)); +		add(new BoxField(theWorld));  	}  } | 
