Skip to main content
spelling
Source Link
BrendanLuke15
  • 10.1k
  • 2
  • 27
  • 83

It's possible to find intersections of orbits around same planet through polar coordinates

In polar view, orbit takes form: $$r(\theta) = \frac{a \times(1-e^2)}{1-e \times \cos(\theta - \phi)}$$

We're looking for intersections, i.e. $r_1 = r_2$ :
$$r_1(\theta)=r_2(\theta)$$ $$\frac{a_1 \times (1-e_1^2)}{1-e_1\times \cos(\theta - \phi_1)} = \frac{a_2 \times (1-e_2^2)}{1-e_2\times \cos(\theta - \phi_2)}$$ $$a_1\times(1-e_1^2)\times \bigl(1-e_2\times \cos(\theta - \phi_2)\bigr) = a_2\times(1-e_2^2)\times \bigl(1-e_1\times \cos(\theta - \phi_1)\bigr)$$ $$a_1\times(1-e_1^2)-a_2\times (1-e_2^2) = - a_2\times (1-e_2^2) \times e_1 \times \cos(\theta - \phi_1) + a_1\times(1-e_1^2)\times e_2 \times \cos(\theta - \phi_2)$$ Now this long equation compacts down.
Let $A$ be the left side and $B_1$ and $B_2$ be the coefficients in front of cosinuses: $$A = a_1\times(1-e_1^2)-a_2\times (1-e_2^2)$$ $$B_1 = - a_2\times (1-e_2^2) \times e_1$$ $$B_2 = a_1\times(1-e_1^2)\times e_2$$ Function takes form: $$A = B_1 \times \cos(\theta - \phi_1)+B_2\times \cos(\theta - \phi_2)$$ Both cosinusescosines have same frequency, so they can be combined: $$B = \sqrt{B_1^2+B_2^2+2\times B_1\times B_2\times \cos(\phi_1-\phi_2)}$$ $$\Phi = arctg(\frac{B_1\times \cos(\phi_1)+B_2\times\cos(\phi_2)}{B_1\times \sin(\phi_1)+B_2\times\sin(\phi_2)})$$ And we get $$A = B\times \sin(\theta-\Phi)$$ From which $\theta = \arcsin(\frac{A}{B})+\Phi$ (arcsin can get 0,1 or 2 roots) From that you can get $r = r(\theta)$ and from both polar coordinates you can get position in whatever form you need.


