Jpp
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Public Member Functions | Protected Attributes | Friends | List of all members
JGEOMETRY3D::JAxis3D Class Reference

Axis object. More...

#include <JAxis3D.hh>

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

Public Member Functions

 JAxis3D ()
 Default constructor. More...
 
 JAxis3D (const JVector3D &pos)
 Constructor. More...
 
 JAxis3D (const JVector3D &pos, const JVersor3D &dir)
 Constructor. More...
 
 JAxis3D (const JVector3D &pos, const JVersor3Z &dir)
 Constructor. More...
 
 JAxis3D (const JSegment3D &segment)
 Constructor. More...
 
const JAxis3DgetAxis () const
 Get axis. More...
 
void setAxis (const JAxis3D &axis)
 Set axis. More...
 
JAxis3Dnegate ()
 Negate axis. More...
 
void move (const double step)
 Move vertex along this axis. More...
 
double getIntersection (const JVector3D &pos) const
 Get longitudinal position along axis of position of closest approach with given position. More...
 
double getIntersection (const JAxis3D &axis, const double precision=1.0e-8) const
 Get longitudinal position along axis of position of closest approach with given axis. More...
 
double getDistanceSquared (const JVector3D &pos) const
 Get distance squared. More...
 
double getDistance (const JVector3D &pos) const
 Get distance. More...
 
JAxis3Drotate (const JRotation3D &R)
 Rotate axis. More...
 
JAxis3Drotate_back (const JRotation3D &R)
 Rotate back axis. More...
 
JAxis3Drotate (const JRotation3X &R)
 Rotate around X-axis. More...
 
JAxis3Drotate_back (const JRotation3X &R)
 Rotate back around X-axis. More...
 
JAxis3Drotate (const JRotation3Y &R)
 Rotate around Y-axis. More...
 
JAxis3Drotate_back (const JRotation3Y &R)
 Rotate back around Y-axis. More...
 
JAxis3Drotate (const JRotation3Z &R)
 Rotate around Z-axis. More...
 
JAxis3Drotate_back (const JRotation3Z &R)
 Rotate back around Z-axis. More...
 
void transform (const JAxis3D &axis)
 Transform axis to reference frame of given axis. More...
 
void transform (const JRotation3D &R, const JVector3D &pos)
 Transform axis. More...
 
void transform_back (const JRotation3D &R, const JVector3D &pos)
 Transform back axis. More...
 
void transform (const JTransformation3D &T)
 Transform axis. More...
 
void transform_back (const JTransformation3D &T)
 Transform back axis. More...
 
const JPosition3DgetPosition () const
 Get position. More...
 
JPosition3DgetPosition ()
 Get position. More...
 
void setPosition (const JVector3D &pos)
 Set position. More...
 
 operator JAngle3D () const
 Type conversion operator. More...
 
 operator JVersor3D () const
 Type conversion operator. More...
 
JPosition3Drotate (const JQuaternion3D &Q)
 Rotate. More...
 
JVector3Dtransform (const JMatrix3D &T)
 Transform. More...
 
double getDot (const JAngle3D &angle) const
 Get dot product. More...
 
double getDot (const JVersor3D &dir) const
 Get dot product. More...
 
double getDot (const JVersor3Z &dir) const
 Get dot product. More...
 
double getDot (const JVector3D &vector) const
 Get dot product. More...
 
 operator JVector2D () const
 Type conversion operator. More...
 
double getX () const
 Get x position. More...
 
double getY () const
 Get y position. More...
 
double getZ () const
 Get z position. More...
 
JVector3Dadd (const JVector3D &vector)
 Add vector. More...
 
JVector3Dsub (const JVector3D &vector)
 Subtract vector. More...
 
JVector3Dmul (const double factor)
 Scale vector. More...
 
JVector3Dmul (const JNullType &object)
 Multiply with object. More...
 
JVector3Ddiv (const double factor)
 Scale vector. More...
 
bool equals (const JVector3D &vector) const
 Check equality. More...
 
double getLengthSquared () const
 Get length squared. More...
 
double getLength () const
 Get length. More...
 
JVector3Dcross (const JVector3D &first, const JVector3D &second)
 Get cross product. More...
 
const JDirection3DgetDirection () const
 Get direction. More...
 
JDirection3DgetDirection ()
 Get direction. More...
 
void setDirection (const JDirection3D &dir)
 Set direction. More...
 
 operator JAngle3D () const
 Type conversion operator. More...
 
 operator JVector3D () const
 Type conversion operator. More...
 
JDirection3Dtransform (const JMatrix3D &T)
 Transform. More...
 
JDirection3Drotate (const JQuaternion3D &Q)
 Rotate. More...
 
double getDot (const JAngle3D &angle) const
 Get dot product. More...
 
double getDot (const JVector3D &pos) const
 Get dot product. More...
 
double getDot (const JVersor3Z &dir) const
 Get dot product. More...
 
double getDot (const JVersor3D &versor) const
 Get dot product. More...
 
bool equals (const JVersor3D &versor) 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...
 
JVersor3Dnormalise ()
 Normalise versor. More...
 
JVersor3Dmul (const JNullType &object)
 Multiply with object. More...
 

Protected Attributes

double __x
 
double __y
 
double __z
 
double __dx
 
double __dy
 
double __dz
 

Friends

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

Detailed Description

Axis object.

An axis object consists of a position and a direction.

Definition at line 37 of file JAxis3D.hh.

Constructor & Destructor Documentation

JGEOMETRY3D::JAxis3D::JAxis3D ( )
inline

Default constructor.

Definition at line 49 of file JAxis3D.hh.

