Jpp
Public Member Functions | Protected Attributes | Friends | List of all members
JGEOMETRY3D::JVersor3Z Class Reference

Data structure for normalised vector in positive z-direction. More...

#include <JVersor3Z.hh>

Inheritance diagram for JGEOMETRY3D::JVersor3Z:
JMATH::JMath< JVersor3Z > JFIT::JLine3Z JFIT::JShower3Z JFIT::JLine3EZ JFIT::JShower3EZ

Public Member Functions

 JVersor3Z ()
 Default constructor. More...
 
 JVersor3Z (const JVersor2D &dir)
 Constructor. More...
 
 JVersor3Z (const double dx, const double dy)
 Constructor. More...
 
const JVersor3ZgetDirection () const
 Get direction. More...
 
JVersor3ZgetDirection ()
 Get direction. More...
 
void setDirection (const JVersor3Z &direction)
 Set direction. More...
 
 operator JAngle3D () const
 Get angle. More...
 
 operator JVector3D () const
 Type conversion operator. More...
 
 operator JVersor3D () const
 Type conversion operator. More...
 
double getDX () const
 Get x direction. More...
 
double getDY () const
 Get y direction. More...
 
double getDZ () const
 Get z direction. More...
 
JVersor3Znegate ()
 Prefix unary minus. More...
 
JVersor3Zadd (const JVersor3Z &value)
 Addition operator. More...
 
JVersor3Zsub (const JVersor3Z &value)
 Subtraction operator. More...
 
JVersor3Zmul (const double value)
 Multiplication operator. More...
 
JVersor3Zdiv (const double value)
 Division operator. More...
 
bool equals (const JVersor3D &versor, const double precision=std::numeric_limits< double >::min()) const
 Check equality. More...
 
double getDot (const JVersor3Z &dir) const
 Get dot product. More...
 
double getDot (const JAngle3D &angle) const
 Get dot product. More...
 
double getDot (const JVector3D &pos) const
 Get dot product. More...
 
double getDot (const JVersor3D &dir) const
 Get dot product. More...
 
JVersor3Zmul (const JSecond_t &object)
 Multiply with object. More...
 

Protected Attributes

double __dx
 
double __dy
 

Friends

std::istream & operator>> (std::istream &in, JVersor3Z &versor)
 Read versor from input. More...
 
std::ostream & operator<< (std::ostream &out, const JVersor3Z &versor)
 Write versor to output. More...
 
JReaderoperator>> (JReader &in, JVersor3Z &versor)
 Read versor from input. More...
 
JWriteroperator<< (JWriter &out, const JVersor3Z &versor)
 Write versor to output. More...
 

Detailed Description

Data structure for normalised vector in positive z-direction.

The member methods getDX() and getDY() refer to the corresponding direction cosines. Note that the direction cosines may have any value. The method getDZ() will simply return 0 if the sum of the squares of the direction cosines is larger than 1.

Definition at line 37 of file JVersor3Z.hh.

Constructor & Destructor Documentation

◆ JVersor3Z() [1/3]

JGEOMETRY3D::JVersor3Z::JVersor3Z ( )
inline

Default constructor.

Definition at line 44 of file JVersor3Z.hh.

44  :
45  __dx(0.0),
46  __dy(0.0)
47  {}

◆ JVersor3Z() [2/3]

JGEOMETRY3D::JVersor3Z::JVersor3Z ( const JVersor2D dir)
inline

Constructor.

Parameters
dirdirection cosines

Definition at line 55 of file JVersor3Z.hh.

55  :
56  __dx(dir.getDX()),
57  __dy(dir.getDY())
58  {}

◆ JVersor3Z() [3/3]

JGEOMETRY3D::JVersor3Z::JVersor3Z ( const double  dx,
const double  dy 
)
inline

Constructor.

Parameters
dxdirection cosine dx/dz
dydirection cosine dy/dz

Definition at line 67 of file JVersor3Z.hh.

68  :
69  __dx(dx),
70  __dy(dy)
71  {}

Member Function Documentation

◆ getDirection() [1/2]

const JVersor3Z& JGEOMETRY3D::JVersor3Z::getDirection ( ) const
inline

Get direction.

Returns
direction

Definition at line 79 of file JVersor3Z.hh.

80  {
81  return static_cast<const JVersor3Z&>(*this);
82  }

◆ getDirection() [2/2]

JVersor3Z& JGEOMETRY3D::JVersor3Z::getDirection ( )
inline

Get direction.

Returns
direction

Definition at line 90 of file JVersor3Z.hh.

91  {
92  return static_cast<JVersor3Z&>(*this);
93  }

◆ setDirection()

void JGEOMETRY3D::JVersor3Z::setDirection ( const JVersor3Z direction)
inline

Set direction.

Parameters
directiondirection

Definition at line 101 of file JVersor3Z.hh.

102  {
103  static_cast<JVersor3Z&>(*this) = direction;
104  }

◆ operator JAngle3D()

JGEOMETRY3D::JVersor3Z::operator JAngle3D ( ) const
inline

