Re: [Flightgear-devel] Ground elevation problems.

2003-02-10 Thread Jim Wilson
Curtis L. Olson [EMAIL PROTECTED] said:

 Ground elevation problems ... 
 
 I'm starting at KHAF (because it illustrates the problem pretty well.)
 I'm using the A4, but the problem is with any aircraft.
 

Below is the fix for that bug.  It's just a one line change.  My apologies if
this mailer screws up the line feeds!

Also note that at some point whoever was working on optimizing the
FGTileMgr::Update also removed the bucket field from the FGLocation class. 
This results in more calls to the tile scheduler.  Not a big deal, but some
wasted cpu effort that could matter in certain situations.

Best,

Jim


Index: Scenery/tilemgr.cxx
===
RCS file: /var/cvs/FlightGear-0.9/FlightGear/src/Scenery/tilemgr.cxx,v
retrieving revision 1.12
diff -u -r1.12 tilemgr.cxx
--- Scenery/tilemgr.cxx 10 Dec 2002 20:50:52 -  1.12
+++ Scenery/tilemgr.cxx 10 Feb 2003 12:47:08 -
@@ -407,7 +407,7 @@
 if ( longitude != last_longitude || latitude != last_latitude ) {
 // update current elevation...
 if ( updateCurrentElevAtPos( abs_pos_vector,
- globals-get_scenery()-get_center() ) )
+globals-get_scenery()-get_next_center() ) )
 {
 last_longitude = longitude;
 last_latitude = latitude;


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



Re: [Flightgear-devel] Ground elevation at an arbitrary point

2002-12-16 Thread David Luff
On 12/16/02 at 12:07 PM David Luff wrote:
Some time ago (Sept/Oct) there was a long discussion about getting the
ground elevation at an arbitrary point which left me very confused after
reading it and didn't seem to come to any definate conclusion.  What is
the
situation at the moment?  Is there a function like

double GetGroundElev(Point3D lat_and_lon_of_somewhere)

anywhere which will return the ground elev if the appropriate tile is
already loaded and a distinctive value (-?) if the tile is not loaded?


Well, the fgCurrentElev(...) functions in hitlist.[ch]xx look promising,
but I might need a bit of help figuring out how to use them:

// Associated functions, assuming a wgs84 world with 0,0,0 at the
// center, find the current terrain intersection elevation for the
// point specified.
bool fgCurrentElev( sgdVec3 abs_view_pos,
sgdVec3 scenery_center,
ssgTransform *terra_transform,
FGHitList *hit_list,
double *terrain_elev,
double *radius,
double *normal );

bool fgCurrentElev( sgdVec3 abs_view_pos,
sgdVec3 scenery_center,
FGHitList *hit_list,
double *terrain_elev,
double *radius,
double *normal );

What does the scenery_center refer to?  Is this the exact location at which
I receive the terrain_elev, or the center of the tile?  What is the
abs_view_pos?  Is this perhaps the point at which we get the elev, or is
this the direction vector in which we are looking?  What is the hit_list
and can I ignore it - ie. just use a local one and discard it, eg:

{
FGHitList tempHitList;
bool haveIntersection = fgCurrentElev( ..., ..., tempHitList, ...,
..., ...);
}

or do I need to pay more attention to it?  Lastly, what do the radius and
normal refer to - bounding sphere and normal of the specific intersected
polygon perhaps?
Sorry for all the questions at once - this is all a bit daunting to me and
I haven't poked my head into the 3D bits of Flightgear for a while.

Cheers - Dave


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



Re: [Flightgear-devel] Ground elevation at an arbitrary point

2002-12-16 Thread Jim Wilson
David Luff [EMAIL PROTECTED] said:

 
 What does the scenery_center refer to?  Is this the exact location at which
 I receive the terrain_elev, or the center of the tile?
Neither actually, but it is a tile center.  It is usually the center of the
tile that the aircraft is currently located over.  You're query location needs
to be reasonably close to the scenery_center to get a good elevation. 
Depending on what you are doing (e.g. placing buildings) the the current FDM
scenery_center is probably good enough.

Take a look at the code under Tile Manager Updates to approx line 1200 in
main.cxx, to see how the query works.  Note that prep_ssg_nodes needs to be
run to reallign the scenery vertices if you change the scenery center, before
doing a query.

 What is the abs_view_pos?
This is where you are.  If I recall this is in geocentric coordinates.  Same
units as the scenery_center.

 or do I need to pay more attention to it?  Lastly, what do the radius and
 normal refer to - bounding sphere and normal of the specific intersected
 polygon perhaps?
IIRC the normal would be the straight down vector to the intersecting ground
polygon.  

It seems to me that Norman recently made some changes that simplified what you
are trying to do.  Not sure if they are in CVS or not.

There's a good chance you can use the same technique I used (see that main.cxx
reference) depending on what you want to do.  Just heed the comment 
around line 1227...the view location update/query needs to be done last before
the rendering.

