3 modified files
GeomConverter/src/org/lcsim/detector/solids
diff -u -r1.2 -r1.3
--- Polygon3D.java 3 Dec 2007 23:23:30 -0000 1.2
+++ Polygon3D.java 6 Dec 2007 02:39:32 -0000 1.3
@@ -29,6 +29,7 @@
{
super(points);
_points = points;
+ checkNormal();
}
public int nSides()
@@ -53,6 +54,52 @@
return closed_points;
}
+ public void checkNormal()
+ {
+ Plane3D test_plane = new Plane3D(_points);
+ if (!GeomOp3D.equals(test_plane,getPlane()))
+ {
+ System.out.println("Normal to points: "+test_plane.getNormal());
+ System.out.println("Normal to plane: "+getNormal());
+ throw new RuntimeException("Normal to points does not match plane");
+ }
+ }
+
+// public void reverseNormal()
+// {
+// super.reverseNormal();
+// checkNormal();
+// }
+
+// public void faceOutward()
+// {
+// if (getDistance() < 0)
+// {
+// reverseNormal();
+// }
+// }
+//
+
+ public void reverseNormal()
+ {
+
+// System.out.println("Reversing points!!!!!!!!!!!!!!!!!");
+// if (1 == 1) throw new RuntimeException();
+
+ super.reverseNormal();
+
+ List<Point3D> reversed_points = new ArrayList<Point3D>();
+ for (int ipoint = _points.size()-1; ipoint >= 0; ipoint--)
+ {
+ reversed_points.add(_points.get(ipoint));
+ }
+
+ _points = reversed_points;
+
+ checkNormal();
+
+ }
+
public List<LineSegment3D> getEdges()
{
List<LineSegment3D> edges = new ArrayList<LineSegment3D>();
@@ -68,23 +115,56 @@
public void transform(ITransform3D transform)
{
+
+ // can these get out of sync?
+
+ super.transform(transform);
for (Point3D point : _points)
{
point.transform(transform);
- }
- Plane3D new_plane = new Plane3D(_points);
- this._distance = new_plane.getDistance();
- this._normal = new_plane.getNormal();
+ }
+
+ checkNormal();
+
+// Plane3D new_plane = new Plane3D(_points);
+// this._distance = new_plane.getDistance();
+// this._normal = new_plane.getNormal();
}
public Polygon3D transformed(ITransform3D transform)
{
+
+// System.out.println("Polygon before transformation: "+this);
+
List<Point3D> transformed_points = new ArrayList<Point3D>();
for (Point3D point : _points)
{
transformed_points.add(point.transformed(transform));
}
- return new Polygon3D(transformed_points);
+
+ Polygon3D transformed_polygon = new Polygon3D(transformed_points);
+
+// System.out.println("Polygon after transformation: "+transformed_polygon);
+
+ checkNormal();
+
+ return transformed_polygon;
+
+// return new Polygon3D(transformed_points);
+ }
+
+ public String toString()
+ {
+ String newline = System.getProperty("line.separator");
+ String output = "Polygon3D: "+newline+
+ " Normal: "+this.getNormal()+newline+
+ " Distance: "+this.getDistance()+newline+
+ " Vertices:"+newline;
+ for (Point3D vertex : this.getVertices())
+ {
+ output += vertex.getHep3Vector()+newline;
+ }
+ return output;
}
}
GeomConverter/src/org/lcsim/detector/solids
diff -u -r1.3 -r1.4
--- GeomOp3D.java 3 Dec 2007 23:23:30 -0000 1.3
+++ GeomOp3D.java 6 Dec 2007 02:39:32 -0000 1.4
@@ -41,9 +41,13 @@
public static boolean equals(Plane3D plane1, Plane3D plane2)
{
+// System.out.println("Equals returns: " + ( parallel(plane1,plane2) &&
+// VecOp.dot(plane1.getNormal(),plane2.getNormal()) > 0 &&
+// Math.abs(plane1.getDistance() - plane2.getDistance()) < DISTANCE_TOLERANCE));
+
return ( parallel(plane1,plane2) &&
VecOp.dot(plane1.getNormal(),plane2.getNormal()) > 0 &&
- plane1.getDistance() - plane2.getDistance() < DISTANCE_TOLERANCE);
+ Math.abs(plane1.getDistance() - plane2.getDistance()) < DISTANCE_TOLERANCE);
}
// intersection tests
GeomConverter/src/org/lcsim/detector/converter/compact
diff -u -r1.14 -r1.15
--- SiTrackerEndcapConverter.java 6 Dec 2007 01:26:34 -0000 1.14
+++ SiTrackerEndcapConverter.java 6 Dec 2007 02:39:32 -0000 1.15
@@ -57,7 +57,7 @@
* Converter for SiTrackerEndcap.
*
* @author Jeremy McCormick, Tim Nelson
- * @version $Id: SiTrackerEndcapConverter.java,v 1.14 2007/12/06 01:26:34 jeremy Exp $
+ * @version $Id: SiTrackerEndcapConverter.java,v 1.15 2007/12/06 02:39:32 tknelson Exp $
*/
public class SiTrackerEndcapConverter
@@ -721,14 +721,14 @@
{
p_side = inner_surface;
n_side = outer_surface;
- side = -1;
+ side = 1;
// strip_angle = strip_angle_magnitude;
}
else // outer sensor
{
p_side = outer_surface;
n_side = inner_surface;
- side = 1;
+ side = -1;
// strip_angle = -1*strip_angle_magnitude;
}
@@ -752,7 +752,7 @@
System.out.println(" side = : "+side);
- ITranslation3D electrodes_position = new Translation3D(VecOp.mult(p_side.getDistance(),new BasicHep3Vector(0,0,1))); // translate to outside of polygon
+ ITranslation3D electrodes_position = new Translation3D(VecOp.mult(-p_side.getDistance(),new BasicHep3Vector(0,0,1))); // translate to outside of polygon
// ITranslation3D electrodes_position = new Translation3D(VecOp.mult(-p_side.getDistance(),p_side.getNormal())); // translate to p_side
IRotation3D electrodes_rotation = new RotationPassiveXYZ(side*(Math.PI/2),0,0*strip_angle); //
Transform3D electrodes_transform = new Transform3D(electrodes_position, electrodes_rotation);
CVSspam 0.2.8