简体   繁体   English

找到一个圆的中心(x和y位置),只有2个随机点和凸起

[英]Find the center of a circle (x and y position) with only 2 random points and bulge

im trying to find the center of a circle. 我试图找到一个圆的中心。 the only information I have is: Two random points in the circle and the circle bulge. 我唯一的信息是:圆圈中的两个随机点和圆形凸起。 So far i've manage to calculate the radius of the circle (at least i think i did). 到目前为止,我已经设法计算圆的半径(至少我认为我做了)。 Ill post bellow the equasions ive used so far. 不幸的是,到目前为止,我已经使用过这种方法。

these are just random values and will change on user input) 这些只是随机值,会根据用户输入而改变)

PointA(x = 10, y = 15) PointB(x = 6, y = 12) PointA(x = 10,y = 15)PointB(x = 6,y = 12)

circle_bulge = 0.41 circle_bulge = 0.41

distance = PointB - PointA 距离= PointB - PointA

radius = (distance / 4) * (circle_bulge + (1 / circle_bulge )) radius =(距离/ 4)*(circle_bulge +(1 / circle_bulge))

if this math is incorrect, please let me know, but keep in mind that i need to find the X and Y coordinates of the center of the circle 如果这个数学不正确,请告诉我,但请记住,我需要找到圆心的X和Y坐标

Here is a picture of the problem: 这是问题的图片:

在此输入图像描述

By definition the bulge is b = tg( Alpha /4) 根据定义,凸起是b = tg( Alpha / 4)

From the trigonometric formula: tg(2 angle ) = 2tg( angle )/(1-tg 2 ( angle )) 从三角公式:tg(2 角度 )= 2tg( 角度 )/(1-tg 2角度 ))

applied to angle = Alpha /4 and using the definition of bulge: 应用于角度 = Alpha / 4并使用凸起的定义:

tg( Alpha /2) = 2 b /(1- b 2 ) tg( Alpha / 2)= 2 b /(1- b 2

On the other hand 另一方面

tg( Alpha /2) = s / d tg( Alpha / 2)= s / d

Then 然后

s / d = 2 b /(1- b 2 ) and s / d = 2 b /(1- b 2 )和

d = s (1- b 2 )/(2 b ) d = s (1- b 2 )/(2 b

which allows us to calculate d because b is known and s = || 这允许我们计算d因为b是已知的并且s = || B - A ||/2, where || B - A || / 2,其中|| B - A || B - A || denotes the norm of the vector B - A . 表示向量B - A的范数。

Now, let's calculate 现在,让我们计算一下

( u , v ) = ( B - A )/|| uv )=( B - A )/ || B - A || B - A ||

Then ||( u , v )|| 然后||( uv )|| = 1, ( v ,- u ) is orthogonal to B - A , and we have = 1,( v , - u )与B - A正交,我们有

C = ( v ,- u ) d + ( A + B )/2 C =( v-ud +( A + B )/ 2


UPDATE UPDATE

Pseudo code to compute the center 用于计算中心的伪代码

Inputs: 输入:

A = (a1, a2), B = (b1, b2) "two points"; b "bulge"

Calculations: 计算:

"lengths"
norm := sqrt(square(b1-a1) + square(b2-a2)).
s := norm/2.
d := s * (1-square(b))/(2*b)

"direction"
u := (b1-a1)/ norm.
v := (b2-a2)/ norm.

"center"
c1 := -v*d + (a1+b1)/2.
c2 := u*d + (a2+b2)/2.
Return C := (c1, c2)

Note: There are two solutions for the Center, the other one being 注意:中心有两种解决方案,另一种是

c1 := v*d + (a1+b1)/2.
c2 := -u*d + (a2+b2)/2.
Return C := (c1, c2)

I believe that you have all the required math in this reference: http://autocad.wikia.com/wiki/Arc_relationships 我相信您在此参考中拥有所有必需的数学: http//autocad.wikia.com/wiki/Arc_relationships

The center of the circunference has to be in the straight line that passes trough the middle point of the segment with perpendicular vector AB. 环形中心必须在直线上,该直线穿过具有垂直矢量AB的线段的中点。 You know the angle of the triangle formed by the three points because you know the bulge so you have to solve a simple equation. 你知道三点形成的三角形的角度,因为你知道凸起,所以你必须解决一个简单的方程。 Try it out, if you can not I will try to help you. 尝试一下,如果你不能,我会尽力帮助你。

Ignacio is right pointing out that there will be two solutions. 伊格纳西奥正确指出将有两种解决方案。

EDIT 编辑

The middle point is given by: 中间点由下式给出:

M = (A + B) / 2

The AB vector is gien by: AB载体是通过以下方式获得的:

AB = A-B

The center of the circle C with coordinates (X, Y) has to be in the line given by: 具有坐标(X,Y)的圆C的中心必须在以下给出的线中:

((X, Y) - M) * AB = 0 //where * is the scalar vector product

The isosceles triangle generated by the points A, B and C has an angle opposite of the AB segment: 由点A,B和C生成的等腰三角形具有与AB段相反的角度:

Angle = 4 arctan(bulge)

now we can compute the distance from the center C to A that we call d1 and half the distance between A and B that we call d2 we know then that 现在我们可以计算从中心C到A的距离,我们称之为d1,A和B之间的距离是我们称之为d2的距离的一半我们知道那个

sin (Angle/2) = d2/d1

This will give you the second equation for X and Y that is quadratic (it has two solutions). 这将为您提供二次方的X和Y的第二个方程(它有两个解)。

Excuse the notation but I do not know how to insert math here :-) 请原谅,但我不知道如何在这里插入数学:-)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 求出以正方形为随机中心的圆正好包含K个点的概率 - Find probablity that circle with random center in square contains exactly K points 找到一个圆圈((x,y,r)),它上面有最大点数; 在2D平面中给出一组点(x,y) - Find a Circle ((x,y,r)) that has maximum number of points 'on' it; given a set of points(x,y) in a 2D plane 给出三个点时找到圆心 - find center of circle when three points are given 从一段表面点找到圆心 - Find circle center from a segment of surface points 提出一种方法来查找以x轴为中心的,覆盖两个点的最小圆 - Come up with a method to find the smallest circle that covers two points with its center in x axis 在 Python 中的 (x,y) 图形上创建随机点 - Creating random points on (x,y) graphic in Python 查找地理位置点的群集(群集中心y距离内的最小x点)的算法 - Algorithm to find clusters (min x pts. within y distance of cluster center) of geographical points 计算圆中点的位置 - Calculating the position of points in a circle 如何从多个点找到最远的 x, y 坐标? - How to find the farthest x, y coordinates from many points? 在由(x,y)点定义的折线中查找双切线 - Find double-tangent in a polyline defined by (x,y) points
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM