Logo ROOT   6.08/07
Reference Guide
Translation3D.cxx
Go to the documentation of this file.
1 // @(#)root/mathcore:$Id$
2 // Authors: W. Brown, M. Fischler, L. Moneta 2005
3 
4 /**********************************************************************
5  * *
6  * Copyright (c) 2005 , LCG ROOT MathLib Team *
7  * *
8  * *
9  **********************************************************************/
10 
11 // implementation file for class Translation3D
12 //
13 // Created by: Lorenzo Moneta October 27 2005
14 //
15 //
16 
18 #include "Math/GenVector/Plane3D.h"
20 
21 #include <cmath>
22 #include <algorithm>
23 
24 
25 
26 
27 namespace ROOT {
28 
29 namespace Math {
30 
31 
33 typedef PositionVector3D<Cartesian3D<double> > XYZPoint;
34 
35 
36 // ========== Constructors and Assignment =====================
37 
38 
40 {
41  // transformations on a 3D plane
42  XYZVector n = plane.Normal();
43  // take a point on the plane. Use origin projection on the plane
44  // ( -ad, -bd, -cd) if (a**2 + b**2 + c**2 ) = 1
45  double d = plane.HesseDistance();
46  XYZPoint p( - d * n.X() , - d *n.Y(), -d *n.Z() );
47  return Plane3D ( operator() (n), operator() (p) );
48 }
49 
50 std::ostream & operator<< (std::ostream & os, const Translation3D & t)
51 {
52  // TODO - this will need changing for machine-readable issues
53  // and even the human readable form needs formatiing improvements
54 
55  double m[3];
56  t.GetComponents(m, m+3);
57  os << "\n" << m[0] << " " << m[1] << " " << m[2] << "\n";
58  return os;
59 }
60 
61 } // end namespace Math
62 } // end namespace ROOT
Class describing a geometrical plane in 3 dimensions.
Definition: Plane3D.h:47
This namespace contains pre-defined functions to be used in conjuction with TExecutor::Map and TExecu...
Definition: StringConv.hxx:21
PositionVector3D< Cartesian3D< double >, DefaultCoordinateSystemTag > XYZPoint
3D Point based on the cartesian coordinates x,y,z in double precision
Definition: Point3Dfwd.h:33
void GetComponents(IT begin, IT end) const
Get the 3 components into data specified by an iterator begin and another to the end of the desired d...
DisplacementVector3D< Cartesian3D< double >, DefaultCoordinateSystemTag > Vector
Definition: Translation3D.h:62
std::ostream & operator<<(std::ostream &os, const AxisAngle &a)
Stream Output and Input.
Definition: AxisAngle.cxx:91
Scalar X() const
Cartesian X, converting if necessary from internal coordinate system.
Scalar Z() const
Cartesian Z, converting if necessary from internal coordinate system.
Scalar Y() const
Cartesian Y, converting if necessary from internal coordinate system.
Vector Normal() const
Return normal vector to the plane as Cartesian DisplacementVector.
Definition: Plane3D.h:166
TMarker * m
Definition: textangle.C:8
Scalar HesseDistance() const
Return the Hesse Distance (distance from the origin) of the plane or the d coefficient expressed in n...
Definition: Plane3D.h:174
PositionVector3D< CoordSystem, Tag > operator()(const PositionVector3D< CoordSystem, Tag > &p) const
Transformation operation for Position Vector in any coordinate system and default tag...
Class describing a 3 dimensional translation.
Definition: Translation3D.h:57
DisplacementVector3D< Cartesian3D< double >, DefaultCoordinateSystemTag > XYZVector
3D Vector based on the cartesian coordinates x,y,z in double precision
Definition: Vector3Dfwd.h:34
Namespace for new Math classes and functions.
const Int_t n
Definition: legend1.C:16