prog_dir = v:get_progradedir()
OBJHANDLE hRef = v->GetGravityRef();
VECTOR3 vel;
MATRIX3 rot;
v->GetRelativeVel (hRef, vel);
v->GetRotationMatrix (rot);
vel = tmul (rot, vel); // rotate into vessel frame
normalise (vel);
Indeed. Thanks for the comprehensive answer.I just thought you wanted to do it in C++
Thanks for the answer but this is not what I was complaining about: the problem is this (bold font):And what are the other coordinates at the moment? The vector is normalized, so its radius should be always 1.
if I rotate the ship around its Y axis, when X (example) reaches something like 0.97, it increases slowly. Then it reaches 0.9999 and start going backward (this is right), and again decreasing really slow (problem), even though i do NOT change my rotation speed.
That doesn't work this way. You are rotating relative to the vector, so it's a sphere you are drawing (or a circle if around one axis), and that's why the result won't have sharp edges, and closer to the direction of the vector the speed of coordinate change will be slower.Yes, like a sine wave, while i want something like a triangle wave.
At 180 degrees Cartesian coordinates will change as slow as at 0 degrees, and +/-90 degrees is the fastest. You can convert Cartesian coordinates to spherical as I added, so you'll have constant speed / triangle wave like you wanted.I see. Actually far to the direction of the vector is slower.
Indeed, the vector direction is at +90 degrees, so it changes fast.At 180 degrees Cartesian coordinates will change as slow as at 0 degrees, and +/-90 degrees is the fastest.
Sorry for bumping this, but I'm now trying to do this: http://www.orbiter-forum.com/showthread.php?t=18272What you can do is change Cartesian to Spherical
Orbiter is left-handed with y pointing 'up', so:So I'm asking here: how to actually change cartesian to spherical?
I'm sorry, I don't think I understand you. Can you elaborate?Is this the right way to obtain that fish eye scope?
If you check the link I've provided you can see what I'm trying to do. I have to print vessels/stations positions on the MFD with a view of 180°.I'm sorry, I don't think I understand you. Can you elaborate?
For 2D projection you only need Theta as a radius and Phi for the angle, and radius isn't used for drawing, but can by displayed as a numerical distance.With your formulae I get an angle Theta, an angle Phi and the radius, but I can't draw anything with all this. Or better, I could draw but reversing again everything, obtaining again those accelerations far from the center.
I've already tried to apply equidistant projection formulae to my coordinates but I didn't manage to get nice results.
EDIT:
actually because I had cartesian data, I will try now to code the equidistant projection formulae using BEFORE the formulae you suggested.
EDIT 2:
no, I totally have no idea
Isn't Theta only -90..90°? And the Phi angle should be in 360 degrees span, otherwise you'd get only a half of the circle for your projection.I've caught a glimpse of success. But it seems you've given me a 360° view.
double theta = acos(Z);
double phi = atan2(Y,X);
Isn't what I want? A 180° degrees scope.otherwise you'd get only a half of the circle for your projection.