View Javadoc

1   package org.lcsim.spacegeom;
2   /** A Cartesian SpacePoint
3    *
4    *@author Norman A. Graf
5    *@version $Id: CartesianPoint.java,v 1.1.1.1 2010/12/01 00:15:57 jeremy Exp $
6    *
7    */
8   import static org.lcsim.spacegeom.Representation.Cartesian;
9   
10  public class CartesianPoint extends SpacePoint
11  {
12  	protected CartesianPoint() {
13  		
14  	}
15      /**
16       * Constructor.
17       * Constructs a SpacePoint with Cartesian coordinates
18       * @param x Cartesian x coordinate
19       * @param y Cartesian y coordinate
20       * @param z Cartesian z coordinate
21       */
22      public CartesianPoint(double x, double y, double z)
23      {
24          _x   = x;
25          _y   = y;
26          _z   = z;
27          _representation = Cartesian;
28          _xy  = Double.NaN;
29          _xyz = Math.sqrt(_x*_x + _y*_y + _z*_z);
30          _phi = Double.NaN;
31          _theta = Double.NaN;
32      }
33      
34      /**
35       * Constructs a CartesianSpacePoint from a legacy vector
36       * @param x
37       */
38      public CartesianPoint(double[] x)
39      {
40          this(x[0], x[1], x[2]);
41      }
42  }