AGX Dynamics 2.38.0.2
Loading...
Searching...
No Matches
ConvexFactory.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
17#pragma once
18
20#include <agx/Referenced.h>
21#include <agx/Vector.h>
22#include <agxCollide/Convex.h>
23#include <agxIO/MeshReader.h>
25#include <agx/debug.h>
26
27namespace agxCollide
28{
29
31
41 {
42 public:
43
45 {
46 };
49
51 {
53 uint32_t resolution = 50;
54
56 double concavity = 0.0025;
57
59 uint32_t planeDownsampling = 4;
60
62 uint32_t convexhullDownsampling = 4;
63
65 double alpha = 0.05;
66
68 double beta = 0.05;
69
71 bool pca = false;
72
74 uint32_t mode = 0; // 0: voxel-based (recommended), 1: tetrahedron-based
75
76 // Controls the maximum number of triangles per convex - hull. Default 64, range: [0, 1024]
77 uint32_t maxNumVerticesPerConvex = 64;
78
80 double minVolumePerConvex = 0.0001;
81
82 bool convexhullApproximation = true;
83
85 uint32_t maxConvexHulls = 1024;
86 };
89
90
93
97 size_t build( const agx::Vec3Vector& vertices,
98 const agx::UInt32Vector& indices,
99 const Parameters* parameters = nullptr,
100 const agx::Matrix3x3& transformation = agx::Matrix3x3(),
101 const agx::Vec3& translation = agx::Vec3()
102 );
103
109 size_t build( const agxIO::MeshReader *reader,
110 const Parameters* parameters = nullptr,
111 const agx::Matrix3x3& transformation = agx::Matrix3x3(),
112 const agx::Vec3& translation = agx::Vec3()
113 );
114
117
120
122 size_t getNumShapes() const;
123
124 protected:
125 virtual ~ConvexFactory( );
126
127 private:
128
129 size_t buildImplementation(const agx::Vec3Vector& vertices,
130 const agx::UInt32Vector& indices,
131 const VHACDParameters* parameters,
132 const agx::Matrix3x3& transformation = agx::Matrix3x3(),
133 const agx::Vec3& translation = agx::Vec3()
134 );
135
136 agxIO::MeshReaderRef m_reader;
137
138 ConvexRefVector m_convexShapes;
139
140 ParametersConstRef m_parameters;
141 };
142}
143
144
145
#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.
agx::ref_ptr< const VHACDParameters > VHACDParametersConstRef
agx::ref_ptr< Parameters > ParametersRef
agx::ref_ptr< const Parameters > ParametersConstRef
size_t build(const agx::Vec3Vector &vertices, const agx::UInt32Vector &indices, const Parameters *parameters=nullptr, const agx::Matrix3x3 &transformation=agx::Matrix3x3(), const agx::Vec3 &translation=agx::Vec3())
Constructs a number of Convex shapes from a triangle list.
agxCollide::ConvexRef getShape(size_t i)
ConvexFactory()
Constructor.
size_t getNumShapes() const
return num shapes
size_t build(const agxIO::MeshReader *reader, const Parameters *parameters=nullptr, const agx::Matrix3x3 &transformation=agx::Matrix3x3(), const agx::Vec3 &translation=agx::Vec3())
Constructs a number of Convex shapes from the triangles read with the MeshReader.
agx::ref_ptr< VHACDParameters > VHACDParametersRef
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
Smart pointer for handling referenced counted objects.
Definition ref_ptr.h:30
This namespace consists of a set of classes for handling geometric intersection tests including boole...
agx::Vector< agxCollide::ConvexRef > ConvexRefVector