As for "orbits around different bodies", usually it is solved by moving objects "between spheres of influence" (think KSP), so only same-body orbits can collide.
Otherwise, ellipse-ellipse collision can be probably approximated via bounding rectangle (if you don't track it already for drawing, it is found via cartesian function of ellipse: focus is at $x = -e\times a$, $y = 0$; bounds of rectangle are at $x = \pm a $ and $ y=\pm a\times \sqrt{1-e^2}$, return to global coords via rotation matrix and body coordinate offset)
And rectangle-rectangle collision check is either AABB or 4x4 line_segment-line_segment checks.

It's possible to find intersections of orbits around same planet through polar coordinates

In polar view, orbit takes form: $$r(\theta) = \frac{a \times(1-e^2)}{1-e \times \cos(\theta - \phi)}$$

We're looking for intersections, i.e. $r_1 = r_2$ :
$$r_1(\theta)=r_2(\theta)$$ $$\frac{a_1 \times (1-e_1^2)}{1-e_1\times \cos(\theta - \phi_1)} = \frac{a_2 \times (1-e_2^2)}{1-e_2\times \cos(\theta - \phi_2)}$$ $$a_1\times(1-e_1^2)\times \bigl(1-e_2\times \cos(\theta - \phi_2)\bigr) = a_2\times(1-e_2^2)\times \bigl(1-e_1\times \cos(\theta - \phi_1)\bigr)$$ $$a_1\times(1-e_1^2)-a_2\times (1-e_2^2) = - a_2\times (1-e_2^2) \times e_1 \times \cos(\theta - \phi_1) + a_1\times(1-e_1^2)\times e_2 \times \cos(\theta - \phi_2)$$ Now this long equation compacts down.
Let $A$ be the left side and $B_1$ and $B_2$ be the coefficients in front of cosinuses: $$A = a_1\times(1-e_1^2)-a_2\times (1-e_2^2)$$ $$B_1 = - a_2\times (1-e_2^2) \times e_1$$ $$B_2 = a_1\times(1-e_1^2)\times e_2$$ Function takes form: $$A = B_1 \times \cos(\theta - \phi_1)+B_2\times \cos(\theta - \phi_2)$$ Both cosinuses have same frequency, so they can be combined: $$B = \sqrt{B_1^2+B_2^2+2\times B_1\times B_2\times \cos(\phi_1-\phi_2)}$$ $$\Phi = arctg(\frac{B_1\times \cos(\phi_1)+B_2\times\cos(\phi_2)}{B_1\times \sin(\phi_1)+B_2\times\sin(\phi_2)})$$ And we get $$A = B\times \sin(\theta-\Phi)$$ From which $\theta = \arcsin(\frac{A}{B})+\Phi$ (arcsin can get 0,1 or 2 roots) From that you can get $r = r(\theta)$ and from both polar coordinates you can get position in whatever form you need.


As for "orbits around different bodies", usually it is solved by moving objects "between spheres of influence" (think KSP), so only same-body orbits can collide.
Otherwise, ellipse-ellipse collision can be probably approximated via bounding rectangle (if you don't track it already for drawing, it is found via cartesian function of ellipse: focus is at $x = -e\times a$, $y = 0$; bounds of rectangle are at $x = \pm a $ and $ y=\pm a\times \sqrt{1-e^2}$, return to global coords via rotation matrix and body coordinate offset)
And rectangle-rectangle collision check is either AABB or 4x4 line_segment-line_segment checks.

It's possible to find intersections of orbits around same planet through polar coordinates

In polar view, orbit takes form: $$r(\theta) = \frac{a \times(1-e^2)}{1-e \times \cos(\theta - \phi)}$$

We're looking for intersections, i.e. $r_1 = r_2$ :
$$r_1(\theta)=r_2(\theta)$$ $$\frac{a_1 \times (1-e_1^2)}{1-e_1\times \cos(\theta - \phi_1)} = \frac{a_2 \times (1-e_2^2)}{1-e_2\times \cos(\theta - \phi_2)}$$ $$a_1\times(1-e_1^2)\times \bigl(1-e_2\times \cos(\theta - \phi_2)\bigr) = a_2\times(1-e_2^2)\times \bigl(1-e_1\times \cos(\theta - \phi_1)\bigr)$$ $$a_1\times(1-e_1^2)-a_2\times (1-e_2^2) = - a_2\times (1-e_2^2) \times e_1 \times \cos(\theta - \phi_1) + a_1\times(1-e_1^2)\times e_2 \times \cos(\theta - \phi_2)$$ Now this long equation compacts down.
Let $A$ be the left side and $B_1$ and $B_2$ be the coefficients in front of cosinuses: $$A = a_1\times(1-e_1^2)-a_2\times (1-e_2^2)$$ $$B_1 = - a_2\times (1-e_2^2) \times e_1$$ $$B_2 = a_1\times(1-e_1^2)\times e_2$$ Function takes form: $$A = B_1 \times \cos(\theta - \phi_1)+B_2\times \cos(\theta - \phi_2)$$ Both cosines have same frequency, so they can be combined: $$B = \sqrt{B_1^2+B_2^2+2\times B_1\times B_2\times \cos(\phi_1-\phi_2)}$$ $$\Phi = arctg(\frac{B_1\times \cos(\phi_1)+B_2\times\cos(\phi_2)}{B_1\times \sin(\phi_1)+B_2\times\sin(\phi_2)})$$ And we get $$A = B\times \sin(\theta-\Phi)$$ From which $\theta = \arcsin(\frac{A}{B})+\Phi$ (arcsin can get 0,1 or 2 roots) From that you can get $r = r(\theta)$ and from both polar coordinates you can get position in whatever form you need.


As for "orbits around different bodies", usually it is solved by moving objects "between spheres of influence" (think KSP), so only same-body orbits can collide.
Otherwise, ellipse-ellipse collision can be probably approximated via bounding rectangle (if you don't track it already for drawing, it is found via cartesian function of ellipse: focus is at $x = -e\times a$, $y = 0$; bounds of rectangle are at $x = \pm a $ and $ y=\pm a\times \sqrt{1-e^2}$, return to global coords via rotation matrix and body coordinate offset)
And rectangle-rectangle collision check is either AABB or 4x4 line_segment-line_segment checks.

Source Link

It's possible to find intersections of orbits around same planet through polar coordinates

In polar view, orbit takes form: $$r(\theta) = \frac{a \times(1-e^2)}{1-e \times \cos(\theta - \phi)}$$

We're looking for intersections, i.e. $r_1 = r_2$ :
$$r_1(\theta)=r_2(\theta)$$ $$\frac{a_1 \times (1-e_1^2)}{1-e_1\times \cos(\theta - \phi_1)} = \frac{a_2 \times (1-e_2^2)}{1-e_2\times \cos(\theta - \phi_2)}$$ $$a_1\times(1-e_1^2)\times \bigl(1-e_2\times \cos(\theta - \phi_2)\bigr) = a_2\times(1-e_2^2)\times \bigl(1-e_1\times \cos(\theta - \phi_1)\bigr)$$ $$a_1\times(1-e_1^2)-a_2\times (1-e_2^2) = - a_2\times (1-e_2^2) \times e_1 \times \cos(\theta - \phi_1) + a_1\times(1-e_1^2)\times e_2 \times \cos(\theta - \phi_2)$$ Now this long equation compacts down.
Let $A$ be the left side and $B_1$ and $B_2$ be the coefficients in front of cosinuses: $$A = a_1\times(1-e_1^2)-a_2\times (1-e_2^2)$$ $$B_1 = - a_2\times (1-e_2^2) \times e_1$$ $$B_2 = a_1\times(1-e_1^2)\times e_2$$ Function takes form: $$A = B_1 \times \cos(\theta - \phi_1)+B_2\times \cos(\theta - \phi_2)$$ Both cosinuses have same frequency, so they can be combined: $$B = \sqrt{B_1^2+B_2^2+2\times B_1\times B_2\times \cos(\phi_1-\phi_2)}$$ $$\Phi = arctg(\frac{B_1\times \cos(\phi_1)+B_2\times\cos(\phi_2)}{B_1\times \sin(\phi_1)+B_2\times\sin(\phi_2)})$$ And we get $$A = B\times \sin(\theta-\Phi)$$ From which $\theta = \arcsin(\frac{A}{B})+\Phi$ (arcsin can get 0,1 or 2 roots) From that you can get $r = r(\theta)$ and from both polar coordinates you can get position in whatever form you need.


As for "orbits around different bodies", usually it is solved by moving objects "between spheres of influence" (think KSP), so only same-body orbits can collide.
Otherwise, ellipse-ellipse collision can be probably approximated via bounding rectangle (if you don't track it already for drawing, it is found via cartesian function of ellipse: focus is at $x = -e\times a$, $y = 0$; bounds of rectangle are at $x = \pm a $ and $ y=\pm a\times \sqrt{1-e^2}$, return to global coords via rotation matrix and body coordinate offset)
And rectangle-rectangle collision check is either AABB or 4x4 line_segment-line_segment checks.