鉴于其三面,在坐标平面中绘制三角形

Ksh*_*uli 5 math html5 drawing canvas graph

将给出三角形的三边长度a,b和c,我需要找到顶点的坐标.中心(可能是外心)可以是原点或(x,y).

谁能指出我正确的方向?

Laj*_*pad 11

我已经阅读了brainjam的答案,并检查他的答案是否正确,他是对的.计算:O(0; 0),A(a; 0)和B(x; y)是三角形的三个点.C1是A周围的圆,r1 = c; C2是O周围的圆,r2 = b.B(X; Y)是C1和C2的交点,这意味着该点位于两个圆上.

替代文字

C1:(x-a)*(x-a)+ y*y = c*c

C2:x*x + y*y = b*b

y*y = b*b - x*x

(x-a)*(x-a)+ b*b-x*x = c*c

x*x - 2*a*x + a*a + b*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*a) )

y = + - sqrt(b*b - ((a*a + b*b - c*c)/(2*a))*((a*a + b*b - c*c)/(2*一个)))


bra*_*jam 8

将第一个顶点放在原点(0,0).将第二个顶点放在(a,0)处.要计算第三个顶点,请找到两个圆的交点,其中心(0,0)和(a,0)以及半径b和c.

更新: Lajos Arpad已经详细说明了在这个答案中计算第三点的位置.归结为(x,y)其中x =(b 2 + a 2 -c 2)/ 2a和y =±sqrt(b 2 -x 2)

  • 非常好的解决方案,我会投票给你,但我发现这个答案不完整,因为你没有写下细节.我拿了一张纸和一支笔来计算你说的话,想和任何对这个主题感兴趣的人分享结果. (2认同)

mon*_*kut 5

在此输入图像描述

今天这个问题和答案帮助我实现了这个目标.它将计算未知顶点,给出2个已知点(a,b)的圆交点的"c"和到第3个未知顶点的距离(ac_length,bc_length),"c".这是我感兴趣的任何人的python实现.

我还引用了以下内容:

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

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

使用django的地理模块作为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 
Run Code Online (Sandbox Code Playgroud)