Best,

Jim

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



Re: [Flightgear-devel] Ground elevation at an arbitrary point

2002-12-16 Thread David Luff
On 12/16/02 at 3:10 PM Jim Wilson wrote:

David Luff [EMAIL PROTECTED] said:

 
 What does the scenery_center refer to?  Is this the exact location at
which
 I receive the terrain_elev, or the center of the tile?
Neither actually, but it is a tile center.  It is usually the center of
the
tile that the aircraft is currently located over.  You're query location
needs
to be reasonably close to the scenery_center to get a good elevation. 
Depending on what you are doing (e.g. placing buildings) the the current
FDM
scenery_center is probably good enough.

It's for the AI plane during taxiing and takeoff/landing run.  In order to
generate realistic radio traffic these may need to exist some distance from
the fdm, but I guess that the rendering accuracy required decreases the
further they are from the user.  Going under the ground is not an option
though if they are within sight of the user, unlike a building which may
simply become less tall.


Take a look at the code under Tile Manager Updates to approx line 1200
in
main.cxx, to see how the query works.  Note that prep_ssg_nodes needs to
be
run to reallign the scenery vertices if you change the scenery center,
before
doing a query.

OK, I think I see what you're doing - changing the scenery center to the
point of interest and then changing it back again when done.  How expensive
is this operation in the scheme of things - I see you do it every frame if
the view location is different so I presume it can't be too bad?


 What is the abs_view_pos?
This is where you are.  If I recall this is in geocentric coordinates. 
Same
units as the scenery_center.

 or do I need to pay more attention to it?  Lastly, what do the radius
and
 normal refer to - bounding sphere and normal of the specific intersected
 polygon perhaps?
IIRC the normal would be the straight down vector to the intersecting
ground
polygon.  

It seems to me that Norman recently made some changes that simplified what
you
are trying to do.  Not sure if they are in CVS or not.

There's a good chance you can use the same technique I used (see that
main.cxx
reference) depending on what you want to do.  Just heed the comment 
around line 1227...the view location update/query needs to be done last
before
the rendering.


Thanks for the reply - I'll give it a go roughly along the lines of what
you've done and see what happens!

Cheers - Dave



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



RE: [Flightgear-devel] Ground Elevation

2002-04-16 Thread Norman Vine

Sam Varner writes:

How can I get the ground elevation and normal vector for a particular
longitude and latitude?

See Scenery / hitlist / hitlist.cxx / fgCurrentElev() 

Note this is very likely to change,  but the API should stay
the same

These are available for the current FDM in the global Scenery
instantiation  see Scenery / scenery.hxx

Cheers

Norman


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



Re: [Flightgear-devel] Ground Elevation

2002-04-16 Thread jj

Hi Sam:

Not sure about the normal vector you mention, but as far as the ground
elevation you can get that off of the charts (maps) provided by the
U.S.G.S.

For some areas there are CD ROMS available with (for example all the
state of California as 7.5 min topo maps.  The one that I have is from
the National Geographic Society.  (see http://www,topo.com  for a very
nice program!  I use that program with FlightGear acting as a GPS
reciever to get the airplane (simulator)  location overlayed on the
chart.  A moving map display!!).

jj

Sam Varner wrote:

 How can I get the ground elevation and normal vector for a particular
 longitude and latitude?

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


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



Re: [Flightgear-devel] Ground Elevation

2002-04-16 Thread jj

OOPS, had a typo in that link. (a , vice a .).

Here's a better one anyway:
http://maps.nationalgeographic.com/topo/gps.cfm

jj

jj wrote:

 snip
   The one that I have is from the National Geographic Society.  (see
 http://www,topo.com
 snip


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



RE: [Flightgear-devel] Ground Elevation

2002-04-16 Thread Sam Varner

On Tue, 2002-04-16 at 08:49, Norman Vine wrote:
 These are available for the current FDM in the global Scenery
 instantiation  see Scenery / scenery.hxx

This looks like what I need.  (Thanks for your reply too, jj.  I'm
always up for cool map stuf:)  One problem, I see a set_cur_normal(),
but I don't see a get method.  Am I missing something?


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