1
$\begingroup$

It would appear that the Disk function, when asked to produce the sector of an ellipse between two angles treats those angles as Eccentric Anomalies (i.e. arguments to a parametric plot) rather than true central angles (i.e. arguments to a polar plot). The first part of my question asks whether this observation is correct?

Given that I want to construct a sector using the true central angles, I know that I can make use of the polar equation (r=(a*b)/Sqrt[(b Cos[θ])^2+(a Sin[θ])^2];), but this does not provide me Disk's ability to color the resultant sector. So, the second part of my question is, does Mathematica provide me a function for performing this filling operation?

I am aware of the Filling option to Plot. If it is, in fact, the preferred approach, can anyone provide an example of its use for doing elliptical sectors?

Thanks.

$\endgroup$
0
4
$\begingroup$

I think these functions do what you want. First the length from the centre of the ellipse to a point on its perimeter.

EllipsePolarRadius[t_, a_, b_] := a*b/Sqrt[(a Sin[t])^2 + (b Cos[t])^2]

Next a conversion from eccentric anomaly to central angle that works when input to Disk.

AngleConversionForDisk[t_, a_, b_] :=
   Which[
      0 <= t < Pi/2, ArcTan[a*Tan[t]/b],
      t == Pi/2, Pi/2,
      Pi/2 < t < 3 Pi/2, ArcTan[a*Tan[t]/b] + Pi,
      t == 3 Pi/2, 3 Pi/2,
      3 Pi/2 < t <= 2 Pi, ArcTan[a*Tan[t]/b] + 2 Pi]

And a Manipulate to illustrate the relationships.

Manipulate[
   Module[{a = 2, b = 4, u},
      u = AngleConversionForDisk[t, a, b];
      Graphics[{Thick,
         Circle[{0, b}, {a, b}],(* ellipse *)
         Cyan, Disk[{0, b}, {a, b}, {0, u}], (* ellipse sector *)
          (* t parameterization *)
         Black, Line[{{0, b}, {a Cos[t], b Sin[t]} + {0, b}}],
         (* u parameterization *)
         Red, Line[{{0, b}, EllipsePolarRadius[t, a, b]*{Cos[t], Sin[t]} + {0, b}}]
         }, Frame -> True, GridLines -> {Range[-a, a], Range[0, 2 b]},
         PlotLabel -> "Central Angle: " <> ToString[N[t]/Degree] <> " degrees"]],
   {{t, 0.2, "Central Angle"}, 0., 2.*Pi, Appearance -> "Labeled"}]

ellipse sector

$\endgroup$
3
  • $\begingroup$ AngleConversionForDisk[] looks like it can be expressed better with two-argument arctangent. See this article by Glassner as well. $\endgroup$ – J. M.'s ennui Oct 8 '15 at 3:12
  • $\begingroup$ This is exactly what I need. BTW, I am familiar with using the expansion factor a/b to transform a y coordinate from an ellipse to the circumscribed circle. But I am unfamiliar with its use in the context of ArcTan[a*Tan[t]/b]. Can you explain a bit how this works, or give me a pointer to a resource? Thanks. $\endgroup$ – Spencer Rugaber Oct 12 '15 at 16:51
  • $\begingroup$ Thanks! The connection between the central angle and the eccentric anomaly is discussed, for example, here. $\endgroup$ – KennyColnago Oct 14 '15 at 15:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.