VR-Forces Developer's Guide
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
List of all members | Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | Static Protected Attributes | Private Member Functions
DtTerrainReasoner Class Reference

Public Types

typedef DtTerrainReasoner *(* DtTerrainReasonerCreatorFcn )(DtPhysicalWorld &physicalWorld)
 

Public Member Functions

virtual ~DtTerrainReasoner ()
 
bool findHilltopsInArea (const DtLocalVertexList &areaVertices, double gridResolutionMeters, double prominenceMeters, double prominenceRangeMeters, vector< DtVector > &foundHilltopsLocal, string *queryString=NULL, string *problemDescription=NULL)
 
bool findPositionGroup (const DtLocalVertexList &targetsAreaVertices, unsigned int targetsAreaSampleCount, double targetsHeightMeters, double viewHeightMeters, double coverHeightMeters, const DtVector &pivotLocal, double forwardRangeMeters, double backwardRangeMeters, double lateralRangeMeters, double verticalIntervalMeters, double maxSlopeDegrees, double lateralIntervalMeters, double positionsLateralSpacingMeters, unsigned int positionsCount, vector< DtViewCoverPosition > &foundPositions, string *queryString=NULL, string *problemDescription=NULL)
 
bool findPosition (const DtLocalVertexList &targetsAreaVertices, unsigned int targetsAreaSampleCount, double targetsHeightMeters, double viewHeightMeters, double coverHeightMeters, const DtVector &pivotLocal, double forwardRangeMeters, double backwardRangeMeters, double verticalIntervalMeters, double maxSlopeDegrees, DtViewCoverPosition &foundPosition, string *queryString=NULL, string *problemDescription=NULL)
 
bool findPositionGroupsInArea (const DtLocalVertexList &searchAreaVertices, double gridResolutionMeters, double prominenceMeters, double prominenceRangeMeters, const DtLocalVertexList &targetsAreaVertices, unsigned int targetsAreaSampleCount, double targetsHeightMeters, double viewHeightMeters, double coverHeightMeters, double forwardRangeMeters, double backwardRangeMeters, double lateralRangeMeters, double verticalIntervalMeters, double maxSlopeDegrees, double lateralIntervalMeters, double positionsLateralSpacingMeters, unsigned int positionsCount, vector< DtViewCoverPositionGroup > &foundPositionGroups, string *queryString=NULL, string *problemDescription=NULL)
 
bool findRidgedPositionGroupsInArea (const DtLocalVertexList &searchAreaVertices, const DtLocalVertexList &targetsAreaVertices, unsigned int targetsAreaSampleCount, double targetsHeightMeters, double viewHeightMeters, double coverHeightMeters, double coverRangeMeters, double lateralRangeMeters, double lateralIntervalMeters, double verticalRangeMeters, double verticalIntervalMeters, double maxSlopeDegrees, double positionsLateralSpacingMeters, unsigned int positionsCount, vector< DtViewCoverPositionGroup > &foundPositionGroups, string *queryString=NULL, string *problemDescription=NULL)
 

Static Public Member Functions

static DtTerrainReasonerinstance ()
 
static DtTerrainReasonercreateInstance (DtPhysicalWorld &physicalWorld)
 
static DtTerrainReasonercreator (DtPhysicalWorld &physicalWorld)
 

Protected Member Functions

 DtTerrainReasoner (DtPhysicalWorld &physicalWorld)
 
 DtTerrainReasoner (const DtTerrainReasoner &other)
 
DtTerrainReasoneroperator= (const DtTerrainReasoner &other)
 

Protected Attributes

DtPhysicalWorldmyPhysicalWorld
 

Static Protected Attributes

static DtTerrainReasonerCreatorFcn TheCreatorFcn
 
static DtTerrainReasonerTheInstance
 

Private Member Functions

