Lines or curves for a smooth circle in Vectrosity

Hello,

I am wondering what approach for drawing circles would produce the best looking, smooth circles/orbits in Vectrosity? Pretty much similar to the smoothness of the orbits in Kerbal Space Program.

I am currently using multiple line segments (2500) to display a circle, but it seems a bit … edgy and not looking good when zooming in and out with the camera (3d camera with changing the Z coordinates for zoom in/out, drawing with Draw3dAuto()).

Would it be better if i used multiple curves to draw a circle, would it be smoother and finally would it be more efficient?

I guess my questions is more directed towards Eric, but if anyone else is interested in providing an answer, that would be great :slight_smile:

The orbits in KSP are drawn as Vectrosity Splines. We take a fixed number of samples from the orbit code, and let the spline interpolate the segments in between.

This works nicely for us, since querying the orbit maths for sample points is much more expensive than interpolating the spline, so we try to keep the number of samples down as much as we can (as low as we can get them without the spline becoming distorted), and the number of subdivisions just high enough to make it look smooth.

Mind though, it’s not just about the number of samples, it’s about distribution. The more evenly spaced your sample points are, the better the spline will be able to draw smoothly across them.

Also keep in mind that even then, the spline drawing for orbits is one of the most performance intensive operations in KSP, it is a lot of maths, so we do what we can to keep the number of splines on screen as low as possible.

Cheers

The more segments, the smoother it will be. You could switch between different circles at different zoom levels, with higher zooms having more segments.