Orbit
The problem with orbits
The problem with orbits appears to be that celestia samples 100 points from each
orbit and then plots the orbits using these points. The trouble is that the orbits start
looking jerky when you zoom in close to an orbit.
Ideally celestia should sample more points close into the orbit. Another option is
to heavily sample the orbit of the object currently selected.
orbit and then plots the orbits using these points. The trouble is that the orbits start
looking jerky when you zoom in close to an orbit.
Ideally celestia should sample more points close into the orbit. Another option is
to heavily sample the orbit of the object currently selected.
patch to improve orbit rendering
--- render.cpp 2002-05-11 03:54:47.000000000 -0500
+++ render.cpp.orig 2002-05-02 12:53:47.000000000 -0500
@@ -714,20 +714,7 @@
orbit->body = body;
orbit->keep = true;
OrbitSampler sampler(&orbit->trajectory);
-
- // This makes the orbits look better
- // I use a high sample rate so that the orbits remain curves
- // even when you are close in
-
- // I start the sample one/half period in the past and move
- // forward by one period
-
- // The planets are not perfect ellipses due to perturbations
- // and if I start and stop at time t, I get a kink in the
- // planetary orbits
-
- body->getOrbit()->sample(t - body->getOrbit()->getPeriod() / 2.0,
- body->getOrbit()->getPeriod(), 1000,
+ body->getOrbit()->sample(t, body->getOrbit()->getPeriod(), 100,
sampler);
trajectory = &orbit->trajectory;
[joe@bodhi celengine]$ diff -u render.cpp.orig render.cpp
--- render.cpp.orig 2002-05-02 12:53:47.000000000 -0500
+++ render.cpp 2002-05-11 03:54:47.000000000 -0500
@@ -714,7 +714,20 @@
orbit->body = body;
orbit->keep = true;
OrbitSampler sampler(&orbit->trajectory);
- body->getOrbit()->sample(t, body->getOrbit()->getPeriod(), 100,
+
+ // This makes the orbits look better
+ // I use a high sample rate so that the orbits remain curves
+ // even when you are close in
+
+ // I start the sample one/half period in the past and move
+ // forward by one period
+
+ // The planets are not perfect ellipses due to perturbations
+ // and if I start and stop at time t, I get a kink in the
+ // planetary orbits
+
+ body->getOrbit()->sample(t - body->getOrbit()->getPeriod() / 2.0,
+ body->getOrbit()->getPeriod(), 3000,
sampler);
trajectory = &orbit->trajectory;
+++ render.cpp.orig 2002-05-02 12:53:47.000000000 -0500
@@ -714,20 +714,7 @@
orbit->body = body;
orbit->keep = true;
OrbitSampler sampler(&orbit->trajectory);
-
- // This makes the orbits look better
- // I use a high sample rate so that the orbits remain curves
- // even when you are close in
-
- // I start the sample one/half period in the past and move
- // forward by one period
-
- // The planets are not perfect ellipses due to perturbations
- // and if I start and stop at time t, I get a kink in the
- // planetary orbits
-
- body->getOrbit()->sample(t - body->getOrbit()->getPeriod() / 2.0,
- body->getOrbit()->getPeriod(), 1000,
+ body->getOrbit()->sample(t, body->getOrbit()->getPeriod(), 100,
sampler);
trajectory = &orbit->trajectory;
[joe@bodhi celengine]$ diff -u render.cpp.orig render.cpp
--- render.cpp.orig 2002-05-02 12:53:47.000000000 -0500
+++ render.cpp 2002-05-11 03:54:47.000000000 -0500
@@ -714,7 +714,20 @@
orbit->body = body;
orbit->keep = true;
OrbitSampler sampler(&orbit->trajectory);
- body->getOrbit()->sample(t, body->getOrbit()->getPeriod(), 100,
+
+ // This makes the orbits look better
+ // I use a high sample rate so that the orbits remain curves
+ // even when you are close in
+
+ // I start the sample one/half period in the past and move
+ // forward by one period
+
+ // The planets are not perfect ellipses due to perturbations
+ // and if I start and stop at time t, I get a kink in the
+ // planetary orbits
+
+ body->getOrbit()->sample(t - body->getOrbit()->getPeriod() / 2.0,
+ body->getOrbit()->getPeriod(), 3000,
sampler);
trajectory = &orbit->trajectory;
-
- Posts: 312
- Joined: 04.03.2002
- With us: 22 years 8 months
Adaptive sampling
More to the point would be to do some sort of adaptive sampling so that the curve is subdivided further if the polygon deviates from the actual curve by more than some threshold. There could be an absolute limit on sampling frequency as well.
This is how conventional curve flattening algorithms usually work (Foley and van Dam cover the subject in good detail).
This is how conventional curve flattening algorithms usually work (Foley and van Dam cover the subject in good detail).
Adaptive orbits
Yeah, I've been looking at the code to see how to make that work.
One of the problems is that you have to take into account the location
of the observer. One thing that I found out is that sampling at 3000
breaks if you move within a few km of the object, which happens if
you are a comet or asteroid. So what you need is a lot of samples
near the observer and fewer samples further away. You can also
"cheat" by ignoring the observer and creating a large number of
samples near the object.
It's all doable, and I'm looking at the code to figure out the best
way of doing it.
One of the problems is that you have to take into account the location
of the observer. One thing that I found out is that sampling at 3000
breaks if you move within a few km of the object, which happens if
you are a comet or asteroid. So what you need is a lot of samples
near the observer and fewer samples further away. You can also
"cheat" by ignoring the observer and creating a large number of
samples near the object.
It's all doable, and I'm looking at the code to figure out the best
way of doing it.