49  :
50  JPosition3D (),
51  JDirection3D()
52  {}
JDirection3D()
Default constructor.
Definition: JDirection3D.hh:42
JPosition3D()
Default constructor.
Definition: JPosition3D.hh:47
JGEOMETRY3D::JAxis3D::JAxis3D ( const JVector3D pos)
inline

Constructor.

Parameters
posposition

Definition at line 60 of file JAxis3D.hh.

60  :
61  JPosition3D (pos),
62  JDirection3D()
63  {}
JDirection3D()
Default constructor.
Definition: JDirection3D.hh:42
JPosition3D()
Default constructor.
Definition: JPosition3D.hh:47
JGEOMETRY3D::JAxis3D::JAxis3D ( const JVector3D pos,
const JVersor3D dir 
)
inline

Constructor.

Parameters
posposition
dirdirection

Definition at line 72 of file JAxis3D.hh.

73  :
74  JPosition3D (pos),
75  JDirection3D(dir)
76  {}
JDirection3D()
Default constructor.
Definition: JDirection3D.hh:42
JPosition3D()
Default constructor.
Definition: JPosition3D.hh:47
JGEOMETRY3D::JAxis3D::JAxis3D ( const JVector3D pos,
const JVersor3Z dir 
)
inline

Constructor.

Parameters
posposition
dirdirection

Definition at line 85 of file JAxis3D.hh.

86  :
87  JPosition3D (pos),
88  JDirection3D(dir)
89  {}
JDirection3D()
Default constructor.
Definition: JDirection3D.hh:42
JPosition3D()
Default constructor.
Definition: JPosition3D.hh:47
JGEOMETRY3D::JAxis3D::JAxis3D ( const JSegment3D segment)
inline

Constructor.

Parameters
segmentline segment

Definition at line 97 of file JAxis3D.hh.

97  :
98  JPosition3D (segment.first),
99  JDirection3D(segment.second - segment.first)
100  {}
JDirection3D()
Default constructor.
Definition: JDirection3D.hh:42
JPosition3D()
Default constructor.
Definition: JPosition3D.hh:47

Member Function Documentation

const JAxis3D& JGEOMETRY3D::JAxis3D::getAxis ( ) const
inline

Get axis.

Returns
axis

Definition at line 108 of file JAxis3D.hh.

109  {
110  return *this;
111  }
void JGEOMETRY3D::JAxis3D::setAxis ( const JAxis3D axis)
inline

Set axis.

Parameters
axisaxis

Definition at line 119 of file JAxis3D.hh.

120  {
121  *this = axis;
122  }
JAxis3D& JGEOMETRY3D::JAxis3D::negate ( )
inline

Negate axis.

Returns
this axis

Definition at line 130 of file JAxis3D.hh.

131  {
132  static_cast<JPosition3D&> (*this).negate();
133  static_cast<JDirection3D&>(*this).negate();
134 
135  return *this;
136  }
Data structure for direction in three dimensions.
Definition: JDirection3D.hh:32
JVersor3D & negate()
Negate versor.
Definition: JVersor3D.hh:61
Data structure for position in three dimensions.
Definition: JPosition3D.hh:35
JVector3D & negate()
Negate vector.
Definition: JVector3D.hh:124
void JGEOMETRY3D::JAxis3D::move ( const double  step)
inline

Move vertex along this axis.

Parameters
stepstep

Definition at line 144 of file JAxis3D.hh.

145  {
146  getPosition() += step * JPosition3D(getDirection());
147  }
const JDirection3D & getDirection() const
Get direction.
const JPosition3D & getPosition() const
Get position.
Definition: JPosition3D.hh:129
JPosition3D()
Default constructor.
Definition: JPosition3D.hh:47
double JGEOMETRY3D::JAxis3D::getIntersection ( const JVector3D pos) const
inline

Get longitudinal position along axis of position of closest approach with given position.

Parameters
posposition
Returns
longitudinal position

Definition at line 156 of file JAxis3D.hh.

157  {
158  JPosition3D D(pos);
159 
160  D.sub(this->getPosition());
161 
162  return D.getDot(this->getDirection());
163  }
const JDirection3D & getDirection() const
Get direction.
const JPosition3D & getPosition() const
Get position.
Definition: JPosition3D.hh:129
Data structure for position in three dimensions.
Definition: JPosition3D.hh:35
double JGEOMETRY3D::JAxis3D::getIntersection ( const JAxis3D axis,
const double  precision = 1.0e-8 
) const
inline

Get longitudinal position along axis of position of closest approach with given axis.


If the axes are paralel, this position corresponds to the vertex of the given axis.

Parameters
axisaxis
precisionprecision
Returns
longitudinal position

Definition at line 174 of file JAxis3D.hh.

175  {
176  JPosition3D pos(getPosition ());
177  JDirection3D dir(getDirection());
178 
179  const JRotation3D R(axis.getDirection());
180 
181  // offset this position with position of given axis
182 
183  pos.sub(axis.getPosition());
184 
185  // rotate along given axis
186 
187  pos.rotate(R);
188  dir.rotate(R);
189 
190  // longitudinal position at minimal distance of approach
191 
192  const double alpha = pos.getX() * dir.getDX() + pos.getY() * dir.getDY();
193  const double beta = dir.getDX() * dir.getDX() + dir.getDY() * dir.getDY();
194 
195  return (fabs(beta) > precision ? -alpha/beta : -pos.getZ());
196  }
Data structure for direction in three dimensions.
Definition: JDirection3D.hh:32
JMatrix3D & sub(const JMatrix3D &A)
Matrix subtraction.
const JDirection3D & getDirection() const
Get direction.
Rotation matrix.
Definition: JRotation3D.hh:108
const JPosition3D & getPosition() const
Get position.
Definition: JPosition3D.hh:129
Data structure for position in three dimensions.
Definition: JPosition3D.hh:35
double JGEOMETRY3D::JAxis3D::getDistanceSquared ( const JVector3D pos) const
inline

