2
$\begingroup$

I’m trying to figure out how to model the rings of Saturn using a particle system for a gravity simulator that I’m making. Using the code below, I’ve managed to create a, if not perfect, decent ring that rotates around Saturn under the force of the gravity of Saturn and its moons. However, my ring has an axial tilt of 0 whereas in reality the axial tilt of Saturn’s rings is 27 degrees. The problem is that I can’t get the z position and velocity vectors right for the particles that make up the particle system. Would anybody be able to help me figure out how to accomplish this? The code that I'm using to generate the initial state vectors for each particle in the ring can be found below.

for (let i = 0; i < this.numberOfParticles; i++) {

  const rad = Math.PI * 2 * Math.random();
  const dist = (25 + 20 * Math.random()) / 32000;

  this.particles.push({
    x: Math.cos(rad) * dist,
    y: Math.sin(rad) * dist,
    z: 0,
    vx: (Math.cos(rad + Math.PI / 2 + (Math.PI / 180 * 6 - Math.PI / 180 * 12) * 0) * Math.sqrt(500 / dist)) / 120,
    vy: (Math.sin(rad + Math.PI / 2 + (Math.PI / 180 * 6 - Math.PI / 180 * 12) * 0) * Math.sqrt(500 / dist)) / 120,
    vz: 0
 });

}
$\endgroup$
  • $\begingroup$ This kind of question is off-topic: If I read your question right, you are simply asking for us to debug your code. $\endgroup$ – Wolfgang Bangerth Jun 14 '18 at 22:47
  • $\begingroup$ My apologies if the kind of question I posted is off-topic. It's not a question of debugging the code, though; my math skills simply aren't good enough to figure out what what formula will give me z position and velocity vectors that will give me a ring that has an axial tilt of 27 degrees, and I was hoping somebody could explain the maths or at least give a pointer. $\endgroup$ – Happy Koala Jun 16 '18 at 15:02
3
$\begingroup$

A couple of directions and notes to make it work:

  • Now, you have points & vectors in the XY-plane with the normal $\hat{n}_{xy}=(0,0,1)$.
  • Instead of constructing the points and vector initially in the tilted plane, you can simply rotate your points & vectors (created in the XY-plane) accordingly
  • For that you will have to find the normal of the tilted plane: $\hat{n}_{\theta}$ which you can find using basic geometry and $\theta=27^\circ$.
  • Since you will also need a point for rotation, you might notice, that for both the original and tilted planes, the origin $O=(0,0,0)$ stays where it is.

After figuring out that, you will have enough information to make a proper rotation from the plane with $\hat{n}_{xy}$ to the one with $\hat{n}_{\theta}$.

$\endgroup$

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.