View Javadoc

1   package org.lcsim.detector.solids;
2   
3   import hep.physics.vec.BasicHep3Vector;
4   import hep.physics.vec.Hep3Vector;
5   import hep.physics.vec.VecOp;
6   
7   /**
8    *
9    * @author tknelson
10   */
11  public class GeomOp2D
12  {
13      
14      // All operations are defined on x,y plane
15      public static final Plane3D PLANE = new Plane3D(new BasicHep3Vector(0,0,1),0);
16      
17      public static final double DISTANCE_TOLERANCE = 1E-9;
18      public static final double ANGULAR_TOLERANCE = 1E-9;
19      
20      /** Creates a new instance of GeomOp2D */
21      public GeomOp2D()
22      {
23      }
24      
25      public static boolean intersects(Line3D line, LineSegment3D linesegment)
26      {
27          Hep3Vector diff_start = VecOp.sub(linesegment.getStartPoint(),line.getStartPoint());
28          Hep3Vector diff_end = VecOp.sub(linesegment.getEndPoint(),line.getStartPoint());
29          Hep3Vector start_cross = VecOp.cross(line.getDirection(),diff_start);
30          Hep3Vector end_cross = VecOp.cross(line.getDirection(),diff_end);
31          return (VecOp.dot(start_cross,end_cross) < 0);
32      }
33      
34  //    public Point3D intersection(Line3D line, LineSegment3D linesegment)
35  //    {
36  //        
37  //        
38  //        
39  //    }
40      
41      
42      
43  }