Jpp 19.3.0-rc.3
the software that should make you happy
Loading...
Searching...
No Matches
JDYNAMICS::JDynamics::JOrientation Struct Reference

Dynamic orientation calibration. More...

#include <JDynamics.hh>

Inheritance diagram for JDYNAMICS::JDynamics::JOrientation:
JDYNAMICS::JDynamics::JUTCTracker JUTC::JUTCTimeRange JTOOLS::JRange< T, JComparator_t > JTOOLS::JPair< T, T > JLANG::JEquals< JFirst_t, JSecond_t > JMATH::JMath< JFirst_t, JSecond_t >

Public Types

enum  { NUMBER_OF_POINTS = 20 , NUMBER_OF_DEGREES = 1 }
 
typedef JTOOLS::JElement2D< double, JGEOMETRY3D::JQuaternion3Delement_type
 
typedef JTOOLS::JPolfitFunction1D< NUMBER_OF_POINTS, NUMBER_OF_DEGREES, element_type, JTOOLS::JCollectionfunction_type
 
typedef function_type::collection_type::container_type container_type
 
typedef JTOOLS::JHashMap< int, JGEOMETRY3D::JQuaternion3Dbuffer_type
 
typedef JTOOLS::JHashMap< int, function_typedata_type
 
typedef data_type::const_iterator const_iterator
 
typedef data_type::const_reverse_iterator const_reverse_iterator
 
typedef std::pair< T, T > pair_type
 
typedef JRange< T, JComparator_t > range_type
 
typedef JLANG::JClass< T >::argument_type argument_type
 
typedef T key_type
 
typedef T mapped_type
 

Public Member Functions

 JOrientation (const JDetector &detector, const double Tmax_s)
 Constructor.
 
void load (JObjectIterator< JCOMPASS::JOrientation > &input)
 Load calibration data.
 
bool empty () const
 empty
 
size_t size () const
 size
 
const_iterator begin () const
 begin of calibration data
 
const_iterator end () const
 end of calibration data
 
const_reverse_iterator rbegin () const
 begin of reverse of calibration data
 
const_reverse_iterator rend () const
 begin of reverse of calibration data
 
double getCoverage (const JDetector &detector, const double t1_s) const
 Get coverage.
 
bool update (JDetector &detector, const double t1_s)
 Calibrate given detector at given UTC time.
 
void reset ()
 Reset.
 
void set (const double t0_s)
 Set.
 
const JUTCTimeRangegetUTCTimeRange () const
 Get UTC time range.
 
JUTCTimeRangegetUTCTimeRange ()
 Get UTC time range.
 
void setUTCTimeRange (const JRange< double > &timerange)
 Set UTC time range.
 
 operator pair_type () const
 Type conversion operator.
 
const range_typegetRange () const
 Get range.
 
void setRange (const range_type &range)
 Set range.
 
void setRange (argument_type x, argument_type y)
 Set lower and upper limit.
 
template<class R >
void setRange (R first, R second)
 Set range.
 
template<class JElement_t , class JAllocator_t >
void setRange (const array_type< JElement_t, JAllocator_t > &buffer)
 Set lower and upper limit according to input data.
 
getLowerLimit () const
 Get lower limit.
 
getUpperLimit () const
 Get upper limit.
 
void setLowerLimit (argument_type x)
 Set lower limit.
 
void setUpperLimit (argument_type y)
 Set upper limit.
 
void fixLowerLimit (argument_type x)
 Fix lower limit.
 
void fixUpperLimit (argument_type y)
 Fix upper limit.
 
bool equals (const range_type &range) const
 Equal method.
 
getLength () const
 Get length (difference between upper and lower limit).
 
void setLength (argument_type length)
 Set length (difference between upper and lower limit).
 
bool is_valid () const
 Check validity of range.
 
bool in_range (argument_type x) const
 Test whether value is inside range.
 
bool operator() (argument_type x) const
 Test whether value is inside range.
 
constrain (argument_type x) const
 Constrain value to range.
 
mod (argument_type x) const
 Modulo value with respect to range.
 
bool overlap (const range_type &range) const
 Test overlap with given range.
 
range_typeinclude (argument_type x)
 Include given value to range.
 
range_typejoin (const range_type &range)
 Join ranges.
 
range_typecombine (const range_type &range)
 Combine ranges.
 
