![]() |
VR-Forces Developer's Guide
|
Go to the source code of this file.
/******************************************************************************* ** Copyright (c) 2010 MAK Technologies, Inc. ** All rights reserved. *******************************************************************************/
//! //!
//!DtHumanPathMetric
#ifndef humanPathMetric_h #define humanPathMetric_h
#include "vrfobjcore/pathMetric.h" #include "vrfmodel/vrfmodelDefines.h"
class DtPhysicalWorld;
//! Path planning metric used with the DtPathPlanner. //! Checks the slope and of the terrain //! being passed over, compares them to the capabilities of the //! entity, and returns a cost based on those values. //! //! The returned cost is equivalent to the distance across a flat paved surface //! the vehicle would need to travel to cross the segment. class DT_DLL_vrfmodel DtHumanPathMetric : public DtPathMetric { public: DtHumanPathMetric(const DtSimObject* entity);
virtual ~DtHumanPathMetric();
virtual bool init();
//! Calculates the cost of moving directly from startPoint to endPoint //! based on what slope is between the points. //! Takes samples of the terrain along the segment at terrainSampleDistance //! apart and calls multiplierForPoint() for each point checked along the //! segment. //! Note: this function makes a blocking terrain call to insure the required //! data is paged in. It also sets overrideBlockingAssert on its call to //! DtPhysicalWorld::terrainHeightAndSurface to prevent an assertion. This is //! safe because this function is not called from the main simulation thread. virtual double transitionCost(const DtPoint& startPoint, const DtPoint& endPoint) const;
//! Returns a cost based on the turning radius of the vehicle. virtual double turningCost(double cosAngle) const;
//! Override this function to add your own cost calculations to //! the path. Default implementation return 1.0. //! To further customize this metric, override this method and //! return a multiplier for each point. Do not return less than //! 1.0 in order to keep the optimistic heuristic rule. virtual double multiplierForPoint(const DtPoint& point) const;
//! Sets the distance between terrain sample points used when //! calculating the cost of moving between two points. //! This distance will be the average used. virtual void setTerrainSampleDistance(double distance);
//! Returns the current terrain sample distance. virtual double terrainSampleDistance() const;
static DtPathMetric* creator(const DtSimObject* entity);
protected: DtPhysicalWorld* myPhysicalWorld; double myTerrainSampleDistance; };
#endif