title: C++ - Efficient way to compare vectors
body: <p>At the moment i'm working with a camera to detect a marker. I use opencv and the Aruco Libary.</p>
  
  <p>Only I'm stuck with a problem right now. I need to detect if the distance between 2 marker is less than a specific value. I have a function to calculate the distance, I can compare everything. But I'm looking for the most efficient way to keep track of all the markers (around 5/6) and how close they are together.</p>
  
  <p>There is a list with markers but I cant find a efficient way to compare all of them.</p>
  
  <p>I have a</p>
  
  <pre><code>Vector &lt;Marker&gt; 
  </code></pre>
  
  <p>I also have a function called <code>getDistance</code>.</p>
  
  <pre><code>double getDistance(cv::Point2f punt1, cv::Point2f punt2)
  {
      float xd = punt2.x-punt1.x;
      float yd = punt2.y-punt1.y;
      double Distance = sqrtf(xd*xd + yd*yd);
      return Distance; 
  }
  </code></pre>
  
  <p>The <code>Marker</code>s contain a <code>Point2f</code>, so i can compare them easily.</p>