range_typeadd (argument_type x)
 Add offset.
 
range_typeadd (const range_type &range)
 Add offsets.
 
range_typesub (argument_type x)
 Subtract offset.
 
range_typesub (const range_type &range)
 Subtract offsets.
 
range_typemul (const double factor)
 Multiply range.
 
JFirst_t & mul (const JSecond_t &object)
 Multiply with object.
 
range_typediv (const double factor)
 Divide range.
 
const key_typegetKey () const
 
const mapped_typegetValue () const
 
mapped_typegetValue ()
 

Static Public Member Functions

static T getMinimum ()
 Get minimum possible value.
 
static T getMaximum ()
 Get maximum possible value.
 
static JRange< T, JComparator_t > DEFAULT_RANGE ()
 Default range.
 

Public Attributes

JComparator_t compare
 Function object for comparisons.
 
first
 
second
 

Protected Member Functions

template<class R >
void setRange (R first, R second, const JLANG::JBool< false > &option)
 Set range.
 
template<class R >
void setRange (R first, R second, const JLANG::JBool< true > &option)
 Set range.
 

Protected Attributes

buffer_type buffer
 
data_type calibration
 

Detailed Description

Dynamic orientation calibration.

Definition at line 129 of file JDynamics.hh.

Member Typedef Documentation

◆ element_type

◆ function_type

◆ container_type

function_type::collection_type::container_type JDYNAMICS::JDynamics::JOrientation::container_type

Definition at line 141 of file JDynamics.hh.

◆ buffer_type

◆ data_type

◆ const_iterator

◆ const_reverse_iterator

◆ pair_type

template<class T , class JComparator_t = std::less<T>>
std::pair<T,T> JTOOLS::JRange< T, JComparator_t >::pair_type
inherited

Definition at line 45 of file JRange.hh.

◆ range_type

template<class T , class JComparator_t = std::less<T>>
JRange<T, JComparator_t> JTOOLS::JRange< T, JComparator_t >::range_type
inherited

Definition at line 46 of file JRange.hh.

◆ argument_type

template<class T , class JComparator_t = std::less<T>>
JLANG::JClass<T>::argument_type JTOOLS::JRange< T, JComparator_t >::argument_type
inherited

Definition at line 47 of file JRange.hh.

◆ key_type

T JTOOLS::JPair< T, T >::key_type
inherited

Definition at line 32 of file JPair.hh.

◆ mapped_type

T JTOOLS::JPair< T, T >::mapped_type
inherited

Definition at line 33 of file JPair.hh.

Member Enumeration Documentation

◆ anonymous enum

anonymous enum
Enumerator
NUMBER_OF_POINTS 

number of points for interpolation

NUMBER_OF_DEGREES 

number of degrees for interpolation

Definition at line 132 of file JDynamics.hh.

132 {
133 NUMBER_OF_POINTS = 20, //!< number of points for interpolation
134 NUMBER_OF_DEGREES = 1 //!< number of degrees for interpolation
135 };
@ NUMBER_OF_DEGREES
number of degrees for interpolation
Definition JDynamics.hh:134
@ NUMBER_OF_POINTS
number of points for interpolation
Definition JDynamics.hh:133

Constructor & Destructor Documentation

◆ JOrientation()

JDYNAMICS::JDynamics::JOrientation::JOrientation ( const JDetector & detector,
const double Tmax_s )
inline

Constructor.

Parameters
detectordetector
Tmax_sapplicability period of calibration [s]

Definition at line 156 of file JDynamics.hh.

157 :
158 JUTCTracker(Tmax_s)
159 {
160 using namespace JPP;
161
163 THROW(JValueOutOfRange, "Detector version " << detector.getVersion() << " < " << JDetectorVersion::V4);
164 }
165
166 if (hasDetectorBuilder(detector.getID())) {
167
168 const JDetectorBuilder& demo = getDetectorBuilder(detector.getID());
169
170 for (JDetector::const_iterator module = detector.begin(); module != detector.end(); ++module) {
171 if (module->getFloor() != 0) {
172 buffer[module->getID()] = getRotation(demo.getModule(module->getID()), *module);
173 }
174 }
175
176 } else {
177
178 THROW(JValueOutOfRange, "No detector address map for detector identier " << detector.getID());
179 }
180 }
#define THROW(JException_t, A)
Marco for throwing exception with std::ostream compatible message.
Exception for accessing a value in a collection that is outside of its range.
static JRotation getRotation
Function object to get rotation matrix to go from first to second module.
JDetectorBuilder & getDetectorBuilder()
Get detector builder.
static const JGetDetectorVersion getDetectorVersion
Function object to map detector version to numerical value.
bool hasDetectorBuilder(const int id)
Check if detector builder is available.
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
Detector file.
Definition JHead.hh:227
Auxiliary interface for building detector.
const JModule & getModule(const int id=-1, const JLocation &location=JLocation()) const
Get module.
@ V4
Version with quaternion and time offset per module.
JUTCTracker(const double Tmax_s)
Constructor.
Definition JDynamics.hh:98

