gxqcn 发表于 2012-7-24 09:17:07

三角形外心坐标公式

已知:三角形三顶点坐标 (x_1,y_1), (x_2,y_2), (x_3,y_3)
求:其外心坐标公式。

要求公式简洁,并便于编程计算(即:方便抽象出大量相似的过程以便于编写子函数)。

mathematica 发表于 2012-7-24 09:30:13

遗憾地告诉你没有简单的计算方法!!!!!!!!!!!!!!

gxqcn 发表于 2012-7-24 09:47:07

P1,P2,P3 为三角形三顶点,

d1 = - (P2–P1)·(P1–P3)    // 此为矢量运算:减法、内积;
d2 = - (P3–P2)·(P2–P1)    // 所得为标量
d3 = - (P1–P3)·(P3–P2)      

c1 = d2*d3
c2 = d3*d1
c3 = d1*d2
c = c1 + c2 + c3

则,其外接圆半径及圆心为:
Radius = 1/2 sqrt( (d1+d2)*(d2+d3)*(d3+d1)/c )   
Center = {(c2+c3)P1 + (c3+c1)P2 + (c1+c2)P3}/2c

mathematica 发表于 2012-7-24 09:49:26

(*三角形外心坐标公式*)
(*http://bbs.emath.ac.cn/thread-4482-1-1.html*)
Clear["Global`*"];(*Clear all variables*)
eq1=Solve[
    {(x-x1)^2+(y-y1)^2==(x-x2)^2+(y-y2)^2,
    (x-x1)^2+(y-y1)^2==(x-x3)^2+(y-y3)^2},
    {x,y}]
eq2={x,y}/.eq1
(*约分\化简\压缩*)
eq3=Flatten@FullSimplify@Cancel@eq2
(*提取横坐标的分母*)
a=Expand@Denominator@eq3[]
(*提取横坐标的分子*)
b=Expand@Numerator@eq3[]
(*提取纵坐标的分母*)
c=Expand@Denominator@eq3[]
(*提取纵坐标的分子*)
d=Expand@Numerator@eq3[]

mathematica 发表于 2012-7-24 09:51:55

a=-2 x2 y1 + 2 x3 y1 + 2 x1 y2 - 2 x3 y2 - 2 x1 y3 + 2 x2 y3
b=-x2^2 y1 + x3^2 y1 + x1^2 y2 - x3^2 y2 + y1^2 y2 - y1 y2^2 - x1^2 y3 +
x2^2 y3 - y1^2 y3 + y2^2 y3 + y1 y3^2 - y2 y3^2
c=-2 x2 y1 + 2 x3 y1 + 2 x1 y2 - 2 x3 y2 - 2 x1 y3 + 2 x2 y3
d=-x1^2 x2 + x1 x2^2 + x1^2 x3 - x2^2 x3 - x1 x3^2 + x2 x3^2 - x2 y1^2 +
x3 y1^2 + x1 y2^2 - x3 y2^2 - x1 y3^2 + x2 y3^2

横坐标是b/a,纵坐标是d/c
其中a=c
mathematica化简失败
a的化简形式可以是
2 (x3 (y1 - y2) + x1 (y2 - y3) + x2 (-y1 + y3))

mathematica 发表于 2012-7-24 09:54:12

b=x3^2 (y1 - y2) + x1^2 (y2 - y3) + x2^2 (-y1 + y3)+(y1 - y2) (y1 - y3) (y2 - y3)
这个是我的人工化简!!!!!!!!!!!!

gxqcn 发表于 2012-7-24 09:58:57

上述公式有点复杂,不利于编程,
但还是谢谢了。

有没有比3#更简洁的计算过程?

mathematica 发表于 2012-7-24 10:00:45

d=x3 (y1 - y2) (y1 + y2) + x1 (y2 - y3) (y2 + y3) + x2 (-y1^2 + y3^2)
    -(x1 - x2) (x1 - x3) (x2 - x3)

mathematica 发表于 2012-7-24 10:07:32

最土的办法就是联立方程组呀!!!!!!!!!!!!!
外心到三个顶点的距离相等,然后联立方程组求解结果呀!!!!!!!!!!!!!

gxqcn 发表于 2012-7-24 10:12:44

我喜欢追求形式上的优美与简洁,不仅仅是出于美感,
而且因为这样便于记忆,以及编写高效的代码。
页: [1] 2 3 4 5 6 7 8
查看完整版本: 三角形外心坐标公式