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 JVersor3Z &versor) 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 36 of file JVersor3Z.hh.

Constructor & Destructor Documentation

JGEOMETRY3D::JVersor3Z::JVersor3Z ( )
inline

Default constructor.

Definition at line 43 of file JVersor3Z.hh.

43  :
44  __dx(0.0),
45  __dy(0.0)
46  {}
JGEOMETRY3D::JVersor3Z::JVersor3Z ( const JVersor2D dir)
inline

Constructor.

Parameters
dirdirection cosines

Definition at line 54 of file JVersor3Z.hh.

54  :
55  __dx(dir.getDX()),
56  __dy(dir.getDY())
57  {}
JGEOMETRY3D::JVersor3Z::JVersor3Z ( const double  dx,
const double  dy 
)
inline

Constructor.

Parameters
dxdirection cosine dx/dz
dydirection cosine dy/dz

Definition at line 66 of file JVersor3Z.hh.

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

Member Function Documentation

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

Get direction.

Returns
direction

Definition at line 78 of file JVersor3Z.hh.

79  {
80  return static_cast<const JVersor3Z&>(*this);
81  }
Data structure for normalised vector in positive z-direction.
Definition: JVersor3Z.hh:36
JVersor3Z& JGEOMETRY3D::JVersor3Z::getDirection ( )
inline

Get direction.

Returns
direction

Definition at line 89 of file JVersor3Z.hh.

90  {
91  return static_cast<JVersor3Z&>(*this);
92  }
Data structure for normalised vector in positive z-direction.
Definition: JVersor3Z.hh:36
void JGEOMETRY3D::JVersor3Z::setDirection ( const JVersor3Z direction)
inline

Set direction.

Parameters
directiondirection

Definition at line 100 of file JVersor3Z.hh.

101  {
102  static_cast<JVersor3Z&>(*this) = direction;
103  }
Data structure for normalised vector in positive z-direction.
Definition: JVersor3Z.hh:36
JGEOMETRY3D::JVersor3Z::operator JAngle3D ( ) const
inline

Get angle.

Returns
angle

Definition at line 111 of file JVersor3Z.hh.

112  {
113  return JAngle3D(getDX(), getDY(), getDZ());
114  }
Data structure for angles in three dimensions.
Definition: JAngle3D.hh:30
double getDY() const
Get y direction.
Definition: JVersor3Z.hh:155
double getDX() const
Get x direction.
Definition: JVersor3Z.hh:144
double getDZ() const
Get z direction.
Definition: JVersor3Z.hh:166
JGEOMETRY3D::JVersor3Z::operator JVector3D ( ) const
inline

Type conversion operator.

Returns
position

Definition at line 122 of file JVersor3Z.hh.

123  {
124  return JVector3D(getDX(), getDY(), getDZ());
125  }
double getDY() const
Get y direction.
Definition: JVersor3Z.hh:155
Data structure for vector in three dimensions.
Definition: JVector3D.hh:32
double getDX() const
Get x direction.
Definition: JVersor3Z.hh:144
double getDZ() const
Get z direction.
Definition: JVersor3Z.hh:166
JGEOMETRY3D::JVersor3Z::operator JVersor3D ( ) const
inline

Type conversion operator.

Returns
direction

Definition at line 133 of file JVersor3Z.hh.

134  {
135  return JVersor3D(getDX(), getDY(), getDZ());
136  }
double getDY() const
Get y direction.
Definition: JVersor3Z.hh:155
double getDX() const
Get x direction.
Definition: JVersor3Z.hh:144
double getDZ() const
Get z direction.
Definition: JVersor3Z.hh:166
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 144 of file JVersor3Z.hh.

145  {
146  return __dx;
147  }
double JGEOMETRY3D::JVersor3Z::getDY ( ) const
inline

Get y direction.

Returns
y direction

Definition at line 155 of file JVersor3Z.hh.

156  {
157  return __dy;
158  }
double JGEOMETRY3D::JVersor3Z::getDZ ( ) const
inline

Get z direction.

Returns
z direction

Definition at line 166 of file JVersor3Z.hh.

167  {
168  const double v = getDX()*getDX() + getDY()*getDY();
169 
170  if (v <= 1.0)
171  return sqrt(1.0 - v);
172  else
173  return 0.0;
174  }
double getDY() const
Get y direction.
Definition: JVersor3Z.hh:155
double getDX() const
Get x direction.
Definition: JVersor3Z.hh:144
JVersor3Z& JGEOMETRY3D::JVersor3Z::negate ( )
inline

Prefix unary minus.

Returns
this versor

Definition at line 182 of file JVersor3Z.hh.

183  {
184  __dx = -__dx;
185  __dy = -__dy;
186 
187  return *this;
188  }
JVersor3Z& JGEOMETRY3D::JVersor3Z::add ( const JVersor3Z value)
inline

Addition operator.

Parameters
valueversor
Returns
this versor

Definition at line 197 of file JVersor3Z.hh.

198  {
199  __dx += value.getDX();
200  __dy += value.getDY();
201 
202  return *this;
203  }
double getDY() const
Get y direction.
Definition: JVersor3Z.hh:155
double getDX() const
Get x direction.
Definition: JVersor3Z.hh:144
JVersor3Z& JGEOMETRY3D::JVersor3Z::sub ( const JVersor3Z value)
inline

Subtraction operator.

Parameters
valueversor
Returns
this versor

Definition at line 212 of file JVersor3Z.hh.

213  {
214  __dx -= value.getDX();
215  __dy -= value.getDY();
216 
217  return *this;
218  }
double getDY() const
Get y direction.
Definition: JVersor3Z.hh:155
double getDX() const
Get x direction.
Definition: JVersor3Z.hh:144
JVersor3Z& JGEOMETRY3D::JVersor3Z::mul ( const double  value)
inline

