VR-Forces 4.0.4 Class Documentation
Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | Static Protected Attributes
DtMissileStateRepository Class Reference

This repository holds all information that is common to all the forms of missile entities within the system. More...

Inheritance diagram for DtMissileStateRepository:
Inheritance graph
[legend]

List of all members.

Public Member Functions

 DtMissileStateRepository (DtVrfObject *vrfObject, const DtObjectType &objectType, DtVrfObjectParameters *parameters, const DtString &rwName=DtString::nullString(), DtReaderWriterRegistry *parentRegistry=0)
 Constructor with parameters to set up read/writability correctly.
 DtMissileStateRepository (const DtMissileStateRepository &orig, const DtString &rwName=DtString::nullString(), DtReaderWriterRegistry *parentRegistry=0)
 copy constructor
const DtMissileStateRepositoryoperator= (const DtMissileStateRepository &orig)
 assignment operator
virtual ~DtMissileStateRepository ()
 destructor
virtual
DtSimObjectStateRepository
clone (const DtString &rwName=DtString::nullString(), DtReaderWriterRegistry *parentRegistry=0) const
 Clone.
virtual bool init ()
 Our 'virtual' constructor. Calls all the create<>() methods.
virtual DtString type () const
 Returns the string type of the repository, as defined in vrfSRTypes.h.
virtual const int vrfMovingObjectStateRepositorySubType () const
 Returns DtVrfMovingObjectStateRepositorySubTypeMissile.
virtual const int missileEntityStateRepositorySubType () const
 Returns DtMissileEntityStateRepositorySubTypeBase.
virtual void tick ()
 Give a thread of control to the entity.
virtual bool createParameters ()
virtual void initializeFromParameters ()
virtual const DtMissileParametersmissileParameters () const
virtual DtReal range () const
 Set/Get the missile range.
virtual void setRange (const DtReal range)
virtual DtReal maxManeuverGs () const
 Set/Get maximum maneuver acceleration in Gs.
virtual void setMaxManeuverGs (const DtReal maxAcceleration)
virtual void setFuzeType (DtDetonatorFuze fuze)
 Set/Get the detonator fuze type.
virtual DtDetonatorFuze fuzeType () const
virtual void setWarheadType (DtWarheadType type)
 Set/Get the warhead type.
virtual DtWarheadType warheadType () const
virtual void setFireAndForget (bool isFireAndForget)
 Set/Get a boolean indicating whether this is a fire-and-forget missile.
virtual bool fireAndForget () const
virtual void setAttackerId (const DtObjectId &attackerId)
 Set/Get the Id of who launched this missile.
virtual const DtObjectId & attackerId () const
virtual DtReal radiusCEP () const
 Set/Get the Circular Error Probable radius (CEP).
virtual void setRadiusCEP (const DtReal radiusCEP)
virtual void place (const DtVector &location)
 Place entity at the x, y coordinates given in 'location', and z at 1000 m.
virtual void place (const DtReal heading)
 Give entity the specified 'heading', but stay at its current location in x and y coordinates and pitch.
virtual void place (const DtReal heading, const DtReal pitch)
 Give entity the specified 'heading' and 'pitch', but stay at its current location in x and y coordinates.
virtual void place (const DtVector &location, const DtReal heading)
 Place entity at specified 'location' in x and y coordinates, and at the given 'heading'.
virtual void place (const DtVector &location, const DtReal heading, const DtReal pitch)
 Place entity at specified 'location' in x and y, 'heading', and 'pitch'.
virtual void setStartLocalPosition (const DtVector &localPosition)
 At launch time, the launcher should set position and orientation of the missile along with its velocity.
virtual void setStartLocalVelocity (const DtVector &localVelocity)
virtual void setStartLocalOrientationWrtDatabase (const DtTaitBryan &localOrientation)
virtual bool setTargetPoint (const DtVector &localTerrainPoint)
 At launch time the missile should be given a target.
virtual bool setTargetEntity (const DtObjectId &id)
virtual void setEventId (const DtEventId &eventId)
 Missile launcher must set the event Id from the DtFireInteraction sent out for the missile during launch.
virtual const DtEventId & eventId () const
virtual void setDisconnectedFromLauncher ()
 If the launcher gets destroyed or the firing entity stops guiding this missile (because, perhaps, the wires to a wire-guided missile are cut), it will make this call to the missile.
virtual bool missilePassedTarget (double &distSquaredToTargetOut) const
 Indicates with a boolean whether the missile has passed the target by comparing the missile's velocity vector with the target's position.
virtual void missileDetonated (DtDetonationInteraction *detInter)
 For removing munition entities after they are destroyed.
