Math 椭圆公式中的位置

Math 椭圆公式中的位置,math,lua,geometry,love2d,Math,Lua,Geometry,Love2d,假设我有一个坐标网格。我需要知道p0是否位于从p1开始到p2结束的椭圆上 其他几何对象的示例: --长方形 function PositiongOnRectangle(posx, posy, x1, y1, x2, y2) return (posx >= x1 and posy >= y1 and posx <= x2 and posy <= y2) end 上面的Exmaple是用Lua编写的,不过伪代码也可以。我想用椭圆做同样的事情 提前谢谢 对于椭圆,内接

假设我有一个坐标网格。我需要知道p0是否位于从p1开始到p2结束的椭圆上

其他几何对象的示例: --长方形

function PositiongOnRectangle(posx, posy, x1, y1, x2, y2)
    return (posx >= x1 and posy >= y1 and posx <= x2 and posy <= y2)
end
上面的Exmaple是用Lua编写的,不过伪代码也可以。我想用椭圆做同样的事情


提前谢谢

对于椭圆,内接在轴对齐的矩形中,由两个顶点p1、p2定义:

PositionOnEllipse(posx, posy, x1, y1, x2, y2)

///center of ellipse coordinates:
mx = (x1+x2)/2
my = (y1+y2)/2

///ellipse semiaxes:
ax = (x1-x2)/2
ay = (y1-y2)/2 

////due to ellipse equation
 return = (posx-mx)^2/ax^2 + (posy-my)^2/ay^2 <= 1
positionAllipse(posx,posy,x1,y1,x2,y2)
///椭圆中心坐标:
mx=(x1+x2)/2
my=(y1+y2)/2
///椭圆半轴:
ax=(x1-x2)/2
ay=(y1-y2)/2
////由于椭圆方程

return=(posx mx)^2/ax^2+(posy my)^2/ay^2椭圆的数学定义是什么(从p1开始,以p2结束)-它是椭圆吗?对于ellipse,您可能需要定义更多参数,我指的是ellipse。。请原谅我的英语能力。它是刻在轴对齐的矩形中,由两个顶点p1,p2定义,还是这些点应该位于椭圆圆周上?好的,现在你能解释一下x,y,mx,我的意思吗?我如何知道位置是否在椭圆内?请原谅我缺乏数学/英语知识,这使得这个问题更加令人困惑!没问题。Just-oval没有精确的数学定义,所以不需要太多的澄清。是的,在俄语中“oval”就是这个意思。好吧,你活着,你学习。再次感谢!
PositionOnEllipse(posx, posy, x1, y1, x2, y2)

///center of ellipse coordinates:
mx = (x1+x2)/2
my = (y1+y2)/2

///ellipse semiaxes:
ax = (x1-x2)/2
ay = (y1-y2)/2 

////due to ellipse equation
 return = (posx-mx)^2/ax^2 + (posy-my)^2/ay^2 <= 1