使用三角形两个顶点的坐标来计算第三个顶点的坐标

发布于 2025-01-03 10:57:09 字数 952 浏览 0 评论 0 原文

我知道三角形中两个顶点的两个坐标(未与轴对齐),并且我正在尝试计算第三个顶点的坐标。

          a
     B ------- C
       \      |
        \     |
C'       \    |
        c \   | b
           \  |
            \ |
             \|
              A

我知道AB的坐标,ac的长度,以及角度 >C 永远是直角。我相信C的坐标只能有两种可能的解决方案;上面绘制的一个,以及关于线 c 反射的 C ,大约在 C' 处。我想计算这两个位置。

编辑

三角形的来源如下。

Valid XHTML

我知道顶点 A,圆心 B,圆的半径 (a),并且通过 Pythag 与 (B - A),我知道 c 的长度。我试图找到从顶点开始的直线与圆的每条边相切的点,CC'

似乎是我的问题的答案;任何人都可以详细说明“给定直角三角形的两条边,很容易找到第三条边的长度和方向。”。

I know two coordinates of two vertices in a triangle (not aligned to an axis) and I'm attempting to calculate the coordinates of the third.

          a
     B ------- C
       \      |
        \     |
C'       \    |
        c \   | b
           \  |
            \ |
             \|
              A

I know the coordinates of A and B, the lengths of a and c, and that the angle C will always be a right angle. I believe there can only be two possible solutions for the coordinates of C; the one drawn above, and one with C reflected about the line c, approximately at C'. I'd like to calculate both positions.

EDIT:

The source of the triangle is as below.

Valid XHTML

I know the apex A, the centre of the circle B, the radius of the circle (a) and, from Pythag with (B - A), I know the length of c. I'm trying to find the points at which a line from the apex are at a tangent to each side of the circle, C and C'.

This appears to be an answer to my problem; can anyone elaborate on 'Given two sides of a right triangle, it's easy to find the length and direction of the third side.'.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

乱了心跳 2025-01-10 10:57:09

我知道A和B的坐标,以及a和c的长度。由此看来,C的坐标只能有两种可能的解

这是不正确的。 C 的位置有无数种选择,因为你不知道 b 的长度。

例如:

C
| 
| 
| 
| 
| 
B
\      
 \     
  \    
c  \   
    \  
     \ 
      \
       A

如果将 C 连接到 A,您仍然保持那些已知的长度......

为了实现这一点,您还需要知道其中一个角度(例如它是直角三角形),或者b. 的长度

I know the coordinates of A and B, and the lengths of a and c. From this, I believe there can only be two possible solutions for the coordinates of C

This is not true. There are an infinite number of choices for the position of C, as you don't know the length of b.

For example:

C
| 
| 
| 
| 
| 
B
\      
 \     
  \    
c  \   
    \  
     \ 
      \
       A

If you connect C to A, you still maintain those known lengths....

