Am trying to write a code to make my planet increase and decrease with respect to PI/2 and 3*PI/2 as it orbits round the sun please any tips

What have you got so far?

Seriously. Post your code.

Without knowing what you already have working, we are at a total loss as to how to help you.

Are you trying to increase the radius of the planets? Are you trying to have elliptical orbits? I have no idea what you have already.

Post your code. Tell us what works, and what doesnâ€™t.

Orbital mechanics are great fun!

Iâ€™m not sure about your reference to `PI / 2`

and `3 * PI / 2`

. How does this relate to orbits?

Hereâ€™s a quick brain dump of things you should be aware of:

- 2-body orbital motion is elliptical with the parent body at one of the foci of the ellipse.
- A body orbiting another obeys Keplerâ€™s Laws of Planetary Motion.
- Orbits are frequently parameterized based on the following:
- The angle between some reference direction and the â€śascending nodeâ€ť which is the point at which the orbit crosses from below to above the â€ścelestial planeâ€ť which is the plane that you think of as â€ślevelâ€ť
- The angle of inclination, which is how tilted the orbit is relative to the â€ścelestial planeâ€ť
- The angle of periapse, which is the angle in the plane of the orbit between the ascending node and the point where the satellite is closest to itâ€™s parent
- The eccentricity, which is how elongated the orbit is (0 is circular, 1 is parabolic, in between 0 and 1 is elliptical, > 1 is hyperbolic)
- The semi major axis (which is half the long diameter of the ellipse, although the meaning for hyperbolic orbits is different)

- These are called â€śorbital elementsâ€ť.
- The position of a satellite within itâ€™s orbit is denoted by itâ€™s â€śTrue Anomalyâ€ť which is the angle between the point of periapsis as the satellites current position.
- The True Anomaly varies
**non-linearly**because a satellite moves quickly when it is close to itâ€™s parent and more slowly when it is far away. - However True Anomaly can be related to the â€śMean Anomalyâ€ť, which basically denotes what fraction itâ€™s orbit a satellite has progressed through in terms of an angle, via Keplerâ€™s Equation.
- Solving Keplerâ€™s equation to go from Mean Anomaly to True Anomaly is a bit complicated because it doesnâ€™t have a simple algebraic solution so you wind up using either an approximation or iteration (see Newtonâ€™s Method).

I have a sketch that demonstrates some of these principles, however, I must apologize because it is implemented in p5.js not processing, and it is incomplete and uncommented: Orbit Diagram - OpenProcessing

Hey man i was able to figure it out thanks

Hello can you help me with this same question

Hello can I get help with the same question

THE SAME REPLY APPLIES TO YOU.

What have you got so far?

Seriously. Post your code.

Without knowing what you already have working, we are at a total loss as to how to help you.

Are you trying to increase the radius of the planets? Are you trying to have elliptical orbits? I have no idea what you have already.

Post your code. Tell us what works, and what doesnâ€™t.

final int SUN_DIAM = 50;

final int ORBIT_X = 150;

final int ORBIT_Y = 35;

final float SPEED = 0.03;

float angle = 0;

float planetDiam = 25;

float xPos, yPos;

void setup () {

size(500, 500);

}

void draw () {

background(0);

fill(255, 255, 0);

circle(width/2, height/2, SUN_DIAM);

xPos = ORBIT_X * cos(angle) + width/2;

yPos = ORBIT_Y * sin(angle) + height/2;

fill(120);

circle(xPos, yPos, planetDiam);

angle = angle + SPEED;

planetDiam = 10 * cos(angle) + 15;

}

this is my code so far

I want to make the diameter of the planet change, depending on angle using a sin or cos function. Thank you !

This makes the diameter of your planet change, depending on the angle, using a cos() function. You have what you want already. I have no idea what more you want.

@MacJ ,

You already have a topic on this here and tagged as homework:

*Scale using cos/sin*

Our forum:

https://discourse.processing.org/faq#keep-tidy

Asks that you:

Donâ€™t cross-post the same thing in multiple topics

Hello,

An example:

```
void setup()
{
size(300, 300);
}
void draw()
{
background(0);
// This advances every frame by TWO_PI/360
float angle = frameCount*TAU/360; //TAU = TWO_PI radians
//Useful:
println(frameCount, angle, degrees(angle));
float planetDiam = 150 + 100 * cos(angle);
circle(width/2, height/2, planetDiam);
}
```

You may find some of this useful in projects.

`:)`