Translation3D.cxx

Go to the documentation of this file.
00001 // @(#)root/mathcore:$Id: Translation3D.cxx 22516 2008-03-07 15:14:26Z moneta $
00002 // Authors: W. Brown, M. Fischler, L. Moneta    2005
00003 
00004 /**********************************************************************
00005  *                                                                    *
00006  * Copyright (c) 2005 , LCG ROOT MathLib Team                         *
00007  *                                                                    *
00008  *                                                                    *
00009  **********************************************************************/
00010 
00011 // implementation file for class Translation3D
00012 //
00013 // Created by: Lorenzo Moneta  October 27 2005
00014 //
00015 //
00016 
00017 #include "Math/GenVector/Translation3D.h"
00018 #include "Math/GenVector/Plane3D.h"
00019 #include "Math/GenVector/PositionVector3D.h"
00020 
00021 #include <cmath>
00022 #include <algorithm>
00023 
00024 
00025 
00026 
00027 namespace ROOT {
00028 
00029 namespace Math {
00030 
00031 
00032 typedef Translation3D::Vector XYZVector; 
00033 typedef PositionVector3D<Cartesian3D<double> > XYZPoint; 
00034 
00035 
00036 // ========== Constructors and Assignment =====================
00037 
00038 
00039 Plane3D Translation3D::operator() (const Plane3D & plane) const
00040 {
00041    // transformations on a 3D plane
00042    XYZVector n = plane.Normal();
00043    // take a point on the plane. Use origin projection on the plane
00044    // ( -ad, -bd, -cd) if (a**2 + b**2 + c**2 ) = 1
00045    double d = plane.HesseDistance();
00046    XYZPoint p( - d * n.X() , - d *n.Y(), -d *n.Z() );
00047    return Plane3D ( operator() (n), operator() (p) );
00048 }
00049 
00050 std::ostream & operator<< (std::ostream & os, const Translation3D & t)
00051 {
00052    // TODO - this will need changing for machine-readable issues
00053    //        and even the human readable form needs formatiing improvements
00054    
00055    double m[3];
00056    t.GetComponents(m, m+3);
00057    os << "\n" << m[0] << "  " << m[1] << "  " << m[2] << "\n";
00058    return os;
00059 }
00060 
00061 }  // end namespace Math
00062 }  // end namespace ROOT

Generated on Tue Jul 5 14:33:07 2011 for ROOT_528-00b_version by  doxygen 1.5.1