25class point_t :
public std::pair<float , float>{
69template<
class inT,
class ouT>
106template<
class T ,
class T2>
107void recenter_set(T &inSet, T2 &outSet,
float phicenter);
110template<
class T ,
class T2>
123inline float deltaPhi(
float phi1,
float phi2);
149 typedef typename T::iterator it_t;
152 for(; it != itE; ++it)
delete *it;
157 typedef typename T::iterator it_t;
160 for(; it != itE; ++it)
delete *it;
165 typedef typename T::iterator it_t;
166 it_t it =
set.begin();
167 it_t itE =
set.end();
169 for(; it != itE; ++it){
178 typedef typename T::iterator it_t;
179 it_t it = line.begin();
180 it_t itE = line.end();
182 for(; it != itE; ++it){
185 if(itp == itE) itp = line.begin();
186 a += ( (*it).first*(*itp).second - (*itp).first*(*it).second );
193 typedef typename T::iterator it_t;
194 it_t it = line.begin();
195 it_t itE = line.end();
197 for(; it != itE; ++it){
200 if(itp == itE) itp = line.begin();
207 float d = fabs(phi1 - phi2);
208 return d <
M_PI ? d: fabs(d-2*
M_PI);
214 return deltaPhi(p1.second,p2.second);
222 while(p.second < -
M_PI) p.second += 2*
M_PI;
223 while(p.second >=
M_PI) p.second -= 2*
M_PI;
227 point_t n(p.first, p.second - center.second);
232 point_t n(p.first, p.second - phicenter);
237 return (p1.first-p2.first)*(p1.first-p2.first) +
244template<
class T ,
class T2>
246 typedef typename T::iterator it_t;
247 typedef typename T2::iterator it_t2;
248 it_t it = inSet.begin();
249 it_t itE = inSet.end();
250 it_t2 it2 = outSet.begin();
251 for(; it!= itE; ++it){
252 it2 = outSet.insert(it2,
recenter(*it,phicenter));
255template<
class T ,
class T2>
258 if (phicenter <-9)
return;
265 typedef typename T::iterator it_t;
266 it_t it =
set.begin();
267 it_t end =
set.end();
271 for(; it!= end; ++it){
288 m_cy = p1.first - p2.first;
289 m_cx = p2.second - p1.second;
316template<
class inT,
class ouT>
319 typedef typename inT::iterator it_t;
320 it_t it = inSet.begin();
321 it_t itE = inSet.end();
322 for(; it!=itE; ++it) rset.insert(*it);
335 outSet.insert(outSet.begin(), inSet.begin(), inSet.end() );
339 point_set_t::iterator s_it = inSet.begin();
342 while(point01.first == point00.first){
346 --s_it; point01 = *s_it;
348 s_it = inSet.end(); --s_it;
351 while(point10.first == point11.first){
355 ++s_it; point10 = *s_it;
358 line_t lmin(point00, point10);
360 line_t lmax(point01, point11);
365 s_it = inSet.begin();
366 if(point00 == point01 ){
367 lowPoints.push_back(point00);
368 upPoints.push_back(point00);
372 point_set_t::iterator s_itE = inSet.end();
374 for(; s_it!= s_itE; ++s_it){
378 lowPoints.push_back(p);
382 upPoints.push_front(p);
387 if(point11 == point10 ){
388 lowPoints.push_back(point11);
389 upPoints.push_front(point11);
392 lowPoints.push_back(point10);
393 upPoints.push_front(point00);
400 point_list_t::iterator it = lowPoints.begin();
401 point_list_t::iterator itE = lowPoints.end();
402 lowHull.push_back(point00);
404 lowHull.push_back(*it);
406 unsigned int nn = lowPoints.size();
416 it = upPoints.begin();
417 itE = upPoints.end();
418 upHull.push_back(point11);
420 upHull.push_back(*it);
422 if(upPoints.size()>2){
432 outSet.insert(outSet.begin(), lowHull.begin(), lowHull.end() );
433 outSet.insert((outSet.end()), ++(upHull.begin()), --(upHull.end()) );
Scalar phi() const
phi method
oriented segment/line in a simplistic way
bool is_right(point_t &p)
void phi_shift(float dphi)
line_t(float cx, float cy, float cc, bool to_r)
constructor by giving the coeff of equation of the line (
bool is_above(point_t &p)
point_t intercept_x(float x)
point_t intercept_y(float y)
bool is_below(point_t &p)
Very basic point objects.
point_t(float x, float y)
void mean(std::vector< double > &bins, std::vector< double > &values, const std::vector< std::string > &files, const std::string &histname, const std::string &tplotname, const std::string &label="")
A collection of routines for geometric tasks in 2D and on a cylinder.
float polygon_area(T &line)
float getMeanPhi(T &set)
return average phi (i.e.
void findConvexHull(inT &inSet, ouT &outSet)
Find convex hull of a set of points in euclidian plan.
float abs_dphi(float phi1, float phi2)
float in_mPI_pPI(float phi)
convert
float deltaR2(point_t &p1, point_t &p2)
void listToSet(point_list_t &inList, point_set_t &outSet)
float max_deltaR(point_t p, T &set)
Return max distance betweens point.
point_t recenter(const point_t &p, const point_t ¢er)
void _findConvexHull(point_set_t &inSet, inT &outSet)
void clear_delete(T &container)
void fix2pi(point_t &p)
convert
void testHullLine(point_list_t &hull, point_t p)
void delete_content(T &container)
std::list< point_t > point_list_t
float deltaR(point_t &p1, point_t &p2)
distances between points
float deltaPhi(point_t &p1, point_t &p2)
void recenter_set(T &inSet, T2 &outSet, float phicenter)
copy
float polygon_lenght(T &line)