AGXDynamics  2.31.1.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
MeshData.h
Go to the documentation of this file.
1 /*
2 Copyright 2007-2021. 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 
46  MeshData();
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 
86  CollisionMeshData* deepCopy() const;
87 
88  const agx::Vec3Vector& getNormals() const;
89 
90  const agx::Real32Vector& getTriangleMaximumEdgeLengths() const;
91 
92  const agx::UInt32Vector& getHalfEdges() const;
93 
94  agx::Real getTotalMaximumEdgeLength() const;
95 
96  bool isValid() const;
97 
98  bool hasHalfEdge() const;
99 
100  const agx::SPDMatrix3x3& getInertia() const;
101 
102  agx::Vec3 getCenter() const;
103 
104  agx::Real getVolume() const;
105 
106  agx::Real getBottomMargin() const;
107 
108  bool isTerrain() const;
109 
110  bool hasInternalCenterPoint() const;
111 
113 
114  protected:
116  virtual ~CollisionMeshData();
117 
118  protected:
119  // Everything here should be added to the deepCopy()-method.
128  bool m_valid;
129  bool m_closed;
133  };
134 
137 
138 
141  {
142  public:
143  friend class HeightField;
144 
146 
148  agx::Vec2 getSize() const { return m_size; }
149 
151  agx::Vec2u32 getResolution() const;
152 
154  HeightFieldMeshData* deepCopy() const;
155 
156  protected:
158  virtual ~HeightFieldMeshData();
159  protected:
160  // Everything here should be added to the deepCopy()-method.
164  agx::Vec2 m_invScale; // Cached inverses of m_scale.
168  bool m_dynamic; // Are we interested of mass properties?
169  };
170 
173 
174 
175 
176  // Implementations
177 
179  {
180  return m_vertices;
181  }
182 
183 
185  {
186  return m_vertices;
187  }
188 
189 
191  {
192  return m_indices;
193  }
194 
195 
197  {
198  return m_indices;
199  }
200 
201 
203  {
204  return m_numTriangles;
205  }
206 
207 
209  {
210  return m_bound;
211  }
212 
213 
214 }
215 
216 #endif
217 
agx::Vec3Vector m_normals
Definition: MeshData.h:120
Mesh is a common base class for triangle meshes, such as Mesh or HeightField.
Definition: Mesh.h:68
size_t getNumTriangles() const
Definition: MeshData.h:202
Class for data sharing only to be used by Mesh, its internal classes and children.
Definition: MeshData.h:75
agx::ref_ptr< const MeshData > ConstMeshDataRef
Definition: MeshData.h:71
size_t m_numTriangles
Definition: MeshData.h:67
#define m_size
Definition: Vector.h:429
#define AGXPHYSICS_EXPORT
A convex class for geometric intersection tests.
Definition: Convex.h:37
agx::SPDMatrix3x3 m_inertia
Definition: MeshData.h:123
Class for data sharing only to be used by HeightField.
Definition: MeshData.h:140
#define AGX_FORCE_INLINE
Definition: Object.h:62
Base class providing referencing counted objects.
Definition: Referenced.h:113
agx::ref_ptr< HeightFieldMeshData > HeightFieldMeshDataRef
Definition: MeshData.h:171
AGXMODEL_EXPORT agx::Vec3 getCenter(const agxCollide::Mesh::Triangle &triangle)
agx::ref_ptr< CollisionMeshData > CollisionMeshDataRef
Definition: MeshData.h:135
const BoundingAABB & getBound() const
Definition: MeshData.h:208
agx::Vec3Vector m_vertices
Definition: MeshData.h:64
agx::UInt32Vector & getIndices()
Definition: MeshData.h:190
Specialized type of matrices for holding symmetric positive definite matrices.
Definition: SPDMatrix3x3.h:48
agx::UInt32Vector m_indices
Definition: MeshData.h:65
agx::Real32Vector m_triangleMaximumEdgeLengths
Definition: MeshData.h:121
Smart pointer for handling referenced counted objects.
Definition: ref_ptr.h:29
agx::Vec2 getSize() const
Definition: MeshData.h:148
BoundingAABB m_bound
Definition: MeshData.h:66
#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:206
This class is an abstract base class for all classes that can be stored and retrieved from an Archive...
Definition: Serializable.h:44
agx::UInt32Vector m_halfEdges
Definition: MeshData.h:122
agx::UIntVector m_boundIndices
Definition: MeshData.h:161
agx::ref_ptr< MeshData > MeshDataRef
Definition: MeshData.h:70
agx::ref_ptr< const CollisionMeshData > ConstCollisionMeshDataRef
Definition: MeshData.h:136
double Real
Definition: Real.h:42
Axis aligned bounding box implementation.
Definition: BoundingAABB.h:37
Triangle mesh for geometric intersection tests.
Definition: Trimesh.h:42
Stores triangle mesh data as triangle lists, i.e.
Definition: MeshData.h:38
A HeightField is a collision shape that can be created from a grid structure, like an image...
agx::Vec3Vector & getVertices()
Definition: MeshData.h:178
agx::Real m_totalMaximumEdgeLength
Definition: MeshData.h:125
agx::ref_ptr< const HeightFieldMeshData > ConstHeightFieldMeshDataRef
Definition: MeshData.h:172