Get angle.

Returns
angle

Definition at line 112 of file JVersor3Z.hh.

113  {
114  return JAngle3D(getDX(), getDY(), getDZ());
115  }

◆ operator JVector3D()

JGEOMETRY3D::JVersor3Z::operator JVector3D ( ) const
inline

Type conversion operator.

Returns
position

Definition at line 123 of file JVersor3Z.hh.

124  {
125  return JVector3D(getDX(), getDY(), getDZ());
126  }

◆ operator JVersor3D()

JGEOMETRY3D::JVersor3Z::operator JVersor3D ( ) const
inline

Type conversion operator.

Returns
direction

Definition at line 134 of file JVersor3Z.hh.

135  {
136  return JVersor3D(getDX(), getDY(), getDZ());
137  }

◆ getDX()

double JGEOMETRY3D::JVersor3Z::getDX ( ) const
inline

Get x direction.

Returns
x direction

Definition at line 145 of file JVersor3Z.hh.

146  {
147  return __dx;
148  }

◆ getDY()

double JGEOMETRY3D::JVersor3Z::getDY ( ) const
inline

Get y direction.

Returns
y direction

Definition at line 156 of file JVersor3Z.hh.

157  {
158  return __dy;
159  }

◆ getDZ()

double JGEOMETRY3D::JVersor3Z::getDZ ( ) const
inline

Get z direction.

Returns
z direction

Definition at line 167 of file JVersor3Z.hh.

168  {
169  const double v = getDX()*getDX() + getDY()*getDY();
170 
171  if (v <= 1.0)
172  return sqrt(1.0 - v);
173  else
174  return 0.0;
175  }

◆ negate()

JVersor3Z& JGEOMETRY3D::JVersor3Z::negate ( )
inline

Prefix unary minus.

Returns
this versor

Definition at line 183 of file JVersor3Z.hh.

184  {
185  __dx = -__dx;
186  __dy = -__dy;
187 
188  return *this;
189  }

◆ add()

JVersor3Z& JGEOMETRY3D::JVersor3Z::add ( const JVersor3Z value)
inline

Addition operator.

Parameters
valueversor
Returns
this versor

Definition at line 198 of file JVersor3Z.hh.

199  {
200  __dx += value.getDX();
201  __dy += value.getDY();
202 
203  return *this;
204  }

◆ sub()

JVersor3Z& JGEOMETRY3D::JVersor3Z::sub ( const JVersor3Z value)
inline

Subtraction operator.

Parameters
valueversor
Returns
this versor

Definition at line 213 of file JVersor3Z.hh.

214  {
215  __dx -= value.getDX();
216  __dy -= value.getDY();
217 
218  return *this;
219  }

◆ mul() [1/2]

JVersor3Z& JGEOMETRY3D::JVersor3Z::mul ( const double  value)
inline

Multiplication operator.

Parameters
valuemultiplication factor
Returns
this versor

Definition at line 228 of file JVersor3Z.hh.

229  {
230  __dx *= value;
231  __dy *= value;
232 
233  return *this;
234  }

◆ div()

JVersor3Z& JGEOMETRY3D::JVersor3Z::div ( const double  value)
inline

Division operator.

Parameters
valuemultiplication factor
Returns
this versor

Definition at line 243 of file JVersor3Z.hh.

244  {
245  __dx /= value;
246  __dy /= value;
247 
248  return *this;
249  }

◆ equals()

bool JGEOMETRY3D::JVersor3Z::equals ( const JVersor3D versor,
const double  precision = std::numeric_limits<double>::min() 
) const
inline

Check equality.

Parameters
versorversor
Returns
true if versors are equal; else false

Definition at line 258 of file JVersor3Z.hh.

260  {
261  return (fabs(getDX() - versor.getDX()) <= precision &&
262  fabs(getDY() - versor.getDY()) <= precision);
263  }

◆ getDot() [1/4]

double JGEOMETRY3D::JVersor3Z::getDot ( const JVersor3Z dir) const
inline

Get dot product.

Parameters
dirdirection
Returns
dot product

Definition at line 272 of file JVersor3Z.hh.

273  {
274  return
275  getDX() * dir.getDX() +
276  getDY() * dir.getDY() +
277  getDZ() * dir.getDZ();
278  }

◆ getDot() [2/4]

double JGEOMETRY3D::JVersor3Z::getDot ( const JAngle3D angle) const
inline

Get dot product.

Parameters
angleangle
Returns
dot product

Definition at line 287 of file JVersor3Z.hh.

288  {
289  return
290  getDX() * angle.getDX() +
291  getDY() * angle.getDY() +
292  getDZ() * angle.getDZ();
293  }

◆ getDot() [3/4]

double JGEOMETRY3D::JVersor3Z::getDot ( const JVector3D pos) const
inline

Get dot product.

Parameters
posposition
Returns
dot product

Definition at line 302 of file JVersor3Z.hh.

303  {
304  return
305  getDX() * pos.getX() +
306  getDY() * pos.getY() +
307  getDZ() * pos.getZ();
308  }

