codac 2.0.0
Loading...
Searching...
No Matches
codac2_Slice_polygon.h
Go to the documentation of this file.
1
9
10namespace codac2
11{
12 template<typename T>
13 ConvexPolygon Slice<T>::polygon_slice(const Slice<T>& v) const
14 requires std::is_same_v<T,Interval>
15 {
16 const Interval& t = t0_tf();
17
18 ConvexPolygon p(IntervalVector({t,codomain()
19 & Interval(next_float(-oo),prev_float(oo)) // todo: remove this
20 }));
21
22 if(v.codomain().is_unbounded())
23 return p;
24
25 ConvexPolygon p_fwd(std::vector<Vector>({
26 {t.ub(), (input_gate().ub()+Interval(t.diam())*v.codomain().ub()).ub()},
27 {t.ub(), (input_gate().lb()+Interval(t.diam())*v.codomain().lb()).lb()},
28 {t.lb(), input_gate().lb()},
29 {t.lb(), input_gate().ub()}
30 }), false); // false: avoid costly computation of convex hull (vertices are already ordered)
31
32 ConvexPolygon p_bwd(std::vector<Vector>({
33 {t.lb(), (output_gate().ub()-Interval(t.diam())*v.codomain().lb()).ub()},
34 {t.lb(), (output_gate().lb()-Interval(t.diam())*v.codomain().ub()).lb()},
35 {t.ub(), output_gate().lb()},
36 {t.ub(), output_gate().ub()}
37 }), false); // false: avoid costly computation of convex hull (vertices are already ordered)
38
39 return p & p_fwd & p_bwd;
40 }
41}
Represents a convex polygon defined by vertices enclosed in IntervalVectors.
Definition codac2_ConvexPolygon.h:25
Interval class, for representing closed and connected subsets of .
Definition codac2_Interval.h:49
double ub() const
Returns the upper bound of this.
Definition codac2_Interval_impl.h:115
double lb() const
Returns the lower bound of this.
Definition codac2_Interval_impl.h:110
auto lb() const
Returns a matrix containing the lower bounds of each interval element.
Definition codac2_MatrixBase_addons_IntervalMatrixBase.h:91
auto ub() const
Returns a matrix containing the upper bounds of each interval element.
Definition codac2_MatrixBase_addons_IntervalMatrixBase.h:103
Definition codac2_OctaSym.h:21
double prev_float(double x)
Returns the previous representable double-precision floating-point value before x.
Definition codac2_Interval_impl.h:614
Eigen::Matrix< Interval,-1, 1 > IntervalVector
Alias for a dynamic-size column vector of intervals.
Definition codac2_IntervalVector.h:25
double next_float(double x)
Returns the next representable double-precision floating-point value after x.
Definition codac2_Interval_impl.h:619