2010-10-23 306 views

回答

10

我已閱讀brainjam的答案,並檢查他的答案是否屬實,他是否正確。 計算: O(0; 0),A(a; 0)和B(x; y)是三角形的三個點。 C1是A周圍的圓,r1 = c; C2是圍繞O的圓並且r2 = b。 B(X; Y)是C1和C2的交點,表示該點在兩個圓上。

alt text

C1:(X - A)*(X - A)+ Y * Y = C * C

C2:X * X + Y * Y = B * B

ÿ* Y = b * b - X * X

(X - A)*(X - A)+ b * b - X * X = C * C

X * X - 2 *一* X + A * b * A + b - X * X - C * C = 0

2 * A * X =(A * A + B * B - C * C)

X =(A * A + B * B - C * C)/(2 * A)

Y * Y = b *期b - ((A * A + b * b - C * C)/(2 * A))*((A * A + b * b - C * C)/(2 *一個))

Y = + - SQRT(b * b - ((A * A + b * b - C * C)/(2 * A))*((A * A + b * b - C * C)/(2 * A)))

+2

+1發佈數學.. – 2010-10-27 16:09:46

8

將第一個頂點放在原點(0,0)處。 (a,0)放置第二個頂點。要計算第三個頂點,請找到中心(0,0)和(a,0)以及半徑爲b和c的兩個圓的intersection

更新: Lajos Arpad給出了計算this answer中第三點位置的詳細信息。它歸結爲(X,Y),其中x =(B 2 +一個 -c )/ 2a和Y =± SQRT(B -x )

+2

很好的解決,我會給予好評你,但我覺得這是不完整的答案,因爲你沒有寫下來的細節。我把紙和一支筆和紙來計算你說什麼,想要共享的結果將與任何人感興趣的話題。 – 2010-10-23 17:58:29

+0

@Lajos,我不知道需要被證明的東西。長度A,B,兩側的建設成果ç...我會說這是顯而易見的,爲什麼你會說這是不是很明顯嗎?由於 – brainjam 2010-10-23 18:06:43

+0

問了這個問題了。我不知道這個解決方案,我不得不檢查。我是一個不可知論者,只相信我所看到的。你跟你的Flickr後絕對正確的,我只是想RO而且它。此外,該解決方案是一個解決方案,可以把三角VI任何你想要使用的旋轉和翻譯技巧。 – 2010-10-23 18:41:29

3

繪製一個未知的三角形時,通常最容易選擇一邊(比如最長),並將其水平或垂直放置。該邊的端點組成了三角形的兩個頂點,通過將三角形細分爲兩個直角三角形(另兩邊是斜邊)並使用反正弦/餘弦函數來計算缺失的角度。通過細分爲直角三角形,我的意思是這裏看起來像一個圖像:http://en.wikipedia.org/wiki/File:Triangle.TrigArea.svg您的第一面是該圖中的AC。

一旦你找到了三角形,應該很容易計算出它的中心位置並將其平移,以便它以任意中心點爲中心。

2

首先檢查三角形是否可能:

 
    a+b >= c 
    b+c >= a 
    c+a >= b
然後,如果是,求解兩個圓的交點。基本頂點是
 
    {0,0}, {a,0}, {x,y}
其中
 
    x = (a^2-b^2+c^2)/(2a) 
    y = sqrt(c^2-x^2)
從這一點上尋找外心是非常容易的。

+0

公式'x'和'y'?式是不正確的 – 2010-10-23 18:52:21

+0

(嘗試了,B,C = 4,3,5爲一例)。正確的公式推導由約什答案。 – brainjam 2010-10-23 19:30:27

+0

@brainjam:X =(4^2-3^2^2 + 5)/(8)== 4 == 32/8一個,如所預期。 Y = SQRT(5^2-16)= 3 == B,如預期。這是餘弦定理和勾股定理雅典的打扮版本。它也恰好是兩個圓的交點的唯一解*,它也*滿足邊長的三角不等式(我給出的三種可能性測試)。 – 2010-10-23 20:53:52

5

enter image description here

這個問題和答案helpe今天ð我出去實現此。這將計算未知頂點,給定兩個已知點(A,B)和距離(ac_length,bc_length)圓的交點的「C」到第3頂點未知的,「C」。這是我 興趣的人QUA蟒蛇的實現。

我也降引用:

http://mathworld.wolfram.com/RadicalLine.html

http://mathworld.wolfram.com/Circle-CircleIntersection.html

使用Django的GEOS模塊爲Point()對象,可能是與身材勻稱,不對齊對象馬雲完全或指向真的。

from math import sqrt 
from django.contrib.gis.geos import Point 

class CirclesSeparate(BaseException): 
    pass 

class CircleContained(BaseException): 
    pass 

def discover_location(point_a, point_b, ac_length, bc_length): 
    """ 
    Find point_c given: 
     point_a 
     point_b 
     ac_length 
     bc_length 

    point_d == point at which the right-angle to c is formed. 
    """ 
    ab_length = point_a.distance(point_b)  
    if ab_length > (ac_length + bc_length): 
     raise CirclesSeparate("Given points do not intersect!")  
    elif ab_length < abs(ac_length - bc_length): 
     raise CircleContained("The circle of the points do not intersect")  

    # get the length to the vertex of the right triangle formed, 
    # by the intersection formed by circles a and b 
    ad_length = (ab_length**2 + ac_length**2 - bc_length**2)/(2.0 * ab_length)  

    # get the height of the line at a right angle from a_length 
    h = sqrt(abs(ac_length**2 - ad_length**2)) 

    # Calculate the mid point (point_d), needed to calculate point_c(1|2) 
    d_x = point_a.x + ad_length * (point_b.x - point_a.x)/ab_length 
    d_y = point_a.y + ad_length * (point_b.y - point_a.y)/ab_length 
    point_d = Point(d_x, d_y)  

    # get point_c location 
    # --> get x 
    c_x1 = point_d.x + h * (point_b.y - point_a.y)/ab_length 
    c_x2 = point_d.x - h * (point_b.y - point_a.y)/ab_length 

    # --> get y 
    c_y1 = point_d.y - h * (point_b.x - point_a.x)/ab_length 
    c_y2 = point_d.y + h * (point_b.x - point_a.x)/ab_length  

    point_c1 = Point(c_x1, c_y1) 
    point_c2 = Point(c_x2, c_y2)  
    return point_c1, point_c2