Jpp  18.0.0-rc.4
the software that should make you happy
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Classes | Functions
Vec.hh File Reference
#include <cmath>
#include <iostream>
#include <sstream>
#include "Rtypes.h"

Go to the source code of this file.

Classes

struct  Vec
 The Vec class is a straightforward 3-d vector, which also works in pyroot. More...
 

Functions

std::ostream & operator<< (std::ostream &out, const Vec &v)
 Write vector to output stream. More...
 
std::istream & operator>> (std::istream &in, Vec &v)
 Read vector from input stream. More...
 
double cos_angle_between (const Vec &a, const Vec &b)
 Get cosine of space angle between two vectors. More...
 
double angle_between (const Vec &a, const Vec &b)
 Get space angle between two vectors. More...
 
Vec operator+ (const Vec &a, const Vec &b)
 Add two vectors. More...
 
Vec operator- (const Vec &a, const Vec &b)
 Subtract two vectors. More...
 
Vec operator* (double a, const Vec &v)
 Multiply vector. More...
 
Vec operator* (const Vec &v, double a)
 Multiply vector. More...
 
Vec operator/ (const Vec &v, double a)
 Divide vector. More...
 

Function Documentation

std::ostream& operator<< ( std::ostream &  out,
const Vec v 
)
inline

Write vector to output stream.

Parameters
outoutput stream
vvector
Returns
output stream

Definition at line 284 of file Vec.hh.

285 {
286  out << v.x << " " << v.y << " " << v.z << " ";
287  return out;
288 }
double z
Definition: Vec.hh:14
double y
Definition: Vec.hh:14
double x
Definition: Vec.hh:14
std::istream& operator>> ( std::istream &  in,
Vec v 
)
inline

Read vector from input stream.

Parameters
ininput stream
vvector
Returns
input stream

Definition at line 297 of file Vec.hh.

298 {
299  in >> v.x >> v.y >> v.z ; return in;
300 }
double z
Definition: Vec.hh:14
double y
Definition: Vec.hh:14
double x
Definition: Vec.hh:14
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 JAcoustics sh $DETECTOR_ID source JAcousticsToolkit sh CHECK_EXIT_CODE typeset A EMITTERS get_tripods $WORKDIR tripod txt EMITTERS get_transmitters $WORKDIR transmitter txt EMITTERS for EMITTER in
Definition: JCanberra.sh:46
double cos_angle_between ( const Vec a,
const Vec b 
)
inline

Get cosine of space angle between two vectors.

Parameters
afirst vector
bsecond vector
Returns
cosine

Definition at line 309 of file Vec.hh.

310 {
311  const double n = a.len() * b.len();
312  return a.dot(b) / n;
313 }
double len() const
Get length.
Definition: Vec.hh:145
const int n
Definition: JPolint.hh:697
double dot(const Vec &v) const
Get dot product.
Definition: Vec.hh:36
double angle_between ( const Vec a,
const Vec b 
)
inline

Get space angle between two vectors.

Parameters
afirst vector
bsecond vector
Returns
angle [rad]

Definition at line 322 of file Vec.hh.

323 {
324  double c = cos_angle_between( a, b );
325  if ( c < -1 ) return M_PI;
326  if ( c > 1 ) return 0;
327  return acos( c );
328 }
double cos_angle_between(const Vec &a, const Vec &b)
Get cosine of space angle between two vectors.
Definition: Vec.hh:309
$WORKDIR ev_configure_dqsimulator txt echo process $DQ_SIMULATOR $i $SOURCE_HOST[$index] csh c(setenv ROOTSYS $ROOTSYS &&source $JPP_DIR/setenv.csh $JPP_DIR &&($DQ_SIMULATOR\-u\$NAME\$\-H\$SERVER\$\-M\$LOGGER\$\-d $DEBUG</dev/null > &/dev/null &))'
Vec operator+ ( const Vec a,
const Vec b 
)
inline

Add two vectors.

Parameters
afirst vector
bsecond vector
Returns
vector

Definition at line 337 of file Vec.hh.

337 { Vec r(a); return r+=b;}
data_type r[M+1]
Definition: JPolint.hh:779
The Vec class is a straightforward 3-d vector, which also works in pyroot.
Definition: Vec.hh:12
Vec operator- ( const Vec a,
const Vec b 
)
inline

Subtract two vectors.

Parameters
afirst vector
bsecond vector
Returns
vector

Definition at line 346 of file Vec.hh.

346 { Vec r(a); return r-=b;}
data_type r[M+1]
Definition: JPolint.hh:779
The Vec class is a straightforward 3-d vector, which also works in pyroot.
Definition: Vec.hh:12
Vec operator* ( double  a,
const Vec v 
)
inline

Multiply vector.

Parameters
afactor
vvector
Returns
vector

Definition at line 355 of file Vec.hh.

355 { return Vec(a*v.x,a*v.y,a*v.z);}
double z
Definition: Vec.hh:14
double y
Definition: Vec.hh:14
double x
Definition: Vec.hh:14
The Vec class is a straightforward 3-d vector, which also works in pyroot.
Definition: Vec.hh:12
then JCalibrateToT a
Definition: JTuneHV.sh:116
Vec operator* ( const Vec v,
double  a 
)
inline

Multiply vector.

Parameters
vvector
afactor
Returns
vector

Definition at line 364 of file Vec.hh.

364 { return Vec(a*v.x,a*v.y,a*v.z);}
double z
Definition: Vec.hh:14
double y
Definition: Vec.hh:14
double x
Definition: Vec.hh:14
The Vec class is a straightforward 3-d vector, which also works in pyroot.
Definition: Vec.hh:12
then JCalibrateToT a
Definition: JTuneHV.sh:116
Vec operator/ ( const Vec v,
double  a 
)
inline

Divide vector.

Parameters
vvector
afactor
Returns
vector

Definition at line 373 of file Vec.hh.

373 { return Vec(v.x/a,v.y/a,v.z/a);}
double z
Definition: Vec.hh:14
double y
Definition: Vec.hh:14
double x
Definition: Vec.hh:14
The Vec class is a straightforward 3-d vector, which also works in pyroot.
Definition: Vec.hh:12
then JCalibrateToT a
Definition: JTuneHV.sh:116