我知道三角形中两个顶点的两个坐标(未与轴对齐),并且我正在尝试计算第三个顶点的坐标。
a
B ------- C
\ |
\ |
C' \ |
c \ | b
\ |
\ |
\|
A
我知道A和B的坐标,a和c的长度,以及角度 >C 永远是直角。我相信C的坐标只能有两种可能的解决方案;上面绘制的一个,以及关于线 c 反射的 C ,大约在 C' 处。我想计算这两个位置。
编辑:
三角形的来源如下。
我知道顶点 A,圆心 B,圆的半径 (a),并且通过 Pythag 与 (B - A),我知道 c 的长度。我试图找到从顶点开始的直线与圆的每条边相切的点,C 和 C'。
这似乎是我的问题的答案;任何人都可以详细说明“给定直角三角形的两条边,很容易找到第三条边的长度和方向。”。
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.
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.'.
发布评论
评论(4)
这是不正确的。 C 的位置有无数种选择,因为你不知道 b 的长度。
例如:
如果将 C 连接到 A,您仍然保持那些已知的长度......
为了实现这一点,您还需要知道其中一个角度(例如它是直角三角形),或者b. 的长度
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:
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.
这很简单:由于 C 角为 PI/2,因此
b=sqrt(c*ca*a)
所以您知道 a、b、c 的长度。C 和 C' 的坐标 = 两个圆的交点:
此处求解 例如 //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:
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.如果您知道它将是一个直角三角形,那么您就知道 x 和 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.
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.
如果假设 a 和 b 是矩形的对角
,则右上角矩形点为 c1 = (max(xa,xb), max(ya,yb))
左下矩形点为 c2 = (min(xa,xb), min(ya,yb))
假设 xa != xb 且 ya ! = yb
如果你的对角线走向相反的方向(为了测试这个看看是否 xa > xb),你需要将 x 上的最小值交换为最大值
如果你感兴趣,完整的解决方案实际上位于圆圈:
要计算此值,假设我们有两个点
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 = A
和p = B
,因此这些u
值并不是很好的解决方案。您可以写出方程并求解这两个点,从而得到您无法使用的 u 值。If you assume a and b are the opposite corners of a rectangle
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
andya != 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
And if you're interested, the full set of solutions actually lies on the circle:
To compute this, suppose we have two points
A = (xa, ya)
andB = (xb, yb)
. Then the center point of this circle isc = (0.5 (xa + xb), 0.5 (ya + yb))
- just the midpoint of the A and B. The radius of the circle isr = 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 byp = c + (rcos(u), rsin (u))
for some angleu
. There are 2 angles which give you the pointsp = A
andp = B
so these values ofu
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.