Jpp  16.0.2
the software that should make you happy
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Public Member Functions | Protected Attributes | List of all members
JGEOMETRY3D::JVersor3D Class Reference

Data structure for normalised vector in three dimensions. More...

#include <JVersor3D.hh>

Inheritance diagram for JGEOMETRY3D::JVersor3D:
JMATH::JMath< JFirst_t, JSecond_t > JGEOMETRY3D::JDirection3D JGEOMETRY3D::JAxis3D JDETECTOR::JPMT JFIT::JPMTW0 JGEOMETRY3D::JTrack3D JTRIGGER::JHitL0 JTRIGGER::JPMTHeader JGEOMETRY3D::JTrack3E JRECONSTRUCTION::JHitW0 JTRIGGER::JFrame< JElement_t, JAllocator_t > JTRIGGER::JFrameClone< JElement_t, JAllocator_t > JGEOMETRY3D::JTrack3EY

Public Member Functions

 JVersor3D ()
 Default constructor. More...
 
 JVersor3D (const double dx, const double dy, const double dz)
 Constructor. More...
 
JVersor3Dnegate ()
 Negate versor. More...
 
bool equals (const JVersor3D &versor, const double precision=std::numeric_limits< double >::min()) const
 Check equality. More...
 
double getDX () const
 Get x direction. More...
 
double getDY () const
 Get y direction. More...
 
double getDZ () const
 Get z direction. More...
 
double getTheta () const
 Get theta angle. More...
 
double getPhi () const
 Get phi angle. More...
 
double getDot (const JVersor3D &versor) const
 Get dot product. More...
 
JVersor3DgetCross (const JVersor3D &first, const JVersor3D &second)
 Get cross product. More...
 
JVersor3Dnormalise ()
 Normalise versor. More...
 
JFirst_t & mul (const JSecond_t &object)
 Multiply with object. More...
 

Protected Attributes

double __dx
 
double __dy
 
double __dz
 

Detailed Description

Data structure for normalised vector in three dimensions.

Definition at line 26 of file JVersor3D.hh.

Constructor & Destructor Documentation

JGEOMETRY3D::JVersor3D::JVersor3D ( )
inline

Default constructor.

This constructor yields a unit z-vector.

Definition at line 34 of file JVersor3D.hh.

34  :
35  __dx(0.0),
36  __dy(0.0),
37  __dz(1.0)
38  {}
JGEOMETRY3D::JVersor3D::JVersor3D ( const double  dx,
const double  dy,
const double  dz 
)
inline

Constructor.

Parameters
dxdx value
dydy value
dzdz value

Definition at line 48 of file JVersor3D.hh.

50  :
51  __dx(dx),
52  __dy(dy),
53  __dz(dz)
54  {
55  normalise();
56  }
JVersor3D & normalise()
Normalise versor.
Definition: JVersor3D.hh:192

Member Function Documentation

JVersor3D& JGEOMETRY3D::JVersor3D::negate ( )
inline

Negate versor.

Returns
this versor

Definition at line 64 of file JVersor3D.hh.

65  {
66  __dx = -__dx;
67  __dy = -__dy;
68  __dz = -__dz;
69 
70  return *this;
71  }
bool JGEOMETRY3D::JVersor3D::equals ( const JVersor3D versor,
const double  precision = std::numeric_limits<double>::min() 
) const
inline

Check equality.

Parameters
versorversor
precisionprecision
Returns
true if versors are equal; else false

Definition at line 81 of file JVersor3D.hh.

83  {
84  return (fabs(getDX() - versor.getDX()) <= precision &&
85  fabs(getDY() - versor.getDY()) <= precision &&
86  fabs(getDZ() - versor.getDZ()) <= precision);
87  }
double getDY() const
Get y direction.
Definition: JVersor3D.hh:106
double getDX() const
Get x direction.
Definition: JVersor3D.hh:95
double getDZ() const
Get z direction.
Definition: JVersor3D.hh:117
double JGEOMETRY3D::JVersor3D::getDX ( ) const
inline

Get x direction.

Returns
x direction

Definition at line 95 of file JVersor3D.hh.

96  {
97  return __dx;
98  }
double JGEOMETRY3D::JVersor3D::getDY ( ) const
inline

Get y direction.

Returns
y direction

Definition at line 106 of file JVersor3D.hh.

