title: search of segments that form an angle with HoughLinesP and c++
body: <p>I want to call a function to compare all of the segments that I calculate in my code and know how many polygons there are in my view, made up of straight lines, which consist of 3, 4 or more segments that form a closed path, or alternatively i would like to know how many pairs of straight segments form an angle (thus have a common point):</p>
  
  <pre><code>           vector&lt;Vec4i&gt; lines;
         HoughLinesP(dst, lines, 1, CV_PI/180, 80, 50, 10 );
         for( size_t i = 0; i &lt; lines.size(); i++ )
             {
             Vec4i l = lines[i];
             double x = l[0]-l[2];
             double y = l[1]-l[3];
             double dist = pow(x,2) + pow(y,2);
             dist= sqrt(dist);
             segments.push_back(round(dist));
             line( cdst, Point(l[0], l[1]), Point(l[2], l[3]), Scalar(0,0,255), 3, CV_AA);
             }
  </code></pre>
  
  <p>alternatvely, trying to simplify, how can i calculate the number of intersections between segments?</p>