Download

Calculate a smoothing tangent between two World-Space Points?

The best way would be to use sphere coordinates and calculate x,y,z from them.
Sphere coordinates take two angles and a radius as input and calculating x,y,z from that is literally,3 lines of code.
I did that for full custom, made 3d camera and a orbit scenario is made for it. Just vary one angle and calculate x, y, z every frame for a perfectly smooth orbital movement. You could vary all three sphere coordinates with timelines to get any oval, elliptical or whatever movement. It is applications like this what sphere coordinates have been invented for.

@ Michael3DX - Thanks for the link, I’ll have a look through that!

@PolyPlant - The only problem with that is it’s not accurate, and won’t work for an Elliptical orbit. We have a library that plots all this stuff from real orbital data, it seems the missing ingredient that we need is the ‘Velocity’ of the object at a particular point, which would give us our proper tangent.

I have a feeling the inaccuracy was always like this, it’s just we used so many points we didn’t notice it as much :p.

To get the velocity use the first derivate over your timeline. Any kind of elliptical movement or movement on the surface of an ‘egg’ can be done by varying all sphere parameters. The smoothness is determined by how small the sphere variable increments are.

The problem isn’t so much plotting the ellipse, we have that already. The problem is the tangent velocity at each point in the ellipse in order to give us the interpolation for a spline. We can’t plot hundreds of XYZ points to get the smoothness because the points themselves have to be replicated over network for clients to draw it (The clients are running on Android, and aren’t powerful enough to do the orbit math all the time).

So, we have to plot very few points and get the correct tangent to use at those points to get the correct interpolation. I’ve got the direction and velocity, but the strength of the tangent for the spline isn’t directly tied to the size of the velocity unfortunately, it also depends on how far around the spline the next point is by the looks of it. That’s where the difficulty comes from.

EDIT: Basically, there’s no easy pre-defined way to convert an Ellipse to a Bezier Curve.

Bump, did you fix it?

Hah wow, and nope never did :frowning: Ended up making my calculation faster instead and drawing my points better.

**** this is old :o

Well, we are going to have to wait for that thesis then… :stuck_out_tongue:

where is thesis??? i been waiting 4 years now

Doesn’t exist. There is no known mathematical way to convert an arbitrary ellipse to a bezier curve with only four points.

If you look above you can see I never solved it, so I just plotted more than four points instead. Was easier.