Re: drawing tilted ellipses?
- To: mathgroup at smc.vnet.net
- Subject: [mg20493] Re: drawing tilted ellipses?
- From: adam.smith at hillsdale.edu
- Date: Wed, 27 Oct 1999 02:04:55 -0400
- References: <7v3bmr$5te@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
This is easily possible. First parameterize your ellipse. Then use a
rotation matrix to transform the {x,y} coordinates into a tilted set.
Below is my code (Maybe not the most elegant, but it works). I
used "Evaluate" inside the plot to avoid an annoying but harmless
warning message. Also, be sure to set AspectRatio->Automatic or
Mathematica will scale the height/width in such a way that your ellipse
won't have the proper "look".
In[1]:=
ellipse = {3 *Cos[2*Pi*t],2*Sin[2*Pi*t]};
In[2]:=
ParametricPlot[ Evaluate[ellipse],{t,0,1},AspectRatio->Automatic];
In[3]:=
theta = 30*Pi/180;
rotmatrix = {{Cos[theta],-Sin[theta]},{Sin[theta],Cos[theta]}};
tiltedellipse = rotmatrix.ellipse
Clear[theta];
In[4]:=
ParametricPlot[ Evaluate[tiltedellipse],{t,0,1},AspectRatio->Automatic];
Adam Smith
In article <7v3bmr$5te at smc.vnet.net>,
Joe Strout <joe at strout.net> wrote:
> Is it possible to draw an ellipse in Mathematica that is not
orthogonal
> to the XY axes? E.g., leaning over 30 degrees?
>
> I thought perhaps I could specify it orthogonally and then apply a
> rotation transformation, but the only transformations available seem
to
> be scaling (Scaled) and translation (Offset).
>
> Of course I could use a series of line segments, but I want this to be
> smooth even when printed on a high-resolution printer. Any tips?
>
> Thanks,
> -- Joe
>
> --
> ,------------------------------------------------------------------.
> | Joseph J. Strout Biocomputing -- The Salk Institute |
> | joe at strout.net http://www.strout.net |
> `------------------------------------------------------------------'
> Check out the Mac Web Directory! http://www.strout.net/macweb.cgi
>
>
Sent via Deja.com http://www.deja.com/
Before you buy.