Get distance squared.

Parameters
posposition
Returns
square of distance

Definition at line 205 of file JAxis3D.hh.

206  {
207  JPosition3D D(pos);
208 
209  D.sub(this->getPosition());
210 
211  const double dz = D.getDot(this->getDirection());
212 
213  return D.getLengthSquared() - dz*dz;
214  }
const JDirection3D & getDirection() const
Get direction.
const JPosition3D & getPosition() const
Get position.
Definition: JPosition3D.hh:129
Data structure for position in three dimensions.
Definition: JPosition3D.hh:35
double JGEOMETRY3D::JAxis3D::getDistance ( const JVector3D pos) const
inline

Get distance.

Parameters
pososition
Returns
distance

Definition at line 223 of file JAxis3D.hh.

224  {
225  return sqrt(this->getDistanceSquared(pos));
226  }
double getDistanceSquared(const JVector3D &pos) const
Get distance squared.
Definition: JAxis3D.hh:205
JAxis3D& JGEOMETRY3D::JAxis3D::rotate ( const JRotation3D R)
inline

Rotate axis.

Parameters
Rrotation matrix
Returns
this axis

Definition at line 235 of file JAxis3D.hh.

236  {
237  static_cast<JPosition3D&> (*this).rotate(R);
238  static_cast<JDirection3D&>(*this).rotate(R);
239 
240  return *this;
241  }
Data structure for direction in three dimensions.
Definition: JDirection3D.hh:32
JDirection3D & rotate(const JRotation3D &R)
Rotate.
Data structure for position in three dimensions.
Definition: JPosition3D.hh:35
JPosition3D & rotate(const JRotation3D &R)
Rotate.
Definition: JPosition3D.hh:185
JAxis3D& JGEOMETRY3D::JAxis3D::rotate_back ( const JRotation3D R)
inline

Rotate back axis.

Parameters
Rrotation matrix
Returns
this axis

Definition at line 250 of file JAxis3D.hh.

251  {
252  static_cast<JPosition3D&> (*this).rotate_back(R);
253  static_cast<JDirection3D&>(*this).rotate_back(R);
254 
255  return *this;
256  }
Data structure for direction in three dimensions.
Definition: JDirection3D.hh:32
JDirection3D & rotate_back(const JRotation3D &R)
Rotate back.
JPosition3D & rotate_back(const JRotation3D &R)
Rotate back.
Definition: JPosition3D.hh:199
Data structure for position in three dimensions.
Definition: JPosition3D.hh:35
JAxis3D& JGEOMETRY3D::JAxis3D::rotate ( const JRotation3X R)
inline

Rotate around X-axis.

Parameters
Rrotation matrix
Returns
this axis

Definition at line 265 of file JAxis3D.hh.

266  {
267  static_cast<JPosition3D&> (*this).rotate(R);
268  static_cast<JDirection3D&>(*this).rotate(R);
269 
270  return *this;
271  }
Data structure for direction in three dimensions.
Definition: JDirection3D.hh:32
JDirection3D & rotate(const JRotation3D &R)
Rotate.
Data structure for position in three dimensions.
Definition: JPosition3D.hh:35
JPosition3D & rotate(const JRotation3D &R)
Rotate.
Definition: JPosition3D.hh:185
JAxis3D& JGEOMETRY3D::JAxis3D::rotate_back ( const JRotation3X R)
inline

Rotate back around X-axis.

Parameters
Rrotation matrix
Returns
this axis

Definition at line 280 of file JAxis3D.hh.

281  {
282  static_cast<JPosition3D&> (*this).rotate_back(R);
283  static_cast<JDirection3D&>(*this).rotate_back(R);
284 
285  return *this;
286  }
Data structure for direction in three dimensions.
Definition: JDirection3D.hh:32
JDirection3D & rotate_back(const JRotation3D &R)
Rotate back.
JPosition3D & rotate_back(const JRotation3D &R)
Rotate back.
Definition: JPosition3D.hh:199
Data structure for position in three dimensions.
Definition: JPosition3D.hh:35
JAxis3D& JGEOMETRY3D::JAxis3D::rotate ( const JRotation3Y R)
inline

Rotate around Y-axis.

Parameters
Rrotation matrix
Returns
this axis

Definition at line 295 of file JAxis3D.hh.

296  {
297  static_cast<JPosition3D&> (*this).rotate(R);
298  static_cast<JDirection3D&>(*this).rotate(R);
299 
300  return *this;
301  }
Data structure for direction in three dimensions.
Definition: JDirection3D.hh:32
JDirection3D & rotate(const JRotation3D &R)
Rotate.
Data structure for position in three dimensions.
Definition: JPosition3D.hh:35
JPosition3D & rotate(const JRotation3D &R)
Rotate.
Definition: JPosition3D.hh:185
JAxis3D& JGEOMETRY3D::JAxis3D::rotate_back ( const JRotation3Y R)
inline

Rotate back around Y-axis.

Parameters
Rrotation matrix
Returns
this axis

Definition at line 310 of file JAxis3D.hh.

311  {
312  static_cast<JPosition3D&> (*this).rotate_back(R);
313  static_cast<JDirection3D&>(*this).rotate_back(R);
314 
315  return *this;
316  }
Data structure for direction in three dimensions.
Definition: JDirection3D.hh:32
JDirection3D & rotate_back(const JRotation3D &R)
Rotate back.
JPosition3D & rotate_back(const JRotation3D &R)
Rotate back.
Definition: JPosition3D.hh:199
Data structure for position in three dimensions.
Definition: JPosition3D.hh:35
JAxis3D& JGEOMETRY3D::JAxis3D::rotate ( const JRotation3Z R)
inline

