1

I'm working on a scientific project about planetary motion. And I need to divide orbit of a planet which is often ellipse to numbers of days. For example, I need to divide earth's orbit into 365 parts but not by the length. I need to divide by its surface into 365 parts, also called sectors. I'm thinking of creating a code that generates random sectors until the surface area is the one we're looking for.

So, I firstly find what each of 365 sectors's area should be by dividing original ellipse area to 365. And then I want to draw random lines from the location of sun(also called focus or foci) to the edge of a ellipse orbit one by one until the area of that sector that is being generated is the one that we calculated earlier.

There's no mathematical way to find surface area of any sector of an ellipse. So the only way to achieve what we're looking for is to calculate it by pixels. And since I'm pretty new to that stuff, I have no idea how to do that.

I really hope you help me. Thanks in advance. And also it would be better if code was in c# otherwise in python.

Spektre
  • 49,595
  • 11
  • 110
  • 380
ssmn
  • 27
  • 3
  • for better explanation of a problem here's the image https://images.app.goo.gl/XxpNtoT5dYu8YMq26 – ssmn Jun 27 '19 at 13:06
  • 4
    *"There's no mathematical way to find any sector of an ellipse"* Are you sure? – Sefe Jun 27 '19 at 13:07
  • @Sefe I mean, there's a way to find it only if the start of a sector is at the center. In my case Sun is often located not in the center of planet's orbit. So it's impossible to find area mathematically, as far as I know. – ssmn Jun 27 '19 at 13:14
  • Is the origin of the ellipse and the sun location known? – Blue Eyed Behemoth Jun 27 '19 at 13:17
  • @BlueEyedBehemoth planets' aphelion and perihelion measures are known – ssmn Jun 27 '19 at 13:19
  • 1
    https://physics.stackexchange.com/a/426544 ? – canton7 Jun 27 '19 at 13:19
  • I'm not good at math, but if you did want to do it through an image, what you would have to do is do a check pixel by pixel to figure out what color it was. You would want to have the ellipse one color, background another, and the area a 3rd color. You can check out the following answer for that route: https://stackoverflow.com/questions/7874447/get-the-percentage-usage-of-every-colour-in-an-image But it won't be as accurate – Blue Eyed Behemoth Jun 27 '19 at 13:26
  • @canton7 for me it seems like using pixels is more precise and much easier, but still thank you very much – ssmn Jun 27 '19 at 13:26
  • "*I'm thinking of creating a code that generates random sectors until the surface area is the one we're looking for*" -- you can do better than that, easily - try a binary search – canton7 Jun 27 '19 at 13:26
  • @canton7 I don't quite understand what binary search has to do with this problem. Could you please explain? – ssmn Jun 27 '19 at 13:54
  • You suggested generating random sector sizes. I'm saying you can do better - if the sector you generate is too large, make it smaller. If it's too small, make it larger. When you change its size, use a measure of how badly wrong it is to decide how much to change it by - don't just pick a random value. – canton7 Jun 27 '19 at 14:00
  • @canton7 I got you, but I initially thought of drawing random lines from the foci(location of sun) to the ellipse, that way I think sector would be created. – ssmn Jun 27 '19 at 14:05
  • Did you try to create equations for lines, ellipse, find intersections in theory ? In case you find them, you can integrate leng of arc by radius, if it is hard abstractly, you can integrate numerically by algo. In case you can decide if you are in or out, it should be close to Monte Carlo method you are asking for, but way better ;-)... – Jan Jun 27 '19 at 16:30
  • as I mentioned in the comment to your other answer this is solvable by [Kepler's Equation](https://stackoverflow.com/a/25403425/2521214) directly. Anyway you can do this also by math by integrating the `circumference_point-focal_point` by `angle` however that one will most likely lead to ugly transcendent stuff and need either Z/Laplace transform or Taylor polynomial to make it computable so Kepler's equation is much much easier/faster .... – Spektre Aug 19 '19 at 18:50

0 Answers0