Jpp
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
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 JNullType &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

JGEOMETRY3D::JVersor3Z::JVersor3Z ( )
inline

Default constructor.

Definition at line 44 of file JVersor3Z.hh.

44  :
45  __dx(0.0),
46  __dy(0.0)
47  {}
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  {}
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

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  }
Data structure for normalised vector in positive z-direction.
Definition: JVersor3Z.hh:37
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  }
Data structure for normalised vector in positive z-direction.
Definition: JVersor3Z.hh:37
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  }
Data structure for normalised vector in positive z-direction.
Definition: JVersor3Z.hh:37
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  }
Data structure for angles in three dimensions.
Definition: JAngle3D.hh:31
double getDY() const
Get y direction.
Definition: JVersor3Z.hh:156
double getDX() const
Get x direction.
Definition: JVersor3Z.hh:145
double getDZ() const
Get z direction.
Definition: JVersor3Z.hh:167
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  }
double getDY() const
Get y direction.
Definition: JVersor3Z.hh:156
Data structure for vector in three dimensions.
Definition: JVector3D.hh:33
double getDX() const
Get x direction.
Definition: JVersor3Z.hh:145
double getDZ() const
Get z direction.
Definition: JVersor3Z.hh:167
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  }
double getDY() const
Get y direction.
Definition: JVersor3Z.hh:156
double getDX() const
Get x direction.
Definition: JVersor3Z.hh:145
double getDZ() const
Get z direction.
Definition: JVersor3Z.hh:167
Data structure for normalised vector in three dimensions.
Definition: JVersor3D.hh:23
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  }
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  }
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  }
double getDY() const
Get y direction.
Definition: JVersor3Z.hh:156
double getDX() const
Get x direction.
Definition: JVersor3Z.hh:145
data_type v[N+1][M+1]
Definition: JPolint.hh:707
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  }
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  }
double getDY() const
Get y direction.
Definition: JVersor3Z.hh:156
double getDX() const
Get x direction.
Definition: JVersor3Z.hh:145
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  }
double getDY() const
Get y direction.
Definition: JVersor3Z.hh:156
double getDX() const
Get x direction.
Definition: JVersor3Z.hh:145
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  }
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  }
bool JGEOMETRY3D::JVersor3Z::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 259 of file JVersor3Z.hh.

261  {
262  return (fabs(getDX() - versor.getDX()) <= precision &&
263  fabs(getDY() - versor.getDY()) <= precision);
264  }
double getDY() const
Get y direction.
Definition: JVersor3Z.hh:156
double getDY() const
Get y direction.
Definition: JVersor3D.hh:103
double getDX() const
Get x direction.
Definition: JVersor3D.hh:92
double getDX() const
Get x direction.
Definition: JVersor3Z.hh:145
double JGEOMETRY3D::JVersor3Z::getDot ( const JVersor3Z dir) const
inline

Get dot product.

Parameters
dirdirection
Returns
dot product

Definition at line 273 of file JVersor3Z.hh.

274  {
275  return
276  getDX() * dir.getDX() +
277  getDY() * dir.getDY() +
278  getDZ() * dir.getDZ();
279  }
double getDY() const
Get y direction.
Definition: JVersor3Z.hh:156
double getDX() const
Get x direction.
Definition: JVersor3Z.hh:145
double getDZ() const
Get z direction.
Definition: JVersor3Z.hh:167
double JGEOMETRY3D::JVersor3Z::getDot ( const JAngle3D angle) const
inline

Get dot product.

Parameters
angleangle
Returns
dot product

Definition at line 288 of file JVersor3Z.hh.