Rotate around Z-axis.

Parameters
Rrotation matrix
Returns
this axis

Definition at line 325 of file JAxis3D.hh.

326  {
327  static_cast<JPosition3D&> (*this).rotate(R);
328  static_cast<JDirection3D&>(*this).rotate(R);
329 
330  return *this;
331  }
Data structure for direction in three dimensions.
Definition: JDirection3D.hh:32
JDirection3D & rotate(const JRotation3D &R)
Rotate.
Data structure for position in three dimensions.
Definition: JPosition3D.hh:35
JPosition3D & rotate(const JRotation3D &R)
Rotate.
Definition: JPosition3D.hh:185
JAxis3D& JGEOMETRY3D::JAxis3D::rotate_back ( const JRotation3Z R)
inline

Rotate back around Z-axis.

Parameters
Rrotation matrix
Returns
his axis

Definition at line 340 of file JAxis3D.hh.

341  {
342  static_cast<JPosition3D&> (*this).rotate_back(R);
343  static_cast<JDirection3D&>(*this).rotate_back(R);
344 
345  return *this;
346  }
Data structure for direction in three dimensions.
Definition: JDirection3D.hh:32
JDirection3D & rotate_back(const JRotation3D &R)
Rotate back.
JPosition3D & rotate_back(const JRotation3D &R)
Rotate back.
Definition: JPosition3D.hh:199
Data structure for position in three dimensions.
Definition: JPosition3D.hh:35
void JGEOMETRY3D::JAxis3D::transform ( const JAxis3D axis)
inline

Transform axis to reference frame of given axis.

Parameters
axisaxis

Definition at line 354 of file JAxis3D.hh.

355  {
356  JRotation3D R (axis.getDirection());
357  JPosition3D pos(axis.getPosition ());
358 
359  transform(R, pos.rotate(R));
360  }
const JDirection3D & getDirection() const
Get direction.
Rotation matrix.
Definition: JRotation3D.hh:108
void transform(const JAxis3D &axis)
Transform axis to reference frame of given axis.
Definition: JAxis3D.hh:354
const JPosition3D & getPosition() const
Get position.
Definition: JPosition3D.hh:129
Data structure for position in three dimensions.
Definition: JPosition3D.hh:35
void JGEOMETRY3D::JAxis3D::transform ( const JRotation3D R,
const JVector3D pos 
)
inline

Transform axis.

The final position and direction are obtained as follows:

  1. rotation of the position and the direction according rotation matrix (R);
  2. offset position with position of origin in rotated system (pos);
  3. rotation of position and direction around z-axis, such that final position is in x-z plane;
Parameters
Rrotation matrix
posposition of origin

Definition at line 374 of file JAxis3D.hh.

376  {
377  JPosition3D& u = getPosition ();
378  JDirection3D& v = getDirection();
379 
380  // rotate axis to system such that direction is along z-axis
381 
382  u.rotate(R);
383  v.rotate(R);
384 
385  // offset with respect to origin
386 
387  u.sub(pos);
388 
389  // rotate axis to x-z plane such that position is in x-z plane
390 
391  const double phi = atan2(u.getY(), u.getX());
392 
393  const JRotation3Z r(-phi);
394 
395  u.rotate(r);
396  v.rotate(r);
397  }
Data structure for direction in three dimensions.
Definition: JDirection3D.hh:32
const JDirection3D & getDirection() const
Get direction.
Rotation around Z-axis.
Definition: JRotation3D.hh:82
JVector3D & sub(const JVector3D &vector)
Subtract vector.
Definition: JVector3D.hh:156
JDirection3D & rotate(const JRotation3D &R)
Rotate.
double getY() const
Get y position.
Definition: JVector3D.hh:102
const JPosition3D & getPosition() const
Get position.
Definition: JPosition3D.hh:129
double getX() const
Get x position.
Definition: JVector3D.hh:92
Data structure for position in three dimensions.
Definition: JPosition3D.hh:35
JPosition3D & rotate(const JRotation3D &R)
Rotate.
Definition: JPosition3D.hh:185
void JGEOMETRY3D::JAxis3D::transform_back ( const JRotation3D R,
const JVector3D pos 
)
inline

Transform back axis.

The final position and direction are obtained as follows:

  1. offset position with position pos;
  2. rotation of position and direction according matrix R;
Parameters
Rrotation matrix
posposition of origin (before rotation)

Definition at line 410 of file JAxis3D.hh.

412  {
413  JPosition3D& u = getPosition ();
414  JDirection3D& v = getDirection();
415 
416  // offset with respect to origin
417 
418  u.add(pos);
419 
420  // rotate back axis to system with original particle direction
421 
422  u.rotate_back(R);
423  v.rotate_back(R);
424  }
Data structure for direction in three dimensions.
Definition: JDirection3D.hh:32
JDirection3D & rotate_back(const JRotation3D &R)
Rotate back.
JPosition3D & rotate_back(const JRotation3D &R)
Rotate back.
Definition: JPosition3D.hh:199
const JDirection3D & getDirection() const
Get direction.
const JPosition3D & getPosition() const
Get position.
Definition: JPosition3D.hh:129
Data structure for position in three dimensions.
Definition: JPosition3D.hh:35
JVector3D & add(const JVector3D &vector)
Add vector.
Definition: JVector3D.hh:140
void JGEOMETRY3D::JAxis3D::transform ( const JTransformation3D T)
inline