Member Function Documentation

◆ load()

void JDYNAMICS::JDynamics::JOrientation::load ( JObjectIterator< JCOMPASS::JOrientation > & input)
inline

Load calibration data.

Parameters
inputcalibration data

Definition at line 188 of file JDynamics.hh.

189 {
190 this->reset();
191
192 while (input.hasNext()) {
193
194 const JCOMPASS::JOrientation* orientation = input.next();
195
196 if (buffer.has(orientation->id)) {
198 }
199 }
200
201 for (data_type::iterator i = calibration.begin(); i != calibration.end(); ++i) {
202 i->second.sort();
203 i->second.compile();
204 }
205 }
virtual bool hasNext()=0
Check availability of next element.
virtual const pointer_type & next()=0
Get next element.
bool has(const T &value) const
Test whether given value is present.
JQuaternion3D getQuaternion(const JQuaternion &Q)
Get quaternion.
Calibration.
Definition JHead.hh:330
Orientation of module.
JTOOLS::JElement2D< double, JGEOMETRY3D::JQuaternion3D > element_type
Definition JDynamics.hh:137
function_type::collection_type::container_type container_type
Definition JDynamics.hh:141
container_type::iterator iterator
Definition JHashMap.hh:88

◆ empty()

bool JDYNAMICS::JDynamics::JOrientation::empty ( ) const
inline

empty

Definition at line 208 of file JDynamics.hh.

◆ size()

size_t JDYNAMICS::JDynamics::JOrientation::size ( ) const
inline

size

Definition at line 209 of file JDynamics.hh.

◆ begin()

const_iterator JDYNAMICS::JDynamics::JOrientation::begin ( ) const
inline

begin of calibration data

Definition at line 210 of file JDynamics.hh.

◆ end()

const_iterator JDYNAMICS::JDynamics::JOrientation::end ( ) const
inline

end of calibration data

Definition at line 211 of file JDynamics.hh.

◆ rbegin()

const_reverse_iterator JDYNAMICS::JDynamics::JOrientation::rbegin ( ) const
inline

begin of reverse of calibration data

Definition at line 212 of file JDynamics.hh.

◆ rend()

const_reverse_iterator JDYNAMICS::JDynamics::JOrientation::rend ( ) const
inline

begin of reverse of calibration data

Definition at line 213 of file JDynamics.hh.

◆ getCoverage()

double JDYNAMICS::JDynamics::JOrientation::getCoverage ( const JDetector & detector,
const double t1_s ) const
inline

Get coverage.

Parameters
detectordetector
t1_sUTC time [s]
Returns
coverage [0,1]

Definition at line 223 of file JDynamics.hh.

224 {
225 int n0 = 0;
226 int n1 = 0;
227
228 for (JDetector::const_iterator module = detector.begin(); module != detector.end(); ++module) {
229
230 if (module->getFloor() != 0 && !module->has(COMPASS_DISABLE)) {
231
232 ++n0;
233
234 if (calibration.has(module->getID()) && !calibration.get(module->getID()).empty()) {
235 if (calibration[module->getID()].getXmin() <= t1_s &&
236 calibration[module->getID()].getXmax() >= t1_s) {
237 ++n1;
238 }
239 }
240 }
241 }
242
243 if (n0 != 0)
244 return (double) n1 / (double) n0;
245 else
246 return 0.0;
247 }
static const int COMPASS_DISABLE
Enable (disable) use of compass if this status bit is 0 (1);.

◆ update()

bool JDYNAMICS::JDynamics::JOrientation::update ( JDetector & detector,
const double t1_s )
inline

Calibrate given detector at given UTC time.

