AGX Dynamics 2.38.0.2
Loading...
Searching...
No Matches
ConvexBuilder.h
Go to the documentation of this file.
1/*
2Copyright 2007-2024. Algoryx Simulation AB.
3
4All AGX source code, intellectual property, documentation, sample code,
5tutorials, scene files and technical white papers, are copyrighted, proprietary
6and confidential material of Algoryx Simulation AB. You may not download, read,
7store, distribute, publish, copy or otherwise disseminate, use or expose this
8material unless having a written signed agreement with Algoryx Simulation AB, or having been
9advised so by Algoryx Simulation AB for a time limited evaluation, or having purchased a
10valid commercial license from Algoryx Simulation AB.
11
12Algoryx Simulation AB disclaims all responsibilities for loss or damage caused
13from using this software, unless otherwise stated in written agreements with
14Algoryx Simulation AB.
15*/
16#pragma once
17
19#include <agx/Referenced.h>
20#include <agx/Vector.h>
21#include <agxCollide/Convex.h>
22#include <agxIO/MeshReader.h>
24#include <agx/debug.h>
25
26namespace agxCollide
27{
28 namespace deprecated {
29
31
32 class ConvexBuilderImplementation;
44 {
45 public:
46
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}
#define AGX_DECLARE_POINTER_TYPES(type)
Definition Referenced.h:254
#define AGXPHYSICS_EXPORT
Class for creating convex meshes from a set of vertices and indices.
size_t buildConvexShapes(agxCollide::deprecated::ConvexBuilderImplementation *impl)
void setMaxVertices(unsigned int n=32)
Option: Set maximum number of vertices in the output hull. Recommended 32 or less.
size_t getNumShapes() const
return num shapes
agxCollide::ConvexRef getShape(size_t i)
unsigned int getConcavityPercent() const
void setDepth(unsigned int depth=5)
Option: Set the depth to split, a maximum of 10, generally not over 7.
void setSkinWidth(double swidth=0.0)
Option: Set the skin width to apply to the output hulls.
void setVolumePercent(unsigned int volumePercent=5)
Option: Set the percentage volume conservation threshold to collapse hulls. 0-30 is reasonable.
size_t build(agxIO::MeshReader *reader)
Constructs a number of Convex shapes from the triangles read with the MeshReader.
size_t build(const agx::Vec3Vector &vertices, const agx::UInt32Vector &indices, size_t numTriangles)
Constructs a number of Convex shapes from a triangle list.
void setConcavityPercent(unsigned int concPercent=5)
Option: Set the concavity threshold percentage. 0=20 is reasonable.
const ConvexRefVector & getConvexShapes() const
Class for reading a mesh object from file and extracting vertices, normals and indices for collision ...
Definition MeshReader.h:83
Base class providing referencing counted objects.
Definition Referenced.h:120
Templated vector class.
Definition agx/Vector.h:53
#define agxAssert(expr)
Definition debug.h:143
agx::Vector< agxCollide::ConvexRef > ConvexRefVector
This namespace consists of a set of classes for handling geometric intersection tests including boole...