View Javadoc

1   package org.lcsim.spacegeom;
2   
3   import static java.lang.Math.sqrt;
4   import static org.lcsim.spacegeom.Representation.Cartesian;
5   /**
6    *
7    *@version $Id: CartesianVector.java,v 1.1.1.1 2010/12/01 00:15:57 jeremy Exp $
8    */
9   public class CartesianVector extends SpaceVector
10  {
11  	/**
12  	 * Constructs a new Vector from the first three dimensions of an array
13  	 * @param x The coordinate array
14  	 */
15      public CartesianVector(double[] x) {
16      	this(x[0], x[1], x[2]);
17      }
18      /**
19       * Constructs a new Vector from 3 Cartesian co-ordinates
20       * @param x
21       * @param y
22       * @param z
23       */
24      public CartesianVector(double x, double y, double z)
25      {
26          _x = x;
27          _y = y;
28          _z = z;
29          _representation = Cartesian;
30          _phi = Double.NaN;
31          _theta = Double.NaN;
32          _xy = Double.NaN;
33          _xyz = sqrt(_x*_x + _y*_y + _z*_z);
34      }
35  }