Parameters
detectordetector (I/O)
t1_sUTC time [s]
Returns
true if updated; else false

Definition at line 257 of file JDynamics.hh.

258 {
259 using namespace std;
260 using namespace JPP;
261
262 if (!calibration.empty()) {
263
264 if (!in_range(t1_s)) {
265
266 for (JDetector::iterator module = detector.begin(); module != detector.end(); ++module) {
267
268 if (module->getFloor() != 0 && !module->has(COMPASS_DISABLE) && calibration.has(module->getID()) && buffer.has(module->getID())) {
269
270 const function_type& f1 = calibration.get(module->getID());
271
272 if (!f1.empty()) {
273
274 if (t1_s >= f1.getXmin() && t1_s <= f1.getXmax()) {
275
276 JQuaternion3D Q0 = buffer[module->getID()];
277 JQuaternion3D Q1 = module->getQuaternion() * f1(t1_s);
278
279 const JPosition3D center = module->getPosition();
280
281 module->sub(center);
282
283 module->rotate(Q1 * Q0.conjugate());
284
285 module->add(center);
286
287 buffer[module->getID()] = Q1;
288 }
289 }
290 }
291 }
292
293 set(t1_s);
294
295 return true;
296 }
297 }
298
299 return false;
300 }
Data structure for position in three dimensions.
Data structure for unit quaternion in three dimensions.
bool in_range(argument_type x) const
Test whether value is inside range.
Definition JRange.hh:323
const JPolynome f1(1.0, 2.0, 3.0)
Function.
JTOOLS::JPolfitFunction1D< NUMBER_OF_POINTS, NUMBER_OF_DEGREES, element_type, JTOOLS::JCollection > function_type
Definition JDynamics.hh:140
void set(const double t0_s)
Set.
Definition JDynamics.hh:117

◆ reset()

void JDYNAMICS::JDynamics::JUTCTracker::reset ( )
inlineinherited

Reset.

Definition at line 106 of file JDynamics.hh.

107 {
108 set(0.0);
109 }

◆ set()

void JDYNAMICS::JDynamics::JUTCTracker::set ( const double t0_s)
inlineinherited

Set.

Parameters
t0_sUTC time [s]

Definition at line 117 of file JDynamics.hh.

118 {
119 const double Tmax_s = 0.5 * (getUpperLimit() - getLowerLimit());
120
121 setRange(t0_s - Tmax_s, t0_s + Tmax_s);
122 }
void setRange(const range_type &range)
Set range.
Definition JRange.hh:146
T getLowerLimit() const
Get lower limit.
Definition JRange.hh:202
T getUpperLimit() const
Get upper limit.
Definition JRange.hh:213

◆ getUTCTimeRange() [1/2]

const JUTCTimeRange & JUTC::JUTCTimeRange::getUTCTimeRange ( ) const
inlineinherited

Get UTC time range.

Returns
UTC time range

Definition at line 63 of file JUTCTimeRange.hh.

64 {
65 return static_cast<const JUTCTimeRange&>(*this);
66 }
JUTCTimeRange()
Default constructor.

◆ getUTCTimeRange() [2/2]

JUTCTimeRange & JUTC::JUTCTimeRange::getUTCTimeRange ( )
inlineinherited

Get UTC time range.

Returns
UTC time range

Definition at line 74 of file JUTCTimeRange.hh.

75 {
76 return static_cast<JUTCTimeRange&>(*this);
77 }

◆ setUTCTimeRange()

void JUTC::JUTCTimeRange::setUTCTimeRange ( const JRange< double > & timerange)
inlineinherited

Set UTC time range.

Parameters
timerangeUTC time range

Definition at line 85 of file JUTCTimeRange.hh.

86 {
87 static_cast<JUTCTimeRange&>(*this) = timerange;
88 }

◆ operator pair_type()

template<class T , class JComparator_t = std::less<T>>
JTOOLS::JRange< T, JComparator_t >::operator pair_type ( ) const
inlineinherited

Type conversion operator.

Returns
piar

Definition at line 124 of file JRange.hh.

125 {
127 }
std::pair< T, T > pair_type
Definition JRange.hh:45

◆ getRange()

template<class T , class JComparator_t = std::less<T>>
const range_type & JTOOLS::JRange< T, JComparator_t >::getRange ( ) const
inlineinherited

Get range.

Returns
range

Definition at line 135 of file JRange.hh.

136 {
137 return static_cast<const range_type&>(*this);
138 }
JRange< T, JComparator_t > range_type
Definition JRange.hh:46

◆ setRange() [1/6]

template<class T , class JComparator_t = std::less<T>>
void JTOOLS::JRange< T, JComparator_t >::setRange ( const range_type & range)
inlineinherited

Set range.

Parameters
rangerange

Definition at line 146 of file JRange.hh.

147 {
148 static_cast<range_type&>(*this) = range;
149 }

◆ setRange() [2/6]

template<class T , class JComparator_t = std::less<T>>
void JTOOLS::JRange< T, JComparator_t >::setRange ( argument_type x,
argument_type y )
inlineinherited

Set lower and upper limit.

Parameters
xlower limit
yupper limit

Definition at line 158 of file JRange.hh.

◆ setRange() [3/6]

template<class T , class JComparator_t = std::less<T>>
template<class R >
void JTOOLS::JRange< T, JComparator_t >::setRange ( R first,
R second )
inlineinherited

Set range.


The arguments could be values or iterators.

Parameters
firstfirst
secondsecond

Definition at line 173 of file JRange.hh.

174 {
175 using namespace JLANG;
176
178 }
Auxiliary classes and methods for language specific functionality.
Auxiliary template class for type bool.
Definition JBool.hh:21
Data structure to check whether given data type is an iterator.
Definition JClass.hh:62

◆ setRange() [4/6]

template<class T , class JComparator_t = std::less<T>>
template<class JElement_t , class JAllocator_t >
void JTOOLS::JRange< T, JComparator_t >::setRange ( const array_type< JElement_t, JAllocator_t > & buffer)
inlineinherited

Set lower and upper limit according to input data.

Parameters
bufferinput data

Definition at line 187 of file JRange.hh.

188 {
190
191 for (typename array_type<JElement_t, JAllocator_t>::const_iterator i = buffer.begin(); i != buffer.end(); ++i) {
192 include(*i);
193 }
194 }
range_type & include(argument_type x)
Include given value to range.
Definition JRange.hh:397
static T getMaximum()
Get maximum possible value.
Definition JRange.hh:545
static T getMinimum()
Get minimum possible value.
Definition JRange.hh:534

◆ setRange() [5/6]

template<class T , class JComparator_t = std::less<T>>
template<class R >
void JTOOLS::JRange< T, JComparator_t >::setRange ( R first,
R second,
const JLANG::JBool< false > & option )
inlineprotectedinherited

Set range.

Parameters
firstfirst
secondsecond
optionfalse

Definition at line 576 of file JRange.hh.

577 {
579 }
JLANG::JClass< T >::argument_type argument_type
Definition JRange.hh:47

◆ setRange() [6/6]

template<class T , class JComparator_t = std::less<T>>
template<class R >
void JTOOLS::JRange< T, JComparator_t >::setRange ( R first,
R second,
const JLANG::JBool< true > & option )
inlineprotectedinherited

Set range.

Parameters
firstfirst
secondsecond
optiontrue

Definition at line 590 of file JRange.hh.

591 {
593
594 for (R i = first; i != second; ++i) {
595 include(*i);
596 }
597 }

◆ getLowerLimit()

template<class T , class JComparator_t = std::less<T>>
T JTOOLS::JRange< T, JComparator_t >::getLowerLimit ( ) const
inlineinherited

Get lower limit.

Returns
lower limit

Definition at line 202 of file JRange.hh.

203 {
204 return this->first;
205 }

◆ getUpperLimit()

template<class T , class JComparator_t = std::less<T>>
T JTOOLS::JRange< T, JComparator_t >::getUpperLimit ( ) const
inlineinherited

Get upper limit.

Returns
upper limit

Definition at line 213 of file JRange.hh.

214 {
215 return this->second;
216 }

◆ setLowerLimit()

template<class T , class JComparator_t = std::less<T>>
void JTOOLS::JRange< T, JComparator_t >::setLowerLimit ( argument_type x)
inlineinherited

Set lower limit.

Parameters
xlower limit

Definition at line 224 of file JRange.hh.

225 {
226 this->first = x;
227 }

◆ setUpperLimit()

template<class T , class JComparator_t = std::less<T>>
void JTOOLS::JRange< T, JComparator_t >::setUpperLimit ( argument_type y)
inlineinherited

Set upper limit.

Parameters
yupper limit

Definition at line 235 of file JRange.hh.

236 {
237 this->second = y;
238 }

◆ fixLowerLimit()

template<class T , class JComparator_t = std::less<T>>
void JTOOLS::JRange< T, JComparator_t >::fixLowerLimit ( argument_type x)
inlineinherited

Fix lower limit.

The range is shifted to the given lower limit.

Parameters
xlower limit

Definition at line 248 of file JRange.hh.

249 {
250 this->second += x - this->first;
251 this->first = x;
252 }

◆ fixUpperLimit()

template<class T , class JComparator_t = std::less<T>>
void JTOOLS::JRange< T, JComparator_t >::fixUpperLimit ( argument_type y)
inlineinherited

Fix upper limit.

The range is shifted to the given upper limit.

Parameters
yupper limit

Definition at line 262 of file JRange.hh.

263 {
264 this->first += y - this->second;
265 this->second = y;
266 }

◆ equals()

template<class T , class JComparator_t = std::less<T>>
bool JTOOLS::JRange< T, JComparator_t >::equals ( const range_type & range) const
inlineinherited

Equal method.

Parameters
rangerange
Returns
true if this range is equal to given range; else false

Definition at line 275 of file JRange.hh.

276 {
277 return (!this->compare(this->getLowerLimit(), range.getLowerLimit()) &&
278 !this->compare(range.getLowerLimit(), this->getLowerLimit()) &&
279 !this->compare(this->getUpperLimit(), range.getUpperLimit()) &&
280 !this->compare(range.getUpperLimit(), this->getUpperLimit()));
281 }
JComparator_t compare
Function object for comparisons.
Definition JRange.hh:565

◆ getLength()

template<class T , class JComparator_t = std::less<T>>
T JTOOLS::JRange< T, JComparator_t >::getLength ( ) const
inlineinherited

Get length (difference between upper and lower limit).

Returns
length

Definition at line 289 of file JRange.hh.

290 {
291 return getUpperLimit() - getLowerLimit();
292 }

◆ setLength()

template<class T , class JComparator_t = std::less<T>>
void JTOOLS::JRange< T, JComparator_t >::setLength ( argument_type length)
inlineinherited

Set length (difference between upper and lower limit).

Parameters
lengthlength

Definition at line 300 of file JRange.hh.

301 {
302 setUpperLimit(getLowerLimit() + length);
303 }
void setUpperLimit(argument_type y)
Set upper limit.
Definition JRange.hh:235

◆ is_valid()

template<class T , class JComparator_t = std::less<T>>
bool JTOOLS::JRange< T, JComparator_t >::is_valid ( ) const
inlineinherited

Check validity of range.

Returns
true if lower limit less than or equal to upper limit; else false

Definition at line 311 of file JRange.hh.

312 {
313 return !compare(getUpperLimit(), getLowerLimit());
314 }

◆ in_range()

template<class T , class JComparator_t = std::less<T>>
bool JTOOLS::JRange< T, JComparator_t >::in_range ( argument_type x) const
inlineinherited

Test whether value is inside range.

Parameters
xvalue
Returns
true if lower limit <= value <= upper limit; else false

Definition at line 323 of file JRange.hh.

324 {
325 return (!compare(x, getLowerLimit()) &&
326 !compare(getUpperLimit(), x));
327 }

◆ operator()()

template<class T , class JComparator_t = std::less<T>>
bool JTOOLS::JRange< T, JComparator_t >::operator() ( argument_type x) const
inlineinherited

Test whether value is inside range.

Parameters
xvalue
Returns
true if lower limit <= value <= upper limit; else false

Definition at line 336 of file JRange.hh.

337 {
338 return in_range(x);
339 }

◆ constrain()

template<class T , class JComparator_t = std::less<T>>
T JTOOLS::JRange< T, JComparator_t >::constrain ( argument_type x) const
inlineinherited

Constrain value to range.


This method returns the original value if it is in this range, else lower limit if value < lower limit or upper limit if value > upper limit.

Parameters
xvalue
Returns
lower limit <= x <= upper limit

Definition at line 350 of file JRange.hh.

351 {
352 if (compare(x, getLowerLimit())) { return getLowerLimit(); }
353 if (compare(getUpperLimit(), x)) { return getUpperLimit(); }
354
355 return x;
356 }

◆ mod()

template<class T , class JComparator_t = std::less<T>>
T JTOOLS::JRange< T, JComparator_t >::mod ( argument_type x) const
inlineinherited

Modulo value with respect to range.


Parameters
xvalue
Returns
lower limit <= x <= upper limit

Definition at line 365 of file JRange.hh.

366 {
367 if (compare(x, getLowerLimit()))
368 return x + getLength() * floor((getUpperLimit() - x) / getLength());
369 else if (compare(getUpperLimit(), x))
370 return x - getLength() * floor((x - getLowerLimit()) / getLength());
371 else
372 return x;
373 }
T getLength() const
Get length (difference between upper and lower limit).
Definition JRange.hh:289

◆ overlap()

template<class T , class JComparator_t = std::less<T>>
bool JTOOLS::JRange< T, JComparator_t >::overlap ( const range_type & range) const
inlineinherited

Test overlap with given range.


Parameters
rangerange
Returns
true if there is a non-zero overlap; else false

Definition at line 382 of file JRange.hh.

383 {
384 return (!compare(range.getUpperLimit(), getLowerLimit()) &&
385 !compare(getUpperLimit(), range.getLowerLimit()));
386 }

◆ include()

template<class T , class JComparator_t = std::less<T>>
range_type & JTOOLS::JRange< T, JComparator_t >::include ( argument_type x)
inlineinherited

Include given value to range.


The new lower limit is the minimim of the original lower limit and given value and
the new upper limit is the maximum of the original upper limit and given value;

Parameters
xvalue
Returns
range

Definition at line 397 of file JRange.hh.

398 {
399 if (compare(x, getLowerLimit())) { setLowerLimit(x); }
400 if (compare(getUpperLimit(), x)) { setUpperLimit(x); }
401
402 return *this;
403 }
void setLowerLimit(argument_type x)
Set lower limit.
Definition JRange.hh:224

◆ join()

template<class T , class JComparator_t = std::less<T>>
range_type & JTOOLS::JRange< T, JComparator_t >::join ( const range_type & range)
inlineinherited

Join ranges.


The new lower limit is the maximim of the two lower limits and
the new upper limit is the minimum of the two upper limits.
This operation results in an equal or smaller range and may result in an unphysical range (i.e. lower limit > upper limit).

Parameters
rangerange

Definition at line 415 of file JRange.hh.

416 {
417 if (compare(getLowerLimit(), range.getLowerLimit())) { setLowerLimit(range.getLowerLimit()); }
418 if (compare(range.getUpperLimit(), getUpperLimit())) { setUpperLimit(range.getUpperLimit()); }
419
420 return *this;
421 }

◆ combine()

template<class T , class JComparator_t = std::less<T>>
range_type & JTOOLS::JRange< T, JComparator_t >::combine ( const range_type & range)
inlineinherited

Combine ranges.


The new lower limit is the minimim of the two lower limits and
the new upper limit is the maximum of the two upper limits.
This operation results in an equal or larger range.

Parameters
rangerange

Definition at line 432 of file JRange.hh.

433 {
434 if (compare(range.getLowerLimit(), getLowerLimit())) { setLowerLimit(range.getLowerLimit()); }
435 if (compare(getUpperLimit(), range.getUpperLimit())) { setUpperLimit(range.getUpperLimit()); }
436
437 return *this;
438 }

◆ add() [1/2]

template<class T , class JComparator_t = std::less<T>>
range_type & JTOOLS::JRange< T, JComparator_t >::add ( argument_type x)
inlineinherited

Add offset.

Parameters
xoffset

Definition at line 446 of file JRange.hh.

447 {
448 this->first += x;
449 this->second += x;
450
451 return *this;
452 }

◆ add() [2/2]

template<class T , class JComparator_t = std::less<T>>
range_type & JTOOLS::JRange< T, JComparator_t >::add ( const range_type & range)
inlineinherited

Add offsets.


The new lower limit is the sum of the two lower limits and
the new upper limit is the sum of the two upper limits.

Parameters
rangeoffset

Definition at line 476 of file JRange.hh.

477 {
478 this->first += range.getLowerLimit();
479 this->second += range.getUpperLimit();
480
481 return *this;
482 }

◆ sub() [1/2]

template<class T , class JComparator_t = std::less<T>>
range_type & JTOOLS::JRange< T, JComparator_t >::sub ( argument_type x)
inlineinherited

Subtract offset.

Parameters
xoffset

Definition at line 460 of file JRange.hh.

461 {
462 this->first -= x;
463 this->second -= x;
464
465 return *this;
466 }

◆ sub() [2/2]

template<class T , class JComparator_t = std::less<T>>
range_type & JTOOLS::JRange< T, JComparator_t >::sub ( const range_type & range)
inlineinherited

Subtract offsets.


The new lower limit is the difference of the two lower limits and
the new upper limit is the difference of the two upper limits.

Parameters
rangeoffset

Definition at line 492 of file JRange.hh.

493 {
494 this->first -= range.getLowerLimit();
495 this->second -= range.getUpperLimit();
496
497 return *this;
498 }

◆ mul() [1/2]

template<class T , class JComparator_t = std::less<T>>
range_type & JTOOLS::JRange< T, JComparator_t >::mul ( const double factor)
inlineinherited

Multiply range.

Parameters
factorfactor

Definition at line 506 of file JRange.hh.

507 {
508 this->first *= factor;
509 this->second *= factor;
510
511 return *this;
512 }

◆ mul() [2/2]

template<class JFirst_t , class JSecond_t >
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 354 of file JMath.hh.

355 {
356 return static_cast<JFirst_t&>(*this) = JFirst_t().mul(static_cast<const JFirst_t&>(*this), object);
357 }

◆ div()

template<class T , class JComparator_t = std::less<T>>
range_type & JTOOLS::JRange< T, JComparator_t >::div ( const double factor)
inlineinherited

Divide range.

Parameters
factorfactor

Definition at line 520 of file JRange.hh.

521 {
522 this->first /= factor;
523 this->second /= factor;
524
525 return *this;
526 }

◆ getMinimum()

template<class T , class JComparator_t = std::less<T>>
static T JTOOLS::JRange< T, JComparator_t >::getMinimum ( )
inlinestaticinherited

Get minimum possible value.

Returns
minimum possible value

Definition at line 534 of file JRange.hh.

535 {
536 return JMATH::JLimits<T>::min();
537 }
float min()
Get minimum possible value.
Definition JLimits.hh:96

◆ getMaximum()

template<class T , class JComparator_t = std::less<T>>
static T JTOOLS::JRange< T, JComparator_t >::getMaximum ( )
inlinestaticinherited

Get maximum possible value.

Returns
maximum possible value

Definition at line 545 of file JRange.hh.

546 {
547 return JMATH::JLimits<T>::max();
548 }
TTimeStamp max()
Get maximum possible value.

◆ DEFAULT_RANGE()

template<class T , class JComparator_t = std::less<T>>
static JRange< T, JComparator_t > JTOOLS::JRange< T, JComparator_t >::DEFAULT_RANGE ( )
inlinestaticinherited

Default range.

This range corresponds to an unphysical range.

Definition at line 555 of file JRange.hh.

◆ getKey()

const key_type & JTOOLS::JPair< T, T >::getKey ( ) const
inlineinherited

Definition at line 123 of file JPair.hh.

123{ return this->first; }

◆ getValue() [1/2]

const mapped_type & JTOOLS::JPair< T, T >::getValue ( ) const
inlineinherited

Definition at line 124 of file JPair.hh.

124{ return this->second; }

◆ getValue() [2/2]

mapped_type & JTOOLS::JPair< T, T >::getValue ( )
inlineinherited

Definition at line 126 of file JPair.hh.

126{ return this->second; }

Member Data Documentation

◆ buffer

buffer_type JDYNAMICS::JDynamics::JOrientation::buffer
protected

Definition at line 303 of file JDynamics.hh.

◆ calibration

data_type JDYNAMICS::JDynamics::JOrientation::calibration
protected

Definition at line 304 of file JDynamics.hh.

◆ compare

template<class T , class JComparator_t = std::less<T>>
JComparator_t JTOOLS::JRange< T, JComparator_t >::compare
inherited

Function object for comparisons.

Definition at line 565 of file JRange.hh.

◆ first

T JTOOLS::JPair< T, T >::first
inherited

Definition at line 128 of file JPair.hh.

◆ second

T JTOOLS::JPair< T, T >::second
inherited

Definition at line 129 of file JPair.hh.


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