Skip to content

Commit

Permalink
Merge commit 'bikegriffith/master'
Browse files Browse the repository at this point in the history
Seems to help when there are a very large number of people at once
(to test, try visualizing the Rails repo with 1 frame per day)
  • Loading branch information
rictic committed Feb 12, 2010
2 parents e82e1e5 + 149f051 commit c80b2fc
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 10 deletions.
3 changes: 2 additions & 1 deletion run.sh
Expand Up @@ -49,7 +49,8 @@ fi

# running
#if java -Xmx1000m -classpath dist/code_swarm.jar:lib/core.jar:lib/xml.jar:lib/vecmath.jar:. code_swarm $params; then
if java -Xmx1000m -classpath dist/code_swarm.jar:lib/gluegen-rt.jar:lib/jogl.jar:lib/jogl-natives-macosx-universal.jar:lib/core.jar:lib/opengl.jar:lib/xml.jar:lib/vecmath.jar:. code_swarm $params; then
#if java -Xmx1000m -classpath dist/code_swarm.jar:lib/gluegen-rt.jar:lib/jogl.jar:lib/jogl-natives-macosx-universal.jar:lib/core.jar:lib/opengl.jar:lib/xml.jar:lib/vecmath.jar:. code_swarm $params; then
if java -Xmx1000m -classpath dist/code_swarm.jar:lib/gluegen-rt.jar:lib/jogl.jar:lib/jogl-natives-macosx-universal.jar:lib/core.jar:lib/opengl.jar:lib/xml.jar:lib/vecmath.jar:. -Djava.library.path=lib/ code_swarm $params; then
# always on error due to no "exit buton" on rendering window
echo "bye"
# echo -n "error, press a key to exit"
Expand Down
1 change: 1 addition & 0 deletions run_projectfocus.sh
@@ -0,0 +1 @@
./run.sh data/projectfocus.config
19 changes: 10 additions & 9 deletions src/PhysicsEngineOrderly.java
Expand Up @@ -52,6 +52,16 @@ public void setup (CodeSwarmConfig p)
public void onRelax(code_swarm.PersonNode pNode) {
Vector2f delta = new Vector2f();

// A gentle force to attract pNodes to the center
// NOTE: this should be done prior to attraction/repulsion forces, otherwise
// tends to generate a grid-like pattern
Vector2f midpoint = new Vector2f(code_swarm.width / 2, code_swarm.height / 2);
delta = new Vector2f();
delta.sub(midpoint, pNode.mPosition);

delta.scale(1 / delta.length() * 0.003f);
pNode.mPosition.add(delta);

// All person nodes attract each other, but only to a certain point, then they repel with gentle force
for (code_swarm.PersonNode n : code_swarm.getLivingPeople()) {
if (pNode != n) {
Expand All @@ -76,15 +86,6 @@ public void onRelax(code_swarm.PersonNode pNode) {
}
}


// A gentle force to attract pNodes to the center
Vector2f midpoint = new Vector2f(code_swarm.width / 2, code_swarm.height / 2);
delta = new Vector2f();
delta.sub(midpoint, pNode.mPosition);

delta.scale(1 / delta.length() * 0.003f);
pNode.mPosition.add(delta);

// place the edited files around the person
Iterator<code_swarm.FileNode> editedFiles = pNode.editing.iterator();
int index = 0;
Expand Down

0 comments on commit c80b2fc

Please sign in to comment.