46 assert(
x.nc() ==
y.nc());
47 m_data = dlib::zeros_matrix<T>(2,
x.nc());
59 unsigned int lower = 0;
60 unsigned int upper =
m_data.nc() - 2;
68 unsigned int new_index = (std::ceil)((
float)(
m_searchIndex + upper) / 2.0f);
75 unsigned int new_index = (std::floor)((
float)(
m_searchIndex + lower) / 2.0f);
111 virtual void bound(
const DT& xmin,
const DT& xmax,
CT& ymin,
CT& ymax)
override
125 for (
int i = imin + 1; i <= imax; i++)
137 template<
typename T,
int n>
144 typedef adoreMatrix<T, n, 1>
CT;
152 const adoreMatrix<T, n + 1, 0>&
getData()
const
166 std::cerr<<
"LLinearPiecewiseFunctionM out of bounds: findIndex("<<
x<<
") called, while limitLo()="<<
limitLo()<<
"and limtiHi()="<<
limitHi()<<std::endl;
178 std::cerr<<
"LLinearPiecewiseFunctionM out of bounds: findIndex("<<
x<<
") called, while limitLo()="<<
limitLo()<<
"and limtiHi()="<<
limitHi()<<std::endl;
187 unsigned int lower = 0;
188 unsigned int upper =
m_data.nc() - 2;
235 unsigned int new_index = (std::ceil)((
float)(
m_searchIndex + upper) / 2.0f);
242 unsigned int new_index = (std::floor)((
float)(
m_searchIndex + lower) / 2.0f);
255 CT y0 = dlib::subm(
m_data, dlib::range(1, n), dlib::range(i, i));
256 CT y1 = dlib::subm(
m_data, dlib::range(1, n), dlib::range(i + 1, i + 1));
278 virtual void bound(
const DT& xmin,
const DT& xmax,
CT& ymin,
CT& ymax)
override
289 ymin = adore::mad::min<T,n,1>(ymin,
y);
290 ymax = adore::mad::max<T,n,1>(ymax,
y);
292 for (
int i = imin + 1; i <= imax; i++)
294 y = subm(
m_data, dlib::range(1, n), dlib::range(i, i));
295 ymin = adore::mad::min<T,n,1>(ymin,
y);
296 ymax = adore::mad::max<T,n,1>(ymax,
y);
348 for(
int i = 1; i <
m_data.nc(); i++)
359 auto rows = dlib::range(1,n);
360 for(
int i=0;i<
m_data.nc();i++)
362 dlib::set_subm(
m_data,rows,dlib::range(i,i)) = dlib::subm(
m_data,rows,dlib::range(i,i)) + dy;
378 for(
int i=0 ; i<
m_data.nc(); i++)
391 virtual T
fi(
DT x,
int row)
const override
414 for (
int i = 0; i < count; i++)
416 yvec[i] =
dfidx(xvec[i], row);
443 virtual void bound(
const DT& xmin,
const DT& xmax, T& ymin, T& ymax)
override
457 for (
int i = imin + 1; i <= imax; i++)
481 for (
int i = 0; i < n; i++)
488 if(&other==
this)
return *
this;
489 this->m_data = other.
m_data;
491 for (
int i = 0; i < n; i++)
502 this->m_data = other.
m_data;
504 for (
int i = 0; i < n; i++)
516 for (
int i = 0; i < n; i++)
526 dlib::set_rowm(this->m_data,0) = xdata;
527 dlib::set_rowm(this->m_data,dlib::range(1l,n+1l)) = ydata;
529 for (
int i = 0; i < n; i++)
539 this->m_data.set_size(n+1,nc);
540 this->m_data = dlib::ones_matrix<T>(n+1,nc)*value;
542 for (
int i = 0; i < n; i++)
580 void setData(
const adoreMatrix<T, n + 1, 0>& data)
589 virtual void multiply(adoreMatrix<T, 0, 0> A,
int rowi,
int rowj)
override
591 assert(A.nc() == A.nr());
592 assert(A.nr() == rowj - rowi + 1);
596 set_rowm(
m_data, dlib::range(rowi + 1, rowj + 1)) = A * rowm(
m_data, dlib::range(rowi + 1, rowj + 1));
601 virtual void add(adoreMatrix<T, 0, 1> b,
int rowi,
int rowj)
override
603 assert(b.nr() == rowj - rowi + 1);
606 for (
int i = 0; i <
m_data.nc(); i++)
608 set_subm(
m_data, dlib::range(rowi + 1, rowj + 1), dlib::range(i, i)) = subm(
m_data, dlib::range(rowi + 1, rowj + 1), dlib::range(i, i)) + b;
619 std::vector<std::pair<T, T> >* result =
new std::vector<std::pair<T, T>>();
620 T a0, b0, c0, d0, a1, b1, c1, d1, e0, e1, f0, f1;
621 T xi0, xi1, xj0, xj1, xi, xj,alpha,beta;
622 for (
int i = 0; i < this->m_data.nc() - 1; i++)
625 xi1 = this->
m_data(0, i+1);
626 a0 = this->
m_data(dim1 + 1, i);
627 a1 = this->
m_data(dim2 + 1, i);
628 b0 = this->
m_data(dim1 + 1, i + 1);
629 b1 = this->
m_data(dim2 + 1, i + 1);
632 for (
int j = 0; j < other->
m_data.nc() - 1; j++)
634 xj0 = other->
m_data(0, j);
635 xj1 = other->
m_data(0, j+1);
636 c0 = other->
m_data(dim1 + 1, j);
637 c1 = other->
m_data(dim2 + 1, j);
638 d0 = other->
m_data(dim1 + 1, j + 1);
639 d1 = other->
m_data(dim2 + 1, j + 1);
642 if (e1 * f0 - e0 * f1 == 0)
continue;
643 alpha = (c0*f1-c1*f0-a0*f1+a1*f0) / (e0*f1-e1*f0);
644 beta = (a0*e1-a1*e0-c0*e1+c1*e0) / (e1*f0-e0*f1);
645 if( 0.0<=alpha && alpha<=1.0
646 && 0.0<=beta && beta<=1.0 )
648 xi = xi0+alpha*(xi1-xi0);
649 xj = xj0+beta*(xj1-xj0);
650 result->push_back(std::pair<T, T>(xi,xj));
666 T a0, b0, c0, d0, a1, b1, c1, d1, e0, e1, f0, f1;
667 T xi0, xi1, xj0, xj1, alpha,beta;
668 for (
int i = 0; i < this->m_data.nc() - 1; i++)
671 xi1 = this->
m_data(0, i+1);
672 a0 = this->
m_data(dim1 + 1, i);
673 a1 = this->
m_data(dim2 + 1, i);
674 b0 = this->
m_data(dim1 + 1, i + 1);
675 b1 = this->
m_data(dim2 + 1, i + 1);
678 for (
int j = 0; j < other->
m_data.nc() - 1; j++)
680 xj0 = other->
m_data(0, j);
681 xj1 = other->
m_data(0, j+1);
682 c0 = other->
m_data(dim1 + 1, j);
683 c1 = other->
m_data(dim2 + 1, j);
684 d0 = other->
m_data(dim1 + 1, j + 1);
685 d1 = other->
m_data(dim2 + 1, j + 1);
688 if (std::abs(e1 * f0 - e0 * f1 )< 1.0e-3)
continue;
689 alpha = (c0*f1-c1*f0-a0*f1+a1*f0) / (e0*f1-e1*f0);
690 beta = (a0*e1-a1*e0-c0*e1+c1*e0) / (e1*f0-e0*f1);
691 if( 0.0<=alpha && alpha<=1.0
692 && 0.0<=beta && beta<=1.0 )
694 double dx = a0 + e0*alpha - (c0 + f0*beta);
695 double dy = a1 + e1*alpha - (c1 + f1*beta);
696 if(dx*dx+dy*dy>1e-4){std::cout <<
"Llinearpiecewise l 635"<<std::endl;
continue;}
697 result.first = xi0+alpha*(xi1-xi0);
698 result.second = xj0+beta*(xj1-xj0);
719 for(
int i=1;i<
m_data.nc();i++)
747 bool direction = this->
fi(xstart,dim)<other->
fi(xstart,dim);
751 bool new_direction = this->
fi(x,dim)<other->
fi(
x,dim);
752 double x_this = this->
getData()(0,i);
753 double x_other = other->
getData()(0,j);
754 if( new_direction!=direction )
764 i = (std::min<unsigned int>)(this->m_data.nc()-1,i);
765 j = (std::min<unsigned int>)(other->
m_data.nc()-1,j);
772 result.second = other->
m_data(0,j) + (other->
m_data(0,j+1)-other->
m_data(0,j))*xother;
801 bool getNextIntersectionWithLine2d(T
x0, T px, T py, T vx, T vy,
int d1,
int d2, T& x_result, T& distance,
bool extend_fringes=
false,
bool inside_input_line=
false)
807 for (
int i = i0; i <
m_data.nc() - 1; i++)
811 xa, xb, xa_inside, xb_inside);
812 if (xb_inside && (!inside_input_line || xa_inside))
829 if( i==
m_data.nc()-1 && xb>1 )
854 px1 = px-max_distance*vx;
855 py1 = py-max_distance*vy;
856 vx1 = ((T)2)*max_distance*vx;
857 vy1 = ((T)2)*max_distance*vy;
858 bool rv =
getNextIntersectionWithLine2d(
x0,px1,py1,vx1,vy1, 0, 1, x_result,s,extend_fringes,
true);
861 distance = ((T)2)*max_distance*s-max_distance;
865 distance = max_distance;
887 for (
int i = 0; i <
m_data.nc() - 1; i++)
907 if(ry<(T)0 && (T)0<sy)
910 x0 = rx-ry*(sx-rx)/(sy-ry);
919 int i=(inverted)?0:
m_data.nc()-1;
923 sx = ex-px; sy=ey-py;
929 rx = ex-px; ry=ey-py;
937 if(ry<(T)0 && (T)0<sy)
940 x0 = rx-ry*(sx-rx)/(sy-ry);
960 d_normal_min = DIST_GUARD;
961 d_tangential_min = DIST_GUARD;
964 for (
int i = 0; i <
m_data.nc() - 1; i++)
967 comparePointWithLine(
m_data(d1, i),
m_data(d2, i),
m_data(d1, i+1),
m_data(d2, i+1), px, py, d_tangential_i, d_normal_i);
968 if ((T)0 <= d_tangential_i && d_tangential_i <= (T)1)
970 if ((T)0 <= d_tangential_min && d_tangential_min <= (T)1)
972 if ((std::abs)(d_normal_i) < (std::abs)(d_normal_min))
974 d_normal_min = d_normal_i;
975 d_tangential_min = d_tangential_i;
982 d_normal_min = d_normal_i;
983 d_tangential_min = d_tangential_i;
990 if (d_tangential_min < (T)0 || (T)1 < d_tangential_min)
992 if ((std::abs)(d_tangential_i - (T)0.5) < (std::abs)(d_tangential_min - (T)0.5))
994 d_normal_min = d_normal_i;
995 d_tangential_min = d_tangential_i;
996 if(d_tangential_min<(T)0)
1017 T d, d_min = 1e99,normal;
1018 for(
int i=0;i<
m_data.nc()-1;i++)
1020 d =
getDistancePointToLine(
m_data(d1, i),
m_data(d2, i),
m_data(d1, i+1),
m_data(d2, i+1), px, py, rel,normal);
1038 T d, d_min = 1e99,normal;
1039 d_min =
getDistancePointToLine(
m_data(d1, i0),
m_data(d2, i0),
m_data(d1, i0+1),
m_data(d2, i0+1), px, py, rel,normal);
1042 for(
int i=i0+1;i<
m_data.nc()-1;i++)
1045 && std::abs(
m_data(d2,i+1)-
m_data(d2,i))<1e-10 )
continue;
1046 d =
getDistancePointToLine(
m_data(d1, i),
m_data(d2, i),
m_data(d1, i+1),
m_data(d2, i+1), px, py, rel,normal);
1051 if(n_min!=
nullptr)*n_min=normal;
1088 ex0 = other->
m_data(d1,0);
1089 ey0 = other->
m_data(d2,0);
1093 ex1 = this->
m_data(d1,this->m_data.nc()-1);
1094 ey1 = this->
m_data(d2,this->m_data.nc()-1);
1098 ex1 = this->
m_data(d1,0);
1099 ey1 = this->
m_data(d2,0);
1107 return (count%2)!=0;
1126 for(
int k=i;k<=j;k++)
1128 for(
int d = 0; d<n; d++)
1130 m[(k-i)*n+d] =
m_data(d+1,k);
1139 for(
int k=i;k<=j;k++)
1155 if((std::abs)(
m_data(0,i)-
x0)<precision)
1157 set_subm(target,dlib::range(0,n),dlib::range(0,0)) = subm(
m_data,dlib::range(0,n),dlib::range(i,i));
1164 if((std::abs)(
m_data(0,l)-
x0)<precision)
1166 set_subm(target,dlib::range(0,n),dlib::range(0,0)) = subm(
m_data,dlib::range(0,n),dlib::range(l,l));
1173 set_subm(target,dlib::range(1,n),dlib::range(0,0)) =
f(
x0);
1180 set_subm(target,dlib::range(0,n),dlib::range(1,j-i+1)) = subm(
m_data,dlib::range(0,n),dlib::range(i,j));
1182 if(
x1 -
m_data(0,j)>precision || i>j)
1184 target(0,j-i+2) =
x1;
1185 set_subm(target,dlib::range(1,n),dlib::range(j-i+2,j-i+2)) =
f(
x1);
1201 template<
typename T,
int N,
int k>
1212 inline void idx(
DT x,
int dim,
int & i,
int & j)
const
1216 j = (c + 1)*N + dim;
1223 typedef adoreMatrix<T, N, 1>
CT;
1227 for (
int i = 0; i < N; i++)m(i, 1) =
fi(
x, i);
1230 virtual T
fi(
DT x,
int dim)
const override
1261 idx(xmax, 0, imax, jmax);
1267 idx(xmin, 0, imin, jmin);
1272 for (
int i = jmin; i <= imax; i += N)
1274 for (
int j = 0; j < N; j++)
1298 virtual void bound(
const DT& xmin,
const DT& xmax, T& ymin, T& ymax)
override
1314 for (
int i = jmin; i <= imax; i += N)
1333 memcpy(
m_data, data,
sizeof(T)*N*k);
1334 for (
int i = 0; i < N; i++)
1348 virtual void multiply(adoreMatrix<T, 0, 0> A,
int row_start,
int row_end)
override
1350 assert(A.nc() == A.nr());
1351 assert(A.nr() == row_end - row_start + 1);
1352 assert(row_start >= 0);
1353 assert(row_end < N);
1356 for (
int col = 0; col < k; col++)
1358 for (
int i = row_start; i <= row_end; i++)
1361 for (
int j = row_start; j <= row_end; j++)buf[i] += A(i - row_start, j - row_start)*
m_data[col*N + j];
1363 for (
int i = row_start; i <= row_end; i++)
1365 m_data[col*N + i] = buf[i];
1369 virtual void add(adoreMatrix<T, 0, 1> b,
int row_start,
int row_end)
override
1371 assert(b.nr() == row_end - row_start + 1);
1372 assert(row_start >= 0);
1373 assert(row_end < N);
1374 for (
int col = 0; col < k; col++)
1376 for (
int i = row_start; i <= row_end; i++)
1378 m_data[col*N + i] += b(i - row_start, 0);
1384 template<
typename T,
int dout,
int din>
1387 adoreMatrix<T> m_out;
1388 m_out.set_size(dout+1,fin.
getData().nc());
1389 dlib::set_rowm(m_out,0) = dlib::rowm(fin.
getData(),0);
1390 for(
int i=0;i<dout;i++)
1392 dlib::set_rowm(m_out,i+1) = dlib::rowm(fin.
getData(),dimensions[i]+1);
1404 template<
typename T,
int n_dfun,
int n_base,
int n_normal,
int n_target>
1405 void defineDistanceMap2d(
LLinearPiecewiseFunctionM<T,n_dfun>* dfun,
int id,
LLinearPiecewiseFunctionM<T,n_base>* base,
LLinearPiecewiseFunctionM<T,n_normal>* normal,
LLinearPiecewiseFunctionM<T,n_target>* target,T guard,
LLinearPiecewiseFunctionM<T,1>* guardfun=0)
1407 static const int it = 0;
1408 static const int ix = 1;
1409 static const int iy = 2;
1414 dlib::set_rowm(dfun->
getData(),it) = dlib::rowm(base->
getData(),it);
1416 for(
int j=0;j<dfun->
getData().nc();j++)
1424 if( guardfun!=0 && dj==guard )
Definition: alfunction.h:74
Definition: alfunction.h:214
T DT
Definition: alfunction.h:216
adoreMatrix< T, N, 1 > CT
Definition: alfunction.h:217
Definition: alfunction.h:54
Definition: alfunction.h:38
Definition: alfunction.h:46
Definition: alfunction.h:30
Definition: llinearpiecewisefunction.h:1284
OneDimension()
Definition: llinearpiecewisefunction.h:1290
int m_row
Definition: llinearpiecewisefunction.h:1287
virtual SUBFUN * create_derivative() override
Definition: llinearpiecewisefunction.h:1297
virtual DT limitLo() const override
Definition: llinearpiecewisefunction.h:1294
virtual void bound(const DT &xmin, const DT &xmax, T &ymin, T &ymax) override
Definition: llinearpiecewisefunction.h:1298
virtual SUBFUN * clone() override
Definition: llinearpiecewisefunction.h:1296
ALFunction< DT, T > SUBFUN
Definition: llinearpiecewisefunction.h:1288
virtual DT limitHi() const override
Definition: llinearpiecewisefunction.h:1293
OneDimension(LLinearPiecewiseFunctionA *parent, int row)
Definition: llinearpiecewisefunction.h:1291
LLinearPiecewiseFunctionA * m_parent
Definition: llinearpiecewisefunction.h:1286
virtual void setLimits(DT lo, DT hi) override
Definition: llinearpiecewisefunction.h:1295
virtual T f(DT x) override
Definition: llinearpiecewisefunction.h:1292
Definition: llinearpiecewisefunction.h:1203
virtual void add(adoreMatrix< T, 0, 1 > b, int row_start, int row_end) override
Definition: llinearpiecewisefunction.h:1369
virtual DT limitHi() const override
Definition: llinearpiecewisefunction.h:1236
LLinearPiecewiseFunctionA(T *data, T x0, T x1)
Definition: llinearpiecewisefunction.h:1328
void idx(DT x, int dim, int &i, int &j) const
Definition: llinearpiecewisefunction.h:1212
adoreMatrix< T, N, 1 > CT
Definition: llinearpiecewisefunction.h:1223
DT m_x0
Definition: llinearpiecewisefunction.h:1209
virtual ~LLinearPiecewiseFunctionA()
Definition: llinearpiecewisefunction.h:1339
virtual void setLimits(DT lo, DT hi) override
Definition: llinearpiecewisefunction.h:1248
virtual SUBFUN * dimension(int i) override
Definition: llinearpiecewisefunction.h:1324
DT m_x1
Definition: llinearpiecewisefunction.h:1210
virtual DT limitLo() const override
Definition: llinearpiecewisefunction.h:1240
OneDimension single_dimensions[N]
Definition: llinearpiecewisefunction.h:1322
virtual ALFunction< DT, CT > * clone() override
Definition: llinearpiecewisefunction.h:1340
virtual ALFunction< DT, CT > * create_derivative() override
Definition: llinearpiecewisefunction.h:1252
AScalarToN< T, N >::DT DT
Definition: llinearpiecewisefunction.h:1205
virtual void multiply(adoreMatrix< T, 0, 0 > A, int row_start, int row_end) override
Definition: llinearpiecewisefunction.h:1348
DT xval(int i)
Definition: llinearpiecewisefunction.h:1218
DT m_dx
Definition: llinearpiecewisefunction.h:1211
T m_data[N *k]
Definition: llinearpiecewisefunction.h:1208
AScalarToN< T, N >::SUBFUN SUBFUN
Definition: llinearpiecewisefunction.h:1206
virtual void bound(const DT &xmin, const DT &xmax, CT &ymin, CT &ymax) override
Definition: llinearpiecewisefunction.h:1256
virtual T fi(DT x, int dim) const override
Definition: llinearpiecewisefunction.h:1230
virtual CT f(DT x) const override
Definition: llinearpiecewisefunction.h:1224
Definition: llinearpiecewisefunction.h:424
virtual DT limitHi() const override
Definition: llinearpiecewisefunction.h:432
OneDimension(LLinearPiecewiseFunctionM *parent, int row)
Definition: llinearpiecewisefunction.h:430
int m_row
Definition: llinearpiecewisefunction.h:427
virtual ALFunction< DT, T > * create_derivative() override
Definition: llinearpiecewisefunction.h:439
virtual DT limitLo() const override
Definition: llinearpiecewisefunction.h:433
OneDimension()
Definition: llinearpiecewisefunction.h:429
virtual T f(DT x) const override
Definition: llinearpiecewisefunction.h:431
virtual void bound(const DT &xmin, const DT &xmax, T &ymin, T &ymax) override
Definition: llinearpiecewisefunction.h:443
virtual void setLimits(DT lo, DT hi)
Definition: llinearpiecewisefunction.h:434
LLinearPiecewiseFunctionM * m_parent
Definition: llinearpiecewisefunction.h:426
virtual ALFunction< DT, T > * clone()
Definition: llinearpiecewisefunction.h:435
Definition: llinearpiecewisefunction.h:139
void writePointsToArray(int i, int j, int d, T *m)
Definition: llinearpiecewisefunction.h:1137
T getXAfterNPoints(T xstart, int N)
Definition: llinearpiecewisefunction.h:1113
double getPositionOfPoint(T px, T py, int d1, int d2, T &d_tangential_min, T &d_normal_min)
Definition: llinearpiecewisefunction.h:955
virtual ALFunction< DT, CT > * clone() override
Definition: llinearpiecewisefunction.h:548
virtual CT f(DT x) const override
Definition: llinearpiecewisefunction.h:251
virtual void bound(const DT &xmin, const DT &xmax, CT &ymin, CT &ymax) override
Definition: llinearpiecewisefunction.h:278
unsigned int m_searchIndex
Definition: llinearpiecewisefunction.h:142
void setData(const adoreMatrix< T, n+1, 0 > &data)
Definition: llinearpiecewisefunction.h:580
bool getFirstIntersection2d(LLinearPiecewiseFunctionM< T, n > *other, int dim1, int dim2, std::pair< T, T > &result)
Definition: llinearpiecewisefunction.h:664
double getClosestParameter_local(T px, T py, int d1, int d2, T x0, T *n_min=nullptr) const
Definition: llinearpiecewisefunction.h:1034
double getClosestParameter(T px, T py, int d1, int d2, T &n_min) const
Definition: llinearpiecewisefunction.h:1014
bool getNextIntersectionWithLine2d(T x0, T px, T py, T vx, T vy, int d1, int d2, T &x_result, T &distance, bool extend_fringes=false, bool inside_input_line=false)
Definition: llinearpiecewisefunction.h:801
bool getFirstIntersection1d(T y_cross, int dimension, T &x)
Definition: llinearpiecewisefunction.h:716
virtual void startDomainAtZero()
Definition: llinearpiecewisefunction.h:330
adoreMatrix< T, n, 1 > CT
Definition: llinearpiecewisefunction.h:144
OneDimension single_dimensions[n]
Definition: llinearpiecewisefunction.h:465
virtual void stretchDomain(DT x0, DT x1)
Definition: llinearpiecewisefunction.h:344
std::vector< std::pair< T, T > > * getIntersections2d(LLinearPiecewiseFunctionM< T, n > *other)
Definition: llinearpiecewisefunction.h:656
void sample_dfidx(DT *xvec, T *yvec, int count, int row)
Definition: llinearpiecewisefunction.h:411
bool getFirstIntersection1d(T y_cross, T &x)
Definition: llinearpiecewisefunction.h:729
LLinearPiecewiseFunctionM(const int nc, T value)
Definition: llinearpiecewisefunction.h:537
virtual ALFunction< DT, T > * dimension(int i) override
Definition: llinearpiecewisefunction.h:470
LLinearPiecewiseFunctionM & operator=(const LLinearPiecewiseFunctionM &other)
Definition: llinearpiecewisefunction.h:486
const adoreMatrix< T, n+1, 0 > & getData() const
Definition: llinearpiecewisefunction.h:152
virtual T fi(DT x, int row) const override
Definition: llinearpiecewisefunction.h:391
LLinearPiecewiseFunctionM()
Definition: llinearpiecewisefunction.h:478
virtual void invertDomain()
Definition: llinearpiecewisefunction.h:320
std::vector< std::pair< T, T > > * getIntersections2d(LLinearPiecewiseFunctionM< T, n > *other, int dim1, int dim2)
Definition: llinearpiecewisefunction.h:617
virtual DT limitLo() const override
Definition: llinearpiecewisefunction.h:264
void rotateXY(double angle, double x0=0.0, double y0=0.0)
Definition: llinearpiecewisefunction.h:376
bool isPointEnclosed(LLinearPiecewiseFunctionM< T, n > *other, T px, T py, int d1, int d2, bool invert_this=false, bool invert_other=true)
Definition: llinearpiecewisefunction.h:1075
int export_points(adoreMatrix< double, 0, 0 > &target, double x0, double x1, double precision)
Definition: llinearpiecewisefunction.h:1148
LLinearPiecewiseFunctionM(const adoreMatrix< T, n+1, 0 > &data)
Definition: llinearpiecewisefunction.h:512
bool getNextIntersectionWithLine2d(T x0, T px, T py, T vx, T vy, T &x_result, T &distance, bool extend_fringes=false)
Definition: llinearpiecewisefunction.h:840
LLinearPiecewiseFunctionM(const LLinearPiecewiseFunctionM &other)
Definition: llinearpiecewisefunction.h:500
virtual T dfidx(DT x, int row)
Definition: llinearpiecewisefunction.h:400
LLinearPiecewiseFunctionM(const adoreMatrix< T, 1, 0 > &xdata, const adoreMatrix< T, n, 0 > &ydata)
Definition: llinearpiecewisefunction.h:524
virtual void add(adoreMatrix< T, 0, 1 > b, int rowi, int rowj) override
Definition: llinearpiecewisefunction.h:601
virtual void setLimits(DT lo, DT hi) override
Definition: llinearpiecewisefunction.h:270
unsigned int findIndex(DT x, DT precision=0.001) const
Definition: llinearpiecewisefunction.h:158
void shiftCodomain(CT dy)
Definition: llinearpiecewisefunction.h:357
virtual ~LLinearPiecewiseFunctionM()
Definition: llinearpiecewisefunction.h:547
AScalarToN< T, n >::DT DT
Definition: llinearpiecewisefunction.h:145
bool getFirstIntersection1d(LLinearPiecewiseFunctionM< T, n > *other, int dim, std::pair< T, T > &result)
Definition: llinearpiecewisefunction.h:739
adoreMatrix< T, n+1, 0 > & getData()
Definition: llinearpiecewisefunction.h:147
virtual DT limitHi() const override
Definition: llinearpiecewisefunction.h:259
bool getNextIntersectionWithVector2d(T x0, T px, T py, T vx, T vy, T &x_result, T &distance, T max_distance, bool extend_fringes=false)
Definition: llinearpiecewisefunction.h:850
void writePointsToArray(int i, int j, T *m)
Definition: llinearpiecewisefunction.h:1124
virtual void multiply(adoreMatrix< T, 0, 0 > A, int rowi, int rowj) override
Definition: llinearpiecewisefunction.h:589
virtual ALFunction< DT, CT > * create_derivative() override
Definition: llinearpiecewisefunction.h:274
adoreMatrix< T, n+1, 0 > m_data
Definition: llinearpiecewisefunction.h:141
void shiftDomain(DT dx)
Definition: llinearpiecewisefunction.h:337
int countIntersectionsWithRay2d(T px, T py, int d1, int d2, T ex, T ey, bool inverted=false)
Definition: llinearpiecewisefunction.h:880
virtual double limit_s_to_bounds(double s) const
shifts s to be in between limitLo and limitHi
Definition: llinearpiecewisefunction.h:309
void shiftCodomain(T dy, int i=0)
Definition: llinearpiecewisefunction.h:368
double getClosestParameter(T px, T py, int d1, int d2) const
Definition: llinearpiecewisefunction.h:1062
bool getFirstIntersection2d(LLinearPiecewiseFunctionM< T, n > *other, std::pair< T, T > &result)
Definition: llinearpiecewisefunction.h:705
Definition: llinearpiecewisefunction.h:32
unsigned int findIndex(DT x) const
Definition: llinearpiecewisefunction.h:53
virtual void bound(const DT &xmin, const DT &xmax, CT &ymin, CT &ymax) override
Definition: llinearpiecewisefunction.h:111
LLinearPiecewiseFunctionS(const adoreMatrix< T, 2, 0 > &data)
Definition: llinearpiecewisefunction.h:39
virtual CT f(DT x) const override
Definition: llinearpiecewisefunction.h:83
virtual DT limitHi() const override
Definition: llinearpiecewisefunction.h:91
virtual ALFunction< DT, CT > * clone()
Definition: llinearpiecewisefunction.h:103
LLinearPiecewiseFunctionS(const adoreMatrix< T, 1, 0 > &x, const adoreMatrix< T, 1, 0 > &y)
Definition: llinearpiecewisefunction.h:44
unsigned int m_searchIndex
Definition: llinearpiecewisefunction.h:37
adoreMatrix< T, 2, 0 > m_data
Definition: llinearpiecewisefunction.h:34
T CT
Definition: llinearpiecewisefunction.h:35
virtual ALFunction< DT, CT > * create_derivative() override
Definition: llinearpiecewisefunction.h:107
virtual DT limitLo() const override
Definition: llinearpiecewisefunction.h:95
T DT
Definition: llinearpiecewisefunction.h:36
virtual void setLimits(DT lo, DT hi)
Definition: llinearpiecewisefunction.h:99
bool intersectLines(T a, T b, T c, T d, T e, T f, T g, T h, T &x0, T &x1, bool &x0_inside, bool &x1_inside)
Definition: adoremath.h:522
interval< T > cos(interval< T > x)
Definition: intervalarithmetic.h:225
T bound(T lb, T value, T ub)
Definition: adoremath.h:569
LLinearPiecewiseFunctionM< T, dout > getSubFunction(LLinearPiecewiseFunctionM< T, din > &fin, int dimensions[dout])
Definition: llinearpiecewisefunction.h:1385
void defineDistanceMap2d(LLinearPiecewiseFunctionM< T, n_dfun > *dfun, int id, LLinearPiecewiseFunctionM< T, n_base > *base, LLinearPiecewiseFunctionM< T, n_normal > *normal, LLinearPiecewiseFunctionM< T, n_target > *target, T guard, LLinearPiecewiseFunctionM< T, 1 > *guardfun=0)
Definition: llinearpiecewisefunction.h:1405
T min(T a, T b, T c, T d)
Definition: adoremath.h:663
interval< T > sin(interval< T > x)
Definition: intervalarithmetic.h:204
double getDistancePointToLine(T a, T b, T c, T d, T e, T f, T &rel, T &n)
Definition: adoremath.h:265
adoreMatrix< T, N, M > max(adoreMatrix< T, N, M > a, const adoreMatrix< T, N, M > &b)
Definition: adoremath.h:686
bool intersectLines2(T a, T b, T c, T d, T e, T f, T g, T h, T &x0, T &x1, T eps)
Definition: adoremath.h:546
void comparePointWithLine(T a, T b, T c, T d, T e, T f, T &d_tangential, T &d_normal)
Definition: adoremath.h:229
x0
Definition: adore_set_goal.py:25
x
Definition: adore_set_goal.py:30
y0
Definition: adore_set_goal.py:26
y
Definition: adore_set_goal.py:31
y1
Definition: adore_set_pose.py:29
x1
Definition: adore_set_pose.py:28
Definition: areaofeffectconverter.h:20