title: Check for collision between a circle and the perimeter of a circle sector
body: <p>I'm trying to create a function that checks if there is a collision/intersection between a circle and the perimeter of a circle sector.   </p>
  
  <p>I'm going to explain my problem in more detail:<br>
  1. I have a circle sector defined by the center point(x1,y1), the radius(r1) and the angle(m) that tells me where the circle sector starts and ends.<br>
  2. On the other hand, I have a circle defined by the center point (x2,y2), the radius(r2).<br>
  3. I'm creating a small game in HTML5 canvas in which both of these geometric shapes can move freely.<br>
  4. The problem is that I wanna know if these two (the green circle sector and the green circle) are colliding to each other.    </p>
  
  <p><a href="https://i.stack.imgur.com/n48Dc.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/n48Dc.png" alt="enter image description here"></a></p>
  
  <p>My current code is very basic (as I can't come up of something that can efficiently check collision). It only checks the collision between the circle that defines that circle sector and the other circle:    </p>
  
  <pre><code>this.crashWith = function(otherobj) {
      // "this" is the circle
      // "otherobj" is the circle sector
      var dx = this.x - otherobj.x;
      var dy = this.y - otherobj.y;
      var distance = Math.sqrt(dx * dx + dy * dy);
      var crash = false;
      if (distance &lt; this.radius +otherobj.radius) {
          crash = true;
      }
      return crash;
  }
  </code></pre>
  
  <p>Note: The circle sector (in color green) has a line width (as seen in the image) and the angle m changes (because the circle sector is spinning around the center).     </p>
  
  <p>I think the proper solution would be something that can can calculate collisions knowing that the circle sector shape doesn't change (it is only spinning).</p>