AGX Dynamics  2.37.3.2
Mesh.h
Go to the documentation of this file.
1 /*
2 Copyright 2007-2024. 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_MESH_H
18 #define AGXCOLLIDE_MESH_H
19 
20 #include <agx/agxPhysics_export.h>
21 #include <agx/agx_vector_types.h>
22 
23 #include <agxData/LocalVector.h>
24 
25 #include <GIMPACT/AabbTree.h>
26 
27 #include <agxCollide/agxCollide.h>
28 #include <agxCollide/MeshData.h>
29 #include <agxCollide/Shape.h>
30 
31 #include <agxStream/Serializable.h>
32 
33 
34 namespace agxCollide
35 {
37 
69  class AGXPHYSICS_EXPORT Mesh : public Shape
70  {
71 
72  public:
79  {
80  friend class Mesh;
81  public:
86  agx::Vec3 getVertex( uint_fast8_t localVertexIndex ) const;
87 
92  agx::Vec3 getNormal() const;
93 
101  bool isValid() const;
102 
108  size_t getGlobalVertexIndex( uint_fast8_t localVertexIndex ) const;
109 
114  agx::Vec3 getEdgeStartVertex( uint_fast8_t localEdgeIndex ) const;
115 
120  agx::Vec3 getEdgeEndVertex( uint_fast8_t localEdgeIndex ) const;
121 
123  agx::Real getMaximumEdgeLength() const;
124 
129  bool hasHalfEdgePartner( uint_fast8_t localEdgeIndex ) const;
130 
139  const Triangle getHalfEdgePartner( uint_fast8_t localEdgeIndex ) const;
140 
151  size_t getHalfEdgePartnerGlobalEdgeIndex( uint_fast8_t localEdgeIndex ) const;
152 
162  size_t getHalfEdgePartnerLocalEdgeIndex( uint_fast8_t localEdgeIndex ) const;
163 
168  size_t getTriangleIndex() const;
169 
171  const Mesh* getMesh() const;
172 
173 
174  protected:
181  Triangle( const Mesh* mesh, size_t triangleIndex );
182 
187  Triangle();
188 
189  protected:
192 
193  };
194 
195 
203  {
204  friend class Mesh;
205 
206  public:
214  void operator++(int);
215 
223  VertexEdgeCirculator& operator++ ();
224 
229  bool isValid() const;
230 
235  bool atEnd() const;
236 
238  agx::Vec3 getEdgeStartVertex() const;
239 
241  agx::Vec3 getEdgeEndVertex() const;
242 
244  inline const Triangle getTriangle() const;
245 
247  uint_fast8_t getLocalEdgeIndex() const;
248 
250  bool hasJustJumpedOverHole() const;
251 
253  size_t getTriangleIndex() const;
254 
256  const Mesh* getMesh() const;
257 
260 
261  protected:
270  VertexEdgeCirculator( const Mesh* mesh,
271  size_t triangleIndex, uint_fast8_t localVertexIndex );
272 
273  protected:
277  uint_fast8_t m_localEdgeStartIndex;
278  uint_fast8_t m_localEdgeIndex;
281  bool m_valid;
282  };
283 
291  {
292  friend class Mesh;
293 
294  public:
298  void operator++(int);
299 
303  FaceEdgeCirculator& operator++();
304 
310  bool isValid() const;
311 
316  bool atEnd() const;
317 
319  agx::Vec3 getEdgeStartVertex() const;
320 
322  agx::Vec3 getEdgeEndVertex() const;
323 
325  const Triangle getTriangle() const;
326 
328  uint_fast8_t getLocalEdgeIndex() const;
329 
331  const Mesh* getMesh() const;
332 
335 
336  protected:
343  FaceEdgeCirculator( const Mesh* mesh, size_t triangleIndex );
344 
345  protected:
348  uint_fast8_t m_localEdgeIndex;
350  bool m_valid;
351  };
352 
353 
354  // Methods of the class Mesh.
355  public:
356 
358  size_t getNumVertices() const;
359 
364  agx::Vec3 getVertex( size_t globalVertexIndex ) const;
365 
367  size_t getNumTriangles() const;
368 
375  agx::Vec3 getTriangleVertex( size_t triangleIndex, uint_fast8_t localVertexIndex ) const;
376 
381  agx::Vec3 getTriangleNormal( size_t triangleIndex ) const;
382 
389  size_t getGlobalVertexIndex( size_t triangleIndex, uint_fast8_t localVertexIndex ) const;
390 
395  agx::Real getTriangleMaximumEdgeLength( size_t triangleIndex ) const;
396 
398  agx::Real getTotalMaximumEdgeLength() const;
399 
401  uint32_t getHalfEdgePartnerEdge( size_t globalEdgeIndex ) const;
402 
407  bool isValid() const;
408 
414  bool isValidAndClosed() const;
415 
417  virtual agx::Vec3 getCenter() const override;
418 
420  virtual agx::Real getVolume() const override;
421 
423  virtual agx::SPDMatrix3x3 calculateInertia( agx::Real mass ) const override;
424 
426  bool isTerrain() const;
427 
429  bool hasInternalCenterPoint() const;
430 
436  agx::Real getBottomMargin() const;
437 
445  void setBottomMargin(agx::Real newMargin);
446 
451  bool isValidEdgeIndex(size_t globalEdgeIndex ) const;
452 
457  bool isValidTriangleIndex(size_t globalTriangleIndex ) const;
458 
463  inline const Triangle getTriangle( size_t triangleIndex ) const;
464 
469  static size_t getLocalEdgeIndex( size_t globalEdgeIndex );
470 
475  static size_t getGlobalTriangleIndex( size_t globalEdgeIndex );
476 
484  static size_t getGlobalEdgeIndex ( size_t triangleIndex, uint_fast8_t localEdgeIndex );
485 
495  void calculateTrianglesInVolume(
496  const BoundingAABB& volume, const agx::AffineMatrix4x4& meshToWorld, const agx::AffineMatrix4x4& volumeToWorld,
497  agx::UInt32Vector& triangleIndices ) const;
498 
499  void calculateTrianglesInVolume(
500  const BoundingAABB& volume, const agx::AffineMatrix4x4& meshToWorld, const agx::AffineMatrix4x4& volumeToWorld,
501  agxData::LocalVector<agx::UInt32>& triangleIndices ) const;
502 
503 
506  {
508  agx::Real newLineParameter, bool newIsFrontFace) :
509  lineParameter(newLineParameter), triangleIndex(newTriangleIndex),
510  isFrontFace(newIsFrontFace)
511  {}
512  agx::Real lineParameter; // Parameter along line, between 0 and 1.
513  agx::UInt32 triangleIndex; // The triangle index.
514  bool isFrontFace; // Is triangle hit from front, or back?
515  };
516 
518 
529  void calculateTriangleOverlapsAlongLineSegment(
530  const agx::Vec3& segmentStartLocal,
531  const agx::Vec3& segmentEndLocal,
532  TriangleLineSegmentResultVector& triangleResults) const;
533 
541  virtual void calculatePossibleTriangleOverlapsAlongLineSegment(
542  const agx::Vec3& segmentStartLocal,
543  const agx::Vec3& segmentEndLocal,
544  agx::UInt32Vector& triangleIndices) const = 0;
545 
546 
554  virtual void calculatePossibleTriangleOverlapsAlongLineSegment(
555  const agx::Vec3& segmentStartLocal,
556  const agx::Vec3& segmentEndLocal,
557  agxData::LocalVector<agx::UInt32>& triangleIndices) const = 0;
558 
567  VertexEdgeCirculator createVertexEdgeCirculator(
568  size_t triangleIndex,
569  uint_fast8_t localVertexIndex ) const;
570 
576  FaceEdgeCirculator createFaceEdgeCirculator(
577  size_t triangleIndex ) const;
578 
587  bool isConvexEdge(size_t globalEdgeIndex) const;
588 
601  bool isConvexVertex(size_t triangleIndex, size_t localVertexIndex) const;
602 
604  const CollisionMeshData* getMeshData() const;
605 
607  bool hasHalfEdge() const;
608 
610  const AabbTree* getBvhTree() const;
611 
612  virtual const BoundingAABB& updateBoundingVolume() override;
613  virtual BoundingAABB calculateLocalBound() const override;
614  const BoundingAABB& getLocalBound() const;
615 
616  // AGXSTREAM_DECLARE_SERIALIZABLE( agxCollide::Mesh );
617 
618  protected:
621 
623  virtual ~Mesh();
624 
625  void store( class agxStream::OutputArchive& out ) const override;
626  void restore( class agxStream::InputArchive& in ) override;
627 
628  // Update the bounding volume hierarchy.
629  virtual void updateBvhTree() = 0;
630 
631 
632  protected:
634  AabbTreeRef m_aabbTree;
636  };
637 
638 
640 
643  {
644  return m_triangleIndex;
645  }
646 
647 
648  AGX_FORCE_INLINE size_t Mesh::Triangle::getGlobalVertexIndex( uint_fast8_t localVertexIndex ) const
649  {
650  return m_mesh->getGlobalVertexIndex( m_triangleIndex, localVertexIndex );
651  }
652 
653 
655  {
656  return m_mesh->isValid() && m_mesh->isValidTriangleIndex( m_triangleIndex );
657  }
658 
659 
661  {
662  return m_mesh->getTriangleNormal( m_triangleIndex );
663  }
664 
665 
666  AGX_FORCE_INLINE agx::Vec3 Mesh::Triangle::getVertex( uint_fast8_t localVertexIndex ) const
667  {
668  return m_mesh->getTriangleVertex( m_triangleIndex, localVertexIndex );
669  }
670 
671 
672  AGX_FORCE_INLINE agx::Vec3 Mesh::Triangle::getEdgeStartVertex( uint_fast8_t localEdgeIndex ) const
673  {
674  return m_mesh->getTriangleVertex( m_triangleIndex, localEdgeIndex );
675  }
676 
677 
678  AGX_FORCE_INLINE agx::Vec3 Mesh::Triangle::getEdgeEndVertex( uint_fast8_t localEdgeIndex ) const
679  {
680  return m_mesh->getTriangleVertex( m_triangleIndex, (uint_fast8_t)((localEdgeIndex + (uint_fast8_t)1) % (uint_fast8_t)3) );
681  }
682 
683 
685  {
686  return m_mesh->getTriangleMaximumEdgeLength( m_triangleIndex );
687  }
688 
689 
690  inline size_t Mesh::Triangle::getHalfEdgePartnerGlobalEdgeIndex( uint_fast8_t localEdgeIndex ) const
691  {
692  return m_mesh->getHalfEdgePartnerEdge( Mesh::getGlobalEdgeIndex( m_triangleIndex, localEdgeIndex ) );
693  }
694 
695 
696  inline const Mesh::Triangle Mesh::Triangle::getHalfEdgePartner( uint_fast8_t localEdgeIndex ) const
697  {
698  agxAssert( localEdgeIndex < 3 );
699  return Triangle( m_mesh, this->getHalfEdgePartnerGlobalEdgeIndex( localEdgeIndex ) / 3 ) ;
700  }
701 
702 
703  AGX_FORCE_INLINE size_t Mesh::Triangle::getHalfEdgePartnerLocalEdgeIndex( uint_fast8_t localEdgeIndex ) const
704  {
705  agxAssert( localEdgeIndex < 3 );
706  return this->getHalfEdgePartnerGlobalEdgeIndex( localEdgeIndex ) % 3;
707  }
708 
709 
710 
711  AGX_FORCE_INLINE bool Mesh::Triangle::hasHalfEdgePartner( uint_fast8_t localEdgeIndex )
712  const
713  {
714  return m_mesh->isValidEdgeIndex( this->getHalfEdgePartnerGlobalEdgeIndex( localEdgeIndex ) );
715  }
716 
717 
719  {
720  return m_mesh.get();
721  }
722 
723 
725  AGX_FORCE_INLINE size_t Mesh::getGlobalEdgeIndex ( size_t triangleIndex, uint_fast8_t localEdgeIndex )
726  {
727  return 3 * triangleIndex + localEdgeIndex;
728  }
729 
730 
731  inline const Mesh::Triangle Mesh::getTriangle( size_t triangleIndex ) const
732  {
733  return Mesh::Triangle( this, triangleIndex );
734  }
735 
736 
737  AGX_FORCE_INLINE size_t Mesh::getLocalEdgeIndex( size_t globalEdgeIndex )
738  {
739  return globalEdgeIndex % 3;
740  }
741 
742 
743  AGX_FORCE_INLINE size_t Mesh::getGlobalTriangleIndex( size_t globalEdgeIndex )
744  {
745  return globalEdgeIndex / 3;
746  }
747 
748 
750  {
751  return m_collisionMeshData->m_vertices.size();
752  }
753 
754 
755  AGX_FORCE_INLINE agx::Vec3 Mesh::getVertex( size_t globalVertexIndex ) const
756  {
757  return m_collisionMeshData->m_vertices[ globalVertexIndex ];
758  }
759 
760 
762  {
763  return m_collisionMeshData->m_numTriangles;
764  }
765 
766 
767  AGX_FORCE_INLINE agx::Vec3 Mesh::getTriangleVertex( size_t triangleIndex, uint_fast8_t localVertexIndex ) const
768  {
769  return m_collisionMeshData->m_vertices[m_collisionMeshData->m_indices[3 * triangleIndex + localVertexIndex]];
770  }
771 
772 
773  AGX_FORCE_INLINE agx::Vec3 Mesh::getTriangleNormal( size_t triangleIndex ) const
774  {
775  return m_collisionMeshData->m_normals[triangleIndex];
776  }
777 
778 
779  AGX_FORCE_INLINE size_t Mesh::getGlobalVertexIndex( size_t triangleIndex, uint_fast8_t localVertexIndex ) const
780  {
781  return m_collisionMeshData->m_indices[3 * triangleIndex + localVertexIndex];
782  }
783 
784 
786  {
787  return m_collisionMeshData->m_triangleMaximumEdgeLengths[triangleIndex];
788  }
789 
790 
792  {
793  return m_collisionMeshData->m_totalMaximumEdgeLength;
794  }
795 
796 
797  AGX_FORCE_INLINE uint32_t Mesh::getHalfEdgePartnerEdge( size_t globalEdgeIndex ) const
798  {
799  return m_collisionMeshData->m_halfEdges[globalEdgeIndex];
800  }
801 
802 
804  {
805  return m_collisionMeshData->m_valid;
806  }
807 
808 
810  {
811  return (m_collisionMeshData->m_valid && m_collisionMeshData->m_closed);
812  }
813 
815  {
816  return m_collisionMeshData->m_center;
817  }
818 
819 
821  {
822  return m_collisionMeshData->m_volume;
823  }
824 
825 
827  {
828  return mass * m_collisionMeshData->m_inertia;
829  }
830 
831 
833  {
834  return m_collisionMeshData->m_isTerrain;
835  }
836 
838  {
839  return m_collisionMeshData->m_hasInternalCenterPoint;
840  }
841 
842 
844  {
845  return m_collisionMeshData->m_bottomMargin;
846  }
847 
848 
850  {
851  if (newMargin >= 0) {
852  m_collisionMeshData->m_bottomMargin = newMargin;
853  incrementModifiedCount();
854  updateBoundingVolume();
855  }
856  }
857 
858 
859  AGX_FORCE_INLINE bool Mesh::isValidEdgeIndex(size_t globalEdgeIndex ) const
860  {
861  return globalEdgeIndex < m_collisionMeshData->m_indices.size();
862  }
863 
864 
865  AGX_FORCE_INLINE bool Mesh::isValidTriangleIndex(size_t globalTriangleIndex ) const
866  {
867  return globalTriangleIndex < m_collisionMeshData->m_numTriangles;
868  }
869 
870 
872  {
873  return m_collisionMeshData.get();
874  }
875 
876 
878  {
879  return m_collisionMeshData->m_hasHalfEdge;
880  }
881 
882 
883  AGX_FORCE_INLINE const AabbTree* Mesh::getBvhTree() const
884  {
885  return m_aabbTree;
886  }
887 
888 
889 
890  // From class VertexEdgeCirculator.
891 
893  {
894  if (m_valid) {
895  if (m_hasJustJumpedOverHole) {
896  // must have moved already to come here
897  // keep same triangle, just move local index
898  m_localEdgeIndex = (uint_fast8_t)((m_localEdgeIndex + (uint_fast8_t)1) % (uint_fast8_t)3);
899  m_hasJustJumpedOverHole = false;
900  } else {
901  m_hasMoved = true;
902  size_t he = m_mesh->getHalfEdgePartnerEdge(3 * m_triangleIndex + m_localEdgeIndex);
903  if (!m_mesh->isValidEdgeIndex(he)) {
904  // Found hole.
905  // Go all the way in counter clockwise direction from start.
906  m_triangleIndex = m_triangleStartIndex;
907  m_localEdgeIndex = (uint_fast8_t)((m_localEdgeStartIndex + (uint_fast8_t)2) % (uint_fast8_t)3);
908  m_hasJustJumpedOverHole = true;
909  size_t he2 = m_mesh->getHalfEdgePartnerEdge(3 * m_triangleIndex + m_localEdgeIndex);
910  while (m_mesh->isValidEdgeIndex( he2 )) {
911  m_triangleIndex = he2 / 3;
912  m_localEdgeIndex = (uint_fast8_t)((he2 + 2) % 3);
913  he2 = m_mesh->getHalfEdgePartnerEdge(3 * m_triangleIndex + m_localEdgeIndex);
914  }
915  } else {
916  // normal case not influenced by hole: continue in clockwise direction
917  m_triangleIndex = he / 3;
918  m_localEdgeIndex = (uint_fast8_t)((he + 1) % 3);
919  }
920  }
921  }
922  }
923 
924 
926  {
927  (*this)++;
928  return *this;
929  }
930 
931 
932 
934  {
935  return m_valid;
936  }
937 
938 
939 
941  {
942  return (m_valid && m_hasMoved && m_localEdgeIndex == m_localEdgeStartIndex &&
943  m_triangleIndex == m_triangleStartIndex);
944  }
945 
946 
947 
949  const
950  {
951  return m_mesh->getMeshData()->m_vertices[
952  m_mesh->getMeshData()->m_indices[3 * m_triangleIndex + m_localEdgeIndex]];
953  }
954 
955 
956 
958  const
959  {
960  return m_mesh->getMeshData()->m_vertices[
961  m_mesh->getMeshData()->m_indices[3 * m_triangleIndex + (m_localEdgeIndex + 1) % 3]];
962  }
963 
964 
966  {
967  return m_hasJustJumpedOverHole;
968  }
969 
970 
972  const
973  {
974  return Triangle( m_mesh->getTriangle( m_triangleIndex ));
975  }
976 
977 
979  {
980  return m_localEdgeIndex;
981  }
982 
983 
985  {
986  return m_triangleIndex;
987  }
988 
989 
991  {
992  return m_mesh.get();
993  }
994 
995 
997  const agx::AffineMatrix4x4& meshToWorld, const agx::AffineMatrix4x4& volumeToWorld,
998  agx::UInt32Vector& triangleIndices ) const
999  {
1000  m_aabbTree->findCollision(&volume, std::back_inserter(triangleIndices), meshToWorld, volumeToWorld );
1001  }
1002 
1003 
1004 
1006  const agx::AffineMatrix4x4& meshToWorld, const agx::AffineMatrix4x4& volumeToWorld,
1007  agxData::LocalVector<agx::UInt32>& triangleIndices ) const
1008  {
1009  m_aabbTree->findCollision(&volume, std::back_inserter(triangleIndices), meshToWorld, volumeToWorld );
1010  }
1011 
1012 
1014  size_t triangleIndex,
1015  uint_fast8_t localVertexIndex ) const
1016  {
1017  return VertexEdgeCirculator( this, triangleIndex, localVertexIndex );
1018  }
1019 
1020 
1021 
1022  // From class FaceEdgeCirculator.
1023 
1025  {
1026  if (m_valid) {
1027  m_hasMoved = true;
1028  m_localEdgeIndex = (uint_fast8_t)((m_localEdgeIndex + (uint_fast8_t)1) % (uint_fast8_t)3);
1029  }
1030  }
1031 
1032 
1034  {
1035  (*this)++;
1036  return *this;
1037  }
1038 
1039 
1041  {
1042  return m_valid;
1043  }
1044 
1045 
1046 
1048  {
1049  return (m_valid && m_hasMoved && m_localEdgeIndex == 0);
1050  }
1051 
1052 
1053 
1055  const
1056  {
1057  return m_mesh->getMeshData()->m_vertices[
1058  m_mesh->getMeshData()->m_indices[3 * m_triangleIndex + m_localEdgeIndex]];
1059  }
1060 
1061 
1062 
1064  const
1065  {
1066  return m_mesh->getMeshData()->m_vertices[
1067  m_mesh->getMeshData()->m_indices[3 * m_triangleIndex + (m_localEdgeIndex + 1) % 3]];
1068  }
1069 
1070 
1072  const
1073  {
1074  return m_mesh->getTriangle( m_triangleIndex );
1075  }
1076 
1077 
1079  {
1080  return m_localEdgeIndex;
1081  }
1082 
1083 
1084 
1086  size_t triangleIndex ) const
1087  {
1088  return FaceEdgeCirculator( this, triangleIndex );
1089  }
1090 
1091 
1093  {
1094  return m_mesh.get();
1095  }
1096 
1098  {
1099  return m_localBound;
1100  }
1101 
1102 
1103 }
1104 
1105 #endif /* AGXCOLLIDE_MESH_H */
InputRef< T > in(const char *name, T &obj)
Create an object with a name and a reference to the object that should be restored (usually a pointer...
Definition: InputArchive.h:400
size_t getTriangleIndex() const
Implementations.
Definition: Mesh.h:642
agx::Vec3 getEdgeEndVertex(uint_fast8_t localEdgeIndex) const
Definition: Mesh.h:678
bool isTerrain() const
Definition: Mesh.h:832
VertexEdgeCirculator createVertexEdgeCirculator(size_t triangleIndex, uint_fast8_t localVertexIndex) const
Creates an VertexEdgeCirculator pointing to this Triangle and a Voronoi region.
Definition: Mesh.h:1013
const BoundingAABB & getLocalBound() const
Definition: Mesh.h:1097
const Triangle getTriangle() const
Definition: Mesh.h:971
size_t getGlobalVertexIndex(uint_fast8_t localVertexIndex) const
Returns the global index of the vertex.
Definition: Mesh.h:648
MeshConstRef m_mesh
Definition: Mesh.h:190
const Triangle getTriangle() const
Definition: Mesh.h:1071
Mesh is a common base class for triangle meshes, such as Mesh or HeightField.
Definition: Mesh.h:69
AabbTreeRef m_aabbTree
Definition: Mesh.h:634
OutputRef< Serializable > out(const char *name, const Serializable *obj)
Return an object that contain the name and the object that should be serialized to an archive...
Class for data sharing only to be used by Mesh, its internal classes and children.
Definition: MeshData.h:75
const Triangle getHalfEdgePartner(uint_fast8_t localEdgeIndex) const
Definition: Mesh.h:696
Base class for a shape.
Definition: Shape.h:53
static size_t getGlobalEdgeIndex(size_t triangleIndex, uint_fast8_t localEdgeIndex)
Computes the global edge index from a given triangle index and the local edge index within this trian...
Definition: Mesh.h:725
This namespace consists of a set of classes for handling geometric intersection tests including boole...
agx::Vec3 getEdgeStartVertex() const
Definition: Mesh.h:948
FaceEdgeCirculator createFaceEdgeCirculator(size_t triangleIndex) const
Creates an FaceEdgeCirculator pointing to this Triangle and a Voronoi region.
Definition: Mesh.h:1085
agx::Vec3 getTriangleVertex(size_t triangleIndex, uint_fast8_t localVertexIndex) const
Returns one of the three vertices in a triangle.
Definition: Mesh.h:767
agx::Vec3 getNormal() const
This function returns the triangle normal (as stored in the collision mesh data). ...
Definition: Mesh.h:660
#define AGXPHYSICS_EXPORT
Pointer to a entity instance of type Physics.Geometry.Shape.
Definition: ShapeEntity.h:195
uint_fast8_t getLocalEdgeIndex() const
Definition: Mesh.h:978
agx::Real getBottomMargin() const
Definition: Mesh.h:843
BoundingAABB m_localBound
Definition: Mesh.h:635
agx::Real getTotalMaximumEdgeLength() const
Definition: Mesh.h:791
#define AGX_FORCE_INLINE
Definition: Object.h:59
agx::Vector< TriangleLineSegmentResult > TriangleLineSegmentResultVector
Definition: Mesh.h:517
static size_t getGlobalTriangleIndex(size_t globalEdgeIndex)
Definition: Mesh.h:743
const AabbTree * getBvhTree() const
Definition: Mesh.h:883
agx::Real getMaximumEdgeLength() const
Definition: Mesh.h:684
bool hasHalfEdgePartner(uint_fast8_t localEdgeIndex) const
Definition: Mesh.h:711
size_t getHalfEdgePartnerGlobalEdgeIndex(uint_fast8_t localEdgeIndex) const
Definition: Mesh.h:690
AGXMODEL_EXPORT agx::Vec3 getCenter(const agxCollide::Mesh::Triangle &triangle)
Class in order to circulate over the edges connected to a Triangle&#39;s vertex.
Definition: Mesh.h:202
Templated vector class.
Definition: Vector.h:52
static size_t getLocalEdgeIndex(size_t globalEdgeIndex)
Definition: Mesh.h:737
agx::Vec3 getTriangleNormal(size_t triangleIndex) const
Definition: Mesh.h:773
agx::Vec3 getEdgeEndVertex() const
Definition: Mesh.h:957
const Mesh * getMesh() const
Definition: Mesh.h:1092
Class for more intuitive access to the Mesh&#39;s mesh data.
Definition: Mesh.h:78
void calculateTrianglesInVolume(const BoundingAABB &volume, const agx::AffineMatrix4x4 &meshToWorld, const agx::AffineMatrix4x4 &volumeToWorld, agx::UInt32Vector &triangleIndices) const
Calculates an array of triangle indices of the triangles that are within a bounding volume...
Definition: Mesh.h:996
bool isValid() const
Definition: Mesh.h:803
void setBottomMargin(agx::Real newMargin)
Sets the depth that is added below the lowest point in the terrain in local z direction, to prevent tunneling in this direction.
Definition: Mesh.h:849
agx::Vec3 getVertex(uint_fast8_t localVertexIndex) const
Definition: Mesh.h:666
const CollisionMeshData * getMeshData() const
Definition: Mesh.h:871
AGXPHYSICS_EXPORT size_t getMeshData(const agxCollide::Mesh *mesh, agx::Vec3Vector &vertices, agx::UInt32Vector &indices)
Extract vertices and indices from mesh.
Specialized type of matrices for holding symmetric positive definite matrices.
Definition: SPDMatrix3x3.h:48
bool isValid() const
Definition: Mesh.h:654
Struct used in calculateTriangleOverlapsAlongLineSegment.
Definition: Mesh.h:505
Class in order to circulate over the edges connected to a Triangle&#39;s face.
Definition: Mesh.h:290
bool isValidEdgeIndex(size_t globalEdgeIndex) const
Definition: Mesh.h:859
size_t getNumVertices() const
Definition: Mesh.h:749
agx::Vec3 getEdgeStartVertex(uint_fast8_t localEdgeIndex) const
Definition: Mesh.h:672
const Triangle getTriangle(size_t triangleIndex) const
Definition: Mesh.h:731
#define agxAssert(expr)
Definition: debug.h:143
bool hasHalfEdge() const
Definition: Mesh.h:877
virtual agx::Real getVolume() const override
Definition: Mesh.h:820
uint_fast8_t getLocalEdgeIndex() const
Definition: Mesh.h:1078
bool isValidAndClosed() const
Definition: Mesh.h:809
Class for reading a binary stream of serialized data.
Definition: InputArchive.h:51
bool hasInternalCenterPoint() const
Definition: Mesh.h:837
Type
Define the type of a Shape.
Definition: Shape.h:58
Class for writing serialized data in binary format to a stream.
Definition: OutputArchive.h:56
VertexEdgeCirculator & operator++()
Move circulator one step clockwise.
Definition: Mesh.h:925
virtual agx::Vec3 getCenter() const override
Definition: Mesh.h:814
const Mesh * getMesh() const
Definition: Mesh.h:990
agx::Vec3 getVertex(size_t globalVertexIndex) const
Definition: Mesh.h:755
agx::Vec3 getEdgeStartVertex() const
Definition: Mesh.h:1054
double Real
Definition: Real.h:42
Axis aligned bounding box implementation.
Definition: BoundingAABB.h:37
agx::Real getTriangleMaximumEdgeLength(size_t triangleIndex) const
Definition: Mesh.h:785
agx::Vec3 getEdgeEndVertex() const
Definition: Mesh.h:1063
uint32_t getHalfEdgePartnerEdge(size_t globalEdgeIndex) const
Definition: Mesh.h:797
virtual agx::SPDMatrix3x3 calculateInertia(agx::Real mass) const override
Returns the inertia of the shape, scaled with the mass. Inherited from class Shape.
Definition: Mesh.h:826
size_t getNumTriangles() const
Definition: Mesh.h:761
const Mesh * getMesh() const
Definition: Mesh.h:718
uint32_t UInt32
Definition: Integer.h:40
size_t getGlobalVertexIndex(size_t triangleIndex, uint_fast8_t localVertexIndex) const
Returns the global index of one of the three vertices in a triangle.
Definition: Mesh.h:779
TriangleLineSegmentResult(agx::UInt32 newTriangleIndex, agx::Real newLineParameter, bool newIsFrontFace)
Definition: Mesh.h:507
AGX_DECLARE_POINTER_TYPES(SpaceListener)
CollisionMeshDataRef m_collisionMeshData
Definition: Mesh.h:633
FaceEdgeCirculator & operator++()
Move circulator one step counter clockwise around the face.
Definition: Mesh.h:1033
size_t getHalfEdgePartnerLocalEdgeIndex(uint_fast8_t localEdgeIndex) const
Definition: Mesh.h:703
bool isValidTriangleIndex(size_t globalTriangleIndex) const
Definition: Mesh.h:865