virtual DtReal currentPitch () const
 Calculate the current pitch of this Missile.
virtual double calcDistanceSquaredToTarget ()
 This function calculates and returns the distance to the target.
virtual DtReal transitionAngle () const
 Set/Get the half angle (in radians) to transition to a proportional navigation entity tracking algorithm.
virtual void setTransitionAngle (DtReal angle)
virtual DtReal proportionalNavigationGain () const
 Set/Get the gain constant used by the proportional navigation algorithm.
virtual void setProportionalNavigationGain (DtReal gain)
virtual void putSelf (FILE *fp, int indentLevel=0, bool writeUnspecified=false, const DtFilename &path=DtReaderWriter::appPath())
 Override to map myAttackerId and myTargetEntity to myAttackerName and myTargetName (we can't write objectIds to file, but we can write the object name - it persists across scenario runs).
virtual void getSelf (DtlObjPtr args, const DtFilename &searchPath, const DtVariableBindingsList &variableBindings)
 Override getSelf to handle mapping of old pre-2.0 oob files.
virtual void setStartLocalOrientation (const DtTaitBryan &topocentricOrientation)

Static Public Member Functions

static void detonationCallback (DtDetonationInteraction *detInter, void *usr)
static DtVrfObjectStateRepositorycreator (const DtString &name, DtVrfObject *vrfObject, const DtObjectType &objectType, DtVrfObjectParameters *parameters, DtReaderWriterRegistry *parentRegistry)
static DtMissileStateRepositoryisMissileStateRepository (DtSimObjectStateRepository *repository)
 Returns a the pointer the repository, if the repository passed in is of type DtMissileStateRepostiory, 0 if not.
static const
DtMissileStateRepository
isMissileStateRepository (const DtSimObjectStateRepository *repository)

Protected Member Functions

 DtMissileStateRepository ()

Protected Attributes

DtObjectId myAttackerId
DtReal myRange
DtReal myMaxManeuverGs
DtDetonatorFuze myFuzeType
DtWarheadType myWarheadType
bool myFireAndForget
DtReal myRadiusCEP
bool myMarkedForRemoval
DtObjectId * myTargetEntity
DtVectormyTargetPoint
DtVector myVectorToTarget
 The instantaneous vector to the target for the current tick.
double myDistanceSquaredToTarget
double myLastDistanceSquaredToTarget
DtReal myTransitionAngle
DtReal myProportionalNavigationGain
DtRwString myAttackerName
DtRwString myTargetEntityName
DtEventId myEventId

Static Protected Attributes

static DtVrfObjectManagermyDetCbackRegWithThisEntMgr
 Flag for indicating whether the detonation callback for munitions has been registered for this VrfObjectManager.

Detailed Description

This repository holds all information that is common to all the forms of missile entities within the system.


Constructor & Destructor Documentation

DtMissileStateRepository::DtMissileStateRepository ( DtVrfObject vrfObject,
const DtObjectType objectType,
DtVrfObjectParameters parameters,
const DtString rwName = DtString::nullString(),
DtReaderWriterRegistry parentRegistry = 0 
)

Constructor with parameters to set up read/writability correctly.

DtMissileStateRepository::DtMissileStateRepository ( const DtMissileStateRepository orig,
const DtString rwName = DtString::nullString(),
DtReaderWriterRegistry parentRegistry = 0 
)

copy constructor

destructor


Member Function Documentation

const DtMissileStateRepository& DtMissileStateRepository::operator= ( const DtMissileStateRepository orig)

assignment operator

virtual DtSimObjectStateRepository* DtMissileStateRepository::clone ( const DtString rwName = DtString::nullString(),
DtReaderWriterRegistry parentRegistry = 0 
) const [virtual]

Clone.

Reimplemented from DtVrfMovingObjectStateRepository.

virtual bool DtMissileStateRepository::init ( ) [virtual]

Our 'virtual' constructor. Calls all the create<>() methods.

Reimplemented from DtVrfObjectStateRepository.

virtual DtString DtMissileStateRepository::type ( ) const [virtual]

Returns the string type of the repository, as defined in vrfSRTypes.h.

Reimplemented from DtVrfMovingObjectStateRepository.

Returns DtVrfMovingObjectStateRepositorySubTypeMissile.

Reimplemented from DtVrfMovingObjectStateRepository.

Returns DtMissileEntityStateRepositorySubTypeBase.

virtual void DtMissileStateRepository::tick ( ) [virtual]

Give a thread of control to the entity.

This will remove the missile if it was marked for removal.

Reimplemented from DtVrfObjectStateRepository.

Reimplemented from DtVrfMovingObjectStateRepository.

Reimplemented from DtVrfMovingObjectStateRepository.

virtual DtReal DtMissileStateRepository::range ( ) const [virtual]

Set/Get the missile range.

virtual void DtMissileStateRepository::setRange ( const DtReal  range) [virtual]
virtual DtReal DtMissileStateRepository::maxManeuverGs ( ) const [virtual]

Set/Get maximum maneuver acceleration in Gs.

virtual void DtMissileStateRepository::setMaxManeuverGs ( const DtReal  maxAcceleration) [virtual]
virtual void DtMissileStateRepository::setFuzeType ( DtDetonatorFuze  fuze) [virtual]

Set/Get the detonator fuze type.

virtual DtDetonatorFuze DtMissileStateRepository::fuzeType ( ) const [virtual]
virtual void DtMissileStateRepository::setWarheadType ( DtWarheadType  type) [virtual]

Set/Get the warhead type.

virtual DtWarheadType DtMissileStateRepository::warheadType ( ) const [virtual]
virtual void DtMissileStateRepository::setFireAndForget ( bool  isFireAndForget) [virtual]

Set/Get a boolean indicating whether this is a fire-and-forget missile.

virtual bool DtMissileStateRepository::fireAndForget ( ) const [virtual]
virtual void DtMissileStateRepository::setAttackerId ( const DtObjectId &  attackerId) [virtual]

Set/Get the Id of who launched this missile.

virtual const DtObjectId& DtMissileStateRepository::attackerId ( ) const [virtual]
virtual DtReal DtMissileStateRepository::radiusCEP ( ) const [virtual]

Set/Get the Circular Error Probable radius (CEP).

This measures the radius of a circle within which 50 % of the missiles fired will impact. For example, if a cep-radius of 100 meters is specified, then 50 % of missiles fired at a given target should impact within 100 meters of that target and the remaining 50 % of the missile will impact at a distance greater that 100 meters from the target. This assumes that the a missile fired was potentially capable of hitting the desired target (that is, it was in range).

virtual void DtMissileStateRepository::setRadiusCEP ( const DtReal  radiusCEP) [virtual]
virtual void DtMissileStateRepository::place ( const DtVector location) [virtual]

Place entity at the x, y coordinates given in 'location', and z at 1000 m.

Keeps its the current heading.

virtual void DtMissileStateRepository::place ( const DtReal  heading) [virtual]

Give entity the specified 'heading', but stay at its current location in x and y coordinates and pitch.

Sets the z component of the entity's position to 1000 m.

Note:
Unlike the base class, this function does not have a "dataAvailable" parameter because it does not make any terrain intersection calls which might block. This function does not call down to DtVrfMovingObjectStateRepository::place
virtual void DtMissileStateRepository::place ( const DtReal  heading,
const DtReal  pitch 
) [virtual]

Give entity the specified 'heading' and 'pitch', but stay at its current location in x and y coordinates.

Sets the z component of the entity's position to 1000 m.

Note:
Unlike the base class, this function does not have a "dataAvailable" parameter because it does not make any terrain intersection calls which might block. This function does not call down to DtVrfMovingObjectStateRepository::place
virtual void DtMissileStateRepository::place ( const DtVector location,
const DtReal  heading 
) [virtual]

Place entity at specified 'location' in x and y coordinates, and at the given 'heading'.

Sets the z component of the entity's position to 1000 m.

Note:
Unlike the base class, this function does not have a "dataAvailable" parameter because it does not make any terrain intersection calls which might block. This function does not call down to DtVrfMovingObjectStateRepository::place
virtual void DtMissileStateRepository::place ( const DtVector location,
const DtReal  heading,
const DtReal  pitch 
) [virtual]

Place entity at specified 'location' in x and y, 'heading', and 'pitch'.

Sets the z component of the entity's position to 1000 m.

Note:
Unlike the base class, this function does not have a "dataAvailable" parameter because it does not make any terrain intersection calls which might block. This function does not call down to DtVrfMovingObjectStateRepository::place
virtual void DtMissileStateRepository::setStartLocalPosition ( const DtVector localPosition) [virtual]

At launch time, the launcher should set position and orientation of the missile along with its velocity.

This position is where the launcher is. The velocity will be the velocity of the launcher, and orientation is the orientation of the launcher. Orientation is specified with respect to the database coordinate system.

virtual void DtMissileStateRepository::setStartLocalVelocity ( const DtVector localVelocity) [virtual]
virtual void DtMissileStateRepository::setStartLocalOrientationWrtDatabase ( const DtTaitBryan &  localOrientation) [virtual]
virtual bool DtMissileStateRepository::setTargetPoint ( const DtVector localTerrainPoint) [virtual]

At launch time the missile should be given a target.

The target should be either a terrain point or an entity -- not both. If both are set, the last one set will take precedence.

virtual bool DtMissileStateRepository::setTargetEntity ( const DtObjectId &  id) [virtual]
virtual void DtMissileStateRepository::setEventId ( const DtEventId &  eventId) [virtual]

Missile launcher must set the event Id from the DtFireInteraction sent out for the missile during launch.

Use this event Id when sending out detonation interaction. Event Ids for DtFireInteraction and DtDetonationInteractions should match.

virtual const DtEventId& DtMissileStateRepository::eventId ( ) const [virtual]

If the launcher gets destroyed or the firing entity stops guiding this missile (because, perhaps, the wires to a wire-guided missile are cut), it will make this call to the missile.

Some missiles will continue tracking the target, others won't. In this missile base, if the launcher gets disconnected from the missile, the missile loses its targeting and will just fly straight until it hits something.

virtual bool DtMissileStateRepository::missilePassedTarget ( double &  distSquaredToTargetOut) const [virtual]

Indicates with a boolean whether the missile has passed the target by comparing the missile's velocity vector with the target's position.

The current distance squared to the target will be returned in distSquaredToTargetOut.

For removing munition entities after they are destroyed.

static void DtMissileStateRepository::detonationCallback ( DtDetonationInteraction detInter,
void *  usr 
) [static]
virtual DtReal DtMissileStateRepository::currentPitch ( ) const [virtual]

Calculate the current pitch of this Missile.

This function calculates and returns the distance to the target.

As a side-effect, it also sets myVectorToTarget.

virtual DtReal DtMissileStateRepository::transitionAngle ( ) const [virtual]

Set/Get the half angle (in radians) to transition to a proportional navigation entity tracking algorithm.

virtual void DtMissileStateRepository::setTransitionAngle ( DtReal  angle) [virtual]
virtual DtReal DtMissileStateRepository::proportionalNavigationGain ( ) const [virtual]

Set/Get the gain constant used by the proportional navigation algorithm.

virtual void DtMissileStateRepository::setProportionalNavigationGain ( DtReal  gain) [virtual]
virtual void DtMissileStateRepository::putSelf ( FILE *  fp,
int  indentLevel = 0,
bool  writeUnspecified = false,
const DtFilename &  path = DtReaderWriter::appPath() 
) [virtual]

Override to map myAttackerId and myTargetEntity to myAttackerName and myTargetName (we can't write objectIds to file, but we can write the object name - it persists across scenario runs).

Reimplemented from DtVrfObjectStateRepository.

virtual void DtMissileStateRepository::getSelf ( DtlObjPtr  args,
const DtFilename &  searchPath,
const DtVariableBindingsList variableBindings 
) [virtual]

Override getSelf to handle mapping of old pre-2.0 oob files.

Maps the old variables for local and world position/orientation to the new object geometry and kinematic state members. Maps old boolean destroyed flag to new appearance bits.

Reimplemented from DtVrfObjectStateRepository.

static DtVrfObjectStateRepository* DtMissileStateRepository::creator ( const DtString name,
DtVrfObject vrfObject,
const DtObjectType objectType,
DtVrfObjectParameters parameters,
DtReaderWriterRegistry parentRegistry 
) [static]

Reimplemented from DtVrfMovingObjectStateRepository.

Returns a the pointer the repository, if the repository passed in is of type DtMissileStateRepostiory, 0 if not.

virtual void DtMissileStateRepository::setStartLocalOrientation ( const DtTaitBryan &  topocentricOrientation) [virtual]
Deprecated:
To be removed after VR-Forces version 3.11 Sets the starting orientation of the missile, in topocentric Euler angles.

This function will only work if the terrain database is in UTM coordinates. This function has been deprecated in the API. Calls to this function be replaced with calls to setStartLocalOrientationWrtDatabase().


Member Data Documentation

DtDetonatorFuze DtMissileStateRepository::myFuzeType [protected]
DtWarheadType DtMissileStateRepository::myWarheadType [protected]

The instantaneous vector to the target for the current tick.

If there is no target, this vector will be zero.

Flag for indicating whether the detonation callback for munitions has been registered for this VrfObjectManager.

DtEventId DtMissileStateRepository::myEventId [protected]

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

Document ID: Generated on Fri Jun 29 16:33:32 EDT 2012 from SVN revision 116588
Copyright © 2005-2012 VT MÄK Inc. All Rights Reserved (www.mak.com)