Transform axis.

Parameters
Ttransformation

Definition at line 432 of file JAxis3D.hh.

433  {
435  }
void transform(const JAxis3D &axis)
Transform axis to reference frame of given axis.
Definition: JAxis3D.hh:354
const JPosition3D & getPosition() const
Get position.
Definition: JPosition3D.hh:129
const JRotation3D & getRotation() const
Get rotation.
Definition: JRotation3D.hh:237
void JGEOMETRY3D::JAxis3D::transform_back ( const JTransformation3D T)
inline

Transform back axis.

Parameters
Ttransformation

Definition at line 443 of file JAxis3D.hh.

444  {
446  }
void transform_back(const JRotation3D &R, const JVector3D &pos)
Transform back axis.
Definition: JAxis3D.hh:410
const JPosition3D & getPosition() const
Get position.
Definition: JPosition3D.hh:129
const JRotation3D & getRotation() const
Get rotation.
Definition: JRotation3D.hh:237
const JPosition3D& JGEOMETRY3D::JPosition3D::getPosition ( ) const
inlineinherited

Get position.

Returns
position

Definition at line 129 of file JPosition3D.hh.

130  {
131  return static_cast<const JPosition3D&>(*this);
132  }
Data structure for position in three dimensions.
Definition: JPosition3D.hh:35
JPosition3D& JGEOMETRY3D::JPosition3D::getPosition ( )
inlineinherited

Get position.

Returns
position

Definition at line 140 of file JPosition3D.hh.

141  {
142  return static_cast<JPosition3D&>(*this);
143  }
Data structure for position in three dimensions.
Definition: JPosition3D.hh:35
void JGEOMETRY3D::JPosition3D::setPosition ( const JVector3D pos)
inlineinherited

Set position.

Parameters
posposition

Definition at line 151 of file JPosition3D.hh.

152  {
153  static_cast<JVector3D&>(*this) = pos;
154  }
Data structure for vector in three dimensions.
Definition: JVector3D.hh:32
JGEOMETRY3D::JPosition3D::operator JAngle3D ( ) const
inlineinherited

Type conversion operator.

Returns
angle

Definition at line 162 of file JPosition3D.hh.

163  {
164  return JAngle3D(getX(), getY(), getZ());
165  }
Data structure for angles in three dimensions.
Definition: JAngle3D.hh:30
double getY() const
Get y position.
Definition: JVector3D.hh:102
double getX() const
Get x position.
Definition: JVector3D.hh:92
double getZ() const
Get z position.
Definition: JVector3D.hh:113
JGEOMETRY3D::JPosition3D::operator JVersor3D ( ) const
inlineinherited

Type conversion operator.

Returns
direction

Definition at line 173 of file JPosition3D.hh.

174  {
175  return JVersor3D(getX(), getY(), getZ());
176  }
double getY() const
Get y position.
Definition: JVector3D.hh:102
double getX() const
Get x position.
Definition: JVector3D.hh:92
Data structure for normalised vector in three dimensions.
Definition: JVersor3D.hh:23
double getZ() const
Get z position.
Definition: JVector3D.hh:113
JPosition3D& JGEOMETRY3D::JPosition3D::rotate ( const JQuaternion3D Q)
inlineinherited

Rotate.

Parameters
Qquaternion
Returns
this position

Definition at line 297 of file JPosition3D.hh.

298  {
299  JQuaternion3D b(Q);
300  JQuaternion3D a;
301 
302  a.mul(getPosition(), b.conjugate());
303 
304  setPosition(b.mul(Q,a));
305 
306  return *this;
307  }
JQuaternion3D & mul(const double factor)
Scale quaternion.
const JPosition3D & getPosition() const
Get position.
Definition: JPosition3D.hh:129
Data structure for quaternion in three dimensions.
void setPosition(const JVector3D &pos)
Set position.
Definition: JPosition3D.hh:151
JVector3D& JGEOMETRY3D::JVector3D::transform ( const JMatrix3D T)
inlineinherited

Transform.

Parameters
Tmatrix
Returns
this vector

Definition at line 204 of file JVector3D.hh.

205  {
206  T.transform(__x, __y, __z);
207 
208  return *this;
209  }
double JGEOMETRY3D::JPosition3D::getDot ( const JAngle3D angle) const
inlineinherited

Get dot product.

Parameters
angleangle
Returns
dot product

Definition at line 368 of file JPosition3D.hh.

369  {
370  return
371  getX() * angle.getDX() +
372  getY() * angle.getDY() +
373  getZ() * angle.getDZ();
374  }
double getY() const
Get y position.
Definition: JVector3D.hh:102
double getX() const
Get x position.
Definition: JVector3D.hh:92
double getZ() const
Get z position.
Definition: JVector3D.hh:113
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::JPosition3D::getDot ( const JVersor3D dir) const
inlineinherited

Get dot product.

Parameters
dirdirection
Returns
dot product

Definition at line 383 of file JPosition3D.hh.

384  {
385  return
386  getX() * dir.getDX() +
387  getY() * dir.getDY() +
388  getZ() * dir.getDZ();
389  }
double getDY() const
Get y direction.
Definition: JVersor3D.hh:101
double getDX() const
Get x direction.
Definition: JVersor3D.hh:90
double getY() const
Get y position.
Definition: JVector3D.hh:102
double getX() const
Get x position.
Definition: JVector3D.hh:92
double getZ() const
Get z position.
Definition: JVector3D.hh:113
double getDZ() const
Get z direction.
Definition: JVersor3D.hh:112
double JGEOMETRY3D::JPosition3D::getDot ( const JVersor3Z dir) const
inlineinherited

