Upgrade to Pro — share decks privately, control downloads, hide ads and more …

円と円の交点の求め方

 円と円の交点の求め方

Sho Iizuka

June 13, 2014
Tweet

More Decks by Sho Iizuka

Other Decks in Science

Transcript

  1. ໰୊ͷίʔυ pair<P, P> cc_cross(const C& c1, const C& c2) {

    double d = abs(c1.p - c2.p); double rc = (d*d + c1.r*c1.r - c2.r*c2.r) / (2*d); double rs = sqrt(c1.r*c1.r - rc*rc); P diff = (c2.p - c1.p) / d; return make_pair(c1.p + diff * P(rc, rs), c1.p + diff * P(rc, -rs)); }
  2. double rc =
 (d*d + c1.r*c1.r - c2.r*c2.r) / (2*d);

    cos = a2+b2 c2 2ab ༨ݭఆཧ b c a θ
  3. double rc =
 (d*d + c1.r*c1.r - c2.r*c2.r) / (2*d);

    b bcosθ θ cos = a2 + b2 c2 2ab b cos = a2 + b2 c2 2a
  4. P diff = (c2.p - c1.p) / d;
 
 =>

    diffは c1.p→c2.p の単位ベクトル d c1.p c2.p
  5. diff * P(rc, rs) ͱ͸ʁ
 => rc*diff + rs*rot90(diff) ͷ͜ͱ

    di = (x + jy) rot90(di ) = rot90(x + jy) = y + jx di P(rc, rs) = (x + jy) · (rc + jrs ) = rc(x + jy) + rs( y + jx) = rc di + rs rot90(di )