VR-Forces Developer's Guide
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
spatialVrfObjectManagerHybrid.h
Go to the documentation of this file.
1 /*******************************************************************************
2 ** Copyright (c) 2019 MAK Technologies, Inc.
3 ** All rights reserved.
4 *******************************************************************************/
5 
6 #pragma once
7 
9 
10 #include "vrfobjcore/spatial.h"
11 #include <tbb/mutex.h>
12 
18 
20 {
21 private:
23 
28 public:
30  const Coordinate_System* coordSys);
31 
32  virtual ~DtSpatialVrfObjectManagerHybrid() override;
33 
35  virtual void addVrfObjects(const DtManagedObjectListConstPtr& vrfObjects) override;
36 
40  virtual void removeVrfObject(const DtSimObject * vrfObject) override;
41 
43  virtual bool setResolutions(unsigned int xRes, unsigned int yRes,
44  unsigned int zRes) override;
45 
48  virtual void clearVrfObjects() override;
49 
59  virtual void reset(const DtManagedObjectListConstPtr& vrfObjects) override;
60 
63 
74  virtual bool getVrfObjects(const DtExtent& extent, DtVrfConstObjectUniqueContainer& objects) const override;
75 
76  virtual bool getVrfObjects(const DtVrfObjectPredicate& predicate, const DtExtent& extent,
77  DtVrfConstObjectUniqueContainer& objects) const override;
78 
79  virtual bool getVrfObjects(const DtChord& chord, std::list<const DtSimObject*>& objects) const override;
80 
81  virtual bool getVrfObjects(const DtVrfObjectPredicate& predicate, const DtChord& chord,
82  std::list<const DtSimObject*>& objects) const override;
84 
87 
100 
101  virtual void visitVrfObjects(const DtExtent& extent, DtSpatialSelectionFunctor &callback) const override;
102  virtual void visitVrfObjects(const DtChord& chord, DtSpatialSelectionFunctor& callback) const override;
104 
105  virtual unsigned int numObjects() const override
106  {
107  return myOctree->numObjects();
108  }
109 
110 private:
114 
116  typedef std::map<unsigned long long, DtSimObjectReference> Container;
117  void splitVrfObjectsSingleMultiPoint(const DtManagedObjectListConstPtr& vrfObjects,
118  Container& vrfObjectsMultiPoint,
119  Container& vrfObjectsSinglePoint);
120  bool IsVrfObjectsSinglePoint(const DtSimObject* vrfObject);
121  void combineVrfObjectsSingleMultiPoint(const DtVrfConstObjectUniqueContainer& vrfObjectsMultiPoint,
122  const DtVrfConstObjectUniqueContainer& vrfObjectsSinglePoint,
123  DtVrfConstObjectUniqueContainer& vrfObjects) const;
124  void combineVrfObjectsSingleMultiPoint(const std::list<const DtSimObject*>& vrfObjectsMultiPoint,
125  const std::list<const DtSimObject*>& vrfObjectsSinglePoint,
126  std::list<const DtSimObject*>& vrfObjects) const;
127  void resetObjectMaxSize();
128  void updateObjectMaxSize(const Dt3dBoundingVolume& boundingVolume);
129 
131  void resetOctree(const Container& vrfObjects);
132  void addVrfObjectsOctree(const Container& vrfObjects);
133  void removeVrfObjectOctree(const DtSimObject* vrfObject);
134  void clearVrfObjectsOctree();
135  bool getVrfObjectsOctree(const DtExtent& extent, DtVrfConstObjectUniqueContainer& objects) const;
136  bool getVrfObjectsOctree(const DtVrfObjectPredicate& predicate, const DtExtent& extent,
137  DtVrfConstObjectUniqueContainer& objects) const;
138  bool getVrfObjectsOctree(const DtChord& chord, std::list<const DtSimObject*>& objects) const;
139  bool getVrfObjectsOctree(const DtVrfObjectPredicate& predicate, const DtChord& chord,
140  std::list<const DtSimObject*>& objects) const;
141  void visitVrfObjectsOctree(const DtExtent& extent, DtSpatialSelectionFunctor &callback) const;
142  void visitVrfObjectsOctree(const DtChord& chord, DtSpatialSelectionFunctor& callback) const;
143 
145  void resetSpatialIndex(const Container& vrfObjects);
146  void addVrfObjectsSpatialIndex(const Container& vrfObjects);
147  void removeVrfObjectSpatialIndex(const DtSimObject* vrfObject);
148  void clearVrfObjectsSpatialIndex();
149  bool getVrfObjectsSpatialIndex(const DtExtent& extent, DtVrfConstObjectUniqueContainer& objects) const;
150  bool getVrfObjectsSpatialIndex(const DtVrfObjectPredicate& predicate, const DtExtent& extent,
151  DtVrfConstObjectUniqueContainer& objects) const;
152  bool getVrfObjectsSpatialIndex(const DtChord& chord, const double delta, std::list<const DtSimObject*>& objects) const;
153  bool getVrfObjectsSpatialIndex(const DtVrfObjectPredicate& predicate, const DtChord& chord, const double delta,
154  std::list<const DtSimObject*>& objects) const;
155  void visitVrfObjectsSpatialIndex(const DtExtent& extent, DtSpatialSelectionFunctor &callback) const;
156  void visitVrfObjectsSpatialIndex(const DtChord& chord, const double delta, DtSpatialSelectionFunctor& callback) const;
157  DtExtent expandExtentSpatialIndex(const DtExtent& extent) const;
158  DtChord expandChordSpatialIndex(const DtChord& chord) const;
159  double getChordDeltaSpatialIndex() const;
160 
162 
163  bool getVrfObjectsWithinSpatialIndex(const MAK::Vector3d& min, const MAK::Vector3d& max,
164  DtVrfConstObjectUniqueContainer& objects) const;
165  bool getVrfObjectsWithinSpatialIndex(const DtVrfObjectPredicate& predicate,
166  const MAK::Vector3d& min, const MAK::Vector3d& max,
167  DtVrfConstObjectUniqueContainer& objects) const;
168  bool getVrfObjectsNearChordSpatialIndex(const MAK::Vector3d& pointA, const MAK::Vector3d& pointB,
169  const double delta, std::list<const DtSimObject*>& objects) const;
170  bool getVrfObjectsNearChordSpatialIndex(const DtVrfObjectPredicate& predicate,
171  const MAK::Vector3d& pointA, const MAK::Vector3d& pointB,
172  const double delta, std::list<const DtSimObject*>& objects) const;
174 
175 protected:
176 
179 
182 
184  std::shared_ptr<MAK::SpatialIndex<const DtSimObject*>> mySpatialIndex;
185 
189 
192 
195  tbb::mutex myRemovalMutex;
196 };
NOTE: This entire class is deprecated, in favor of Dt3dChord.
Definition: chord.h:40
DtOctree< const DtSimObject > * myOctree
The octree being used to store the objects.
Definition: spatialVrfObjectManagerHybrid.h:181
std::vector< const DtSimObject * > DtVrfConstObjectUniqueContainer
Definition: spatialVrfObjectManager.h:94
Container myVrfObjectsSinglePoint
Definition: spatialVrfObjectManagerHybrid.h:191
const Coordinate_System * myCoordSys
Definition: spatialVrfObjectManagerHybrid.h:194
Container myVrfObjectsMultiPoint
Definition: spatialVrfObjectManagerHybrid.h:190
virtual void visitVrfObjects(const DtExtent &extent, DtSpatialSelectionFunctor &callback) const =0
Functions that call the specified functor for every object intersecting the requested region (whether...
virtual bool getVrfObjects(const DtExtent &extent, DtVrfConstObjectUniqueContainer &objects) const =0
The DtSpatialVrfObjectManager is responsible for maintaining a spatial organization of all specified ...
Definition: spatialVrfObjectManager.h:31
double myObjectMaxHeight
Definition: spatialVrfObjectManagerHybrid.h:188
virtual void reset(const DtManagedObjectListConstPtr &vrfObjects)=0
Clears out the current DtSimObjects, sets it to have the minimum extent, that contains all of the DtS...
std::shared_ptr< const DtManagedObjectList > DtManagedObjectListConstPtr
Typedef for a shared pointer to a const DtOrgViewManagedObjectList. These lists are used within VR-Fo...
Definition: managedObjectList.h:35
The DtExtent represents an axis-aligned 3d bounding box.
Definition: extent.h:43
virtual void removeVrfObject(const DtSimObject *vrfObject)=0
Removes vrfObject from the set of vrfObjects we are maintaining.
double myObjectMaxWidth
Definition: spatialVrfObjectManagerHybrid.h:187
tbb::mutex myRemovalMutex
Definition: spatialVrfObjectManagerHybrid.h:195
DtExtent myRootExtent
The extent of the octree.
Definition: spatialVrfObjectManagerHybrid.h:178
Contains the DtVrfObjectPredicate class declaration.
Definition: vrfObjectPredicate.h:20
virtual unsigned int numObjects() const override
Number of objects in the octree.
Definition: spatialVrfObjectManagerHybrid.h:105
Spatial object manager which uses both an octree and a spatialindex. It is a wrapper for the DtSpatia...
Definition: spatialVrfObjectManagerHybrid.h:19
std::shared_ptr< MAK::SpatialIndex< const DtSimObject * > > mySpatialIndex
The SpatialIndex being used to store the objects.
Definition: spatialVrfObjectManagerHybrid.h:184
Definition: coordSystem.h:54
std::map< unsigned long long, DtSimObjectReference > Container
Private class implementation details.
Definition: spatialVrfObjectManagerHybrid.h:116
#define DT_DLL_vrfobjcore
This file is used to determine how to build.
Definition: vrfobjcoreDefines.h:24
Abstract interface for a spatial object manager.
Definition: spatialVrfObjectManager.h:43
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
virtual void clearVrfObjects()=0
Clears all managed objects from the manager. Does not affect the spatial container, other than to empty its cells of any elements.
virtual bool setResolutions(unsigned int xRes, unsigned int yRes, unsigned int zRes)=0
Deprecated – doesn&#39;t apply to octree manager. Still necessary for DtSpatialVrfObjectManager. TODO need to push this all into the manager class, instead of having the DtPhysicalWorld assume that things are uniformly subdivided.
double myObjectMaxLength
Definition: spatialVrfObjectManagerHybrid.h:186
double myLastTimeEvaluated
Definition: spatialVrfObjectManagerHybrid.h:193
virtual void addVrfObjects(const DtManagedObjectListConstPtr &vrfObjects)=0
Spatially sorts the vrfObjects associated in the vrfObjects.

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)