Jpp - the software that should make you happy
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Public Member Functions | Public Attributes | Friends | List of all members
JACOUSTICS::JMODEL::JString Struct Reference

String parameters. More...

#include <JModel.hh>

Inheritance diagram for JACOUSTICS::JMODEL::JString:
JMATH::JMath< JFirst_t, JSecond_t > JLANG::JEquals< JFirst_t, JSecond_t > JACOUSTICS::JKatoomba_t::H_t

Public Member Functions

 JString ()
 Default constructor. More...
 
 JString (const double tx, const double ty)
 Constructor. More...
 
JStringnegate ()
 Negate string. More...
 
JStringadd (const JString &string)
 Add string. More...
 
JStringsub (const JString &string)
 Subtract string. More...
 
JStringmul (const double factor)
 Scale string. More...
 
JStringdiv (const double factor)
 Scale string. More...
 
bool equals (const JString &string, const double precision=std::numeric_limits< double >::min()) const
 Check equality. More...
 
double getLengthSquared () const
 Get length squared. More...
 
double getLength () const
 Get length. More...
 
double getAngle () const
 Get angle. More...
 
double getDot (const JString &string) const
 Get dot product. More...
 
JFirst_t & mul (const JSecond_t &object)
 Multiply with object. More...
 

Public Attributes

double tx
 
double ty
 

Friends

std::istream & operator>> (std::istream &in, JString &string)
 Read string parameters from input stream. More...
 
std::ostream & operator<< (std::ostream &out, const JString &string)
 Write string parameters to output stream. More...
 

Detailed Description

String parameters.

Definition at line 47 of file JAcoustics/JModel.hh.

Constructor & Destructor Documentation

JACOUSTICS::JMODEL::JString::JString ( )
inline

Default constructor.

Definition at line 54 of file JAcoustics/JModel.hh.

54  :
55  tx(0.0),
56  ty(0.0)
57  {}
JACOUSTICS::JMODEL::JString::JString ( const double  tx,
const double  ty 
)
inline

Constructor.

Parameters
txslope dx/dz
tyslope dy/dz

Definition at line 66 of file JAcoustics/JModel.hh.

Member Function Documentation

JString& JACOUSTICS::JMODEL::JString::negate ( )
inline

Negate string.

Returns
this string

Definition at line 78 of file JAcoustics/JModel.hh.

79  {
80  tx = -tx;
81  ty = -ty;
82 
83  return *this;
84  }
JString& JACOUSTICS::JMODEL::JString::add ( const JString string)
inline

Add string.

Parameters
stringstring
Returns
this string

Definition at line 93 of file JAcoustics/JModel.hh.

94  {
95  tx += string.tx;
96  ty += string.ty;
97 
98  return *this;
99  }
JString& JACOUSTICS::JMODEL::JString::sub ( const JString string)
inline

Subtract string.

Parameters
stringstring
Returns
this string

Definition at line 108 of file JAcoustics/JModel.hh.

109  {
110  tx -= string.tx;
111  ty -= string.ty;
112 
113  return *this;
114  }
JString& JACOUSTICS::JMODEL::JString::mul ( const double  factor)
inline

Scale string.

Parameters
factormultiplication factor
Returns
this string

Definition at line 123 of file JAcoustics/JModel.hh.

124  {
125  tx *= factor;
126  ty *= factor;
127 
128  return *this;
129  }
JString& JACOUSTICS::JMODEL::JString::div ( const double  factor)
inline

Scale string.

Parameters
factordivision factor
Returns
this string

Definition at line 138 of file JAcoustics/JModel.hh.

139  {
140  tx /= factor;
141  ty /= factor;
142 
143  return *this;
144  }
bool JACOUSTICS::JMODEL::JString::equals ( const JString string,
const double  precision = std::numeric_limits<double>::min() 
) const
inline

Check equality.

Parameters
stringstring
precisionprecision
Returns
true if strings are equal; else false

Definition at line 154 of file JAcoustics/JModel.hh.

156  {
157  return (fabs(tx - string.tx) <= precision &&
158  fabs(ty - string.ty) <= precision);
159  }
double JACOUSTICS::JMODEL::JString::getLengthSquared ( ) const
inline

Get length squared.

Returns
square of length

Definition at line 167 of file JAcoustics/JModel.hh.

168  {
169  return tx*tx + ty*ty;
170  }
double JACOUSTICS::JMODEL::JString::getLength ( ) const
inline

Get length.

Returns
length

Definition at line 178 of file JAcoustics/JModel.hh.

179  {
180  return sqrt(getLengthSquared());
181  }
double getLengthSquared() const
Get length squared.
double JACOUSTICS::JMODEL::JString::getAngle ( ) const
inline

Get angle.

Returns
angle [rad]

Definition at line 189 of file JAcoustics/JModel.hh.

190  {
191  return atan2(ty, tx);
192  }
double JACOUSTICS::JMODEL::JString::getDot ( const JString string) const
inline

Get dot product.

Parameters
stringstring
Returns
dot product

Definition at line 201 of file JAcoustics/JModel.hh.

202  {
203  return (tx * string.tx +
204  ty * string.ty);
205  }
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,
JString string 
)
friend

Read string parameters from input stream.

Parameters
ininput stream
stringstring
Returns
input stream

Definition at line 215 of file JAcoustics/JModel.hh.

216  {
217  return in >> string.tx >> string.ty;
218  }
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:38
std::ostream& operator<< ( std::ostream &  out,
const JString string 
)
friend

Write string parameters to output stream.

Parameters
outoutput stream
stringstring
Returns
output stream

Definition at line 228 of file JAcoustics/JModel.hh.

229  {
230  using namespace std;
231  using namespace JPP;
232 
233  return out << FIXED(10,7) << string.tx << ' '
234  << FIXED(10,7) << string.ty;
235  }
Auxiliary data structure for floating point format specification.
Definition: JManip.hh:446

Member Data Documentation

double JACOUSTICS::JMODEL::JString::tx

Definition at line 238 of file JAcoustics/JModel.hh.

double JACOUSTICS::JMODEL::JString::ty

Definition at line 239 of file JAcoustics/JModel.hh.


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