codac
codac_Slice.h
Go to the documentation of this file.
1 
12 #ifndef __CODAC_SLICE_H__
13 #define __CODAC_SLICE_H__
14 
15 #include "codac_Tube.h"
16 #include "codac_Trajectory.h"
17 #include "codac_DynamicalItem.h"
18 #include "codac_ConvexPolygon.h"
19 #include "codac_TubeTreeSynthesis.h"
20 #include "codac_BoolInterval.h"
21 
22 namespace codac
23 {
24  #define EPSILON_CONTAINS ibex::next_float(0.) * 1000.
25 
26  class Tube;
27  class Trajectory;
28 
33  class Slice : public DynamicalItem
34  {
35  public:
36 
37  // Base:
38 
41 
48  explicit Slice(const Interval& tdomain, const Interval& codomain = Interval::ALL_REALS);
49 
55  Slice(const Slice& x);
56 
60  ~Slice();
61 
67  int size() const;
68 
75  const Slice& operator=(const Slice& x);
76 
82  const Interval tdomain() const;
83 
87 
93  Slice* prev_slice();
94 
100  const Slice* prev_slice() const;
101 
107  Slice* next_slice();
108 
114  const Slice* next_slice() const;
115 
121  const Interval input_gate() const;
122 
128  const Interval output_gate() const;
129 
139  const ConvexPolygon polygon(const Slice& v) const;
140 
144 
150  const Interval codomain() const;
151 
157  const IntervalVector box() const;
158 
170  static double diam(const Interval& interval);
171 
180  double diam() const;
181 
190  double volume() const;
191 
200  const Interval operator()(double t) const;
201 
208  const Interval operator()(const Interval& t) const;
209 
218  const std::pair<Interval,Interval> eval(const Interval& t = Interval::ALL_REALS) const;
219 
230  const Interval interpol(double t, const Slice& v) const;
231 
242  const Interval interpol(const Interval& t, const Slice& v) const;
243 
251  const Interval invert(const Interval& y, const Interval& search_tdomain = Interval::ALL_REALS) const;
252 
263  const Interval invert(const Interval& y, const Slice& v, const Interval& search_tdomain = Interval::ALL_REALS) const;
264 
268 
278  bool operator==(const Slice& x) const;
279 
289  bool operator!=(const Slice& x) const;
290 
299  bool is_subset(const Slice& x) const;
300 
310  bool is_strict_subset(const Slice& x) const;
311 
320  bool is_interior_subset(const Slice& x) const;
321 
331  bool is_strict_interior_subset(const Slice& x) const;
332 
341  bool is_superset(const Slice& x) const;
342 
352  bool is_strict_superset(const Slice& x) const;
353 
362  bool is_empty() const;
363 
377  const BoolInterval contains(const Trajectory& x) const;
378 
382 
390  void set(const Interval& y);
391 
397  void set_empty();
398 
408  void set_envelope(const Interval& envelope, bool slice_consistency = true);
409 
421  void set_input_gate(const Interval& input_gate, bool slice_consistency = true);
422 
434  void set_output_gate(const Interval& output_gate, bool slice_consistency = true);
435 
444  const Slice& inflate(double rad);
445 
449 
456  Slice& operator+=(double x);
457 
464  Slice& operator+=(const Trajectory& x);
465 
472  Slice& operator+=(const Slice& x);
473 
480  Slice& operator-=(double x);
481 
488  Slice& operator-=(const Trajectory& x);
489 
496  Slice& operator-=(const Slice& x);
497 
504  Slice& operator*=(double x);
505 
512  Slice& operator*=(const Trajectory& x);
513 
520  Slice& operator*=(const Slice& x);
521 
528  Slice& operator/=(double x);
529 
536  Slice& operator/=(const Trajectory& x);
537 
544  Slice& operator/=(const Slice& x);
545 
552  Slice& operator|=(double x);
553 
560  Slice& operator|=(const Trajectory& x);
561 
568  Slice& operator|=(const Slice& x);
569 
576  Slice& operator&=(double x);
577 
584  Slice& operator&=(const Trajectory& x);
585 
592  Slice& operator&=(const Slice& x);
593 
597 
605  const std::string class_name() const { return "Slice"; };
606 
614  friend std::ostream& operator<<(std::ostream& str, const Slice& x);
615 
617 
618  protected:
619 
627  void set_tdomain(const Interval& tdomain);
628 
634  void shift_tdomain(double a);
635 
645  static void chain_slices(Slice *first_slice, Slice *second_slice);
646 
656  static void merge_slices(Slice *first_slice, Slice *&second_slice);
657 
665  const IntervalVector codomain_box() const;
666 
667  // Class variables:
668 
669  Interval m_tdomain;
670  Interval m_codomain = Interval::ALL_REALS;
671  Interval *m_input_gate = nullptr, *m_output_gate = nullptr;
672  Slice *m_prev_slice = nullptr, *m_next_slice = nullptr;
673  mutable TubeTreeSynthesis *m_synthesis_reference = nullptr;
674 
675  friend class Tube;
676  friend class TubeTreeSynthesis;
677  friend class CtcEval;
678  friend void deserialize_Tube(std::ifstream& bin_file, Tube *&tube);
679  };
680 }
681 
682 #endif
FixPoint of a separator The fixpoint of a separator is computed by calling the "::"separate function ...
Definition: codac_capd_helpers.h:9
Slice * prev_slice()
Points to the previous slice .
bool operator==(const Slice &x) const
Returns true if this slice is equal to .
friend void deserialize_Tube(std::ifstream &bin_file, Tube *&tube)
Creates a Tube object from a binary file.
double diam() const
Returns the diameter of this slice.
Slice & operator-=(double x)
Operates -=.
bool is_interior_subset(const Slice &x) const
Returns true if this slice is a subset of the interior of .
bool is_superset(const Slice &x) const
Returns true if this slice is a superset of .
friend std::ostream & operator<<(std::ostream &str, const Slice &x)
Displays a synthesis of this slice.
TubeTreeSynthesis * m_synthesis_reference
pointer to a leaf of the optional synthesis tree of the related tube
Definition: codac_Slice.h:673
const std::pair< Interval, Interval > eval(const Interval &t=Interval::ALL_REALS) const
Returns the interval evaluations of the bounds of the slice over .
Slice of a one dimensional tube and made of an envelope and two gates.
Definition: codac_Slice.h:33
Slice & operator/=(double x)
Operates /=.
const Slice & inflate(double rad)
Inflates this slice by adding to all its codomain components.
void set_envelope(const Interval &envelope, bool slice_consistency=true)
Sets the interval value of the envelope of this slice.
One dimensional trajectory , defined as a temporal map of values.
Definition: codac_Trajectory.h:34
Slice & operator*=(double x)
Operates *=.
const ConvexPolygon polygon(const Slice &v) const
Computes a convex polygon that optimally encloses the values of the slice according to the knowledge ...
const Interval output_gate() const
Returns the value of the output gate of this slice.
const Interval operator()(double t) const
Returns the evaluation of this slice at .
const Interval codomain() const
Returns the envelope of the slice.
double volume() const
Returns the volume of this slice.
Abstract class for common properties of Tube, TubeVector, Slice, Trajectory, TrajectoryVector objects...
Definition: codac_DynamicalItem.h:25
const Interval invert(const Interval &y, const Interval &search_tdomain=Interval::ALL_REALS) const
Returns the interval inversion .
Slice * next_slice()
Points to the next slice .
bool is_strict_subset(const Slice &x) const
Returns true if this slice is a subset of , and not itself.
Slice & operator &=(double x)
Operates &=.
bool operator!=(const Slice &x) const
Returns true if this slice is different from .
~Slice()
Slice destructor.
const IntervalVector codomain_box() const
Returns the box .
that contracts a tube with respect to its derivative tube and a measurement according to the cons...
Definition: codac_CtcEval.h:26
const std::string class_name() const
Returns the name of this class.
Definition: codac_Slice.h:605
bool is_strict_interior_subset(const Slice &x) const
Returns true if this slice is a subset of the interior of , and not itself.
void shift_tdomain(double a)
Shifts the tdomain of .
Slice & operator+=(double x)
Operates +=.
One dimensional tube , defined as an interval of scalar trajectories.
Definition: codac_Tube.h:47
Interval m_codomain
envelope of the slice
Definition: codac_Slice.h:670
bool is_empty() const
Returns true if this slice is empty.
Slice & operator|=(double x)
Operates |=.
void set_tdomain(const Interval &tdomain)
Specifies the temporal domain of this slice.
void set_empty()
Sets this slice to the empty set.
bool is_subset(const Slice &x) const
Returns true if this slice is a subset of .
const Interval input_gate() const
Returns the value of the input gate of this slice.
static void merge_slices(Slice *first_slice, Slice *&second_slice)
Merges the two slices to keep only one.
const BoolInterval contains(const Trajectory &x) const
Returns true if this slice contains the trajectory .
Interval * m_output_gate
input and output gates
Definition: codac_Slice.h:671
int size() const
Returns the dimension of the slice (always 1)
const IntervalVector box() const
Computes the two-dimensional box .
const Slice & operator=(const Slice &x)
Returns a copy of a Slice.
void set_input_gate(const Interval &input_gate, bool slice_consistency=true)
Sets the interval value of the input gate of this slice.
const Interval interpol(double t, const Slice &v) const
Returns the optimal evaluation of this slice at , based on the derivative information ...
bool is_strict_superset(const Slice &x) const
Returns true if this slice is a superset of , and not itself.
Slice * m_next_slice
pointers to previous and next slices of the related tube
Definition: codac_Slice.h:672
void set_output_gate(const Interval &output_gate, bool slice_consistency=true)
Sets the interval value of the output gate of this slice.
Interval m_tdomain
temporal domain of the slice
Definition: codac_Slice.h:669
Slice(const Interval &tdomain, const Interval &codomain=Interval::ALL_REALS)
Creates a slice .
static void chain_slices(Slice *first_slice, Slice *second_slice)
Chains the two slices so that they share pointers and a common gate.
const Interval tdomain() const
Returns the temporal definition domain of this slice.