Update of /cvsroot/pyxida/Pyxida/src/edu/harvard/syrah/pyxida/nc/lib
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv17794/src/edu/harvard/syrah/pyxida/nc/lib
Modified Files:
Coordinate.java NCClient.java Vec.java
Log Message:
fixed xml calls, added gravity
Index: Coordinate.java
===================================================================
RCS file: /cvsroot/pyxida/Pyxida/src/edu/harvard/syrah/pyxida/nc/lib/Coordinate.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** Coordinate.java 27 Nov 2006 20:31:40 -0000 1.4
--- Coordinate.java 4 Dec 2006 16:32:44 -0000 1.5
***************
*** 198,202 ****
}
sum = Math.sqrt(sum);
! if (NCClient.USE_HEIGHT) {
sum = sum + coords[coords.length - 1] + c.coords[coords.length - 1];
}
--- 198,202 ----
}
sum = Math.sqrt(sum);
! if (NCClient.USE_HEIGHT && sum > 0) {
sum = sum + coords[coords.length - 1] + c.coords[coords.length - 1];
}
Index: Vec.java
===================================================================
RCS file: /cvsroot/pyxida/Pyxida/src/edu/harvard/syrah/pyxida/nc/lib/Vec.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** Vec.java 4 Dec 2006 13:14:19 -0000 1.2
--- Vec.java 4 Dec 2006 16:32:44 -0000 1.3
***************
*** 120,133 ****
}
- /*
public void subtract(Vec v) {
for (int i = 0; i < num_dims; ++i) {
direction[i] -= v.direction[i];
}
! if (VivaldiClient.USE_HEIGHT) {
direction[direction.length-1] += v.direction[direction.length-1];
}
}
- */
public void scale(double k) {
--- 120,131 ----
}
public void subtract(Vec v) {
for (int i = 0; i < num_dims; ++i) {
direction[i] -= v.direction[i];
}
! if (NCClient.USE_HEIGHT) {
direction[direction.length-1] += v.direction[direction.length-1];
}
}
public void scale(double k) {
Index: NCClient.java
===================================================================
RCS file: /cvsroot/pyxida/Pyxida/src/edu/harvard/syrah/pyxida/nc/lib/NCClient.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** NCClient.java 25 Nov 2006 21:39:59 -0000 1.2
--- NCClient.java 4 Dec 2006 16:32:44 -0000 1.3
***************
*** 893,911 ****
}
! // TODO add in gravity if necessary
! // Might not be with all of the churn
! // Check whether scaling should happen before or after addition of gravity
!
! /*
! * if (GRAVITY_DIAMETER > 0) { // include "gravity" to keep coordinates
! * centered on the origin Vec gravity = sys_coord.asVectorFromZero(true); if
! * (gravity.getLength() > 0) { // scale gravity s.t. it increases
! * polynomially with distance double force_of_gravity =
! * Math.pow(gravity.getLength() / GRAVITY_DIAMETER, 2.); gravity.makeUnit();
! * gravity.scale(force_of_gravity); // add to total force
! * force.subtract(gravity);
! *
! * if (keepStatistics) { running_gravity.add(force_of_gravity); } } }
! */
sys_coord.add(force);
--- 893,910 ----
}
! // include "gravity" to keep coordinates centered on the origin
! if (GRAVITY_DIAMETER > 0) {
! Vec gravity = sys_coord.asVectorFromZero(true);
! if (gravity.getLength() > 0) {
! // scale gravity s.t. it increases polynomially with distance
! double force_of_gravity =
! Math.pow(gravity.getLength() / GRAVITY_DIAMETER, 2.);
! gravity.makeUnit();
! gravity.scale(force_of_gravity); // add to total force
! force.subtract(gravity);
!
! if (keepStatistics) { running_gravity.add(force_of_gravity); }
! }
! }
sys_coord.add(force);
|