lcsim/test/org/lcsim/util/swim
diff -u -r1.10 -r1.11
--- HelixTest.java 28 Oct 2005 07:57:27 -0000 1.10
+++ HelixTest.java 28 Oct 2005 19:56:59 -0000 1.11
@@ -12,7 +12,7 @@
/**
*
* @author tonyj
- * @version $Id: HelixTest.java,v 1.10 2005/10/28 07:57:27 jstrube Exp $
+ * @version $Id: HelixTest.java,v 1.11 2005/10/28 19:56:59 jstrube Exp $
*/
public class HelixTest extends TestCase
{
@@ -187,16 +187,17 @@
double phi = Math.PI/4;
double lambda = Math.PI/4;
Helix helix = new Helix(origin, radius, phi, lambda);
-
+ double period = 2*Math.PI*radius/Math.cos(lambda);
+// System.out.println(period);
// test "random" points on helix
for (int i=0; i<500; ++i) {
Hep3Vector pointOnHelix = helix.getPointAtDistance(-i*.27);
+// System.out.println(pointOnHelix.z());
// System.err.printf("%.3f, found: %s\n", -i*.27, helix.getDistanceToPoint(pointOnHelix));
assertEquals(helix.getDistanceToPoint(pointOnHelix), -i*.27, 1e-10);
}
// test that the distance to points has the right period along z
- double period = 2*Math.PI*radius/Math.cos(lambda);
double offset = helix.getDistanceToPoint(new BasicHep3Vector(origin.x()+0.333, origin.y(), origin.z()));
for (int i=0; i<5; ++i) {
Hep3Vector newPoint = new BasicHep3Vector(origin.x()+0.333, origin.y(), origin.z()+i*radius*Math.tan(lambda)*Math.PI*2);
@@ -294,11 +295,11 @@
}
}
- public void testCurvature() {
+ public void testCurvatureSign() {
Hep3Vector origin = new BasicHep3Vector(3, 6, 9);
double radius = 1.5;
double phi = Math.PI/2;
- double lambda = 0;
+ double lambda = 1.3;
for (int iPhi=0; iPhi<50; ++iPhi) {
Helix helix1 = new Helix(origin, radius, iPhi*phi, lambda);
Helix helix2 = new Helix(origin, -radius, iPhi*phi, lambda);
@@ -312,18 +313,22 @@
Helix helix1 = new Helix(origin, radius, phi, lambda);
Helix helix2 = new Helix(origin, -radius, phi, lambda);
- Hep3Vector h1 = helix1.getPointAtDistance(Math.PI/2*radius);
+ Hep3Vector h1 = helix1.getPointAtDistance(Math.PI/2*radius/cos(lambda));
assertEquals(h1.x(), 4.5, 1e-14);
assertEquals(h1.y(), 7.5, 1e-14);
- Hep3Vector h2 = helix2.getPointAtDistance(Math.PI/2*radius);
+ assertTrue(h1.z() > origin.z());
+ Hep3Vector h2 = helix2.getPointAtDistance(Math.PI/2*radius/cos(lambda));
assertEquals(h2.x(), 1.5, 1e-14);
assertEquals(h2.y(), 7.5, 1e-14);
- Hep3Vector h3 = helix1.getPointAtDistance(-Math.PI/2*radius);
+ assertTrue(h2.z() > origin.z());
+ Hep3Vector h3 = helix1.getPointAtDistance(-Math.PI/2*radius/cos(lambda));
assertEquals(h3.x(), 4.5, 1e-14);
assertEquals(h3.y(), 4.5, 1e-14);
- Hep3Vector h4 = helix2.getPointAtDistance(-Math.PI/2*radius);
+ assertTrue(h3.z() < origin.z());
+ Hep3Vector h4 = helix2.getPointAtDistance(-Math.PI/2*radius/cos(lambda));
assertEquals(h4.x(), 1.5, 1e-14);
assertEquals(h4.y(), 4.5, 1e-14);
+ assertTrue(h4.z() < origin.z());
}