1 package org.lcsim.spacegeom; 2 3 import hep.physics.vec.Hep3Vector; 4 5 /** 6 * A SpaceVector is the representation of a vector in 3D space, where a vector is defined to have a direction and a length. 7 * SpaceVector objects know about their representation in cartesian, spherical and cylindrical coordinate systems. 8 * In distinction to points in space, vectors are invariant under translation and can be multiplied by a scalar. 9 * A scalar and a vector product is defined for vectors, and the difference between two SpacePoints is a SpaceVector. 10 * For interoperability with Freehep classes, SpaceVector implements the Hep3Vector interface. 11 * 12 *@version $Id: SpaceVector.java,v 1.1.1.1 2010/12/01 00:15:57 jeremy Exp $ 13 */ 14 public class SpaceVector extends SpacePoint 15 { 16 17 /** 18 * A vector of zero length doesn't make sense 19 */ 20 SpaceVector() 21 { 22 } 23 24 /** 25 * Constructor from a SpacePoint 26 * Creates a vector from (0,0,0) to this point 27 * @param spt SpacePoint to point to 28 */ 29 public SpaceVector(Hep3Vector spt) 30 { 31 super(spt); 32 } 33 34 /** 35 * Output Stream 36 * 37 * @return String representation of object 38 */ 39 public String toString() 40 { 41 return _representation + " SpaceVector: " + "\n" + 42 " x: " + x() + "\n" + 43 " y: " + y() + "\n" + 44 " z: " + z() + "\n" + 45 " rxy: " + rxy() + "\n" + 46 " rxyz: " + rxyz() + "\n" + 47 " phi: " + phi() + "\n" + 48 "theta: " + theta() + "\n" ; 49 } 50 51 }