107  {
108  return __dy;
109  }
double JGEOMETRY3D::JVersor3D::getDZ ( ) const
inline

Get z direction.

Returns
z direction

Definition at line 117 of file JVersor3D.hh.

118  {
119  return __dz;
120  }
double JGEOMETRY3D::JVersor3D::getTheta ( ) const
inline

Get theta angle.

Returns
theta angle [rad]

Definition at line 128 of file JVersor3D.hh.

129  {
130  if (__dz > +1.0)
131  return 0.0;
132  else if (__dz < -1.0)
133  return JMATH::PI;
134  else
135  return acos(__dz);
136  }
static const double PI
Mathematical constants.
double JGEOMETRY3D::JVersor3D::getPhi ( ) const
inline

Get phi angle.

Returns
phi angle [rad]

Definition at line 144 of file JVersor3D.hh.

145  {
146  return atan2(__dy, __dx);
147  }
double JGEOMETRY3D::JVersor3D::getDot ( const JVersor3D versor) const
inline

Get dot product.

Parameters
versorversor
Returns
dot product

Definition at line 156 of file JVersor3D.hh.

157  {
158  return
159  getDX() * versor.getDX() +
160  getDY() * versor.getDY() +
161  getDZ() * versor.getDZ();
162  }
double getDY() const
Get y direction.
Definition: JVersor3D.hh:106
double getDX() const
Get x direction.
Definition: JVersor3D.hh:95
double getDZ() const
Get z direction.
Definition: JVersor3D.hh:117
JVersor3D& JGEOMETRY3D::JVersor3D::getCross ( const JVersor3D first,
const JVersor3D second 
)
inline

Get cross product.

Note that this versor should not overlap with the first or second versor,

Parameters
firstfirst versor
secondsecond versor
Returns
this versor

Definition at line 173 of file JVersor3D.hh.

175  {
176  __dx = first .getDY() * second.getDZ() - second.getDY() * first .getDZ();
177  __dy = second.getDX() * first .getDZ() - first .getDX() * second.getDZ();
178  __dz = first .getDX() * second.getDY() - second.getDX() * first .getDY();
179 
180  normalise();
181 
182  return *this;
183  }
JVersor3D & normalise()
Normalise versor.
Definition: JVersor3D.hh:192
double getDY() const
Get y direction.
Definition: JVersor3D.hh:106
double getDX() const
Get x direction.
Definition: JVersor3D.hh:95
double getDZ() const
Get z direction.
Definition: JVersor3D.hh:117
JVersor3D& JGEOMETRY3D::JVersor3D::normalise ( )
inline

Normalise versor.

This operation may set the result to the unit z-vector.

Returns
this versor

Definition at line 192 of file JVersor3D.hh.

193  {
194  const double v = sqrt(getDX()*getDX() + getDY()*getDY() + getDZ()*getDZ());
195 
196  if (v != 0.0) {
197  __dx /= v;
198  __dy /= v;
199  __dz /= v;
200  }
201 
202  return *this;
203  }
double getDY() const
Get y direction.
Definition: JVersor3D.hh:106
double getDX() const
Get x direction.
Definition: JVersor3D.hh:95
data_type v[N+1][M+1]
Definition: JPolint.hh:756
double getDZ() const
Get z direction.
Definition: JVersor3D.hh:117
template<class JFirst_t, class JSecond_t = JNullType>
JFirst_t& JMATH::JMath< JFirst_t, JSecond_t >::mul ( const JSecond_t &  object)
inlineinherited

Multiply with object.

Parameters
objectobject
Returns
result object

Definition at line 357 of file JMath.hh.

358  {
359  return static_cast<JFirst_t&>(*this) = JCalculator<JFirst_t>::calculator.mul(static_cast<const JFirst_t&>(*this), object);
360  }
Auxiliary class for arithmetic operations on objects.
Definition: JCalculator.hh:18

Member Data Documentation

double JGEOMETRY3D::JVersor3D::__dx
protected

Definition at line 206 of file JVersor3D.hh.

double JGEOMETRY3D::JVersor3D::__dy
protected

Definition at line 207 of file JVersor3D.hh.

double JGEOMETRY3D::JVersor3D::__dz
protected

Definition at line 208 of file JVersor3D.hh.


The documentation for this class was generated from the following file: