12#ifndef __CODAC2_TUBECOMPONENT_H__
13#define __CODAC2_TUBECOMPONENT_H__
20 TubeComponent(Tube<T>& tubevector,
size_t i) :
21 _i(i), _tubevector(tubevector)
23 assert(i >= 0 && i < tubevector.size());
28 TubeComponent(
const TubeComponent<T>& tubevector_i) :
29 _i(tubevector_i._i), _tubevector(tubevector_i._tubevector)
39 const std::shared_ptr<TDomain>& tdomain()
const
41 return _tubevector.tdomain();
44 Interval t0_tf()
const
46 return _tubevector.t0_tf();
49 Interval codomain()
const
51 Interval codomain(Interval::EMPTY_SET);
52 for(
const auto& s : _tubevector)
53 codomain |= s.codomain()[_i];
57 bool contains(
const Trajectory& value)
const
63 void set(
const Interval& codomain)
65 for(
auto& s : _tubevector)
66 s.set_component(_i, codomain);
69 const TubeComponent<T>& operator=(
const TubeComponent<T>& x)
71 assert(x.tdomain() == tdomain());
72 for(
auto& s : _tubevector)
73 s.set_component(_i, std::static_pointer_cast<Slice<T>>(s._it_tslice->_slices.at(&x._tubevector))->codomain()[x._i]);
77 const TubeComponent<T>& operator=(std::pair<std::function<Interval(
const Interval&)>,
const TubeComponent<T>> rel)
79 assert(rel.second.tdomain() == tdomain());
80 for(
auto& s : _tubevector)
81 s.set_component(_i, rel.first(std::static_pointer_cast<Slice<T>>(s._it_tslice->_slices.at(&rel.second._tubevector))->codomain()[rel.second._i]));
85 friend std::ostream& operator<<(std::ostream& os,
const TubeComponent<T>& x)
87 os <<
"Component " << x._i <<
" of: " << x._tubevector << std::flush;
91 std::pair<std::function<Interval(
const Interval&)>,
const TubeComponent<T>> cos(
const TubeComponent<T>& x)
93 return std::make_pair(
static_cast<Interval(*)(
const Interval&)
>(ibex::cos), x);
99 for(
const auto& s : _tubevector)
100 if(!s.t0_tf().is_unbounded())
101 x.set(s.codomain()[_i], s.t0_tf());
102 for(
const auto& s : _tubevector)
103 if(s.t0_tf().is_degenerated())
104 x.set(s.codomain()[_i], s.t0_tf());
112 Tube<T>& _tubevector;
119std::pair<std::function<Interval(
const Interval&)>,
const TubeComponent<T>> cos(
const TubeComponent<T>& x);
One dimensional tube , defined as an interval of scalar trajectories.
Definition codac_Tube.h:48