AGXDynamics  2.35.0.3
ConvexBuilder.h
Go to the documentation of this file.
1 /*
2 Copyright 2007-2022. Algoryx Simulation AB.
3 
4 All AGX source code, intellectual property, documentation, sample code,
5 tutorials, scene files and technical white papers, are copyrighted, proprietary
6 and confidential material of Algoryx Simulation AB. You may not download, read,
7 store, distribute, publish, copy or otherwise disseminate, use or expose this
8 material unless having a written signed agreement with Algoryx Simulation AB, or having been
9 advised so by Algoryx Simulation AB for a time limited evaluation, or having purchased a
10 valid commercial license from Algoryx Simulation AB.
11 
12 Algoryx Simulation AB disclaims all responsibilities for loss or damage caused
13 from using this software, unless otherwise stated in written agreements with
14 Algoryx Simulation AB.
15 */
16 #pragma once
17 
18 #include <agx/agxPhysics_export.h>
19 #include <agx/Referenced.h>
20 #include <agx/Vector.h>
21 #include <agxCollide/Convex.h>
22 #include <agxIO/MeshReader.h>
23 #include <agx/agx_vector_types.h>
24 #include <agx/debug.h>
25 
26 namespace agxCollide
27 {
28  namespace deprecated {
29 
31 
32  class ConvexBuilderImplementation;
44  {
45  public:
46 
48  ConvexBuilder();
49 
53  size_t build( const agx::Vec3Vector& vertices, const agx::UInt32Vector& indices, size_t numTriangles );
54 
60  size_t build(agxIO::MeshReader* reader);
61 
63  const ConvexRefVector& getConvexShapes() const { return m_convexShapes; }
64 
67  {
68  agxAssert(i < m_convexShapes.size());
69  if (i >= m_convexShapes.size())
70  return nullptr;
71  return m_convexShapes[i];
72  }
73 
75  size_t getNumShapes() const { return m_convexShapes.size(); }
76 
78  void setMaxVertices(unsigned int n = 32) { m_maxVertices = n; }
79 
81  unsigned int getMaxVertices() const { return m_maxVertices; }
82 
84  void setDepth(unsigned int depth = 5) { m_depth = depth; }
85  unsigned int getDepth() const { return m_depth; }
86 
88  void setConcavityPercent(unsigned int concPercent = 5) { m_concavityPercent = concPercent; }
89  unsigned int getConcavityPercent() const { return m_concavityPercent; }
90 
92  void setVolumePercent(unsigned int volumePercent = 5) { m_volumePercent = volumePercent; }
93  unsigned int getVolumePercent() const { return m_volumePercent; }
94 
96  void setSkinWidth(double swidth = 0.0) { m_skinWidth = swidth; }
97  double getSkinWidth() const { return m_skinWidth; }
98 
99  protected:
100  virtual ~ConvexBuilder();
101 
102  size_t buildConvexShapes(agxCollide::deprecated::ConvexBuilderImplementation* impl);
103 
104  private:
105 
106  agxIO::MeshReaderRef m_reader;
107 
108  double m_skinWidth;
109  unsigned int m_volumePercent;
110  unsigned int m_concavityPercent;
111  unsigned int m_maxVertices;
112  unsigned int m_depth;
113 
114  ConvexRefVector m_convexShapes;
115 
116  ConvexBuilderImplementation* m_impl;
117  };
118  }
119 }
agxPhysics_export.h
agxCollide::deprecated::ConvexBuilder::getConvexShapes
const ConvexRefVector & getConvexShapes() const
Definition: ConvexBuilder.h:63
agxCollide::deprecated::ConvexBuilder::getSkinWidth
double getSkinWidth() const
Definition: ConvexBuilder.h:97
Referenced.h
agxCollide::deprecated::ConvexBuilder::getShape
agxCollide::ConvexRef getShape(size_t i)
Definition: ConvexBuilder.h:66
Vector.h
agx::Vector< agxCollide::ConvexRef >
agxAssert
#define agxAssert(expr)
Definition: debug.h:143
agxCollide::deprecated::ConvexBuilder::setMaxVertices
void setMaxVertices(unsigned int n=32)
Option: Set maximum number of vertices in the output hull. Recommended 32 or less.
Definition: ConvexBuilder.h:78
agxCollide::deprecated::ConvexBuilder::getNumShapes
size_t getNumShapes() const
return num shapes
Definition: ConvexBuilder.h:75
MeshReader.h
agx::VectorPOD< Vec3 >
AGXPHYSICS_EXPORT
#define AGXPHYSICS_EXPORT
agx::ref_ptr< Convex >
agxCollide::deprecated::ConvexBuilder::getMaxVertices
unsigned int getMaxVertices() const
Definition: ConvexBuilder.h:81
Convex.h
agxCollide::deprecated::ConvexBuilder::setSkinWidth
void setSkinWidth(double swidth=0.0)
Option: Set the skin width to apply to the output hulls.
Definition: ConvexBuilder.h:96
agxCollide::deprecated::ConvexBuilder
Class for creating convex meshes from a set of vertices and indices.
Definition: ConvexBuilder.h:43
agxCollide::deprecated::ConvexBuilder::setConcavityPercent
void setConcavityPercent(unsigned int concPercent=5)
Option: Set the concavity threshold percentage. 0=20 is reasonable.
Definition: ConvexBuilder.h:88
agxCollide::deprecated::ConvexBuilder::setVolumePercent
void setVolumePercent(unsigned int volumePercent=5)
Option: Set the percentage volume conservation threshold to collapse hulls. 0-30 is reasonable.
Definition: ConvexBuilder.h:92
agxCollide::deprecated::ConvexRefVector
agx::Vector< agxCollide::ConvexRef > ConvexRefVector
Definition: ConvexBuilder.h:30
agx::Referenced
Base class providing referencing counted objects.
Definition: Referenced.h:113
agxCollide::deprecated::ConvexBuilder::getDepth
unsigned int getDepth() const
Definition: ConvexBuilder.h:85
agxCollide
This namespace consists of a set of classes for handling geometric intersection tests including boole...
Definition: ContactForceFilterParticipant.h:22
agxCollide::AGX_DECLARE_POINTER_TYPES
AGX_DECLARE_POINTER_TYPES(SpaceListener)
agxCollide::deprecated::ConvexBuilder::getVolumePercent
unsigned int getVolumePercent() const
Definition: ConvexBuilder.h:93
agxCollide::deprecated::ConvexBuilder::setDepth
void setDepth(unsigned int depth=5)
Option: Set the depth to split, a maximum of 10, generally not over 7.
Definition: ConvexBuilder.h:84
agxCollide::deprecated::ConvexBuilder::getConcavityPercent
unsigned int getConcavityPercent() const
Definition: ConvexBuilder.h:89
agxIO::MeshReader
Class for reading a mesh object from file and extracting vertices, normals and indices for collision ...
Definition: MeshReader.h:82
agx_vector_types.h
debug.h