j3d.org Code

org.j3d.ui.navigation
Interface HeightDataSource

All Known Subinterfaces:
FreeFormTerrainData, HeightMapGeometry, StaticTerrainData, TerrainData, TiledTerrainData
All Known Implementing Classes:
AbstractFreeFormTerrainData, AbstractStaticTerrainData, AbstractTerrainData, AbstractTiledTerrainData, HeightMapTerrainData, Landscape, ROAMSplitMergeLandscape, SimpleTiledTerrainData

public interface HeightDataSource

A marker interface to indicate that a class can contain direct height information without needing to calculate intersection points.

This interface is used to mark any type of class as being able to provide height information that is useful for terrain following. The typical terrain code will store the data class in the userData section of a Java3D node. When the terrain following code goes looking in the userData, it may find an instance of this interface or the GeometryData to help it speed up the process. In the case of this class, we can perform special case operations that will return height in the local coordinate system Y axis. With a simple height (which may have to be interpolated from the underlying data source), calculations are much easier.

An important caveat must be made here - this class is only applicable for single-sided surfaces, such as terrain. To fetch the height of a sphere using this class is totally meaningless as there are two possible answers and the code does no know which "side" of the sphere to give the height for.

Version:
$Revision: 1.2 $
Author:
Justin Couch

Method Summary
 float getHeight(float x, float z)
          Get the height at the given X,Z coordinate in the local coordinate system.
 

Method Detail

getHeight

float getHeight(float x,
                float z)
Get the height at the given X,Z coordinate in the local coordinate system. Depending on the nature of the underlying data source, this may need to be interpolated (for example, the data is a height grid). If the height is from an area outside of the extents of this geometry which it should never be!) then return Float.NaN.

Parameters:
x - The x coordinate for the height sampling
z - The z coordinate for the height sampling
Returns:
The height at the current point or NaN

j3d.org Code

Latest Info from http://code.j3d.org/
Copyright © 2001 - j3d.org