根据角度求椭圆上坐标

计算椭圆上坐标 分两步,求离心角和根据离心角求椭圆上坐标。

椭圆方程

椭圆方程是
x 2 a 2 + y 2 b 2 = ( x a ) 2 + ( y b ) 2 = ( c o s ( t ) ) 2 + ( s i n ( t ) ) 2 = 1 \frac{x^2}{a^2} + \frac{y^2}{b^2} = \left(\frac{x}{a}\right)^2+\left(\frac{y}{b}\right)^2=\left(cos\left(t\right)\right)^2+\left(sin\left(t\right)\right)^2=1 a2x2+b2y2=(ax)2+(by)2=(cos(t))2+(sin(t))2=1
这个 t t t就是离心角的角度。

求离心角

如下图,已知椭圆的角 p p p,要求主离心角 t t t。如下图,小圆为椭圆内切,大圆为椭圆外切。虚线除OE外,全为垂线。
在这里插入图片描述
根据椭圆方程,可知E的y坐标 E y = b ∗ s i n t ( t ) = A y E_y = b*sint\left(t\right)=A_y Ey=bsint(t)=Ay
又有
t a n ( t ) = B D / O D tan\left(t\right)=BD/OD tan(t)=BD/OD t a n ( p ) = E D / O D tan\left(p\right)=ED/OD tan(p)=ED/OD
那么 t a n ( t ) t a n ( p ) = B D E D = B D A C = O D O C = a b \frac{tan\left(t\right)}{tan\left(p\right)} = \frac{BD}{ED}=\frac{BD}{AC}=\frac{OD}{OC}=\frac{a}{b} tan(p)tan(t)=EDBD=ACBD=OCOD=ba
所以, t a n ( t ) = t a n ( p ) ∗ a b tan\left(t\right)=tan\left(p\right)*\frac{a}{b} tan(t)=tan(p)ba

求解 t t t值时,用函数 a t a n 2 ( x , y ) atan2(x,y) atan2(x,y),这样求出的值是[ − π -\pi π, π \pi π],使用 a t a n atan atan得到的值在[ − π 2 -\frac{\pi}{2} 2π, π 2 \frac{\pi}{2} 2π]

根据离心角求椭圆上给定角度的坐标

根据椭圆公式,可得
x = a ∗ c o s ( t ) x = a*cos\left(t\right) x=acos(t) y = b ∗ s i n ( t ) y = b*sin\left(t\right) y=bsin(t)

椭圆出现平移及旋转的情况

这种情况,需要先将椭圆旋转并平移到标准椭圆位置,计算完点坐标再反算回去。如下图
在这里插入图片描述

旋转后的椭圆坐标与标准椭圆坐标的对应关系如下所示公式:
( x y ) = R ∗ ( ( X Y ) − ( X c Y c ) ) \begin{pmatrix}x \\ y\end{pmatrix} = R*\left(\begin{pmatrix}X \\ Y\end{pmatrix}-\begin{pmatrix}X_c \\ Y_c\end{pmatrix}\right) (xy)=R((XY)(XcYc))
其中 , R = ( c o s ( γ ) s i n ( γ ) − s i n ( γ ) c o s ( γ ) ) R=\begin{pmatrix} cos\left(\gamma \right) & sin\left(\gamma \right) \\ -sin\left(\gamma \right) & cos\left(\gamma \right) \end{pmatrix} R=(cos(γ)sin(γ)sin(γ)cos(γ))
R − 1 = R T = ( c o s ( γ ) − s i n ( γ ) s i n ( γ ) c o s ( γ ) ) R^{-1}=R^{T}=\begin{pmatrix} cos\left(\gamma \right) & -sin\left(\gamma \right) \\ sin\left(\gamma \right) & cos\left(\gamma \right) \end{pmatrix} R1=RT=(cos(γ)sin(γ)sin(γ)cos(γ))
那么,旋转后的椭圆上点坐标公式为
( X Y ) = R − 1 ∗ ( x y ) + ( X c Y c ) \begin{pmatrix}X \\ Y\end{pmatrix} = R^{-1}*\begin{pmatrix}x \\ y\end{pmatrix} +\begin{pmatrix}X_c \\ Y_c\end{pmatrix} (XY)=R1(xy)+(XcYc)
最终,
X = c o s ( γ ) ∗ x − s i n ( γ ) ∗ y = c o s ( γ ) ∗ a ∗ c o s ( t ) − s i n ( γ ) ∗ b ∗ s i n ( t ) + X c Y = s i n ( γ ) ∗ x + c o s ( γ ) ∗ y = s i n ( γ ) ∗ a ∗ c o s ( t ) + c o s ( γ ) ∗ b ∗ s i n ( t ) + Y c \begin{array}{c} X= cos\left(\gamma \right)*x -sin\left(\gamma \right)*y = cos\left(\gamma \right)*a*cos\left(t\right) -sin\left(\gamma \right)*b*sin\left(t\right)+X_c \\ Y= sin\left(\gamma \right)*x +cos\left(\gamma \right)*y = sin\left(\gamma \right)*a*cos\left(t\right) +cos\left(\gamma \right)*b*sin\left(t\right)+Y_c \end{array} X=cos(γ)xsin(γ)y=cos(γ)acos(t)sin(γ)bsin(t)+XcY=sin(γ)x+cos(γ)y=sin(γ)acos(t)+cos(γ)bsin(t)+Yc
参考:
网页1
网页2

  • 5
    点赞
  • 32
    收藏
    觉得还不错? 一键收藏
  • 9
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 9
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值