Jpp  16.0.1
the software that should make you happy
 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< JFirst_t, JSecond_t > JFIT::JLine3Z JFIT::JShower3Z JFIT::JLine3EZ JFIT::JShower3EZ JFIT::JShowerEH

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...
 
JFirst_t & mul (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 39 of file JVersor3Z.hh.

Constructor & Destructor Documentation

JGEOMETRY3D::JVersor3Z::JVersor3Z ( )
inline

Default constructor.

Definition at line 46 of file JVersor3Z.hh.

46  :
47  __dx(0.0),
48  __dy(0.0)
49  {}
JGEOMETRY3D::JVersor3Z::JVersor3Z ( const JVersor2D dir)
inline

Constructor.

Parameters
dirdirection cosines

Definition at line 57 of file JVersor3Z.hh.

57  :
58  __dx(dir.getDX()),
59  __dy(dir.getDY())
60  {}
JGEOMETRY3D::JVersor3Z::JVersor3Z ( const double  dx,
const double  dy 
)
inline

Constructor.

Parameters
dxdirection cosine dx/dz
dydirection cosine dy/dz

Definition at line 69 of file JVersor3Z.hh.

70  :
71  __dx(dx),
72  __dy(dy)
73  {}

Member Function Documentation

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

Get direction.

Returns
direction

Definition at line 81 of file JVersor3Z.hh.

82  {
83  return static_cast<const JVersor3Z&>(*this);
84  }
Data structure for normalised vector in positive z-direction.
Definition: JVersor3Z.hh:39
JVersor3Z& JGEOMETRY3D::JVersor3Z::getDirection ( )
inline

Get direction.

Returns
direction

Definition at line 92 of file JVersor3Z.hh.

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

Set direction.

Parameters
directiondirection

Definition at line 103 of file JVersor3Z.hh.

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

Get angle.

Returns
angle

Definition at line 114 of file JVersor3Z.hh.

115  {
116  return JAngle3D(getDX(), getDY(), getDZ());
117  }
Data structure for angles in three dimensions.
Definition: JAngle3D.hh:33
double getDY() const
Get y direction.
Definition: JVersor3Z.hh:158
double getDX() const
Get x direction.
Definition: JVersor3Z.hh:147
double getDZ() const
Get z direction.
Definition: JVersor3Z.hh:169
JGEOMETRY3D::JVersor3Z::operator JVector3D ( ) const
inline

Type conversion operator.

Returns
position

Definition at line 125 of file JVersor3Z.hh.

126  {
127  return JVector3D(getDX(), getDY(), getDZ());
128  }
double getDY() const
Get y direction.
Definition: JVersor3Z.hh:158
Data structure for vector in three dimensions.
Definition: JVector3D.hh:34
double getDX() const
Get x direction.
Definition: JVersor3Z.hh:147
double getDZ() const
Get z direction.
Definition: JVersor3Z.hh:169
JGEOMETRY3D::JVersor3Z::operator JVersor3D ( ) const
inline

Type conversion operator.

Returns
direction

Definition at line 136 of file JVersor3Z.hh.

137  {
138  return JVersor3D(getDX(), getDY(), getDZ());
139  }
double getDY() const
Get y direction.
Definition: JVersor3Z.hh:158
double getDX() const
Get x direction.
Definition: JVersor3Z.hh:147
double getDZ() const
Get z direction.
Definition: JVersor3Z.hh:169
Data structure for normalised vector in three dimensions.
Definition: JVersor3D.hh:26
double JGEOMETRY3D::JVersor3Z::getDX ( ) const
inline

Get x direction.

Returns
x direction

Definition at line 147 of file JVersor3Z.hh.

148  {
149  return __dx;
150  }
double JGEOMETRY3D::JVersor3Z::getDY ( ) const
inline

Get y direction.

Returns
y direction

Definition at line 158 of file JVersor3Z.hh.

159  {
160  return __dy;
161  }
double JGEOMETRY3D::JVersor3Z::getDZ ( ) const
inline

Get z direction.

Returns
z direction

Definition at line 169 of file JVersor3Z.hh.

170  {
171  const double v = getDX()*getDX() + getDY()*getDY();
172 
173  if (v <= 1.0)
174  return sqrt(1.0 - v);
175  else
176  return 0.0;
177  }
double getDY() const
Get y direction.
Definition: JVersor3Z.hh:158
double getDX() const
Get x direction.
Definition: JVersor3Z.hh:147
data_type v[N+1][M+1]
Definition: JPolint.hh:756
JVersor3Z& JGEOMETRY3D::JVersor3Z::negate ( )
inline

Prefix unary minus.

Returns
this versor

Definition at line 185 of file JVersor3Z.hh.

186  {
187  __dx = -__dx;
188  __dy = -__dy;
189 
190  return *this;
191  }
JVersor3Z& JGEOMETRY3D::JVersor3Z::add ( const JVersor3Z value)
inline

Addition operator.

Parameters
valueversor
Returns
this versor

Definition at line 200 of file JVersor3Z.hh.

201  {
202  __dx += value.getDX();
203  __dy += value.getDY();
204 
205  return *this;
206  }
double getDY() const
Get y direction.
Definition: JVersor3Z.hh:158
double getDX() const
Get x direction.
Definition: JVersor3Z.hh:147
JVersor3Z& JGEOMETRY3D::JVersor3Z::sub ( const JVersor3Z value)
inline

Subtraction operator.

Parameters
valueversor
Returns
this versor

Definition at line 215 of file JVersor3Z.hh.

216  {
217  __dx -= value.getDX();
218  __dy -= value.getDY();
219 
220  return *this;
221  }
double getDY() const
Get y direction.
Definition: JVersor3Z.hh:158
double getDX() const
Get x direction.
Definition: JVersor3Z.hh:147
JVersor3Z& JGEOMETRY3D::JVersor3Z::mul ( const double  value)
inline

Multiplication operator.

Parameters
valuemultiplication factor
Returns
this versor

Definition at line 230 of file JVersor3Z.hh.

231  {
232  __dx *= value;
233  __dy *= value;
234 
235  return *this;
236  }
JVersor3Z& JGEOMETRY3D::JVersor3Z::div ( const double  value)
inline

Division operator.

Parameters
valuemultiplication factor
Returns
this versor

Definition at line 245 of file JVersor3Z.hh.

246  {
247  __dx /= value;
248  __dy /= value;
249 
250  return *this;
251  }
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 261 of file JVersor3Z.hh.

263  {
264  return (fabs(getDX() - versor.getDX()) <= precision &&
265  fabs(getDY() - versor.getDY()) <= precision);
266  }
double getDY() const
Get y direction.
Definition: JVersor3Z.hh:158
double getDY() const
Get y direction.
Definition: JVersor3D.hh:106
double getDX() const
Get x direction.
Definition: JVersor3D.hh:95
double getDX() const
Get x direction.
Definition: JVersor3Z.hh:147
double JGEOMETRY3D::JVersor3Z::getDot ( const JVersor3Z dir) const
inline

Get dot product.

Parameters
dirdirection
Returns
dot product

Definition at line 275 of file JVersor3Z.hh.

276  {
277  return
278  getDX() * dir.getDX() +
279  getDY() * dir.getDY() +
280  getDZ() * dir.getDZ();
281  }
double getDY() const
Get y direction.
Definition: JVersor3Z.hh:158
double getDX() const
Get x direction.
Definition: JVersor3Z.hh:147
double getDZ() const
Get z direction.
Definition: JVersor3Z.hh:169
double JGEOMETRY3D::JVersor3Z::getDot ( const JAngle3D angle) const
inline

Get dot product.

Parameters
angleangle
Returns
dot product

Definition at line 290 of file JVersor3Z.hh.

291  {
292  return
293  getDX() * angle.getDX() +
294  getDY() * angle.getDY() +
295  getDZ() * angle.getDZ();
296  }
double getDY() const
Get y direction.
Definition: JVersor3Z.hh:158
double getDX() const
Get x direction.
Definition: JVersor3Z.hh:147
double getDZ() const
Get z direction.
Definition: JVersor3Z.hh:169
double getDX() const
Get x direction.
Definition: JAngle3D.hh:108
double getDZ() const
Get z direction.
Definition: JAngle3D.hh:130
double getDY() const
Get y direction.
Definition: JAngle3D.hh:119
double JGEOMETRY3D::JVersor3Z::getDot ( const JVector3D pos) const
inline

Get dot product.

Parameters
posposition
Returns
dot product

Definition at line 305 of file JVersor3Z.hh.

306  {
307  return
308  getDX() * pos.getX() +
309  getDY() * pos.getY() +
310  getDZ() * pos.getZ();
311  }
double getDY() const
Get y direction.
Definition: JVersor3Z.hh:158
double getY() const
Get y position.
Definition: JVector3D.hh:104
double getDX() const
Get x direction.
Definition: JVersor3Z.hh:147
double getX() const
Get x position.
Definition: JVector3D.hh:94
double getDZ() const
Get z direction.
Definition: JVersor3Z.hh:169
double getZ() const
Get z position.
Definition: JVector3D.hh:115
double JGEOMETRY3D::JVersor3Z::getDot ( const JVersor3D dir) const
inline

Get dot product.

Parameters
dirdirection
Returns
dot product

Definition at line 320 of file JVersor3Z.hh.

321  {
322  return
323  getDX() * dir.getDX() +
324  getDY() * dir.getDY() +
325  getDZ() * dir.getDZ();
326  }
double getDY() const
Get y direction.
Definition: JVersor3Z.hh:158
double getDY() const
Get y direction.
Definition: JVersor3D.hh:106
double getDX() const
Get x direction.
Definition: JVersor3D.hh:95
double getDX() const
Get x direction.
Definition: JVersor3Z.hh:147
double getDZ() const
Get z direction.
Definition: JVersor3Z.hh:169
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

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 336 of file JVersor3Z.hh.

337  {
338  return in >> versor.__dx >> versor.__dy;
339  }
then fatal Wrong number of arguments fi set_variable DETECTOR $argv[1] set_variable INPUT_FILE $argv[2] eval JPrintDetector a $DETECTOR O IDENTIFIER eval JPrintDetector a $DETECTOR O SUMMARY source JAcoustics sh $DETECTOR_ID CHECK_EXIT_CODE typeset A TRIPODS get_tripods $WORKDIR tripod txt TRIPODS for EMITTER in
Definition: JCanberra.sh:42
std::ostream& operator<< ( std::ostream &  out,
const JVersor3Z versor 
)
friend

Write versor to output.

Parameters
outoutput stream
versorversor
Returns
output stream

Definition at line 349 of file JVersor3Z.hh.

350  {
351  const JFormat format(out, getFormat<JVersor3Z>(JFormat_t(9, 6, std::ios::fixed | std::ios::showpos)));
352 
353  return out << format << versor.getDX() << ' ' << format << versor.getDY();
354  }
double getDY() const
Get y direction.
Definition: JVersor3Z.hh:158
Auxiliary class to temporarily define format specifications.
Definition: JManip.hh:632
double getDX() const
Get x direction.
Definition: JVersor3Z.hh:147
Data structure for format specifications.
Definition: JManip.hh:522
JReader& operator>> ( JReader in,
JVersor3Z versor 
)
friend

Read versor from input.

Parameters
inreader
versorversor
Returns
reader

Definition at line 364 of file JVersor3Z.hh.

365  {
366  return in >> versor.__dx >> versor.__dy;
367  }
then fatal Wrong number of arguments fi set_variable DETECTOR $argv[1] set_variable INPUT_FILE $argv[2] eval JPrintDetector a $DETECTOR O IDENTIFIER eval JPrintDetector a $DETECTOR O SUMMARY source JAcoustics sh $DETECTOR_ID CHECK_EXIT_CODE typeset A TRIPODS get_tripods $WORKDIR tripod txt TRIPODS for EMITTER in
Definition: JCanberra.sh:42
JWriter& operator<< ( JWriter out,
const JVersor3Z versor 
)
friend

Write versor to output.

Parameters
outwriter
versorversor
Returns
writer

Definition at line 377 of file JVersor3Z.hh.

378  {
379  return out << versor.__dx << versor.__dy;
380  }

Member Data Documentation

double JGEOMETRY3D::JVersor3Z::__dx
protected

Definition at line 383 of file JVersor3Z.hh.

double JGEOMETRY3D::JVersor3Z::__dy
protected

Definition at line 384 of file JVersor3Z.hh.


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