How do you determine terrain elevation (Y coord)?

How do you determine terrain elevation (Y coord)?

Post by Frank De » Tue, 19 Mar 1996 04:00:00



Has anyone developed a fast algorithm, or know of an
OpenInventor function to determine terrain elevation (Y coord)
given X and Z coords?  Or, has anyone developed a terrain
following algorithm using OpenInventor?

I am trying to determine the elevation (the Y coordinate) of
particular points in my terrain database at run-time.  I would
like to have tanks, etc. drive over the database and pitch and
roll accordingly to the changes in elevation.  To do this I
need to know the elevation of the terrain under the tank.

If possible, I would like to avoid searching the entire scene
graph for the polygon under the tank and determining elevation
from there.

My first thought was to use the SoRayPickAction to determine
the elevation.  I would like to cast the ray through to tank
and have it determine the objects below it.  However, I
believe SoRayPickAction uses the viewport and camera positions
which is not what I want.  Any ideas???

Thanks for any help or suggestions.

Wm. Frank Dea
--
Research Engineer
Southwest Research Institute (SwRI)
San Antonio, TX

 
 
 

How do you determine terrain elevation (Y coord)?

Post by Theodore W. Hal » Wed, 20 Mar 1996 04:00:00



> My first thought was to use the SoRayPickAction to determine
> the elevation.  I would like to cast the ray through to tank
> and have it determine the objects below it.  However, I
> believe SoRayPickAction uses the viewport and camera positions
> which is not what I want.  Any ideas???

Assuming that there are no caverns in your terrain, and that all
of the elevations are greater than or equal to zero:

   start     = SbVec3f (tank_x, 0., tank_z) ;
   direction = SbVec3f (0., 1., 0.) ;
   near      =  0. ;
   far       = -1 ;
   SoRayPickAction::setRay (start, direction, near, far) ;

Quote:> If possible, I would like to avoid searching the entire scene
> graph for the polygon under the tank and determining elevation
> from there.

That depends on what you apply the action to.

   SoAction::apply()

--
Ted Hall                                       ^
Department of Architecture                    '-`
Chinese University of Hong Kong             '- - -`
Sha Tin, New Territories                 '- - - - - -`
HONG KONG                           \'- - - - - - - - - -`/

 
 
 

1. Determining Z-Coord in Ray Casting

I've been trying to work out some of the ray-casting stuff by hand in
order to implement a quasi-3D view (ala Doom, Wolf3D, etc).  Supposing
you have a wall defined by two points.  If you shoot a ray it is simple
to determine where the ray would intersect the wall.  But how do you know
if the ray strikes above or below the wall without resorting to 3D?  I
was thinking it had to be a function of the distance the ray travelled to
get to the wall.

On the same subject, does anyone know how to narrow down which wall
segments to check so each ray doesn't have to check them all?

Actually, another question is, is there some simple way of knowing
whether the intersection of two lines occurs within a segment of one of
the lines without resorting to four comparisions?  That is, something
other than
     if(Px > Wx1 && Px < Wx2 && Py > Wy1 && Py < Wy2)
In fact, this presupposes that Wx1<Wx2 and Wy1<Wy2 in the first place.
(Px,y=Intersection Point, Wx1,y1 and Wx2,y2 are the wall's endpoints)

Anyway, any ideas would be appreciated.

Alex

2. HIGHEND::3D

3. Terrain elevation software?

4. animating water?? newbie

5. Terrain Elevation Data

6. HELP Win 32s error

7. Question about doing a hillshade will elevation data

8. Having troubles making FLI's

9. Doing refreshes while reading elevation data

10. Showing Elevation - Using false colors to show elevation

11. User coord to world coord transform?

12. Newbie: World coord --> Camera coord

13. mouse coord to object coord