fgx / fgx.github.io

The FGx public web presence on GitHub
http://fgx.github.io
Other
2 stars 3 forks source link

2016-08-07 ~ Elevations View Path #42

Closed theo-armour closed 7 years ago

theo-armour commented 7 years ago

@fgx/owners

Promise to have a look even if I attach no image?

Elevations View Path

Will be used for flying, hiking, cycling etc.

It's over in jaanga until it settles down.

Still having issues with the aircraft headings.

geoffmcl commented 7 years ago

Hi Theo,

As usual looks great...

Promise to have a look even if I attach no image?

Well, I think no image encourages the reader to click on the now visible prominent link ;=)) and see for themselves...

I watched it all the way around, twice...

Still having issues with the aircraft headings.

Yes, this seems strange... took me a little to realize I had missed a new jaanga terrain3 repo from my many local clones... it seems this all happens in terrain3\sandbox\elevations-view-path\flight-path-r3.js, right?

And loading the track file, 6-25-2016-1-cooked.csv, it has a header -

0   1   2   3   4   5    6     7
lon,lat,alt,hdg,ias,roll,pitch,slip

Then I can see the code, for lon,lat,alt - do not understand the alt translation, but appears to work fine...

 path.points = path.waypoints.map( function( p ) {
  return v( p[ 0 ], p[ 1 ], inpVertical.valueAsNumber * p[ 2 ]  * 0.3048  ); } );

But then I am puzzled! The next code I read is - using 3 for heading may be ok, but why is ias/4 and roll/5 included here... and times d2r???

 path.rotations = path.waypoints.map( function( p ) {
  return v( p[ 3 ] * d2r, p[ 4 ] * d2r, p[ 5 ] * d2r ); } );

If that indeed controls the rotations then should that not be roll/5, pitch/6, slip/7... or something...

But I get lost as to exactly where the orientation of the 21.js model is done, so this may be something else entirely...

And thanks to Jasin for this great, treacherous track, through the mountains, and to Theo for this great 3D review... look forward to more...

Regards, Geoff.

theo-armour commented 7 years ago

quick update. More after I finish coding

the rotations are an array of THREE.Vector3() s in radians

http://threejs.org/docs/#Reference/Math/Vector3

This is because it's how Three.js handles rotations:

http://threejs.org/docs/#Reference/Core/Object3D

For time being only the first ( or .x ) just for now - is being used to update the headings. Roll and pitch ignored for now until heading works


'd2r' === 'degrees to radians'

Any time I use a function shortcut like this, it's defined as a var and visible with the usual declarations at the top of the file

https://github.com/jaanga/terrain3/blob/gh-pages/sandbox/elevations-view-path/flight-path-r3.js#L24


21.js orientation is here

https://github.com/jaanga/terrain3/blob/gh-pages/sandbox/elevations-view-path/flight-path-r3.js#L36-L38

geoffmcl commented 7 years ago

@theo-armour yes, I read what you are saying...

I agree THREE.Vector3() are in RADIANS! and understand d2rd, and only ask why you are applying this to ias/4 and roll/5... they are not vectors! ... for starters...

Yes, you point me to the 21.js creation, where you do some things I do not understand... the 21.js creation completely... but ok a model is created somehwere in the scene, but what is its initial position/orientation?

My question was more about, when you load the cooked CSV, which contains some orientation information, at each waypoint in the CSV, that, that seems to be mis-used... that is all...

Maybe I mis-read! Maybe do not understand a whole lot... but nothing I read so far shows me the models orientation is being correctly related to the CSV info available...

Maybe, as can happen, way off base... maybe terminology...

Just do not understand your response... even after reading each link... 3D == x,y,z, yeah, and, wow, a 3D object is quite complex...

But none if that explains using hdg, ias, roll in this code... just saying...

Regards, Geoff.

theo-armour commented 7 years ago

Doe's this help:

@geoffmcl

one day the rotations will look something like this

vec3 = new THREE.Vector3( heading, roll, pitch )  << all in radians
aircraft.rotation.set( vec3 )

Rotations and positions are updated at 60fps in: animate()


21.js creation completely... but ok a model is created somewhere in the scene, but what is its initial position/orientation?

It's whatever it was when you created these aircraft from FG files. ;-)

I added these transforms by trial and mostly errors.

geoffmcl commented 7 years ago

@theo-armour I am trying to understand...

But your present coded, corrected by me, to the current used CSV offsets, reads -

    vec3 = new THREE.Vector3( heading, ias, roll )  << all in radians

That still does not seem right...

And this assumes the roll and pitch are in degrees! They are not!

I have to dig deeper, but think they are presently doubles in the range -1 to +1...

They could be easily converted to a 0 to LTT 360 deg range... if degrees are it...

Or am I still missing some point?

Regards, Geoff.

theo-armour commented 7 years ago

@geoffmcl

Thanks for the heads-up or pitch-up as the case may be.

I will look for this when I move the headings issues.

I've started pitch R4.