[Flightgear-devel] Current Elevation

2002-05-02 Thread Sam Varner

I want to get the elevation of the ground for points other than my
current location.  I suppose I could do this by moving to a new location
and calling scenery.get_cur_elev().  Is there a better way?  If not,
what operations will update the output of FGScenery::get_cur_elev() in
the most efficient way? 


___
Flightgear-devel mailing list
[EMAIL PROTECTED]
http://mail.flightgear.org/mailman/listinfo/flightgear-devel



Re: [Flightgear-devel] Current Elevation

2002-05-02 Thread Jim Wilson

Sam Varner [EMAIL PROTECTED] said:

 I want to get the elevation of the ground for points other than my
 current location.  I suppose I could do this by moving to a new location
 and calling scenery.get_cur_elev().  Is there a better way?  If not,
 what operations will update the output of FGScenery::get_cur_elev() in
 the most efficient way? 
 

That's actually a problem that I'm working on currently.  If you look at
tilemgr.cxx, the update() function you'll see where the value for current
elevation gets set.  What you can do is modify that function to accept an
absolute view position vector along with the longitude and latitude
paramters and pass it along to the hitlist fgCurrentElev call.

Take a look at location.cxx to see how that absolute position vector is
calculated (it is actually based on the latitude and longitude with the
altitude integraded to give you coordinates in 3D space).  Calling the
update() routine in this way causes some trouble with the tile caching because
the caching is based on distance from the longitude and latitude you specify. 

When the routine was written we were dealing with a single view location and
an a longitude and latitude that changed gradually, not abruptly.  If you keep
jumping that around the tile cache starts thrashing a bit (unless the
locations are reasonably close to each other).  All this said, calling
update() will give you the readings you are looking for.  Just make sure that
the current elevation gets set right back to whatever is correct for the
aircraft (the value returned by scenery-get_cur_elev()), otherwise you'll see
some other issues come up.

Sometime in the next week or so look for updates to this code that will make
what you want to do a little easier and fix the numerous bugs in the scenery
and sky rendering that have come up since the new viewer code was introduced.

Best,

Jim

___
Flightgear-devel mailing list
[EMAIL PROTECTED]
http://mail.flightgear.org/mailman/listinfo/flightgear-devel



Re: [Flightgear-devel] Current Elevation

2002-05-02 Thread Sam Varner

On Thu, 2002-05-02 at 20:14, Jim Wilson wrote:
 Sam Varner [EMAIL PROTECTED] said:
 
  I want to get the elevation of the ground for points other than my
  current location.  I suppose I could do this by moving to a new location
  and calling scenery.get_cur_elev().  Is there a better way?  If not,
  what operations will update the output of FGScenery::get_cur_elev() in
  the most efficient way? 
  
 
 That's actually a problem that I'm working on currently.  If you look at
 tilemgr.cxx, the update() function you'll see where the value for current
 elevation gets set.  What you can do is modify that function to accept an
 absolute view position vector along with the longitude and latitude
 paramters and pass it along to the hitlist fgCurrentElev call.
 
 Take a look at location.cxx to see how that absolute position vector is
 calculated (it is actually based on the latitude and longitude with the
 altitude integraded to give you coordinates in 3D space).  Calling the
 update() routine in this way causes some trouble with the tile caching because
 the caching is based on distance from the longitude and latitude you specify. 
 
 When the routine was written we were dealing with a single view location and
 an a longitude and latitude that changed gradually, not abruptly.  If you keep
 jumping that around the tile cache starts thrashing a bit (unless the
 locations are reasonably close to each other).  All this said, calling
 update() will give you the readings you are looking for.  Just make sure that
 the current elevation gets set right back to whatever is correct for the
 aircraft (the value returned by scenery-get_cur_elev()), otherwise you'll see
 some other issues come up.
 
 Sometime in the next week or so look for updates to this code that will make
 what you want to do a little easier and fix the numerous bugs in the scenery
 and sky rendering that have come up since the new viewer code was introduced.

I'll be more explicit about what I'm trying to do, and you can tell me
if you want to change your answer:)  I'm working on a car model; the
elevations I want are the elevations under each tire.  The points will
be close together, so there shouldn't be any tile cache probelms, but
I'll have to do the calculation for each tire (and any other point on
the car that could come into contact with the ground) every time step. 
Also, I don't want the point-of-view to change as I'm checking each
potential contact point.  Is update() still the way to go?  Thanks.


___
Flightgear-devel mailing list
[EMAIL PROTECTED]
http://mail.flightgear.org/mailman/listinfo/flightgear-devel



Re: [Flightgear-devel] Current Elevation

2002-05-02 Thread Jim Wilson

Sam Varner [EMAIL PROTECTED] said:

 On Thu, 2002-05-02 at 20:14, Jim Wilson wrote:
  Sam Varner [EMAIL PROTECTED] said:
  
   I want to get the elevation of the ground for points other than my
   current location.  I suppose I could do this by moving to a new
location
   and calling scenery.get_cur_elev().  Is there a better way?  If not,
   what operations will update the output of FGScenery::get_cur_elev() in
   the most efficient way? 
   
  
  That's actually a problem that I'm working on currently.  If you look at
  tilemgr.cxx, the update() function you'll see where the value for
current
  elevation gets set.  What you can do is modify that function to
accept an
  absolute view position vector along with the longitude and latitude
  paramters and pass it along to the hitlist fgCurrentElev call.
  
  Take a look at location.cxx to see how that absolute position
vector is
  calculated (it is actually based on the latitude and longitude with the
  altitude integraded to give you coordinates in 3D space).  Calling the
  update() routine in this way causes some trouble with the tile
caching because
  the caching is based on distance from the longitude and latitude you
specify. 
  
  When the routine was written we were dealing with a single view
location and
  an a longitude and latitude that changed gradually, not abruptly. 
If you keep
  jumping that around the tile cache starts thrashing a bit (unless the
  locations are reasonably close to each other).  All this said, calling
  update() will give you the readings you are looking for.  Just make
sure that
  the current elevation gets set right back to whatever is correct for the
  aircraft (the value returned by scenery-get_cur_elev()), otherwise
you'll see
  some other issues come up.
  
  Sometime in the next week or so look for updates to this code that
will make
  what you want to do a little easier and fix the numerous bugs in the
scenery
  and sky rendering that have come up since the new viewer code was
introduced.
 
 I'll be more explicit about what I'm trying to do, and you can tell me
 if you want to change your answer:)  I'm working on a car model; the
 elevations I want are the elevations under each tire.  The points will
 be close together, so there shouldn't be any tile cache probelms, but
 I'll have to do the calculation for each tire (and any other point on
 the car that could come into contact with the ground) every time step. 
 Also, I don't want the point-of-view to change as I'm checking each
 potential contact point.  Is update() still the way to go?  Thanks.
 

Yes, I think it is.  Just make another version of it for this purpose.  Use
update() to update your car's origin and trigger the tile loads.  Make another
one that's basically the same as update(), minus the tile loader scheduling
(the middle part of the routine) and just have it return the elevation.

Best,

Jim

___
Flightgear-devel mailing list
[EMAIL PROTECTED]
http://mail.flightgear.org/mailman/listinfo/flightgear-devel