22 const ::cluster::ClusterParamsAlg &cluster2)
27 if (
_debug) { std::cout <<
"Num of Hits below threshold..." <<
std::endl; }
31 double w_start1 = cluster1.GetParams().start_point.w;
32 double t_start1 = cluster1.GetParams().start_point.t;
33 double w_end1 = cluster1.GetParams().end_point.w;
34 double t_end1 = cluster1.GetParams().end_point.t;
36 double w_start2 = cluster2.GetParams().start_point.w;
37 double t_start2 = cluster2.GetParams().start_point.t;
38 double w_end2 = cluster2.GetParams().end_point.w;
39 double t_end2 = cluster2.GetParams().end_point.t;
42 std::cout <<
"Start point Cluster 1: (" << w_start1 <<
", " << t_start1 <<
")" <<
std::endl;
43 std::cout <<
"End point Cluster 2: (" << w_end1 <<
", " << t_end1 <<
")" <<
std::endl;
44 std::cout <<
"Start point Cluster 1: (" << w_start2 <<
", " << t_start2 <<
")" <<
std::endl;
45 std::cout <<
"End point Cluster 2: (" << w_end2 <<
", " << t_end2 <<
")" <<
std::endl;
67 shortest_distance2 = (shortest_distance2_tmp < shortest_distance2) ?
68 shortest_distance2_tmp : shortest_distance2;
75 shortest_distance2 = (shortest_distance2_tmp < shortest_distance2) ?
76 shortest_distance2_tmp : shortest_distance2;
83 shortest_distance2 = (shortest_distance2_tmp < shortest_distance2) ?
84 shortest_distance2_tmp : shortest_distance2;
90 if(compatible) std::cout<<Form(
" Compatible in distance (%g).\n",shortest_distance2);
91 else std::cout<<Form(
" NOT compatible in distance (%g).\n",shortest_distance2);
101 double start_x,
double start_y,
102 double end_x,
double end_y )
const {
110 double distance_squared = 999999;
113 double length_squared =
pow((end_x - start_x), 2) +
pow((end_y - start_y), 2);
119 std::cout << Form(
" Provided very short line segment: (%g,%g) => (%g,%g)",
120 start_x,start_y,end_x,end_y) <<
std::endl;
121 std::cout <<
" Likely this means one of two clusters have start & end point identical." <<
std::endl;
122 std::cout <<
" Check the cluster output!" <<
std::endl;
124 std::cout << Form(
" At this time, the algorithm uses a point (%g,%g)",start_x,start_y) <<
std::endl;
125 std::cout <<
" to represent this cluster's location." <<
std::endl;
129 return (
pow((point_x - start_x),2) +
pow((point_y - start_y),2));
133 double t = ( (point_x - start_x)*(end_x - start_x) + (point_y - start_y)*(end_y - start_y) ) / length_squared;
142 if(t>0.1 && t < 0.9) distance_squared =
pow((point_x - (start_x + t*(end_x - start_x))), 2) +
pow((point_y - (start_y + t*(end_y - start_y))),2);
145 return distance_squared;
Class def header for a class CBAlgoShortestDistNonEndpoint.
QTextStream & endl(QTextStream &s)