Get dot product.

Parameters
dirdirection
Returns
dot product

Definition at line 398 of file JPosition3D.hh.

399  {
400  return
401  getX() * dir.getDX() +
402  getY() * dir.getDY() +
403  getZ() * dir.getDZ();
404  }
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::JVector3D::getDot ( const JVector3D vector) const
inlineinherited

Get dot product.

Parameters
vectorvector
Returns
dot product

Definition at line 278 of file JVector3D.hh.

279  {
280  return
281  getX() * vector.getX() +
282  getY() * vector.getY() +
283  getZ() * vector.getZ();
284  }
double getY() const
Get y position.
Definition: JVector3D.hh:102
double getX() const
Get x position.
Definition: JVector3D.hh:92
double getZ() const
Get z position.
Definition: JVector3D.hh:113
JGEOMETRY3D::JVector3D::operator JVector2D ( ) const
inlineinherited

Type conversion operator.

Returns
JVector2D

Definition at line 81 of file JVector3D.hh.

82  {
83  return JVector2D(this->getX(), this->getY());
84  }
double getY() const
Get y position.
Definition: JVector3D.hh:102
double getX() const
Get x position.
Definition: JVector3D.hh:92
double JGEOMETRY3D::JVector3D::getX ( ) const
inlineinherited

Get x position.

Returns
x position

Definition at line 92 of file JVector3D.hh.

93  {
94  return __x;
95  }
double JGEOMETRY3D::JVector3D::getY ( ) const
inlineinherited

Get y position.

Returns
y position

Definition at line 102 of file JVector3D.hh.

103  {
104  return __y;
105  }
double JGEOMETRY3D::JVector3D::getZ ( ) const
inlineinherited

Get z position.

Returns
z position

Definition at line 113 of file JVector3D.hh.

114  {
115  return __z;
116  }
JVector3D& JGEOMETRY3D::JVector3D::add ( const JVector3D vector)
inlineinherited

Add vector.

Parameters
vectorvector
Returns
this vector

Definition at line 140 of file JVector3D.hh.

141  {
142  __x += vector.getX();
143  __y += vector.getY();
144  __z += vector.getZ();
145 
146  return *this;
147  }
double getY() const
Get y position.
Definition: JVector3D.hh:102
double getX() const
Get x position.
Definition: JVector3D.hh:92
double getZ() const
Get z position.
Definition: JVector3D.hh:113
JVector3D& JGEOMETRY3D::JVector3D::sub ( const JVector3D vector)
inlineinherited

Subtract vector.

Parameters
vectorvector
Returns
this vector

Definition at line 156 of file JVector3D.hh.

157  {
158  __x -= vector.getX();
159  __y -= vector.getY();
160  __z -= vector.getZ();
161 
162  return *this;
163  }
double getY() const
Get y position.
Definition: JVector3D.hh:102
double getX() const
Get x position.
Definition: JVector3D.hh:92
double getZ() const
Get z position.
Definition: JVector3D.hh:113
JVector3D& JGEOMETRY3D::JVector3D::mul ( const double  factor)
inlineinherited

Scale vector.

Parameters
factormultiplication factor
Returns
this vector

Definition at line 172 of file JVector3D.hh.

173  {
174  __x *= factor;
175  __y *= factor;
176  __z *= factor;
177 
178  return *this;
179  }
JVector3D & JMATH::JMath< JVector3D , 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
JVector3D& JGEOMETRY3D::JVector3D::div ( const double  factor)
inlineinherited

Scale vector.

Parameters
factordivision factor
Returns
this vector

Definition at line 188 of file JVector3D.hh.

189  {
190  __x /= factor;
191  __y /= factor;
192  __z /= factor;
193 
194  return *this;
195  }
bool JGEOMETRY3D::JVector3D::equals ( const JVector3D vector) const
inlineinherited

Check equality.

Parameters
vectorvector
Returns
true if vectors are equal; else false

Definition at line 218 of file JVector3D.hh.

219  {
220  return (getX() == vector.getX() &&
221  getY() == vector.getY() &&
222  getZ() == vector.getZ());
223  }
double getY() const
Get y position.
Definition: JVector3D.hh:102
double getX() const
Get x position.
Definition: JVector3D.hh:92
double getZ() const
Get z position.
Definition: JVector3D.hh:113
double JGEOMETRY3D::JVector3D::getLengthSquared ( ) const
inlineinherited

Get length squared.

Returns
square of length

Definition at line 231 of file JVector3D.hh.

232  {
233  return getX()*getX() + getY()*getY() + getZ()*getZ();
234  }
double getY() const
Get y position.
Definition: JVector3D.hh:102
double getX() const
Get x position.
Definition: JVector3D.hh:92
double getZ() const
Get z position.
Definition: JVector3D.hh:113
double JGEOMETRY3D::JVector3D::getLength ( ) const
inlineinherited

Get length.

Returns
length

Definition at line 242 of file JVector3D.hh.

243  {
244  return sqrt(getLengthSquared());
245  }
double getLengthSquared() const
Get length squared.
Definition: JVector3D.hh:231
JVector3D& JGEOMETRY3D::JVector3D::cross ( const JVector3D first,
const JVector3D second 
)
inlineinherited

Get cross product.

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

Parameters
firstfirst vector
secondsecond vector
Returns
this vector

Definition at line 295 of file JVector3D.hh.

