VR-Forces Developer's Guide
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
simObject.h
Go to the documentation of this file.
1 /****************************************************************************
2  * Copyright (c) 2021 MAK Technologies, Inc.
3  * All rights reserved.
4  ****************************************************************************/
5 
6 #pragma once
7 
17 #include <vrfutil/rwEntityType.h>
18 #include <boost/signals2.hpp>
19 #include <matrix/vlVector.h>
20 #include <geometry/extent.h>
21 #include <vrfutil/rwUUID.h>
22 #include <vlpi/appearance.h>
23 #include <vlpi/disEnums.h>
24 #include <matrix/vlDcm.h>
25 #include <matrix/vlTaitBryan.h>
26 #include <map>
27 #include <list>
28 #include <tbb/spin_rw_mutex.h>
29 #include <vrfutil/vrf4XAPI.h>
30 
32 
33 namespace MAKVRinTerra
34 {
35  class DtFeatureGeometry;
36 }
37 
40 class DtRangeItems;
41 class DtLocalVertexList;
42 class DtVertexList;
44 class DtSymbolString;
45 class DtRwProperties;
46 class DtRwReal;
48 class DtOutputStream;
49 class DtObjectConsole;
50 class Coordinate_System;
51 class DtSimObject;
52 class DtChord;
53 class DtAttachedTerrain;
54 class DtPhysicalWorld;
55 class DtSimObjectManager;
58 class Dt3dBoundingVolume;
59 class DtEntityIdentifier;
62 
66 
70 
81 {
82 private:
84  DtSimObject();
85  DtSimObject(const DtSimObject&);
86 
87 public:
90  explicit DtSimObject(const DtSimulationServices* simManager, makVrf::DtStateData* sd);
91  explicit DtSimObject(const DtSimulationServices* simManager, const DtUUID& uuid);
92  explicit DtSimObject(const DtSimulationServices* simManager, const DtEntityIdentifier& id);
93  explicit DtSimObject(const DtSimulationServices* simManager, const makVrf::DtExternalCurrentFrameState*);
94 
96  virtual ~DtSimObject() override;
97 
99  virtual Dt3dBoundingVolume boundingVolume() const override;
100  DtVector localBoundingVolumeCenterPosition() const;
101  DtExtent extent() const;
102 
104  DtExtent roughExtent() const;
105  void expandExtent(DtExtent& extent) const;
106 
109  double distSquaredTo(const DtVector&) const;
110 
111  virtual void frameAdvanced() override;
112 
114  virtual bool isLocal() const;
115 
117  const DtPlatformSimObjectFacade& platformSimObjectFacade() const;
118 
120  const DtVrfSimulatedSimObjectFacade& vrfSimulatedSimObjectFacade() const;
121 
123  bool embarkedOnHighFidelityObject() const;
124 
126  DtSimObjectReference simObjectEmbarkedOn() const;
128 
129  bool isOnTopOf(const DtSimObject* o) const;
130 
132  bool isOnTopOf(const DtSimObject* o, double d) const;
133 
134  bool isOnTopOf(const DtSimObject* o, double d, const DtVector& position) const;
135 
137  virtual DtVrfLocalObjectCreateInformation vrfLocalObjectCreateInformation() const;
138 
140  virtual void makeInvalid() override;
141 
143  {
144  return mySimulationServices;
145  }
146 
149  {
150  return myParameters;
151  }
152 
156  DtVrfObjectParameters* duplicateParameters();
157 
159  double totalMass() const;
160 
161  const Coordinate_System* coordinateSystem() const;
162 
165  DtVector locationRelativeTo(const DtVector&, const DtSimObject* relativeTo) const;
166 
169  DtVector velocityRelativeTo(const DtVector&, const DtSimObject* relativeTo) const;
170 
173  DtVector accelerationRelativeTo(const DtVector&, const DtSimObject* relativeTo) const;
174 
177  DtTaitBryan orientationRelativeTo(const DtTaitBryan&, const DtSimObject* relativeTo) const;
178 
181  const DtRwProperties& parameterProperties() const;
182 
184  double distanceToLocalVector(const DtVector&) const;
185 
187  DtSimObjectReference simObjectReference() const;
188 
189  DtSimObjectReference superior() const;
190  virtual void superiorChanged() override;
191 
192  const DtSimObjectReferenceList& attachments() const;
193 
195  bool isTopLevel() const;
196 
198  MAKVRinTerra::DtFeatureGeometry featureGeometry() const;
199 
200  const DtAttachedTerrain* terrainAttachedTo() const;
201 
202 public:
206  virtual void clearDecorators();
207 
210  DtSimObjectDecorator* getOrCreateDecorator(const std::string& Decorator) const;
212 
213 protected:
214  void tickDecorators();
215  virtual void createNavigationDecorator();
216 
217  virtual void setupVrfObjectParameters();
218  virtual void setUUID(const DtUUID&) override;
220 
221  void attachmentsChanged();
222  virtual void completeSetup() override;
223 
224  virtual void hostChanged(const DtUUID& oldHost, const DtUUID& newHost);
225 
227  virtual void usingParameterSource(const DtString&);
228  virtual void stateDataAdded(makVrf::DtStateData* sd) override;
229 
230 private:
231  friend class DtSimObjectManager;
234  void resetUUID(const DtUUID&);
235 
236 protected:
238 
241  typedef std::map<std::string, DtSimObjectDecorator*> SimObjectDecorators;
243  mutable tbb::spin_rw_mutex mySimObjectDecoratorMutex;
245 
248  {
249  ExtentInformation() : lastSimTime(-1.), physicalFootprint(nullptr) {};
250  double lastSimTime;
253  DtVector lastPosition;
254  tbb::spin_rw_mutex mutex;
255  };
256 
258  DtNavigationSimObjectDecorator* myNavigationSimDecorator = nullptr;
259 
263 
266  boost::signals2::scoped_connection myAttachmentsChangedConnection;
267  boost::signals2::scoped_connection myHostChangedConnection;
268 
271 
274  mutable tbb::spin_rw_mutex mySimObjectReferenceMutex;
275 
277 
281 
282 public:
287  VRF4API_METHOD const DtSimObject* vrfState();
288  VRF4API_METHOD const DtSimObject* vrfState() const;
289  VRF4API_METHOD const DtSimObject* simState();
290  VRF4API_METHOD const DtSimObject* simState() const;
291  VRF4API_METHOD bool operator==(const DtSimObject* rhs) const { if (!rhs) return false; else return (uuid() == rhs->uuid()); };
292  VRF4API_METHOD const DtSimulationServices* simManager() const;
293  VRF4API_METHOD DtSimulationServices* simManager();
294  VRF4API_METHOD makVrf::DtVrfObjectGeometry vrfObjectGeometry() const;
295  VRF4API_METHOD const DtPhysicalWorld* physicalWorld() const;
296  VRF4API_METHOD DtSimObjectReference sharedReference() const { return simObjectReference(); };
297  VRF4API_METHOD const DtVrfObjectParameters* parameterEntry() const;
298  VRF4API_METHOD const DtSimObjectManager* simObjectManager() const;
299  VRF4API_METHOD DtSimObjectReference vrfObject() const;
300  VRF4API_METHOD DtSimObjectReference parent() const;
301  VRF4API_METHOD double currentHeading() const;
302  VRF4API_METHOD double currentPitch() const;
303  VRF4API_METHOD double currentRoll() const;
304  VRF4API_METHOD const DtString& markingText() const;
305 
306  VRF4API_METHOD bool isSpatiallyFrozen() const;
307  VRF4API_METHOD bool isFrozen() const;
308 
310  VRF4API_METHOD double speed() const;
311 
316  VRF4API_METHOD double forwardSpeed() const;
317  VRF4API_METHOD DtVector worldVelocity() const;
318  VRF4API_METHOD DtVector localVelocity() const;
319  VRF4API_METHOD DtVector bodyVelocity() const;
320  VRF4API_METHOD DtVector relativeVelocity() const;
321  VRF4API_METHOD DtVector parentVelocity() const;
322  VRF4API_METHOD DtVector rotationalVelocity() const;
323 
325  VRF4API_METHOD DtVector worldAcceleration() const;
326  VRF4API_METHOD DtVector localAcceleration() const;
327  VRF4API_METHOD DtVector relativeAcceleration() const;
328 
330 };
331 
332 #include "simObject.inl"
UUID is a unique ID wrapper class.
Definition: uuid.h:59
Instances of DtVrfObjectParameters are the readable/writeable objects that contain the information ne...
Definition: vrfObjectParameters.h:64
const DtRwProperties & parameterProperties() const
Extent information as to what it is and when it was last calculated.
Definition: simObject.h:247
NOTE: This entire class is deprecated, in favor of Dt3dChord.
Definition: chord.h:40
bool checkAndConnectForVrfStateComponent()
Checks whether a VRF state component is present and registers the necessary signal connections...
This class is used to interface with the terrain a particular entity is &quot;attached&quot; to...
Definition: attachedTerrain.h:57
Objects may contain a collection of other objects, such as overlays or pseudo-aggregate entities...
Definition: subordinateManager.h:43
std::map< std::string, DtSimObjectDecorator * > SimObjectDecorators
Decorator members.
Definition: simObject.h:241
DtSimObjectReference mySuperior
Superior.
Definition: simObject.h:270
double distSquaredTo(const DtVector &) const
Returns the squared Euclidean distance from this object to the given world position.
This class allows one to collect and compare strings using an index number instead of having to do st...
Definition: symbolString.h:27
const DtUUID & uuid() const
Convenience accessors for various pieces of state data.
const DtSimulationServices * mySimulationServices
Definition: simObject.h:237
DtVrfSimulatedSimObjectFacade * myVrfSimulatedSimObjectFacade
Definition: simObject.h:280
virtual Dt3dBoundingVolume boundingVolume() const
If you use a list of object names to archive which objects are part of a controller (or any object) u...
Definition: simObjectReferenceList.h:129
DtSimObjectReference mySimObjectReference
Back pointer to this objects reference.
Definition: simObject.h:273
tbb::spin_rw_mutex mySimObjectReferenceMutex
Definition: simObject.h:274
VRF4API_METHOD bool operator==(const DtSimObject *rhs) const
This is the deprecated API that can be used as a reference to migrate 4.X code to 5...
Definition: simObject.h:291
virtual void makeInvalid()
Make this invalid by clearing the myExternalCurrentFrameState. This will also set the myIsDeleted fla...
Contains the DtUUID class declaration.
The DtExtent represents an axis-aligned 3d bounding box.
Definition: extent.h:43
Definition: navigationDecorator.h:18
tbb::spin_rw_mutex mutex
Definition: simObject.h:254
The DtLocalObjectCreateInformation class is a subset of the information used in the DtIfCreateVrfObje...
Definition: vrfLocalObjectCreateInformation.h:26
Description: This repository is an internal repository accessible only by local objects. It holds all information that is common to all the forms of all entity/aggregate/control objects within VR-Forces.
Definition: vrfObjectStateRepository.h:92
ExtentInformation myExtentInformation
Definition: simObject.h:257
const DtSimulationServices * simulationServices() const
Definition: simObject.h:142
DtAggregateSimObjectFacade * myAggregateSimObjectFacade
Definition: simObject.h:278
DtExtent extent
Definition: simObject.h:252
const DtVrfObjectParameters * parameters() const
VR-Forces parameters.
Definition: simObject.h:148
This class represents the console for an individual object. It owns a set of streams for various noti...
Definition: objectConsole.h:49
The DtPhysicalWorld is the primary interface to and manager of all of the &quot;physical&quot; aspects of the s...
Definition: physicalWorld.h:114
Definition: coordSystem.h:54
The overall structure of the DtStateData mechanism is: The DtStateData contains a list of double buff...
Definition: stateData.h:513
#define DT_DLL_vrfobjcore
This file is used to determine how to build.
Definition: vrfobjcoreDefines.h:24
virtual void setUUID(const DtUUID &)
Reassigns this wrapper to track the simulation object with the given UUID.
DtVrfObjectParameters * myDuplicateParameters
Definition: simObject.h:262
class DtVertexList:
Definition: vertexList.h:22
const DtVrfObjectParameters * myParameters
Referenced from the simulation services object database based on entity type.
Definition: simObject.h:261
virtual void superiorChanged()
Slot called when the superior unit of this object changes.
Read-only view of the current (committed) frame state components within a DtStateData. Safe to access from any thread once the frame has been advanced.
Definition: stateData.h:391
Definition: rangeItem.h:206
This class maintains a rectangular bounding volume and an ordered list of vertices describing the phy...
Definition: vrfObjectGeometry.h:39
virtual void frameAdvanced()
Called each time the simulation frame advances; updates cached component state.
SimObjectDecorators mySimObjectDecorators
Decorator members.
Definition: simObject.h:242
Description: Readable, Writable DtReal (double)
Definition: rwReal.h:27
Represents a single simulation object in the exercise. Object may be VRF simulation, or non-VRF simulated, and may be simulated by the local sim engine, or by a remote sim engine. Only public (external) state of the object is available. All data is read-only. All access to data of the object is thread safe within the simulation frame.
Definition: stateDataWrapper.h:49
This is a convenience list that will add DtSimObjectReference objects and modify the list as objects ...
Definition: simObjectReferenceList.h:25
const DtRwReal * physicalFootprint
Definition: simObject.h:251
Central access point of all non-object-specific the services and managers that are available for use ...
Definition: simulationServices.h:97
This class is the central access point for all current-frame state of all objects in the simulation i...
Definition: simObjectManager.h:31
Represents a single simulation object in the exercise. Object may be VRF simulation, or non-VRF simulated, and may be simulated by the local sim engine, or by a remote sim engine. Only public (external) state of the object is available. All data is read-only. All access to data of the object is thread safe within the simulation frame.
Definition: simObject.h:80
bool isTopLevel() const
Convenience method to see if this is a top level object. It is if it is local and the entity type is ...
Contains the declaration of the DtExtent class.
DtSimObjectReferenceList * myAttachments
Attachments.
Definition: simObject.h:265
virtual void stateDataAdded(DtStateData *)
Slot called when a new DtStateData is added; resolves a pending awaiting-reference.
Definition: decoratorBase.h:30
DtPlatformSimObjectFacade * myPlatformSimObjectFacade
Definition: simObject.h:279
boost::signals2::scoped_connection myAttachmentsChangedConnection
Definition: simObject.h:266
Contains the DtSimObjectReference class declaration.
tbb::spin_rw_mutex mySimObjectDecoratorMutex
Decorator members.
Definition: simObject.h:243
A list of properties. A DtPropertyInterface object that is a specialized version of DtRwVariableBindi...
Definition: rwProperties.h:122
VRF4API_METHOD DtSimObjectReference sharedReference() const
This is the deprecated API that can be used as a reference to migrate 4.X code to 5...
Definition: simObject.h:296
DtVector lastPosition
Definition: simObject.h:253
class DtLocalVertexList:
Definition: localVertexList.h:20
#define VRF4API_METHOD
Include this header file to allow for the definition/usage of the ability to mark something as deprec...
Definition: vrf4XAPI.h:23
This DtPlatformSimObjectFacadeInterface class will provide API functionality for platform objects...
Definition: platformSimObjectFacade.h:24
boost::signals2::scoped_connection myHostChangedConnection
Definition: simObject.h:267
virtual void completeSetup()
Completes initialization once the underlying state data has become available.
Represents a feature geometry.
Definition: featureGeometry.h:44
DtAttachedTerrain * myTerrainAttachedTo
Definition: simObject.h:276
This DtVrfSimulatedSimObjectFacadeInterface class will provide accessors for data that is available t...
Definition: vrfSimulatedSimObjectFacade.h:27
This DtAggregateSimObjectFacadeInterface class will provide API functionality for aggregate level cal...
Definition: aggregateSimObjectFacade.h:25

Document ID: Generated on Thu Oct 15 21:27:02 EDT 2026 from SVN revision 296421
Copyright © 2005-2026 MAK Technologies. All Rights Reserved (www.mak.com)