void findPositionGroupWithHostQuery (const DtLocalVertexList &targetsAreaVertices, unsigned int targetsAreaSampleCount, double targetsHeightMeters, double viewHeightMeters, double coverHeightMeters, const DtVector &pivotLocal, unsigned int forwardRangeMeters, unsigned int backwardRangeMeters, unsigned int lateralRangeMeters, unsigned int verticalIntervalMeters, double maxSlopeDegrees, unsigned int lateralIntervalMeters, unsigned int positionsLateralSpacingMeters, unsigned int positionsCount, DtHostQueryImplementation &hostQuery, vector< DtViewCoverPosition > &foundPositions)
 
void BuildHeightGrid (double fromX, double fromY, double toX, double toY, int intervalMeters, const DtHostQueryImplementation &hostQuery, DtIntMatrix &grid)
 
void CovertToArea (const DtLocalVertexList &areaVertices, DtHostQueryImplementation &hostQuery, DtArea &area)
 
bool ValidateNoOverlap (string functionName, const DtArea &searchArea, const DtArea &targetArea, string *problemDescription)
 
string ValidationMessage (string functionName, bool isError, string offendingParameterName, double offendingParameterValue, string description)
 
string ValidationMessage (string functionName, bool isError, string offendingParameterName, string description)
 
bool ValidateAreaVertices (string functionName, const DtLocalVertexList &areaVertices, string name, string *problemDescription)
 
bool ValidateGreaterThanZero (string functionName, double value, string name, string *problemDescription)
 
bool ValidateLessThan (string functionName, double value, string name, double refValue, string refName, string *problemDescription)
 
bool ValidateNotLessThan (string functionName, double value, string name, double refValue, string refName, string *problemDescription, bool isError=true)
 
bool ValidateGreaterThan (string functionName, double value, string name, double refValue, string refName, string *problemDescription)
 
bool ValidateNotGreaterThan (string functionName, double value, string name, double refValue, string refName, string *problemDescription, bool isError=true)
 
bool ValidateLocatedOutside (string functionName, const DtArea &targetsArea, const DtTopoPoint &pt, string *problemDescription)
 
bool ValidateCoverNotLessThanView (string functionName, double coverHeightMeters, double viewHeightMeters, string *problemDescription)
 

Member Typedef Documentation

typedef DtTerrainReasoner*(* DtTerrainReasoner::DtTerrainReasonerCreatorFcn)(DtPhysicalWorld &physicalWorld)

Constructor & Destructor Documentation

DtTerrainReasoner::DtTerrainReasoner ( DtPhysicalWorld physicalWorld)
explicitprotected
DtTerrainReasoner::DtTerrainReasoner ( const DtTerrainReasoner other)
protected

Not Implemented.

virtual DtTerrainReasoner::~DtTerrainReasoner ( )
virtual

Member Function Documentation

DtTerrainReasoner& DtTerrainReasoner::operator= ( const DtTerrainReasoner other)
protected

Not Implemented.

static DtTerrainReasoner* DtTerrainReasoner::instance ( )
static

Returns the singleton instance of this class.

static DtTerrainReasoner* DtTerrainReasoner::createInstance ( DtPhysicalWorld physicalWorld)
static

Creates, sets and returns the singleton instance of this class.

static DtTerrainReasoner* DtTerrainReasoner::creator ( DtPhysicalWorld physicalWorld)
static

Creator of type DtTerrainReasoner.

bool DtTerrainReasoner::findHilltopsInArea ( const DtLocalVertexList areaVertices,
double  gridResolutionMeters,
double  prominenceMeters,
double  prominenceRangeMeters,
vector< DtVector > &  foundHilltopsLocal,
string *  queryString = NULL,
string *  problemDescription = NULL 
)

Finds all local hilltops (peaks) in a specified area. The locality of a hilltop is defined as a circle whose radius is the specified prominenceRangeMeters.

A local hilltop is a point that is not lower than any point in its locality AND higher than the avarage height of its locality, by prominenceMeters at least.

The search is performed over a grid of the specified gridResolutionMeters. This means that a returned hilltop is not necessarily higher than nearby points that reside between grid points.

Return value indicates success (true) or failure (false). The cause of failure is described by problemDescription output parameter. Result (out) parameter must not be used in case of failure.

