Working with universal coordinate system

The place to discuss creating, porting and modifying Celestia's source code.
Topic author
Dandelion
Posts: 8
Joined: 23.06.2009
With us: 15 years 4 months

Working with universal coordinate system

Post #1by Dandelion » 20.08.2009, 17:33

Hi,

I'm trying to figure out if the Observer is moving towards an object (e.g a star) or away from it. This is what I have so far. I not sure if the idea is correct.

I'm calculating a new orientation from from the stars position and the observers position : Quatd newOrientation = starPosition - myPosition;
Than I calculate the pot product: double potProduct= newOrientation.x * myOrientation.x + newOrientation.y * myOrientation.y + newOrientation.z * myOrientation.z; (UniversalCoord myPosition = observer.getPosition();)

If the pot product is negative the observer should be moving towards the object otherwise the observer should be moving away from the object.

Is this correct or is there a better way to do it?

Greetings,
Thomas

Avatar
t00fri
Developer
Posts: 8772
Joined: 29.03.2002
Age: 22
With us: 22 years 7 months
Location: Hamburg, Germany

Re: Working with universal coordinate system

Post #2by t00fri » 20.08.2009, 17:37

I like your pot product ;-)

That must give interesting results...

Never mind.

Fridger
Image

Topic author
Dandelion
Posts: 8
Joined: 23.06.2009
With us: 15 years 4 months

Re: Working with universal coordinate system

Post #3by Dandelion » 18.09.2009, 16:44

Hello,

what exactly is the orientation of the observer? i thought it is the vector in which the observer is moving or looking!! And it doesn't seem to normalize correctly.

Quatd myOrientation = observer.getOrientation();
myOrientation.normalize();
double test2 = sqrt(pow(myOrientation.x,2.0) + pow(myOrientation.y,2.0) + pow(myOrientation.z,2.0));

new test2 should be 1 but it isn't

Thomas


Return to “Development”