plEigenFloor=clt_parameters.plEigenFloor;// final double eigenFloor, // Add to eigenvalues of each participating plane and result to validate connections
plMinStrength=clt_parameters.plMinStrength;
dbg_tileX=clt_parameters.tileX;
dbg_tileY=clt_parameters.tileY;
}
publicbooleanplanesFit(
TilePlanes.PlaneDataplane1,// should belong to the same supertile (or be converted for one)
TilePlanes.PlaneDataplane2,
doublemerged_ev,// if NaN will calculate assuming the same supertile
doublemerged_ev_eq,// if NaN will calculate assuming the same supertile
Stringprefix,
intdebugLevel)
{
if((plane1==null)||(plane2==null))returnfalse;
TilePlanes.PlaneDatamerged_pd=null;
TilePlanes.PlaneDatamerged_pd_eq=null;
if(plane1.getWeight()<plMinStrength){
if(debugLevel>1)System.out.println(prefix+" plane1 is too weak ("+plane1.getWeight()+" < plMinStrength="+plMinStrength+")");
returnfalse;
}
if(plane2.getWeight()<plMinStrength){
if(debugLevel>1)System.out.println(prefix+" plane2 is too weak ("+plane2.getWeight()+" < plMinStrength="+plMinStrength+")");
returnfalse;
}
doublecorr_max_eigen=corrMaxEigen(
plMaxEigen,
plDispNorm,
plane1);
if((plMaxEigen!=0.0)&&
(plane1.getValue()>corr_max_eigen)){
if(debugLevel>1)System.out.println(prefix+" plane1 is too thick ("+plane1.getValue()+" > corr_max_eigen="+corr_max_eigen+")");
returnfalse;
}
if((plMaxEigen!=0.0)&&
(plane2.getValue()>corr_max_eigen)){
if(debugLevel>1)System.out.println(prefix+" plane2 is too thick ("+plane2.getValue()+" > corr_max_eigen="+corr_max_eigen+")");
returnfalse;
}
if(Double.isNaN(merged_ev)){
merged_pd=plane1.mergePlaneToThis(
plane2,// PlaneData otherPd,
1.0,// double scale_other,
1.0,// double starWeightPwr, // Use this power of tile weight when calculating connection cost
false,// boolean ignore_weights,
true,// boolean sum_weights,
plPreferDisparity,
debugLevel-1);// int debugLevel)
merged_ev=merged_pd.getValue();
}
if(Double.isNaN(merged_ev_eq)){
merged_pd_eq=plane1.mergePlaneToThis(
plane2,// PlaneData otherPd,
1.0,// double scale_other,
1.0,// double starWeightPwr, // Use this power of tile weight when calculating connection cost
true,// boolean ignore_weights,
true,// boolean sum_weights,
plPreferDisparity,
debugLevel-1);// int debugLevel)
merged_ev_eq=merged_pd_eq.getValue();
}
doublew1=plane1.getWeight();
doublew2=plane2.getWeight();
doublethis_rq=mergeRQuality(
plane1.getValue(),// double L1,
plane2.getValue(),// double L2,
merged_ev,// double L,
w1,// double w1,
w2,// double w2)
plEigenFloor);// double eigen_floor)
doublethis_rq_norm=this_rq;
if((w1+w2)<plWeakWorsening)this_rq_norm*=(w1+w2)/plWeakWorsening;// forgive more for weak planes
doublethis_rq_eq=mergeRQuality(
plane1.getValue(),// double L1,
plane2.getValue(),// double L2,
merged_ev_eq,// double L,
1.0,// double w1,
1.0,// double w2)
plEigenFloor);// double eigen_floor)
doublethis_rq_eq_norm=this_rq_eq;
if((w1+w2)<plWeakWorsening)this_rq_eq_norm*=(w1+w2)/plWeakWorsening;// forgive more for weak planes
if((this_rq_norm<=plWorstWorsening)||
((merged_ev<=plOKMergeEigen)&&(this_rq_norm<=plWorstWorsening2))||// use higher threshold
(this_rq_eq_norm<=plWorstEq)||
((merged_ev_eq<=plOKMergeEigen)&&(this_rq_eq_norm<=plWorstEq2))// use higher threshold