◆ getDot() [4/4]

double JGEOMETRY3D::JVersor3Z::getDot ( const JVersor3D dir) const
inline

Get dot product.

Parameters
dirdirection
Returns
dot product

Definition at line 317 of file JVersor3Z.hh.

318  {
319  return
320  getDX() * dir.getDX() +
321  getDY() * dir.getDY() +
322  getDZ() * dir.getDZ();
323  }

◆ mul() [2/2]

JVersor3Z & JMATH::JMath< JVersor3Z , JSecond_t >::mul ( const JSecond_t &  object)
inlineinherited

Multiply with object.

Parameters
objectobject
Returns
result object

Definition at line 273 of file JMath.hh.

274  {
275  return static_cast<JFirst_t&>(*this) = JCalculator<JFirst_t>::calculator.mul(static_cast<const JFirst_t&>(*this), object);
276  }

Friends And Related Function Documentation

◆ operator>> [1/2]

std::istream& operator>> ( std::istream &  in,
JVersor3Z versor 
)
friend

Read versor from input.

Parameters
ininput stream
versorversor
Returns
input stream

Definition at line 333 of file JVersor3Z.hh.

334  {
335  return in >> versor.__dx >> versor.__dy;
336  }

◆ operator<< [1/2]

std::ostream& operator<< ( std::ostream &  out,
const JVersor3Z versor 
)
friend

Write versor to output.

Parameters
outoutput stream
versorversor
Returns
output stream

Definition at line 346 of file JVersor3Z.hh.

347  {
348  return out << versor.getDX() << ' ' << versor.getDY();
349  }

◆ operator>> [2/2]

JReader& operator>> ( JReader in,
JVersor3Z versor 
)
friend

Read versor from input.

Parameters
inreader
versorversor
Returns
reader

Definition at line 359 of file JVersor3Z.hh.

360  {
361  return in >> versor.__dx >> versor.__dy;
362  }

◆ operator<< [2/2]

JWriter& operator<< ( JWriter out,
const JVersor3Z versor 
)
friend

Write versor to output.

Parameters
outwriter
versorversor
Returns
writer

Definition at line 372 of file JVersor3Z.hh.

373  {
374  return out << versor.__dx << versor.__dy;
375  }

Member Data Documentation

◆ __dx

double JGEOMETRY3D::JVersor3Z::__dx
protected

Definition at line 378 of file JVersor3Z.hh.

◆ __dy

double JGEOMETRY3D::JVersor3Z::__dy
protected

Definition at line 379 of file JVersor3Z.hh.


The documentation for this class was generated from the following file:
JGEOMETRY3D::JVersor3D::getDZ
double getDZ() const
Get z direction.
Definition: JVersor3D.hh:113
JGEOMETRY3D::JVector3D::getZ
double getZ() const
Get z position.
Definition: JVector3D.hh:114
JGEOMETRY3D::JVersor3D
Data structure for normalised vector in three dimensions.
Definition: JVersor3D.hh:23
JGEOMETRY3D::JVersor3Z::__dx
double __dx
Definition: JVersor3Z.hh:378
JGEOMETRY3D::JVector3D
Data structure for vector in three dimensions.
Definition: JVector3D.hh:33
JGEOMETRY3D::JAngle3D::getDX
double getDX() const
Get x direction.
Definition: JAngle3D.hh:106
JGEOMETRY3D::JVersor3D::getDX
double getDX() const
Get x direction.
Definition: JVersor3D.hh:91
JGEOMETRY3D::JVersor3D::getDY
double getDY() const
Get y direction.
Definition: JVersor3D.hh:102
JTOOLS::v
data_type v[N+1][M+1]
Definition: JPolint.hh:707
JGEOMETRY3D::JAngle3D
Data structure for angles in three dimensions.
Definition: JAngle3D.hh:31
JGEOMETRY3D::JAngle3D::getDZ
double getDZ() const
Get z direction.
Definition: JAngle3D.hh:128
JGEOMETRY3D::JVector3D::getY
double getY() const
Get y position.
Definition: JVector3D.hh:103
JGEOMETRY3D::JAngle3D::getDY
double getDY() const
Get y direction.
Definition: JAngle3D.hh:117
JGEOMETRY3D::JVersor3Z::getDY
double getDY() const
Get y direction.
Definition: JVersor3Z.hh:156
JMATH::JCalculator
Auxiliary class for arithmetic operations on objects.
Definition: JCalculator.hh:18
JGEOMETRY3D::JVector3D::getX
double getX() const
Get x position.
Definition: JVector3D.hh:93
JGEOMETRY3D::JVersor3Z::getDZ
double getDZ() const
Get z direction.
Definition: JVersor3Z.hh:167
JGEOMETRY3D::JVersor3Z::__dy
double __dy
Definition: JVersor3Z.hh:379
JGEOMETRY3D::JVersor3Z::getDX
double getDX() const
Get x direction.
Definition: JVersor3Z.hh:145