iMSTK
Interactive Medical Simulation Toolkit
imstkCollisionDataDebugModel.h
1 /*
2 ** This file is part of the Interactive Medical Simulation Toolkit (iMSTK)
3 ** iMSTK is distributed under the Apache License, Version 2.0.
4 ** See accompanying NOTICE for details.
5 */
6 
7 #pragma once
8 
9 #include "imstkCollisionData.h"
10 #include "imstkDebugGeometryModel.h"
11 
12 namespace imstk
13 {
22 {
23 public:
25  ~CollisionDataDebugModel() override = default;
26 
30  void addCollisionElement(std::shared_ptr<PointSet> pointSet, const CollisionElement& elem);
31 
35  void printContactInfo(const CollisionElement& elem);
36 
41  void debugUpdate();
42 
46  void setInputCD(std::shared_ptr<CollisionData> cdData) { m_cdData = cdData; }
47  std::shared_ptr<CollisionData> getInputCD() const { return m_cdData; }
49 
53  void setPrintContacts(const bool printContacts) { m_printContacts = printContacts; }
54  bool getPrintContacts() const { return m_printContacts; }
56 
61  void setClearRate(const int clearRate) { m_clearRate = clearRate; }
62  int getClearRate() const { return m_clearRate; }
64 
68  void setCountEmptyFrames(const bool countEmptyFrames) { m_countEmptyFrames = countEmptyFrames; }
69  int getCountEmptyFrames() const { return m_countEmptyFrames; }
71 
72 protected:
73  std::shared_ptr<CollisionData> m_cdData = nullptr;
74  bool m_printContacts = false;
75  int m_clearRate = 1;
76  int m_frameCounter = 0;
77  bool m_countEmptyFrames = true;
78 };
79 } // namespace imstk
Class for quickly rendering and showing various primivites such as line segments, triangles...
Class for visualizing CollisionData. Give it collision data and add it to the scene This class intent...
void debugUpdate()
Updates visual representation to the current cd (we don&#39;t use the built in update as its useful to ca...
void setClearRate(const int clearRate)
Set the amount of simulation frames to cache data for, this is useful if you have numerous simulation...
Compound Geometry.
void setInputCD(std::shared_ptr< CollisionData > cdData)
Set/Get the input collision data for which geometry is generated for.
Union of collision elements. We use a union to avoid polymorphism. There may be many elements and acc...
void addCollisionElement(std::shared_ptr< PointSet > pointSet, const CollisionElement &elem)
Append visual representation to the debug meshes for the given contact and geometry.
void setPrintContacts(const bool printContacts)
Print collision contact data to stdout.
void setCountEmptyFrames(const bool countEmptyFrames)
If on, frames without collision data won&#39;t be counted for clear rate.
void printContactInfo(const CollisionElement &elem)
Print the contact information.