Multiplication operator.

Parameters
valuemultiplication factor
Returns
this versor

Definition at line 227 of file JVersor3Z.hh.

228  {
229  __dx *= value;
230  __dy *= value;
231 
232  return *this;
233  }
JVersor3Z& JGEOMETRY3D::JVersor3Z::div ( const double  value)
inline

Division operator.

Parameters
valuemultiplication factor
Returns
this versor

Definition at line 242 of file JVersor3Z.hh.

243  {
244  __dx /= value;
245  __dy /= value;
246 
247  return *this;
248  }
bool JGEOMETRY3D::JVersor3Z::equals ( const JVersor3Z versor) const
inline

Check equality.

Parameters
versorversor
Returns
true if versors are equal; else false

Definition at line 257 of file JVersor3Z.hh.

258  {
259  return (getDX() == versor.getDX() &&
260  getDY() == versor.getDY());
261  }
double getDY() const
Get y direction.
Definition: JVersor3Z.hh:155
double getDX() const
Get x direction.
Definition: JVersor3Z.hh:144
double JGEOMETRY3D::JVersor3Z::getDot ( const JVersor3Z dir) const
inline

Get dot product.

Parameters
dirdirection
Returns
dot product

Definition at line 270 of file JVersor3Z.hh.

271  {
272  return
273  getDX() * dir.getDX() +
274  getDY() * dir.getDY() +
275  getDZ() * dir.getDZ();
276  }
double getDY() const
Get y direction.
Definition: JVersor3Z.hh:155
double getDX() const
Get x direction.
Definition: JVersor3Z.hh:144
double getDZ() const
Get z direction.
Definition: JVersor3Z.hh:166
double JGEOMETRY3D::JVersor3Z::getDot ( const JAngle3D angle) const
inline

Get dot product.

Parameters
angleangle
Returns
dot product

Definition at line 285 of file JVersor3Z.hh.

286  {
287  return
288  getDX() * angle.getDX() +
289  getDY() * angle.getDY() +
290  getDZ() * angle.getDZ();
291  }
double getDY() const
Get y direction.
Definition: JVersor3Z.hh:155
double getDX() const
Get x direction.
Definition: JVersor3Z.hh:144
double getDZ() const
Get z direction.
Definition: JVersor3Z.hh:166
double getDX() const
Get x direction.
Definition: JAngle3D.hh:105
double getDZ() const
Get z direction.
Definition: JAngle3D.hh:127
double getDY() const
Get y direction.
Definition: JAngle3D.hh:116
double JGEOMETRY3D::JVersor3Z::getDot ( const JVector3D pos) const
inline

Get dot product.

Parameters
posposition
Returns
dot product

Definition at line 300 of file JVersor3Z.hh.

301  {
302  return
303  getDX() * pos.getX() +
304  getDY() * pos.getY() +
305  getDZ() * pos.getZ();
306  }
double getDY() const
Get y direction.
Definition: JVersor3Z.hh:155
double getY() const
Get y position.
Definition: JVector3D.hh:102
double getDX() const
Get x direction.
Definition: JVersor3Z.hh:144
double getX() const
Get x position.
Definition: JVector3D.hh:92
double getDZ() const
Get z direction.
Definition: JVersor3Z.hh:166
double getZ() const
Get z position.
Definition: JVector3D.hh:113
double JGEOMETRY3D::JVersor3Z::getDot ( const JVersor3D dir) const
inline

Get dot product.

Parameters
dirdirection
Returns
dot product

Definition at line 315 of file JVersor3Z.hh.

316  {
317  return
318  getDX() * dir.getDX() +
319  getDY() * dir.getDY() +
320  getDZ() * dir.getDZ();
321  }
double getDY() const
Get y direction.
Definition: JVersor3Z.hh:155
double getDY() const
Get y direction.
Definition: JVersor3D.hh:101
double getDX() const
Get x direction.
Definition: JVersor3D.hh:90
double getDX() const
Get x direction.
Definition: JVersor3Z.hh:144
double getDZ() const
Get z direction.
Definition: JVersor3Z.hh:166
double getDZ() const
Get z direction.
Definition: JVersor3D.hh:112
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 product evaluation of 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 331 of file JVersor3Z.hh.

332  {
333  return in >> versor.__dx >> versor.__dy;
334  }
std::ostream& operator<< ( std::ostream &  out,
const JVersor3Z versor 
)
friend

Write versor to output.

Parameters
outoutput stream
versorversor
Returns
output stream

Definition at line 344 of file JVersor3Z.hh.

345  {
346  return out << versor.getDX() << ' ' << versor.getDY();
347  }
double getDY() const
Get y direction.
Definition: JVersor3Z.hh:155
double getDX() const
Get x direction.
Definition: JVersor3Z.hh:144
JReader& operator>> ( JReader in,
JVersor3Z versor 
)
friend

Read versor from input.

Parameters
inreader
versorversor
Returns
reader

Definition at line 357 of file JVersor3Z.hh.

358  {
359  return in >> versor.__dx >> versor.__dy;
360  }
JWriter& operator<< ( JWriter out,
const JVersor3Z versor 
)
friend

Write versor to output.

Parameters
outwriter
versorversor
Returns
writer

Definition at line 370 of file JVersor3Z.hh.

371  {
372  return out << versor.__dx << versor.__dy;
373  }

Member Data Documentation

double JGEOMETRY3D::JVersor3Z::__dx
protected

Definition at line 376 of file JVersor3Z.hh.

double JGEOMETRY3D::JVersor3Z::__dy
protected

Definition at line 377 of file JVersor3Z.hh.


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