vtdata library
Public Member Functions | Public Attributes | Protected Member Functions | Protected Attributes | List of all members
vtHeightField3d Class Referenceabstract
Inheritance diagram for vtHeightField3d:
Inheritance graph
[legend]

Public Member Functions

void Initialize (const LinearUnits units, const DRECT &earthextents, float fMinHeight, float fMaxHeight)
 
virtual void SetEarthExtents (const DRECT &ext)
 
virtual bool FindAltitudeAtPoint (const FPoint3 &p3, float &fAltitude, bool bTrue=false, int iCultureFlags=0, FPoint3 *vNormal=NULL) const =0
 
virtual bool CastRayToSurface (const FPoint3 &point, const FPoint3 &dir, FPoint3 &result) const =0
 Find the intersection point of a ray with the heightfield.
 
int PointIsAboveTerrain (const FPoint3 &p) const
 
bool ConvertEarthToSurfacePoint (const DPoint2 &epos, FPoint3 &p3, int iCultureFlags=0, bool bTrue=false) const
 
bool ContainsWorldPoint (float x, float z) const
 
void GetCenter (FPoint3 &center) const
 
void SetCulture (CultureExtension *ext)
 
float LineOnSurface (const DLine2 &line, float fSpacing, float fOffset, bool bInterp, bool bCurve, bool bTrue, FLine3 &output)
 
- Public Member Functions inherited from vtHeightField
void Initialize (const DRECT &extents, float fMinHeight, float fMaxHeight)
 
virtual bool FindAltitudeOnEarth (const DPoint2 &p, float &fAltitude, bool bTrue=false) const =0
 
bool ContainsEarthPoint (const DPoint2 &p, bool bInclusive=false) const
 
DRECTGetEarthExtents ()
 
const DRECTGetEarthExtents () const
 
void GetHeightExtents (float &fMinHeight, float &fMaxHeight) const
 

Public Attributes

FRECT m_WorldExtents
 
LocalCS m_LocalCS
 

Protected Member Functions

void UpdateWorldExtents ()
 

Protected Attributes

float m_fDiagonalLength
 
CultureExtension * m_pCulture
 
- Protected Attributes inherited from vtHeightField
float m_fMinHeight
 
float m_fMaxHeight
 
DRECT m_EarthExtents
 

Detailed Description

This class extents vtHeightField with the abilty to operate in 'world' coordinates, that is, an artificial meters-based 3D coordinate system which is much better suited for many tasks than trying to operate directly on the raw 2D 'earth' coordinates.

Member Function Documentation

bool vtHeightField3d::ContainsWorldPoint ( float  x,
float  z 
) const

Tests whether a given point is within the current terrain

bool vtHeightField3d::ConvertEarthToSurfacePoint ( const DPoint2 epos,
FPoint3 p3,
int  iCultureFlags = 0,
bool  bTrue = false 
) const

Converts a earth coordinate (project or geographic) to a world coordinate on the surface of the heightfield.

Returns
true if successful, false if there was no elevation at that point.
virtual bool vtHeightField3d::FindAltitudeAtPoint ( const FPoint3 p3,
float &  fAltitude,
bool  bTrue = false,
int  iCultureFlags = 0,
FPoint3 vNormal = NULL 
) const
pure virtual

Given a point in world coordinates, determine the elevation at that point.

Parameters
p3The point to test. Only the X and Z values are used.
fAltitudeThe resulting elevation at that point, by reference.
bTrueTrue to test true elevation. False to test the displayed elevation (possibly exaggerated.)
iCultureFlagsPass 0 to test only the heightfield itself, non-zero to test any culture objects which may be sitting on the heightfield. Values include:
  • CE_STRUCTURES Test structures on the ground.
  • CE_ROADS Test roads on the ground.
  • CE_ALL Test everything on the ground.
vNormalIf you supply a pointer to a vector, it will be set to the upward-pointing surface normal at the ground point.
Returns
true if successful, false if there was nothing found at that point.

Implemented in vtElevationGrid, and vtTin.

float vtHeightField3d::LineOnSurface ( const DLine2 line,
float  fSpacing,
float  fOffset,
bool  bInterp,
bool  bCurve,
bool  bTrue,
FLine3 output 
)

Create a set of points on the heightfield for a 2D polyline by draping the point onto the surface.

Parameters
lineThe 2D line to drape, in Earth coordinates.
fSpacingThe approximate spacing of the surface tessellation, used to decide how finely to tessellate the line.
fOffsetAn offset to elevate each point in the resulting geometry, useful for keeping it visibly above the ground.
bInterpTrue to interpolate between the vertices of the input line. This is generally desirable when the ground is much more finely spaced than the input line.
bCurveTrue to interpret the vertices of the input line as control points of a curve. The created geometry will consist of a draped line which passes through the control points.
bTrueTrue to use the true elevation of the terrain, ignoring whatever scale factor is being used to exaggerate elevation for display.
outputReceived the points.
Returns
The approximate length of the resulting 3D polyline.
int vtHeightField3d::PointIsAboveTerrain ( const FPoint3 p) const
Returns
0 if below terrain, 1 if above terrain, -1 if off terrain.
void vtHeightField3d::SetEarthExtents ( const DRECT ext)
virtual

Set the geographic extents of the grid.

Reimplemented from vtHeightField.

Reimplemented in vtHeightFieldGrid3d.