HDU 6242(随机化&求圆心)
Posted Harris-H
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了HDU 6242(随机化&求圆心)相关的知识,希望对你有一定的参考价值。
HDU 6242(随机化&求圆心)
已知三点求圆心的公式:
( x 1 − X ) 2 + ( y 1 − Y ) 2 = R 2 ( 1 ) (x_1-X)^2+(y_1-Y)^2=R^2\\quad(1) (x1−X)2+(y1−Y)2=R2(1)
( x 2 − X ) 2 + ( y 2 − Y ) 2 = R 2 ( 2 ) (x_2-X)^2+(y_2-Y)^2=R^2\\quad(2) (x2−X)2+(y2−Y)2=R2(2)
( x 3 − X ) 2 + ( y 3 − Y ) 2 = R 2 ( 3 ) (x_3-X)^2+(y_3-Y)^2=R^2\\quad(3) (x3−X)2+(y3−Y)2=R2(3)
联立 ( 1 ) , ( 2 ) (1),(2) (1),(2)可得
2 ( x 2 − x 1 ) X + 2 ( y 2 − y 1 ) Y = x 2 2 − x 1 2 + y 2 2 − y 1 2 2(x_2-x_1)X+2(y_2-y_1)Y=x_2^2-x_1^2+y_2^2-y_1^2 2(x2−x1)X+2(y2−y1)Y=x22−x12+y22−y12
联立 ( 2 ) , ( 3 ) (2),(3) (2),(3)可得
2 ( x 3 − x 2 ) X + 2 ( y 3 − y 2 ) Y = x 3 2 − x 2 2 + y 3 2 − y 2 2 2(x_3-x_2)X+2(y_3-y_2)Y=x_3^2-x_2^2+y_3^2-y_2^2 2(x3−x2)X+2(y3−y2)Y=x32−x22+y32−y22
令 a = 2 ( x 2 − x 1 ) , b = 2 ( y 2 − y 1 ) , c = x 2 2 − x 1 2 + y 2 2 − y 1 2 a=2(x_2-x_1),b=2(y_2-y1),c=x_2^2-x_1^2+y_2^2-y_1^2 a=2(x2−x1),b=2(y2−y1),c=x22−x12+y22−y12
p = 2 ( x 3 − x 2 ) , q = 2 ( y 3 − y 2 ) , w = x 3 2 − x 2 2 + y 3 2 − y 2 2 p=2(x_3-x_2),q=2(y_3-y_2),w=x_3^2-x_2^2+y_3^2-y_2^2 p=2(x3−x2),q=2(y3−y2),w=x32−x22+y32−y22
则:
a X + b Y = c aX+bY=c aX+bY=c
p X + q Y = w pX+qY=w pX+qY=w
X = c q − b w a q − b p X=\\dfrac{cq-bw}{aq-bp} X=aq−bpcq−bw
Y = c p − a w b p − a q Y=\\dfrac{cp-aw}{bp-aq} Y=bp−aqcp−aw
R = ( X − x 1 ) 2 + ( Y − y 1 ) 2 R=\\sqrt{(X-x_1)^2+(Y-y_1)^2} R=(X−x1)2+(Y−y1)2017CCPC-哈尔滨站 Hdu-6242 Geometry Problem 计算几何 随机
HDU - 6242:Geometry Problem(随机+几何)