Parameters
areaVerticesThe area to search in.
gridResolutionMetersThe distance between adjacent grid points.
prominenceMetersMinimal height advantage over locality avarage height required for qualifying as a hilltop.
prominenceRangeMetersRadius of locality circle.
[out]foundHilltopsLocalFound hilltops in no particular order. May be empty.
[out]queryStringA JSON string containing all input parameter values as received in this call. It may be used by Terrain Reasoner test harness to reproduce the call for debug purposes.
[out]problemDescriptionDescription of a problem identified by the function, mostly related to bad/conflicting input parameters. Note that problemDescription may also be present when return value is true (success), indicating a problem that is merely a warning, allowing a result to be returned.
bool DtTerrainReasoner::findPositionGroup ( const DtLocalVertexList targetsAreaVertices,
unsigned int  targetsAreaSampleCount,
double  targetsHeightMeters,
double  viewHeightMeters,
double  coverHeightMeters,
const DtVector &  pivotLocal,
double  forwardRangeMeters,
double  backwardRangeMeters,
double  lateralRangeMeters,
double  verticalIntervalMeters,
double  maxSlopeDegrees,
double  lateralIntervalMeters,
double  positionsLateralSpacingMeters,
unsigned int  positionsCount,
vector< DtViewCoverPosition > &  foundPositions,
string *  queryString = NULL,
string *  problemDescription = NULL 
)

Finds a group of positions in a rectangular area, optimizing both view and cover relative to a specified targets area. Each position in the group consists of two points:

  • a forward view point - in which line-of-sight to the targets area is maximized.
  • a rear cover point - in which line-of-fire exposure to the targets area is minimized.

Return value indicates success (true) or failure (false). The cause of failure is described by problemDescription output parameter. Result (out) parameter must not be used in case of failure.

