RE: Ellipse Drawing
- To: mathgroup at smc.vnet.net
- Subject: [mg40201] RE: [mg40170] Ellipse Drawing
- From: "David Park" <djmp at earthlink.net>
- Date: Tue, 25 Mar 2003 14:49:56 -0500 (EST)
- Sender: owner-wri-mathgroup at wolfram.com
Caroline, If you want to try out the ConicSections package from my web site below you will find it easy to plot your ellipses. Here is an example. Needs["ConicSections`ConicSections`"] The following generates all the basic information about a standard ellipse with semi-major axis 2 and ellipticity e = 7/8. The information is returned as a set of rules. It represents the ellipse in "standard position". information = StandardConic[{2, 7/8}] {conictype -> "Ellipse", conicequation -> x^2/4 + (16*y^2)/15 == 1, coniccurve -> {2*Cos[t], (1/4)*Sqrt[15]*Sin[t]}, coniccurvedomain -> {-Pi, Pi}, coniccenter -> {0, 0}, conicfocus -> {{7/4, 0}, {-(7/4), 0}}, conicdirectrix -> {x == -(16/7), x == 16/7}, conicvertex -> {{2, 0}, {-2, 0}}} The following command will transform the ellipse to a nonstandard position. TransofrmEllipseRules[P,T,R][information] will transform the rules generated by StandardConic for an ellipse in standard position to one in actual position as rotated, translated and reflected by P, T and R. Say that we want to rotate it by 60 degrees. We generate new information rules using a rotation matrix for 60 degrees, a zero translation vector, and an identity matrix for no reflection of x and y axes. ang = 60*Degree; newInformation = TransformEllipseRules[ {{Cos[ang], -Sin[ang]}, {Sin[ang], Cos[ang]}}, {0, 0}, IdentityMatrix[2]][information] {conictype -> "Ellipse", conicequation -> (1/240)*(207*x^2 - 98*Sqrt[3]*x*y + 109*y^2) == 1, coniccurve -> {Cos[t] - (3/8)*Sqrt[5]*Sin[t], Sqrt[3]*Cos[t] + (1/8)*Sqrt[15]*Sin[t]}, coniccurvedomain -> {-Pi, Pi}, coniccenter -> {0, 0}, conicfocus -> {{7/8, (7*Sqrt[3])/8}, {-(7/8), -((7*Sqrt[3])/8)}}, conicdirectrix -> {(1/2)*(x + Sqrt[3]*y) == -(16/7), (1/2)*(x + Sqrt[3]*y) == 16/7}, conicvertex -> {{1, Sqrt[3]}, {-1, -Sqrt[3]}}} We can then extract the parametrization curve by... ellipse[t_] = coniccurve /. newInformation {Cos[t] - (3/8)*Sqrt[5]*Sin[t], Sqrt[3]*Cos[t] + (1/8)*Sqrt[15]*Sin[t]} Now we can plot the curve. ParametricPlot[Evaluate[ellipse[t]], {t, -Pi, Pi}, AspectRatio -> Automatic, Frame -> True, AxesStyle -> GrayLevel[0.7]]; Which is the same as ParametricPlot[{Cos[t] - (3/8)*Sqrt[5]*Sin[t], Sqrt[3]*Cos[t] + (1/8)*Sqrt[15]*Sin[t]}, {t, -Pi, Pi}, AspectRatio -> Automatic, Frame -> True, AxesStyle -> GrayLevel[0.7]]; if you want to try it out. David Park djmp at earthlink.net http://home.earthlink.net/~djmp/ From: caroline nyhan [mailto:caznyhan at yahoo.com] To: mathgroup at smc.vnet.net Hi, I have a question concerning using mathematica to draw the cross-sectional pattern of the polarisation ellipse. I want to know how I would draw an ellipse, in the XY plane, with propagation in the positive z-direction, by specifying its - azimuth (angle that the major axis of the cross-sectional ellipse makes with the horizontal x-axis (positive when counterclockwise from x-axis)) - ellipticity (measure of the fatness of the ellipse, (ratio of the lengh of the semi-minor axis to that of the semi-major axis)) Thanks Caroline __________________________________________________ Do you Yahoo!? Yahoo! Platinum - Watch CBS' NCAA March Madness, live on your desktop! http://platinum.yahoo.com