几何尺寸与公差论坛------致力于产品几何量公差标准GD&T (GDT:ASME)|New GPS(ISO)研究/CAD设计/CAM加工/CMM测量  


返回   几何尺寸与公差论坛------致力于产品几何量公差标准GD&T (GDT:ASME)|New GPS(ISO)研究/CAD设计/CAM加工/CMM测量 » 三维空间:产品设计或CAX软件使用 » CAD/CAM/CMM » SPC质量控制
用户名
密码
注册 帮助 会员 日历 银行 搜索 今日新帖 标记论坛为已读


回复
 
主题工具 搜索本主题 显示模式
旧 2009-09-05, 09:02 PM   #1
huangyhg
超级版主
 
huangyhg的头像
 
注册日期: 04-03
帖子: 18592
精华: 36
现金: 249466 标准币
资产: 1080358888 标准币
huangyhg 向着好的方向发展
默认 program to calculate ellipse aspect ratio

program to calculate ellipse aspect ratio
i am working with a large data set of vertical and horizontal velocities. when i plot these velocities, they form an ellipse.
i am required to write a program that will determine the b/a ratio of these ellipses.
it will be easy to determine the length of the major axis... simply the hypotenuse of the triangle connecting the max. and min. points of the ellipse in both directions. but i am having difficulty in comming up with an algorith to determine the length of the minor axis of the ellipse.
any input or ideas on how to do this would be greatly appreciated.
thanks!
find a job or post a job opening
your continued donations keep wikipedia running!
ellipse
from wikipedia, the free encyclopedia
jump to: navigation, search
"elliptical" redirects here. for the exercise machine, see elliptical trainer.
for other uses, see ellipse (disambiguation).
the ellipse and some of its mathematical properties.
the ellipse and some of its mathematical properties.
in mathematics, an ellipse (from the greek for absence) is the locus of points on a plane where the sum of the distances from any point on the curve to two fixed points is constant. the two fixed points are called foci (plural of focus).
an ellipse is a type of conic section: if a conical surface is cut with a plane which does not intersect the cone's base, the intersection of the cone and plane is an ellipse. for a short elementary proof of this, see dandelin spheres.
algebraically, an ellipse is a curve in the cartesian plane defined by an equation of the form
ax2 + bxy + cy2 + dx + ey + f = 0
such that b2 < 4ac, where all of the coefficients are real, and where more than one solution, defining a pair of points (x, y) on the ellipse, exists.
an ellipse can be drawn with two pins, a loop of string, and a pencil. the pins are placed at the foci and the pins and pencil are enclosed inside the string. the pencil is placed on the paper inside the string, so the string is taut. the string will form a triangle. if the pencil is moved around so that the string stays taut, the sum of the distances from the pencil to the pins will remain constant, satisfying the definition of an ellipse.
the line segment ab, that passes through the foci and terminates on the ellipse, is called the major axis. the major axis is the longest segment that can be obtained by joining two points on the ellipse. the line segment cd, which passes through the center (halfway between the foci), perpendicular to the major axis, and terminates on the ellipse, is called the minor axis. the semimajor axis (denoted by a in the figure) is one half the major axis: the line segment from the center, through a focus, and to the edge of the ellipse. likewise, the semiminor axis (denoted by b in the figure) is one half the minor axis.
if the two foci coincide, then the ellipse is a circle; in other words, a circle is a special case of an ellipse, one where the eccentricity is zero.
an ellipse centered at the origin can be viewed as the image of the unit circle under a linear map associated with a symmetric matrix a = pdpt, d being a diagonal matrix with the eigenvalues of a, both of which are real positive, along the main diagonal, and p being a real unitary matrix having as columns the eigenvectors of a. then the axes of the ellipse will lie along the eigenvectors of a, and the eigenvalues are the lengths of the semimajor and semiminor axes.
an ellipse can be produced by multiplying the x coordinates of all points on a circle by a constant, without changing the y coordinates.
contents
[hide]
* 1 eccentricity
* 2 equations
* 3 semi-latus rectum and polar coordinates
* 4 area
* 5 circumference
* 6 stretching and projection
* 7 reflection property
* 8 ellipses in physics
* 9 ellipses in computer graphics
* 10 see also
* 11 references
* 12 external links
[edit] eccentricity
the shape of an ellipse can be expressed by a number called the eccentricity of the ellipse, conventionally denoted \, \varepsilon. the eccentricity is a positive number less than 1 and greater than or equal to 0. an eccentricity of 0 implies that the two foci occupy the same point and that the ellipse is a circle.
for an ellipse with semimajor axis a and semiminor axis b, the eccentricity is
\varepsilon = \sqrt{1 - \frac{b^2}{a^2}}.
the greater the eccentricity is, the larger the ratio of a to b, and therefore the more elongated is the ellipse.
if c equals the distance from the center to either focus, then
\varepsilon = \frac{c}{a}.
the distance c is known as the linear eccentricity of the ellipse. the distance between the foci is 2a?.
[edit] equations
an ellipse centered at the point (h,k) and having its major axis parallel to the x-axis may be specified by the equation
\frac{(x-h)^{2}}{a^{2}} + \frac{(y-k)^{2}}{b^{2}} = 1.
this ellipse can be expressed parametrically as
x = h+a\,\cos t,\,\!
y = k+b\,\sin t\,\!
where t may be restricted to the interval -\pi\leq t \leq \pi\,\!.
if h = 0 and k = 0 (i.e., if the center is the origin (0,0)), then we can express this ellipse in polar coordinates by the equation
r = \frac{ab}{\sqrt{a^2 \sin^2 \theta + b^2 \cos^2 \theta}}=\frac{b}{\sqrt{1-\varepsilon^2 \cos^2 \theta}}
where \varepsilon is the eccentricity of the ellipse.
with one focus at the origin, the ellipse's polar equation is
r = \frac{ a\cdot(1-\varepsilon^{2})}{1 + \varepsilon\cdot\cos\theta}.
a gauss-mapped form:
\left(\frac{a\cos\beta}{\sqrt{a^2\cos^2\beta+b^2\sin^2\beta}},\frac{b\sin\beta}{\sqrt{a^2\cos^2\beta+b^2\sin^2\beta}}\right)
has normal (cos?,sin?).
[edit] semi-latus rectum and polar coordinates
the semi-latus rectum of an ellipse, usually denoted l\,\! (lowercase l), is the distance from a focus of the ellipse to the ellipse itself, measured along a line perpendicular to the major axis. it is related to a\,\! and b\,\! (the ellipse's semi-axes) by the formula al=b^2\,\! or, if using the eccentricity, l=a\cdot(1-\varepsilon^2)\,\!.
ellipse, showing semi-latus rectum
in polar coordinates, an ellipse with one focus at the origin and the other on the negative x-axis is given by the equation
r\cdot(1 + \varepsilon\cdot \cos \theta) = l \,\!
an ellipse can also be thought of as a projection of a circle: a circle on a plane at angle ? to the horizontal projected vertically onto a horizontal plane gives an ellipse of eccentricity sin ?, provided ? is not 90掳.
[edit] area
the area enclosed by an ellipse is ?ab, where 'a' and 'b' are the semimajor and semiminor axes. in the case of a circle where a = b, the expression reduces to the familiar ?a2.
[edit] circumference
the circumference of an ellipse is 4 a e(\varepsilon), where the function e is the complete elliptic integral of the second kind.
the exact infinite series is:
c = 2\pi a \left[{1 - \left({1\over 2}\right)^2\varepsilon^2 - \left({1\cdot 3\over 2\cdot 4}\right)^2{\varepsilon^4\over 3} - \left({1\cdot 3\cdot 5\over 2\cdot 4\cdot 6}\right)^2{\varepsilon^6\over5} - \dots}\right]\!\,
or:
c = 2\pi a \sum_{n=0}^\infty {\left\lbrace - \left[\prod_{m=1}^n \left({ 2m-1 \over 2m}\right)\right]^2 {\varepsilon^{2n}\over 2n - 1}\right\rbrace}
a good approximation is ramanujan's:
c \approx \pi \left[3(a+b) - \sqrt{(3a+b)(a+3b)}\right]\!\,
which can also be written as:
c \approx \pi a \left[ 3 (1+\sqrt{1-\varepsilon^2}) - \sqrt{(3+ \sqrt{1-\varepsilon^2})(1+3 \sqrt{1-\varepsilon^2})} \right] \!\,
for the special case where the minor axis is half the major axis, we get:
c \approx \pi a (9 - \sqrt{35})/2 \!\,
more generally, the arc length of a portion of the circumference, as a function of the angle subtended, is given by an incomplete elliptic integral. the inverse function, the angle subtended as a function of the arc length, is given by the elliptic functions.
[edit] stretching and projection
an ellipse may be uniformly stretched along any axis, in or out of the plane of the ellipse, and it will still be an ellipse. the stretched ellipse will have different properties (perhaps changed eccentricity and semi-major axis length, for instance), but it will still be an ellipse (or a degenerate ellipse: a circle or a line). similarly, any oblique projection onto a plane results in a conic section. if the projection is a closed curve on the plane, then the curve is an ellipse or a degenerate ellipse.
[edit] reflection property
assume an elliptic mirror with a light source at one of the foci. then all rays are reflected to a single point 鈥?the second focus. since no other curve has such a property, it can be used as an alternative definition of an ellipse.
sound waves are reflected in a similar way, so in a large elliptical room a person standing at one focus can hear a person standing at another focus remarkably well. such a room is called a whisper chamber. examples are the national statuary hall collection at the u.s. capitol (where john quincy adams is said to have used this property for eavesdropping on political matters), at an exhibit on sound at the museum of science and industry in chicago, in front of the university of illinois at urbana-champaign foellinger auditorium, and also at a side chamber of the palace of charles v, in the alhambra.
[edit] ellipses in physics
in the 5th century, aryabhata made the discovery that the planets follow elliptical orbits[1] around the sun.[2] he published his elliptical heliocentric model[3] in the aryabhatiya in 499.
in the 11th century, abu al-rayhan al-biruni observed that the planets revolved in elliptical orbits, instead of the circular orbits of the ancient greeks. he published his observations in his kitab al-qanun al-mas鈥檜di in 1031, which was later translated into latin as canon mas鈥檜dicus. a contemporary, al-zarqali, later known as arzachel in latin, stated that the planets moved in ellipses with the sun at one focus.[4] later in the 13th century, nasir al-din al-tusi developed a planetary model in which the planets followed elliptical orbits.[5]
in the 17th century, johannes kepler explained that the orbits along which the planets travel around the sun are ellipses in his first law of planetary motion. later, isaac newton explained this as a corollary of his law of universal gravitation.
more generally, in the gravitational two-body problem, if the two bodies are bound to each other (i.e., the total energy is negative), their orbits are similar ellipses with the common barycenter being one of the foci of each ellipse. interestingly, the orbit of either body in the reference frame of the other is also an ellipse, with the other body at one focus.
the general solution for a harmonic oscillator in two or more dimensions is also an ellipse, but this time with the origin of the force located at the center of the ellipse.
albert einstein also used the ellipse to prove his theory of relativity by using an elliptical shaped mass.
[edit] ellipses in computer graphics
drawing an ellipse is a common graphics primitive in standard display libraries, such as the macintosh quickdraw api and the windows graphics device interface (gdi). often such libraries are limited and can only draw an ellipse with either the major axis or the minor axis horizontal. jack bresenham at ibm is most famous for the invention of 2d drawing primitives, including line and circle drawing, using only fast integer operations such as addition and branch on carry bit. an efficient generalization to draw ellipses was invented in 1984 by jerry van aken (ieee cg&a, sept. 1984).
[edit] see also
* ellipsoid, a higher dimensional analog of an ellipse
* spheroid, the ellipsoids obtained by rotating an ellipse about its major or minor axis.
* super ellipse, a generalization of an ellipse that can look more rectangular
* hyperbola
* parabola
* orbit
* oval (geometry)
* true, eccentric, and mean anomalies
* matrix representation of conic sections
* kepler's laws of planetary motion
[edit] references
1. ^ j. j. o'connor and e. f. robertson, aryabhata the elder, mactutor history of mathematics archive:
"he believes that the moon and planets shine by reflected sunlight, incredibly he believes that the orbits of the planets are ellipses."
2. ^ ragep, j. (2002). ancient roots of modern science, talk of the nation.
3. ^ teresi, dick (2002). lost discoveries: the ancient roots of modern science - from the babylonians to the maya. simon & schuster, new york. isbn 0-684-83718-8.
4. ^ asghar qadir (1989). relativity: an introduction to the special theory, p. 6-11. world scientific, singapore. isbn 9971506122.
5. ^ covington, richard (may-june 2007). "rediscovering arabic science", saudi aramco world, p. 2-16.
[edit] external links
* ellipse & hyperbola construction - an interactive sketch showing how to trace the curves of the ellipse and hyperbola. (requires java.)
* ellipse construction - another interactive sketch, this time showing a different method of tracing the ellipse. (requires java.)
* ellipse on mathworld - more on ellipse
* the shape and history of the ellipse in washington, d.c. by clark kimberling
* collection of animated ellipse demonstrations. ellipse, axes, semi-axes, area, perimeter, tangent, foci.
* woodworking videos showing how to work with ellipses in wood.
wikimedia commons has media related to:
ellipses
rwf7437 - i'm not sure if you are trying to point me in the direction, or simply shame me. but in either case, yes, i read the wikipedia antry for ellipse before posting this question.
right now i'm thinking that the best way to go about this program would be to tilt the ellipse so that the major axis runs parallel to the x axis. this will make it very easy to calculate both the maor and minor axes of the ellipse.
any insight on a code for rotating an ellipse?
just trying to point you to the basic equations for an ellipse. your question is posted in the statistics forum but it seems to me your question might get better responses in either the computer topics forum or the spreadsheet forum. i am not a programmer so i can't give you detailed answers but your suggestion to rotate the axes would probably simplify the problem, i think.
there are some pretty smart programmers on those fora.
good luck
your question as posed doesn't seem to make sense. if you can find the max and min in one direction, what's stopping you from finding the max and min in the other direction? wouldn't you simply trade variables?
ttfn
you state that "it will be easy to determine the length of the major axis... simply the hypotenuse of the triangle connecting the max. and min. points of the ellipse in both directions." perhaps i am misunderstanding you, but i am not at all sure that this statement is correct.
in trying to fit an ellipse to a dataset, you have five degrees of freedom: the centrepoint of the ellipse (2 dof); the semiaxes (2 dof); and the orientation of the ellipse (1 dof). if i was presented with this problem, i would get the data into excel, and set up a very approximate "ellipse of best fit" based on five cells containing these five degrees of freedom. i would then try to come up with some sort of measure of the total error associated with my approximate solution (not a trivial task in the case of an ellipse). having done that, i would then use excel's "solver" to adjust the five degrees of freedom so as to minimise the error.
why do "you" have to write a program to do this? doesn't something like this already exist?
"i" have to write the program to do this because the aspect ratio is only one part of the analysis that we are performing. i now have a program that will read in a data set and spit out a series of different usefull characteristics that i can use to track different trends.
thanks for the help everyone... problem solved.
__________________
借用达朗贝尔的名言:前进吧,你会得到信心!
[url="http://www.dimcax.com"]几何尺寸与公差标准[/url]
huangyhg离线中   回复时引用此帖
GDT自动化论坛(仅游客可见)
回复


主题工具 搜索本主题
搜索本主题:

高级搜索
显示模式

发帖规则
不可以发表新主题
不可以回复主题
不可以上传附件
不可以编辑您的帖子

vB 代码开启
[IMG]代码开启
HTML代码关闭

相似的主题
主题 主题发起者 论坛 回复 最后发表
【转帖】orthoproject query yang686526 DirectDWG 0 2009-05-06 09:32 PM
【转帖】cannot explode an ellipse yang686526 DirectDWG 0 2009-05-04 05:26 PM


所有的时间均为北京时间。 现在的时间是 01:36 AM.


于2004年创办,几何尺寸与公差论坛"致力于产品几何量公差标准GD&T | GPS研究/CAD设计/CAM加工/CMM测量"。免责声明:论坛严禁发布色情反动言论及有关违反国家法律法规内容!情节严重者提供其IP,并配合相关部门进行严厉查处,若內容有涉及侵权,请立即联系我们QQ:44671734。注:此论坛须管理员验证方可发帖。
沪ICP备06057009号-2
更多