private static final float IDEAL_FRAME_RATE = 40.0;
final float ambientLightBrightness = 208.0;
final float directionalLightBrightness = 48.0;
NaiveActorSystem myActorSystem;
ViewAngleController viewer;
frameRate(IDEAL_FRAME_RATE);
ambientLight(ambientLightBrightness, ambientLightBrightness, ambientLightBrightness);
directionalLight(directionalLightBrightness, directionalLightBrightness, directionalLightBrightness, 0, 0, -1);
viewer.applyPerspective();
viewer.translateCoordinates();
viewer.rotateCoordinates();
stroke(224.0, 160.0, 224.0);
viewer.processMouseDragged();
if(key == CODED && keyCode == 123) initialize();
final ForceFieldPhysicsSystem myPhysicsSystem = new ForceFieldPhysicsSystem();
myPhysicsSystem.forceFieldList.add(new LorenzField(10.0, 28.0, 8.0 / 3.0, 0.0, 0.0, -25.0, IDEAL_FRAME_RATE, 0.1));
myActorSystem = new NaiveActorSystem(myPhysicsSystem, 1024);
viewer = new ViewAngleController(radians(75.0), radians(-15.0), PI / 30.0, QUARTER_PI, IDEAL_FRAME_RATE, 0.0);
viewer.addMouseDragChecker(new HorizontalMouseDragChecker(new AddZRotation(), -0.3));
viewer.addMouseDragChecker(new VerticalMouseDragChecker(new AddXRotation(), -0.3));
final ArrayList<PhysicsBodyDisplayer> displayerList = new ArrayList<PhysicsBodyDisplayer>();
final int anglePartitionCount = 24;
final float lightness = 88.0;
final float distanceFromZero = 64.0;
for(int i = 0; i < anglePartitionCount; i++) {
final float hueAngle = i * TWO_PI / anglePartitionCount;
displayerList.add(new SphereDisplayer(0.2, cielabColor(lightness, distanceFromZero * cos(hueAngle), distanceFromZero * sin(hueAngle))));
final int particleNumber = 700;
for (int i = 0; i < particleNumber; i++) {
final NaiveBodyActor3D newActor = new NaiveBodyActor3D();
final float distance = pow(random(1.0), 0.5) * 30.0;
final float theta = random(TWO_PI);
final float phi = random(TWO_PI);
newActor.xPosition = distance * cos(theta) * cos(phi);
newActor.yPosition = distance * cos(theta) * sin(phi);
newActor.zPosition = distance * sin(theta);
newActor.displayer = displayerList.get(int(map(theta, 0.0, TWO_PI, 0.0, displayerList.size())));;
myActorSystem.registerNewActor(newActor);