35 auto rxyz = dlib::range(1,3);
36 static const double min_length = 1e-3;
39 adoreMatrix<double,3,1> La,Lb,Lc,Lac;
40 adoreMatrix<double,3,1> Ra,Rb,Rc,Rac;
41 adoreMatrix<double,3,1> Ca,Cc;
44 La = dlib::subm(
left,rxyz,dlib::range(0,0));
45 Ra = dlib::subm(
right,rxyz,dlib::range(0,0));
50 dlib::set_subm(center,rxyz,dlib::range(0,0)) = Ca;
58 double length_Lac=0,length_Rac=0,length_Cac;
60 double progress_RonL,progress_LonR;
62 while(i_left<N || i_right<M)
65 while(length_Lac<min_length && i_left<N)
67 Lc = dlib::subm(
left,rxyz,dlib::range(i_left,i_left));
69 length_Lac = adore::mad::norm2<double,3>(Lac);
70 Lac = Lac / length_Lac;
73 while(length_Rac<min_length && i_right<M)
75 Rc = dlib::subm(
right,rxyz,dlib::range(i_right,i_right));
77 length_Rac = adore::mad::norm2<double,3>(Rac);
78 Rac = Rac / length_Rac;
81 if(length_Lac>min_length)
83 progress_RonL = dlib::trans(Lac)*(Rc-La) / length_Lac;
84 progress_RonL = (
std::max)(0.0,progress_RonL);
90 if(length_Rac>min_length)
92 progress_LonR = dlib::trans(Rac)*(Lc-Ra) / length_Rac;
93 progress_LonR = (
std::max)(0.0,progress_LonR);
99 if( std::abs(progress_RonL-progress_LonR)<min_length
100 || (progress_LonR>=1.0 && progress_RonL>=1.0)
101 || i_left==N || i_right==M)
110 if(progress_RonL<progress_LonR)
112 La = La + Lac * progress_RonL * length_Lac;
113 length_Lac = (1.0-progress_RonL) * length_Lac;
119 Ra = Ra + Rac * progress_LonR * length_Rac;
120 length_Rac = (1.0-progress_LonR) * length_Rac;
126 length_Cac = adore::mad::norm2<double,3>(Cc-Ca);
127 if( length_Cac > min_length )
129 dlib::set_subm(center,rxyz,dlib::range(i_center,i_center)) = Cc;
130 center(0,i_center) = center(0,i_center-1) + length_Cac;
138 La = dlib::subm(
left,rxyz,dlib::range(0,0));
139 Lb = dlib::subm(
left,rxyz,dlib::range(N-1,N-1));
140 Ra = dlib::subm(
right,rxyz,dlib::range(0,0));
141 Rb = dlib::subm(
right,rxyz,dlib::range(M-1,M-1));
142 dlib::set_subm(center,rxyz,dlib::range(0,0)) = (La+Ra)*0.5;
143 dlib::set_subm(center,rxyz,dlib::range(1,1)) = (Lb+Rb)*0.5;
151 adoreMatrix<double, 0, 0> center_data;
152 center.
getData().set_size(4,
left.getData().nc() +
right.getData().nc() - 2);
153 center_data.set_size(4,
left.getData().nc() +
right.getData().nc() - 2);
155 center.
setData(dlib::colm(center_data, dlib::range(0, K - 1)));
void setData(const adoreMatrix< T, n+1, 0 > &data)
Definition: llinearpiecewisefunction.h:580
adoreMatrix< T, n+1, 0 > & getData()
Definition: llinearpiecewisefunction.h:147
@ right
Definition: indicator_hint.h:36
@ left
Definition: indicator_hint.h:35
int computeCenterline(const adoreMatrix< double, 0, 0 > &left, const adoreMatrix< double, 0, 0 > &right, adoreMatrix< double, 0, 0 > ¢er)
Definition: centerline.h:29
adoreMatrix< T, N, M > max(adoreMatrix< T, N, M > a, const adoreMatrix< T, N, M > &b)
Definition: adoremath.h:686
Definition: areaofeffectconverter.h:20