297  {
298  __x = first .getY() * second.getZ() - second.getY() * first .getZ();
299  __y = second.getX() * first .getZ() - first .getX() * second.getZ();
300  __z = first .getX() * second.getY() - second.getX() * first .getY();
301 
302  return *this;
303  }
double getY() const
Get y position.
Definition: JVector3D.hh:102
double getX() const
Get x position.
Definition: JVector3D.hh:92
double getZ() const
Get z position.
Definition: JVector3D.hh:113
const JDirection3D& JGEOMETRY3D::JDirection3D::getDirection ( ) const
inlineinherited

Get direction.

Returns
direction

Definition at line 106 of file JDirection3D.hh.

107  {
108  return static_cast<const JDirection3D&>(*this);
109  }
Data structure for direction in three dimensions.
Definition: JDirection3D.hh:32
JDirection3D& JGEOMETRY3D::JDirection3D::getDirection ( )
inlineinherited

Get direction.

Returns
direction

Definition at line 117 of file JDirection3D.hh.

118  {
119  return static_cast<JDirection3D&>(*this);
120  }
Data structure for direction in three dimensions.
Definition: JDirection3D.hh:32
void JGEOMETRY3D::JDirection3D::setDirection ( const JDirection3D dir)
inlineinherited

Set direction.

Parameters
dirdirection

Definition at line 128 of file JDirection3D.hh.

129  {
130  static_cast<JDirection3D&>(*this) = dir;
131  }
Data structure for direction in three dimensions.
Definition: JDirection3D.hh:32
JGEOMETRY3D::JDirection3D::operator JAngle3D ( ) const
inlineinherited

Type conversion operator.

Returns
angle

Definition at line 138 of file JDirection3D.hh.

139  {
140  return JAngle3D(getDX(), getDY(), getDZ());
141  }
Data structure for angles in three dimensions.
Definition: JAngle3D.hh:30
double getDY() const
Get y direction.
Definition: JVersor3D.hh:101
double getDX() const
Get x direction.
Definition: JVersor3D.hh:90
double getDZ() const
Get z direction.
Definition: JVersor3D.hh:112
JGEOMETRY3D::JDirection3D::operator JVector3D ( ) const
inlineinherited

Type conversion operator.

Returns
position

Definition at line 149 of file JDirection3D.hh.

150  {
151  return JVector3D(getDX(), getDY(), getDZ());
152  }
Data structure for vector in three dimensions.
Definition: JVector3D.hh:32
double getDY() const
Get y direction.
Definition: JVersor3D.hh:101
double getDX() const
Get x direction.
Definition: JVersor3D.hh:90
double getDZ() const
Get z direction.
Definition: JVersor3D.hh:112
JDirection3D& JGEOMETRY3D::JDirection3D::transform ( const JMatrix3D T)
inlineinherited

Transform.

Parameters
Tmatrix
Returns
this direction

Definition at line 161 of file JDirection3D.hh.

162  {
163  T.transform(__dx, __dy, __dz);
164 
165  normalise();
166 
167  return *this;
168  }
JVersor3D & normalise()
Normalise versor.
Definition: JVersor3D.hh:166
JDirection3D& JGEOMETRY3D::JDirection3D::rotate ( const JQuaternion3D Q)
inlineinherited

Rotate.

Parameters
Qquaternion
Returns
this position

Definition at line 305 of file JDirection3D.hh.

306  {
307  JQuaternion3D b(Q);
308  JQuaternion3D a;
309 
310  a.mul(*this, b.conjugate());
311 
312  static_cast<JVersor3D&>(*this) = b.mul(Q,a);
313 
314  return *this;
315  }
JQuaternion3D & mul(const double factor)
Scale quaternion.
JFirst_t & mul(const JSecond_t &object)
Multiply with object.
Definition: JMath.hh:273
Data structure for quaternion in three dimensions.
Data structure for normalised vector in three dimensions.
Definition: JVersor3D.hh:23
double JGEOMETRY3D::JDirection3D::getDot ( const JAngle3D angle) const
inlineinherited

Get dot product.

Parameters
angleangle
Returns
dot product

Definition at line 324 of file JDirection3D.hh.

325  {
326  return
327  getDX() * angle.getDX() +
328  getDY() * angle.getDY() +
329  getDZ() * angle.getDZ();
330  }
double getDY() const
Get y direction.
Definition: JVersor3D.hh:101
double getDX() const
Get x direction.
Definition: JVersor3D.hh:90
double getDZ() const
Get z direction.
Definition: JVersor3D.hh:112
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::JDirection3D::getDot ( const JVector3D pos) const
inlineinherited

Get dot product.

Parameters
posposition
Returns
dot product

Definition at line 339 of file JDirection3D.hh.

340  {
341  return
342  getDX() * pos.getX() +
343  getDY() * pos.getY() +
344  getDZ() * pos.getZ();
345  }
double getDY() const
Get y direction.
Definition: JVersor3D.hh:101
double getDX() const
Get x direction.
Definition: JVersor3D.hh:90
double getY() const
Get y position.
Definition: JVector3D.hh:102
double getX() const
Get x position.
Definition: JVector3D.hh:92
double getZ() const
Get z position.
Definition: JVector3D.hh:113
double getDZ() const
Get z direction.
Definition: JVersor3D.hh:112
double JGEOMETRY3D::JDirection3D::getDot ( const JVersor3Z dir) const
inlineinherited

Get dot product.

Parameters
dirdirection
Returns
dot product

Definition at line 354 of file JDirection3D.hh.

355  {
356  return
357  getDX() * dir.getDX() +
358  getDY() * dir.getDY() +
359  getDZ() * dir.getDZ();
360  }
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
double JGEOMETRY3D::JVersor3D::getDot ( const JVersor3D versor) const
inlineinherited

Get dot product.

Parameters
versorversor
Returns
dot product

Definition at line 151 of file JVersor3D.hh.