289  {
290  return
291  getDX() * angle.getDX() +
292  getDY() * angle.getDY() +
293  getDZ() * angle.getDZ();
294  }
double getDY() const
Get y direction.
Definition: JVersor3Z.hh:156
double getDX() const
Get x direction.
Definition: JVersor3Z.hh:145
double getDZ() const
Get z direction.
Definition: JVersor3Z.hh:167
double getDX() const
Get x direction.
Definition: JAngle3D.hh:106
double getDZ() const
Get z direction.
Definition: JAngle3D.hh:128
double getDY() const
Get y direction.
Definition: JAngle3D.hh:117
double JGEOMETRY3D::JVersor3Z::getDot ( const JVector3D pos) const
inline

Get dot product.

Parameters
posposition
Returns
dot product

Definition at line 303 of file JVersor3Z.hh.

304  {
305  return
306  getDX() * pos.getX() +
307  getDY() * pos.getY() +
308  getDZ() * pos.getZ();
309  }
double getDY() const
Get y direction.
Definition: JVersor3Z.hh:156
double getY() const
Get y position.
Definition: JVector3D.hh:103
double getDX() const
Get x direction.
Definition: JVersor3Z.hh:145
double getX() const
Get x position.
Definition: JVector3D.hh:93
double getDZ() const
Get z direction.
Definition: JVersor3Z.hh:167
double getZ() const
Get z position.
Definition: JVector3D.hh:114
double JGEOMETRY3D::JVersor3Z::getDot ( const JVersor3D dir) const
inline

Get dot product.

Parameters
dirdirection
Returns
dot product

Definition at line 318 of file JVersor3Z.hh.

319  {
320  return
321  getDX() * dir.getDX() +
322  getDY() * dir.getDY() +
323  getDZ() * dir.getDZ();
324  }
double getDY() const
Get y direction.
Definition: JVersor3Z.hh:156
double getDY() const
Get y direction.
Definition: JVersor3D.hh:103
double getDX() const
Get x direction.
Definition: JVersor3D.hh:92
double getDX() const
Get x direction.
Definition: JVersor3Z.hh:145
double getDZ() const
Get z direction.
Definition: JVersor3Z.hh:167
double getDZ() const
Get z direction.
Definition: JVersor3D.hh:114
JVersor3Z & JMATH::JMath< JVersor3Z , JNullType >::mul ( const JNullType 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  }
Auxiliary class for arithmetic operations on objects.
Definition: JCalculator.hh:18

Friends And Related Function Documentation

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

Read versor from input.

Parameters
ininput stream
versorversor
Returns
input stream

Definition at line 334 of file JVersor3Z.hh.

335  {
336  return in >> versor.__dx >> versor.__dy;
337  }
esac print_variable DETECTOR INPUT_FILE OUTPUT_FILE CDF for TYPE in
Definition: JSirene.sh:45
std::ostream& operator<< ( std::ostream &  out,
const JVersor3Z versor 
)
friend

Write versor to output.

Parameters
outoutput stream
versorversor
Returns
output stream

Definition at line 347 of file JVersor3Z.hh.

348  {
349  return out << versor.getDX() << ' ' << versor.getDY();
350  }
double getDY() const
Get y direction.
Definition: JVersor3Z.hh:156
double getDX() const
Get x direction.
Definition: JVersor3Z.hh:145
JReader& operator>> ( JReader in,
JVersor3Z versor 
)
friend

Read versor from input.

Parameters
inreader
versorversor
Returns
reader

Definition at line 360 of file JVersor3Z.hh.

361  {
362  return in >> versor.__dx >> versor.__dy;
363  }
esac print_variable DETECTOR INPUT_FILE OUTPUT_FILE CDF for TYPE in
Definition: JSirene.sh:45
JWriter& operator<< ( JWriter out,
const JVersor3Z versor 
)
friend

Write versor to output.

Parameters
outwriter
versorversor
Returns
writer

Definition at line 373 of file JVersor3Z.hh.

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

Member Data Documentation

double JGEOMETRY3D::JVersor3Z::__dx
protected

Definition at line 379 of file JVersor3Z.hh.

double JGEOMETRY3D::JVersor3Z::__dy
protected

Definition at line 380 of file JVersor3Z.hh.


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