Parameters
targetsAreaVerticesThe area to maximize view and cover against.
targetsAreaSampleCountNumber of points in targets srea (approx.) to use as a sample for checking line-of-sight (for view) and line-of-fire (for cover) against.
targetsHeightMetersHeight above ground of targets in targets area - to check line-of-sight and line-of-fire against.
viewHeightMetersHeight above ground of view point (e.g. main gun).
coverHeightMetersHeight above ground of cover point (e.g. turret top
  • tank commander's head).
pivotLocalCenter of positions search area (effectively a rectangle).
forwardRangeMetersMax distance to move forward from pivotLocal (towards targets area), when searching for view/cover points.
backwardRangeMetersMax distance to move backward from pivotLocal (away from targets area), when searching for view/cover points.
lateralRangeMetersDistance to both left and right of pivotLocal in which the search is performed (e.g. 100m means an overall lateral search along a 200m front).
verticalIntervalMetersFrontal distance between examined points when searching for view/cover along a single line.
maxSlopeDegreesAbsolute value (value between 0.0 - 90.0) of maximum alowed slope along the line connecting view point and cover point.
lateralIntervalMetersLateral distance between examined lines (density of comb).
positionsLateralSpacingMetersMinimal allowed lateral distance between adjacent positions in the group.
positionsCountNumber of required positions in the group.
[out]foundPositionsThe group of found positions ordered left to right (facing the specified targets area). Size is positionsCount.
[out]queryStringA JSON string containing all input parameter values as received in this call. It may be used by Terrain Reasoner test harness to reproduce the call for debug purposes.
[out]problemDescriptionDescription of a problem identified by the function, mostly related to bad/conflicting input parameters. Note that problemDescription may also be present when return value is true (success), indicating a problem that is merely a warning, allowing a result to be returned.
bool DtTerrainReasoner::findPosition ( const DtLocalVertexList targetsAreaVertices,
unsigned int  targetsAreaSampleCount,
double  targetsHeightMeters,
double  viewHeightMeters,
double  coverHeightMeters,
const DtVector &  pivotLocal,
double  forwardRangeMeters,
double  backwardRangeMeters,
double  verticalIntervalMeters,
double  maxSlopeDegrees,
DtViewCoverPosition foundPosition,
string *  queryString = NULL,
string *  problemDescription = NULL 
)

Finds a position along a line, optimizing both view and cover relative to a specified targets area. The position consists of two points:

  • a forward view point - in which line-of-sight to the targets area is maximized.
  • a rear cover point - in which line-of-fire exposure to the targets area is minimized.

The line along which the search is performed is defined by a pivot point, a forward range and a backward range. The line is oriented towards the center of the specified targets area.

Return value indicates success (true) or failure (false). The cause of failure is described by problemDescription output parameter. Result (out) parameter must not be used in case of failure.

Parameters
targetsAreaVerticesThe area to maximize view and cover against.
targetsAreaSampleCountNumber of points in targets srea (approx.) to use as a sample for checking line-of-sight (for view) and line-of-fire (for cover) against.
targetsHeightMetersHeight above ground of targets in targets area - to check line-of-sight and line-of-fire against.
viewHeightMetersHeight above ground of view point (e.g. main gun).
coverHeightMetersHeight above ground of cover point (e.g. turret top
  • tank commander's head).
pivotLocalThe search is performed along a line connecting this point with the center of the specified targets area polygon.
forwardRangeMetersMax distance to move forward from pivotLocal (towards targets area), when searching for view/cover points.
backwardRangeMetersMax distance to move backward from pivotLocal (away from targets area), when searching for view/cover points.
verticalIntervalMetersDistance between examined points when searching for view/cover along the line.
maxSlopeDegreesAbsolute value (value between 0.0 - 90.0) of maximum alowed slope along the line connecting view point and cover point.
[out]foundPositionthe found position.
[out]queryStringA JSON string containing all input parameter values as received in this call. It may be used by Terrain Reasoner test harness to reproduce the call for debug purposes.
[out]problemDescriptionDescription of a problem identified by the function, mostly related to bad/conflicting input parameters. Note that problemDescription may also be present when return value is true (success), indicating a problem that is merely a warning, allowing a result to be returned.
bool DtTerrainReasoner::findPositionGroupsInArea ( const DtLocalVertexList searchAreaVertices,
double  gridResolutionMeters,
double  prominenceMeters,
double  prominenceRangeMeters,
const DtLocalVertexList targetsAreaVertices,
unsigned int  targetsAreaSampleCount,
double  targetsHeightMeters,
double  viewHeightMeters,
double  coverHeightMeters,
double  forwardRangeMeters,
double  backwardRangeMeters,
double  lateralRangeMeters,
double  verticalIntervalMeters,
double  maxSlopeDegrees,
double  lateralIntervalMeters,
double  positionsLateralSpacingMeters,
unsigned int  positionsCount,
vector< DtViewCoverPositionGroup > &  foundPositionGroups,
string *  queryString = NULL,
string *  problemDescription = NULL 
)

Finds multiple position groups using findPositionGroup, in a specified area. Each position group is based on a separate hilltop that is found using findHilltopsInArea.

Note that positions from diferent groups may overlap if hilltops are relatively close to each other. Potential for overlapping depends on the ratio between prominenceRangeMeters (defining minimal distance between hilltops) and the dimensions of the rectangle used for searching positions around each hilltop, as defined by forwardRangeMeters, backwardRangeMeters and lateralRangeMeters.

Return value indicates success (true) or failure (false). The cause of failure is described by problemDescription output parameter. Result (out) parameter must not be used in case of failure.

Parameters
areaVerticesThe area to search in.
gridResolutionMetersThe distance between adjacent grid points used for searching hilltops.
prominenceMetersMinimal height advantage over locality avarage height required for qualifying as a hilltop.
prominenceRangeMetersRadius of locality circle defining a hilltop.
targetsAreaVerticesThe area to maximize view and cover against.
targetsAreaSampleCountNumber of points in targets srea (approx.) to use as a sample for checking line-of-sight (for view) and line-of-fire (for cover) against.
targetsHeightMetersHeight above ground of targets in targets area - to check line-of-sight and line-of-fire against.
viewHeightMetersHeight above ground of view point (e.g. main gun).
coverHeightMetersHeight above ground of cover point (e.g. turret top
  • tank commander's head).
forwardRangeMetersMax distance to move forward from each hilltop when searching for view/cover points of the corresponding position group.
backwardRangeMetersMax distance to move backward from each hilltop when searching for view/cover points of the corresponding position group.
lateralRangeMetersDistance to both left and right of each hilltop in which the search for the corresponding position group is performed (e.g. 100m means an overall lateral search along a 200m front).
verticalIntervalMetersFrontal distance between examined points when searching for view/cover along a single position line.
maxSlopeDegreesAbsolute value (value between 0.0 - 90.0) of maximum alowed slope along the line connecting view point and cover point.
lateralIntervalMetersLateral distance between examined positions/lines (density of comb).
positionsLateralSpacingMetersMinimal allowed lateral distance between adjacent positions in each group.
positionsCountNumber of required positions in each position group.
[out]foundPositionGroupsThe collection of found position groups, ordered by decreasing overallPctAvg value. May be empty of the specified area contains no hilltops.
[out]queryStringA JSON string containing all input parameter values as received in this call. It may be used by Terrain Reasoner test harness to reproduce the call for debug purposes.
[out]problemDescriptionDescription of a problem identified by the function, mostly related to bad/conflicting input parameters. Note that problemDescription may also be present when return value is true (success), indicating a problem that is merely a warning, allowing a result to be returned.
bool DtTerrainReasoner::findRidgedPositionGroupsInArea ( const DtLocalVertexList searchAreaVertices,
const DtLocalVertexList targetsAreaVertices,
unsigned int  targetsAreaSampleCount,
double  targetsHeightMeters,
double  viewHeightMeters,
double  coverHeightMeters,
double  coverRangeMeters,
double  lateralRangeMeters,
double  lateralIntervalMeters,
double  verticalRangeMeters,
double  verticalIntervalMeters,
double  maxSlopeDegrees,
double  positionsLateralSpacingMeters,
unsigned int  positionsCount,
vector< DtViewCoverPositionGroup > &  foundPositionGroups,
string *  queryString = NULL,
string *  problemDescription = NULL 
)

Finds multiple position groups using findPositionGroup, in a specified area. Rather than using hilltops as anchors for position groups (as with findPositionGroupsInArea), each position group is based on a cluster of closely located potential positions that are heuristically searched for along ridge lines, using elevation data only.

A cluster is a rectangular area whose dimensions are limited by the specified veticalRangeMeters (depth) and lateralRangeMeters (width). The findPositionGroup service (using true line-of-sight checks) is applied to each rectangle [of a cluster] recognized by the heuristic stage that is sufficiently wide (not less than (positionsCount - 1) * positionsLateralSpacingMeters).

Return value indicates success (true) or failure (false). The cause of failure is described by problemDescription output parameter. Result (out) parameter must not be used in case of failure.

Parameters
searchAreaVerticesThe area to search in.
targetsAreaVerticesThe area to maximize view and cover against.
targetsAreaSampleCountNumber of points in targets srea (approx.) to use as a sample for checking line-of-sight (for view) and line-of-fire (for cover) against.
targetsHeightMetersHeight above ground of targets in targets area - to check line-of-sight and line-of-fire against.
viewHeightMetersHeight above ground of view point (e.g. main gun).
coverHeightMetersHeight above ground of cover point (e.g. turret top
  • tank commander's head).
coverRangeMetersmaximal vertical distance between view point and cover point of a potential position. Note that potential positions are only used heuristically for finding clusters. Actual returned positions are not subject to this limitation and are effectively limited only by vericalRangeMeters.
lateralRangeMetersmaximal width of a rectangular cluster, in which the search for a corresponding position group is performed.
lateralIntervalMetersLateral distance between examined positions/lines (density of comb). The distance applies to the farthest point (from targets area) of the specified search area.
verticalRangeMetersmaximal depth of a rectangular cluster, in which the search for a corresponding position group is performed.
verticalIntervalMetersFrontal distance between examined points when searching for view/cover along a single position line.
maxSlopeDegreesAbsolute value (value between 0.0 - 90.0) of maximum alowed slope along the line connecting view point and cover point.
positionsLateralSpacingMetersMinimal allowed lateral distance between adjacent positions in each group.
positionsCountNumber of required positions in each position group.
[out]foundPositionGroupsThe collection of found position groups, ordered by decreasing overallPctAvg value. May be empty of the specified area contains no hilltops.
[out]queryStringA JSON string containing all input parameter values as received in this call. It may be used by Terrain Reasoner test harness to reproduce the call for debug purposes.
[out]problemDescriptionDescription of a problem identified by the function, mostly related to bad/conflicting input parameters. Note that problemDescription may also be present when return value is true (success), indicating a problem that is merely a warning, allowing a result to be returned.
void DtTerrainReasoner::findPositionGroupWithHostQuery ( const DtLocalVertexList targetsAreaVertices,
unsigned int  targetsAreaSampleCount,
double  targetsHeightMeters,
double  viewHeightMeters,
double  coverHeightMeters,
const DtVector &  pivotLocal,
unsigned int  forwardRangeMeters,
unsigned int  backwardRangeMeters,
unsigned int  lateralRangeMeters,
unsigned int  verticalIntervalMeters,
double  maxSlopeDegrees,
unsigned int  lateralIntervalMeters,
unsigned int  positionsLateralSpacingMeters,
unsigned int  positionsCount,
DtHostQueryImplementation hostQuery,
vector< DtViewCoverPosition > &  foundPositions 
)
private
void DtTerrainReasoner::BuildHeightGrid ( double  fromX,
double  fromY,
double  toX,
double  toY,
int  intervalMeters,
const DtHostQueryImplementation hostQuery,
DtIntMatrix grid 
)
private
void DtTerrainReasoner::CovertToArea ( const DtLocalVertexList areaVertices,
DtHostQueryImplementation hostQuery,
DtArea area 
)
private
bool DtTerrainReasoner::ValidateNoOverlap ( string  functionName,
const DtArea searchArea,
const DtArea targetArea,
string *  problemDescription 
)
private
string DtTerrainReasoner::ValidationMessage ( string  functionName,
bool  isError,
string  offendingParameterName,
double  offendingParameterValue,
string  description 
)
private
string DtTerrainReasoner::ValidationMessage ( string  functionName,
bool  isError,
string  offendingParameterName,
string  description 
)
private
bool DtTerrainReasoner::ValidateAreaVertices ( string  functionName,
const DtLocalVertexList areaVertices,
string  name,
string *  problemDescription 
)
private
bool DtTerrainReasoner::ValidateGreaterThanZero ( string  functionName,
double  value,
string  name,
string *  problemDescription 
)
private
bool DtTerrainReasoner::ValidateLessThan ( string  functionName,
double  value,
string  name,
double  refValue,
string  refName,
string *  problemDescription 
)
private
bool DtTerrainReasoner::ValidateNotLessThan ( string  functionName,
double  value,
string  name,
double  refValue,
string  refName,
string *  problemDescription,
bool  isError = true 
)
private
bool DtTerrainReasoner::ValidateGreaterThan ( string  functionName,
double  value,
string  name,
double  refValue,
string  refName,
string *  problemDescription 
)
private
bool DtTerrainReasoner::ValidateNotGreaterThan ( string  functionName,
double  value,
string  name,
double  refValue,
string  refName,
string *  problemDescription,
bool  isError = true 
)
private
bool DtTerrainReasoner::ValidateLocatedOutside ( string  functionName,
const DtArea targetsArea,
const DtTopoPoint pt,
string *  problemDescription 
)
private
bool DtTerrainReasoner::ValidateCoverNotLessThanView ( string  functionName,
double  coverHeightMeters,
double  viewHeightMeters,
string *  problemDescription 
)
private

Member Data Documentation

DtPhysicalWorld& DtTerrainReasoner::myPhysicalWorld
protected
DtTerrainReasonerCreatorFcn DtTerrainReasoner::TheCreatorFcn
staticprotected
DtTerrainReasoner* DtTerrainReasoner::TheInstance
staticprotected

The documentation for this class was generated from the following file:

Document ID: Generated on Thu Oct 23 22:29:17 EDT 2025 from SVN revision 280951
Copyright © 2005-2024 MAK Technologies. All Rights Reserved (www.mak.com)