In order for this to be true, you would also need to know one of the angles (such as that it's a right triangle), or the length of b.

°如果伤别离去 2025-01-10 10:57:09

这很简单:由于 C 角为 PI/2,因此 b=sqrt(c*ca*a) 所以您知道 a、b、c 的长度。

C 和 C' 的坐标 = 两个圆的交点:

  1. 圆心 B 半径 a
  2. 圆心 A 半径 b

此处求解 例如 //A=P1, B=P0, C=P3: https://math. stackexchange.com/questions/187107/calculate-coordinates-of-3rd-point-vertex-of-a-scalene-triangle-if-angles-and

的基本条件this: if (a 否则无解。

It is easy: As the C angle is PI/2 then b=sqrt(c*c-a*a) so you know the lengths of a, b, c.

The coordinates of C and C' = the intersections of two circles:

  1. center B radius a
  2. center A radius b

Solved here for example //A=P1, B=P0, C=P3: https://math.stackexchange.com/questions/187107/calculate-coordinates-of-3rd-point-vertex-of-a-scalene-triangle-if-angles-and

The essential condition for this: if (a<c) otherwise it has no solution.

街角迷惘 2025-01-10 10:57:09

如果您知道它将是一个直角三角形,那么您就知道 x 和 y 值将从其他两点获取。

Point coordsForCompletingTriangleTop(Point a, Point b) {
    return new Point(a.x,b,y);
}

Point coordsForCompletingTriangleBottom(Point a, Point b) {
    return new Point(b.x,a,y);
}

如果不能保证它是直角三角形,那么您确实需要更多信息。需要 B 的长度、C 的长度或 BCA 的角度。

If you know it's going to be a right triangle, then you know the x and y values will be taken from the other two points.

Point coordsForCompletingTriangleTop(Point a, Point b) {
    return new Point(a.x,b,y);
}

Point coordsForCompletingTriangleBottom(Point a, Point b) {
    return new Point(b.x,a,y);
}

If cannot be guaranteed that it will be a right triangle, then you do need more information. The length of B, the length of C, or the angle of BCA would be required.

迷你仙 2025-01-10 10:57:09

如果假设 a 和 b 是矩形的对角

a = (xa, ya)
b = (xb, yb)

,则右上角矩形点为 c1 = (max(xa,xb), max(ya,yb))
左下矩形点为 c2 = (min(xa,xb), min(ya,yb))

假设 xa != xb 且 ya ! = yb

                    (xa, ya) A              C1 (max(xa, xb), max(ya, yb))
                               o----------o
                               |\         |
                               | \        |
                               |  \       |
                               |   \      |
                               |    \     |
                               |     \    |
                               |      \   |
                               |       \  |
                               |        \ |
                               o----------o
(min(xa, xb), min(ya, yb)) C2               B (xb, yb)

如果你的对角线走向相反的方向(为了测试这个看看是否 xa > xb),你需要将 x 上的最小值交换为最大值

(min(xa, xb), max(ya, yb))  C3              A'
                               o----------o
                               |         /|
                               |        / |
                               |       /  |
                               |      /   |
                               |     /    |
                               |    /     |
                               |   /      |
                               |  /       |
                               | /        |
                               o----------o
                           B'               C4 (max(xa, xb), min(ya, yb))

如果你感兴趣,完整的解决方案实际上位于圆圈:

Set of Solutions

要计算此值,假设我们有两个点 A = (xa, ya)B = (xb, yb)。那么这个圆的中心点是 c = (0.5 (xa + xb), 0.5 (ya + yb)) - 就是 A 和 B 的中点。圆的半径是 r = sqrt( (xb - xa)^2 + (yb - ya)^2) / 2 - 使用毕达哥拉斯定理获得线的长度并将其减半。然后圆上的任意点都可以通过 p = c + (rcos(u), rsin (u)) 定义某个角度 u。有 2 个角度可以为您提供点 p = Ap = B,因此这些 u 值并不是很好的解决方案。您可以写出方程并求解这两个点,从而得到您无法使用的 u 值。

If you assume a and b are the opposite corners of a rectangle

a = (xa, ya)
b = (xb, yb)

then the top right rectangle point is c1 = (max(xa,xb), max(ya,yb))
and the bottom left rectangle point is c2 = (min(xa,xb), min(ya,yb))

Assuming that xa != xb and ya != yb

                    (xa, ya) A              C1 (max(xa, xb), max(ya, yb))
                               o----------o
                               |\         |
                               | \        |
                               |  \       |
                               |   \      |
                               |    \     |
                               |     \    |
                               |      \   |
                               |       \  |
                               |        \ |
                               o----------o
(min(xa, xb), min(ya, yb)) C2               B (xb, yb)

If your diagonal is going the other way (to test this see if xa > xb) you need to swap min for max on the x

(min(xa, xb), max(ya, yb))  C3              A'
                               o----------o
                               |         /|
                               |        / |
                               |       /  |
                               |      /   |
                               |     /    |
                               |    /     |
                               |   /      |
                               |  /       |
                               | /        |
                               o----------o
                           B'               C4 (max(xa, xb), min(ya, yb))

And if you're interested, the full set of solutions actually lies on the circle:

Set of solutions

To compute this, suppose we have two points A = (xa, ya) and B = (xb, yb). Then the center point of this circle is c = (0.5 (xa + xb), 0.5 (ya + yb)) - just the midpoint of the A and B. The radius of the circle is r = sqrt( (xb - xa)^2 + (yb - ya)^2) / 2 - using pythagoras' theorem to get the length of the line and halving it. Then any point on the circle can be defined by p = c + (rcos(u), rsin (u)) for some angle u. There are 2 angles which give you the points p = A and p = B so these values of u are not good solutions. You can write out the equation and solve it for these 2 points to give you the values of u which you cannot use.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文