152  {
153  return
154  getDX() * versor.getDX() +
155  getDY() * versor.getDY() +
156  getDZ() * versor.getDZ();
157  }
double getDY() const
Get y direction.
Definition: JVersor3D.hh:101
double getDX() const
Get x direction.
Definition: JVersor3D.hh:90
double getDZ() const
Get z direction.
Definition: JVersor3D.hh:112
bool JGEOMETRY3D::JVersor3D::equals ( const JVersor3D versor) const
inlineinherited

Check equality.

Parameters
versorversor
Returns
true if versors are equal; else false

Definition at line 77 of file JVersor3D.hh.

78  {
79  return (getDX() == versor.getDX() &&
80  getDY() == versor.getDY() &&
81  getDZ() == versor.getDZ());
82  }
double getDY() const
Get y direction.
Definition: JVersor3D.hh:101
double getDX() const
Get x direction.
Definition: JVersor3D.hh:90
double getDZ() const
Get z direction.
Definition: JVersor3D.hh:112
double JGEOMETRY3D::JVersor3D::getDX ( ) const
inlineinherited

Get x direction.

Returns
x direction

Definition at line 90 of file JVersor3D.hh.

91  {
92  return __dx;
93  }
double JGEOMETRY3D::JVersor3D::getDY ( ) const
inlineinherited

Get y direction.

Returns
y direction

Definition at line 101 of file JVersor3D.hh.

102  {
103  return __dy;
104  }
double JGEOMETRY3D::JVersor3D::getDZ ( ) const
inlineinherited

Get z direction.

Returns
z direction

Definition at line 112 of file JVersor3D.hh.

113  {
114  return __dz;
115  }
double JGEOMETRY3D::JVersor3D::getTheta ( ) const
inlineinherited

Get theta angle.

Returns
theta angle [rad]

Definition at line 123 of file JVersor3D.hh.

124  {
125  if (__dz > +1.0)
126  return 0.0;
127  else if (__dz < -1.0)
128  return JTOOLS::PI;
129  else
130  return acos(__dz);
131  }
static const double PI
Constants.
Definition: JConstants.hh:20
double JGEOMETRY3D::JVersor3D::getPhi ( ) const
inlineinherited

Get phi angle.

Returns
phi angle [rad]

Definition at line 139 of file JVersor3D.hh.

140  {
141  return atan2(__dy, __dx);
142  }
JVersor3D& JGEOMETRY3D::JVersor3D::normalise ( )
inlineinherited

Normalise versor.

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

Returns
this versor

Definition at line 166 of file JVersor3D.hh.

167  {
168  const double v = sqrt(getDX()*getDX() + getDY()*getDY() + getDZ()*getDZ());
169 
170  if (v != 0.0) {
171  __dx /= v;
172  __dy /= v;
173  __dz /= v;
174  }
175 
176  return *this;
177  }
double getDY() const
Get y direction.
Definition: JVersor3D.hh:101
double getDX() const
Get x direction.
Definition: JVersor3D.hh:90
double getDZ() const
Get z direction.
Definition: JVersor3D.hh:112
JVersor3D & JMATH::JMath< JVersor3D , 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,
JAxis3D axis 
)
friend

Read axis from input.

Parameters
ininput stream
axisaxis
Returns
input stream

Definition at line 456 of file JAxis3D.hh.

457  {
458  in >> static_cast<JPosition3D&> (axis);
459  in >> static_cast<JDirection3D&>(axis);
460 
461  return in;
462  }
Data structure for direction in three dimensions.
Definition: JDirection3D.hh:32
Data structure for position in three dimensions.
Definition: JPosition3D.hh:35
std::ostream& operator<< ( std::ostream &  out,
const JAxis3D axis 
)
friend

Write axis to output.

Parameters
outoutput stream
axisaxis
Returns
output stream

Definition at line 472 of file JAxis3D.hh.

473  {
474  out << static_cast<const JPosition3D&> (axis);
475  out << ' ';
476  out << static_cast<const JDirection3D&>(axis);
477 
478  return out;
479  }
JReader& operator>> ( JReader in,
JAxis3D axis 
)
friend

Read axis from input.

Parameters
inreader
axisaxis
Returns
reader

Definition at line 489 of file JAxis3D.hh.

490  {
491  in >> static_cast<JPosition3D&> (axis);
492  in >> static_cast<JDirection3D&>(axis);
493 
494  return in;
495  }
Data structure for direction in three dimensions.
Definition: JDirection3D.hh:32
Data structure for position in three dimensions.
Definition: JPosition3D.hh:35
JWriter& operator<< ( JWriter out,
const JAxis3D axis 
)
friend

Write axis to output.

Parameters
outwriter
axisaxis
Returns
writer

Definition at line 505 of file JAxis3D.hh.

506  {
507  out << static_cast<const JPosition3D&> (axis);
508  out << static_cast<const JDirection3D&>(axis);
509 
510  return out;
511  }

Member Data Documentation

double JGEOMETRY3D::JVector3D::__x
protectedinherited

Definition at line 306 of file JVector3D.hh.

double JGEOMETRY3D::JVector3D::__y
protectedinherited

Definition at line 307 of file JVector3D.hh.

double JGEOMETRY3D::JVector3D::__z
protectedinherited

Definition at line 308 of file JVector3D.hh.

double JGEOMETRY3D::JVersor3D::__dx
protectedinherited

Definition at line 180 of file JVersor3D.hh.

double JGEOMETRY3D::JVersor3D::__dy
protectedinherited

Definition at line 181 of file JVersor3D.hh.

double JGEOMETRY3D::JVersor3D::__dz
protectedinherited

Definition at line 182 of file JVersor3D.hh.


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