查找次轴点

时间:2014-10-07 05:10:42

标签: math

我有两个椭圆长轴,我有短轴长度。我想找到短轴点。 我想到的一种方法是找到长轴的斜率。然后找到短轴的斜率。然后我们得到一个中心点,我们得到一个方程。其他方程可以用距离公式得到。但这使得它是二次的。一些线性解决方案可能吗?

2 个答案:

答案 0 :(得分:3)

您可以使用90°旋转来制定此项。假设您的主轴端点是(x 1 ,y 1 )和(x 2 ,y 2 )。更确切地说,假设sqrt((x 1 -x 2 2 +(y 1 -y 2 2 )= a是长轴的长度,b是短轴长度。然后M =½(x 1 + x 2 ,y 1 + y 2 )是中心椭圆,并且v =½(x 1 -x 2 ,y 1 -y 2 )是一个向量从该中心到主轴终点之一。因此,w = b /(2a)*(y 1 -y 2 ,x 2 -x 1 )是从短轴的中点到一个端点的向量,-w是另一个。所以M±w是两个端点。

答案 1 :(得分:2)

所以我认为是这样的:

  • enter image description here
  • 蓝色的东西是已知的
  • 红色未知且想要
  • A0,A1 - 主轴端点
  • a - 长轴
  • B0,B1 - 短轴端点
  • b - 短轴长度
  • C - 椭圆中心

因此,使用一些矢量数学很简单:

// midpoint is just average of endpoints ...
C=(A0+A1)/2

// major axis size
a=|A1-A0|

// now we need vector `b0` perpendicular to major axis
// in 3D use cross product but for that you need at leas to know 1 more point not on major axis
// in 2D simply swap x,y coordinates and make one negated (that is rotation by 90 degrees) so:
b0.x=(A1.y-A0.y)
b0.y=(A0.x-A1.x)
// now make the b0 vector length equal to halve of minor axis length
b0=0.5*b0*b/|b0|
// hope you know how to compute absolute value of 2D vector (|v|=`sqrt(v.x*v.x+v.y*v.y)`)

// now the endpoints are easy
B0=C+b0
B1=C-b0
  • 如果你有一些不同的输入,如图像
  • 例如半轴而不是满,然后C点已知
  • 和或b已经减半,所以不需要乘以0.5
  • 但是需要乘以它而不是半尺寸