AGX Dynamics  2.35.0.1
MeshData.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 
17 #ifndef AGXCOLLIDE_MESHDATA_H
18 #define AGXCOLLIDE_MESHDATA_H
19 
20 #include <agx/agx_vector_types.h>
21 #include <agx/ref_ptr.h>
23 #include <agx/SPDMatrix3x3.h>
24 #include <agxStream/Serializable.h>
25 
26 namespace agxCollide
27 {
39  {
40  public:
41  friend class Mesh;
42  friend class Trimesh;
43  friend class HeightField;
44  friend class Convex;
45 
47 
48  agx::Vec3Vector& getVertices();
49  const agx::Vec3Vector& getVertices() const ;
50 
51  agx::UInt32Vector& getIndices();
52  const agx::UInt32Vector& getIndices() const;
53 
54  size_t getNumTriangles() const;
55 
56  const BoundingAABB& getBound() const;
57 
59 
60  protected:
62  virtual ~MeshData();
63  protected:
66  BoundingAABB m_bound; // Double storing (also in shape entity), here it is only used for graphics.
68  };
69 
72 
73 
76  {
77  public:
78  friend class Mesh;
79  friend class Trimesh;
80  friend class HeightField;
81  friend class Convex;
82 
84 
87 
89  const agx::Vec3Vector& getNormals() const;
90 
92 
94 
96 
97  bool isValid() const;
98 
99  bool hasHalfEdge() const;
100 
102 
104 
106 
108 
109  bool isTerrain() const;
110 
112 
114 
115  protected:
118 
119  protected:
120  // Everything here should be added to the deepCopy()-method.
129  bool m_valid;
130  bool m_closed;
134  };
135 
138 
139 
142  {
143  public:
144  friend class HeightField;
145 
147 
149  agx::Vec2 getSize() const { return m_size; }
150 
153 
156 
157  protected:
160  protected:
161  // Everything here should be added to the deepCopy()-method.
165  agx::Vec2 m_invScale; // Cached inverses of m_scale.
169  bool m_dynamic; // Are we interested of mass properties?
170  };
171 
174 
175 
176 
177  // Implementations
178 
180  {
181  return m_vertices;
182  }
183 
184 
186  {
187  return m_vertices;
188  }
189 
190 
192  {
193  return m_indices;
194  }
195 
196 
198  {
199  return m_indices;
200  }
201 
202 
204  {
205  return m_numTriangles;
206  }
207 
208 
210  {
211  return m_bound;
212  }
213 
214 
215 }
216 
217 #endif
218 
#define AGXSTREAM_DECLARE_SERIALIZABLE(T)
Use this in a Serializable class to add the required methods Important: Use full namespace in the dec...
Definition: Serializable.h:207
#define AGXPHYSICS_EXPORT
#define m_size
Definition: agx/Vector.h:429
Axis aligned bounding box implementation.
Definition: BoundingAABB.h:38
Class for data sharing only to be used by Mesh, its internal classes and children.
Definition: MeshData.h:76
agx::SPDMatrix3x3 m_inertia
Definition: MeshData.h:124
CollisionMeshData * deepCopy() const
Creates a deep copy of all data. Caller takes ownership of pointer.
agx::Real getVolume() const
agx::UInt32Vector m_halfEdges
Definition: MeshData.h:123
const agx::SPDMatrix3x3 & getInertia() const
const agx::UInt32Vector & getHalfEdges() const
const agx::Vec3Vector & getNormals() const
agx::Real getTotalMaximumEdgeLength() const
virtual ~CollisionMeshData()
Hiding destructor.
agx::Vec3Vector m_normals
Definition: MeshData.h:121
agx::Vec3 getCenter() const
const agx::Real32Vector & getTriangleMaximumEdgeLengths() const
agx::Real m_totalMaximumEdgeLength
Definition: MeshData.h:126
agx::Real32Vector m_triangleMaximumEdgeLengths
Definition: MeshData.h:122
agx::Real getBottomMargin() const
A convex class for geometric intersection tests.
Definition: Convex.h:38
Class for data sharing only to be used by HeightField.
Definition: MeshData.h:142
virtual ~HeightFieldMeshData()
Hiding destructor.
agx::Vec2u32 getResolution() const
agx::Vec2 getSize() const
Definition: MeshData.h:149
HeightFieldMeshData * deepCopy() const
Creates a deep copy of all data. Caller takes ownership of pointer.
agx::UIntVector m_boundIndices
Definition: MeshData.h:162
A HeightField is a collision shape that can be created from a grid structure, like an image.
Stores triangle mesh data as triangle lists, i.e.
Definition: MeshData.h:39
virtual ~MeshData()
Hiding destructor.
size_t getNumTriangles() const
Definition: MeshData.h:203
agx::Vec3Vector & getVertices()
Definition: MeshData.h:179
size_t m_numTriangles
Definition: MeshData.h:67
agx::UInt32Vector & getIndices()
Definition: MeshData.h:191
const BoundingAABB & getBound() const
Definition: MeshData.h:209
BoundingAABB m_bound
Definition: MeshData.h:66
agx::UInt32Vector m_indices
Definition: MeshData.h:65
agx::Vec3Vector m_vertices
Definition: MeshData.h:64
Mesh is a common base class for triangle meshes, such as Mesh or HeightField.
Definition: Mesh.h:70
Triangle mesh for geometric intersection tests.
Definition: Trimesh.h:43
This class is an abstract base class for all classes that can be stored and retrieved from an Archive...
Definition: Serializable.h:45
Base class providing referencing counted objects.
Definition: Referenced.h:114
Specialized type of matrices for holding symmetric positive definite matrices.
Definition: SPDMatrix3x3.h:49
Smart pointer for handling referenced counted objects.
Definition: ref_ptr.h:30
#define AGX_FORCE_INLINE
Definition: macros.h:58
This namespace consists of a set of classes for handling geometric intersection tests including boole...
agx::ref_ptr< const CollisionMeshData > ConstCollisionMeshDataRef
Definition: MeshData.h:137
agx::ref_ptr< MeshData > MeshDataRef
Definition: MeshData.h:70
agx::ref_ptr< const MeshData > ConstMeshDataRef
Definition: MeshData.h:71
agx::ref_ptr< CollisionMeshData > CollisionMeshDataRef
Definition: MeshData.h:136
agx::ref_ptr< const HeightFieldMeshData > ConstHeightFieldMeshDataRef
Definition: MeshData.h:173
agx::ref_ptr< HeightFieldMeshData > HeightFieldMeshDataRef
Definition: MeshData.h:172
double Real
Definition: Real.h:42