AGXDynamics  2.31.1.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Mesh.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_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 <agxCollide/agxCollide.h>
26 #include <agxCollide/GIMPACT/AabbTree.h>
27 #include <agxCollide/MeshData.h>
28 #include <agxCollide/Shape.h>
29 
30 #include <agxStream/Serializable.h>
31 
32 
33 namespace agxCollide
34 {
36 
68  class AGXPHYSICS_EXPORT Mesh : public Shape
69  {
70 
71  public:
78  {
79  friend class Mesh;
80  public:
85  agx::Vec3 getVertex( uint_fast8_t localVertexIndex ) const;
86 
91  agx::Vec3 getNormal() const;
92 
100  bool isValid() const;
101 
107  size_t getGlobalVertexIndex( uint_fast8_t localVertexIndex ) const;
108 
113  agx::Vec3 getEdgeStartVertex( uint_fast8_t localEdgeIndex ) const;
114 
119  agx::Vec3 getEdgeEndVertex( uint_fast8_t localEdgeIndex ) const;
120 
122  agx::Real getMaximumEdgeLength() const;
123 
128  bool hasHalfEdgePartner( uint_fast8_t localEdgeIndex ) const;
129 
138  const Triangle getHalfEdgePartner( uint_fast8_t localEdgeIndex ) const;
139 
150  size_t getHalfEdgePartnerGlobalEdgeIndex( uint_fast8_t localEdgeIndex ) const;
151 
161  size_t getHalfEdgePartnerLocalEdgeIndex( uint_fast8_t localEdgeIndex ) const;
162 
167  size_t getTriangleIndex() const;
168 
170  const Mesh* getMesh() const;
171 
172 
173  protected:
180  Triangle( const Mesh* mesh, size_t triangleIndex );
181 
186  Triangle();
187 
188  protected:
191 
192  };
193 
194 
202  {
203  friend class Mesh;
204 
205  public:
213  void operator++(int);
214 
222  VertexEdgeCirculator& operator++ ();
223 
228  bool isValid() const;
229 
234  bool atEnd() const;
235 
237  agx::Vec3 getEdgeStartVertex() const;
238 
240  agx::Vec3 getEdgeEndVertex() const;
241 
243  inline const Triangle getTriangle() const;
244 
246  uint_fast8_t getLocalEdgeIndex() const;
247 
249  bool hasJustJumpedOverHole() const;
250 
252  size_t getTriangleIndex() const;
253 
255  const Mesh* getMesh() const;
256 
259 
260  protected:
269  VertexEdgeCirculator( const Mesh* mesh,
270  size_t triangleIndex, uint_fast8_t localVertexIndex );
271 
272  protected:
276  uint_fast8_t m_localEdgeStartIndex;
277  uint_fast8_t m_localEdgeIndex;
280  bool m_valid;
281  };
282 
290  {
291  friend class Mesh;
292 
293  public:
297  void operator++(int);
298 
302  FaceEdgeCirculator& operator++();
303 
309  bool isValid() const;
310 
315  bool atEnd() const;
316 
318  agx::Vec3 getEdgeStartVertex() const;
319 
321  agx::Vec3 getEdgeEndVertex() const;
322 
324  const Triangle getTriangle() const;
325 
327  uint_fast8_t getLocalEdgeIndex() const;
328 
330  const Mesh* getMesh() const;
331 
334 
335  protected:
342  FaceEdgeCirculator( const Mesh* mesh, size_t triangleIndex );
343 
344  protected:
347  uint_fast8_t m_localEdgeIndex;
349  bool m_valid;
350  };
351 
352 
353  // Methods of the class Mesh.
354  public:
355 
357  size_t getNumVertices() const;
358 
363  agx::Vec3 getVertex( size_t globalVertexIndex ) const;
364 
366  size_t getNumTriangles() const;
367 
374  agx::Vec3 getTriangleVertex( size_t triangleIndex, uint_fast8_t localVertexIndex ) const;
375 
380  agx::Vec3 getTriangleNormal( size_t triangleIndex ) const;
381 
388  size_t getGlobalVertexIndex( size_t triangleIndex, uint_fast8_t localVertexIndex ) const;
389 
394  agx::Real getTriangleMaximumEdgeLength( size_t triangleIndex ) const;
395 
397  agx::Real getTotalMaximumEdgeLength() const;
398 
400  uint32_t getHalfEdgePartnerEdge( size_t globalEdgeIndex ) const;
401 
406  bool isValid() const;
407 
413  bool isValidAndClosed() const;
414 
416  virtual agx::Vec3 getCenter() const override;
417 
419  virtual agx::Real getVolume() const override;
420 
422  virtual agx::SPDMatrix3x3 calculateInertia( agx::Real mass ) const override;
423 
425  bool isTerrain() const;
426 
428  bool hasInternalCenterPoint() const;
429 
435  agx::Real getBottomMargin() const;
436 
444  void setBottomMargin(agx::Real newMargin);
445 
450  bool isValidEdgeIndex(size_t globalEdgeIndex ) const;
451 
456  bool isValidTriangleIndex(size_t globalTriangleIndex ) const;
457 
462  inline const Triangle getTriangle( size_t triangleIndex ) const;
463 
468  static size_t getLocalEdgeIndex( size_t globalEdgeIndex );
469 
474  static size_t getGlobalTriangleIndex( size_t globalEdgeIndex );
475 
483  static size_t getGlobalEdgeIndex ( size_t triangleIndex, uint_fast8_t localEdgeIndex );
484 
494  void calculateTrianglesInVolume(
495  const BoundingAABB& volume, const agx::AffineMatrix4x4& meshToWorld, const agx::AffineMatrix4x4& volumeToWorld,
496  agx::UInt32Vector& triangleIndices ) const;
497 
498  void calculateTrianglesInVolume(
499  const BoundingAABB& volume, const agx::AffineMatrix4x4& meshToWorld, const agx::AffineMatrix4x4& volumeToWorld,
500  agxData::LocalVector<agx::UInt32>& triangleIndices ) const;
501 
502 
505  {
507  agx::Real newLineParameter, bool newIsFrontFace) :
508  lineParameter(newLineParameter), triangleIndex(newTriangleIndex),
509  isFrontFace(newIsFrontFace)
510  {}
511  agx::Real lineParameter; // Parameter along line, between 0 and 1.
512  agx::UInt32 triangleIndex; // The triangle index.
513  bool isFrontFace; // Is triangle hit from front, or back?
514  };
515 
517 
528  void calculateTriangleOverlapsAlongLineSegment(
529  const agx::Vec3& segmentStartLocal,
530  const agx::Vec3& segmentEndLocal,
531  TriangleLineSegmentResultVector& triangleResults) const;
532 
540  virtual void calculatePossibleTriangleOverlapsAlongLineSegment(
541  const agx::Vec3& segmentStartLocal,
542  const agx::Vec3& segmentEndLocal,
543  agx::UInt32Vector& triangleIndices) const = 0;
544 
545 
553  virtual void calculatePossibleTriangleOverlapsAlongLineSegment(
554  const agx::Vec3& segmentStartLocal,
555  const agx::Vec3& segmentEndLocal,
556  agxData::LocalVector<agx::UInt32>& triangleIndices) const = 0;
557 
566  VertexEdgeCirculator createVertexEdgeCirculator(
567  size_t triangleIndex,
568  uint_fast8_t localVertexIndex ) const;
569 
575  FaceEdgeCirculator createFaceEdgeCirculator(
576  size_t triangleIndex ) const;
577 
586  bool isConvexEdge(size_t globalEdgeIndex) const;
587 
600  bool isConvexVertex(size_t triangleIndex, size_t localVertexIndex) const;
601 
603  const CollisionMeshData* getMeshData() const;
604 
606  bool hasHalfEdge() const;
607 
609  const AabbTree* getBvhTree() const;
610 
611  virtual const BoundingAABB& updateBoundingVolume() override;
612  virtual BoundingAABB calculateLocalBound() const override;
613  const BoundingAABB& getLocalBound() const;
614 
615  // AGXSTREAM_DECLARE_SERIALIZABLE( agxCollide::Mesh );
616 
617  protected:
620 
622  virtual ~Mesh();
623 
624  void store( class agxStream::OutputArchive& out ) const override;
625  void restore( class agxStream::InputArchive& in ) override;
626 
627  // Update the bounding volume hierarchy.
628  virtual void updateBvhTree() = 0;
629 
630 
631  protected:
633  AabbTreeRef m_aabbTree;
635  };
636 
637 
639 
642  {
643  return m_triangleIndex;
644  }
645 
646 
647  AGX_FORCE_INLINE size_t Mesh::Triangle::getGlobalVertexIndex( uint_fast8_t localVertexIndex ) const
648  {
649  return m_mesh->getGlobalVertexIndex( m_triangleIndex, localVertexIndex );
650  }
651 
652 
654  {
655  return m_mesh->isValid() && m_mesh->isValidTriangleIndex( m_triangleIndex );
656  }
657 
658 
660  {
661  return m_mesh->getTriangleNormal( m_triangleIndex );
662  }
663 
664 
665  AGX_FORCE_INLINE agx::Vec3 Mesh::Triangle::getVertex( uint_fast8_t localVertexIndex ) const
666  {
667  return m_mesh->getTriangleVertex( m_triangleIndex, localVertexIndex );
668  }
669 
670 
671  AGX_FORCE_INLINE agx::Vec3 Mesh::Triangle::getEdgeStartVertex( uint_fast8_t localEdgeIndex ) const
672  {
673  return m_mesh->getTriangleVertex( m_triangleIndex, localEdgeIndex );
674  }
675 
676 
677  AGX_FORCE_INLINE agx::Vec3 Mesh::Triangle::getEdgeEndVertex( uint_fast8_t localEdgeIndex ) const
678  {
679  return m_mesh->getTriangleVertex( m_triangleIndex, (uint_fast8_t)((localEdgeIndex + (uint_fast8_t)1) % (uint_fast8_t)3) );
680  }
681 
682 
684  {
685  return m_mesh->getTriangleMaximumEdgeLength( m_triangleIndex );
686  }
687 
688 
689  inline size_t Mesh::Triangle::getHalfEdgePartnerGlobalEdgeIndex( uint_fast8_t localEdgeIndex ) const
690  {
691  return m_mesh->getHalfEdgePartnerEdge( Mesh::getGlobalEdgeIndex( m_triangleIndex, localEdgeIndex ) );
692  }
693 
694 
695  inline const Mesh::Triangle Mesh::Triangle::getHalfEdgePartner( uint_fast8_t localEdgeIndex ) const
696  {
697  agxAssert( localEdgeIndex < 3 );
698  return Triangle( m_mesh, this->getHalfEdgePartnerGlobalEdgeIndex( localEdgeIndex ) / 3 ) ;
699  }
700 
701 
702  AGX_FORCE_INLINE size_t Mesh::Triangle::getHalfEdgePartnerLocalEdgeIndex( uint_fast8_t localEdgeIndex ) const
703  {
704  agxAssert( localEdgeIndex < 3 );
705  return this->getHalfEdgePartnerGlobalEdgeIndex( localEdgeIndex ) % 3;
706  }
707 
708 
709 
710  AGX_FORCE_INLINE bool Mesh::Triangle::hasHalfEdgePartner( uint_fast8_t localEdgeIndex )
711  const
712  {
713  return m_mesh->isValidEdgeIndex( this->getHalfEdgePartnerGlobalEdgeIndex( localEdgeIndex ) );
714  }
715 
716 
718  {
719  return m_mesh.get();
720  }
721 
722 
724  AGX_FORCE_INLINE size_t Mesh::getGlobalEdgeIndex ( size_t triangleIndex, uint_fast8_t localEdgeIndex )
725  {
726  return 3 * triangleIndex + localEdgeIndex;
727  }
728 
729 
730  inline const Mesh::Triangle Mesh::getTriangle( size_t triangleIndex ) const
731  {
732  return Mesh::Triangle( this, triangleIndex );
733  }
734 
735 
736  AGX_FORCE_INLINE size_t Mesh::getLocalEdgeIndex( size_t globalEdgeIndex )
737  {
738  return globalEdgeIndex % 3;
739  }
740 
741 
742  AGX_FORCE_INLINE size_t Mesh::getGlobalTriangleIndex( size_t globalEdgeIndex )
743  {
744  return globalEdgeIndex / 3;
745  }
746 
747 
749  {
750  return m_collisionMeshData->m_vertices.size();
751  }
752 
753 
754  AGX_FORCE_INLINE agx::Vec3 Mesh::getVertex( size_t globalVertexIndex ) const
755  {
756  return m_collisionMeshData->m_vertices[ globalVertexIndex ];
757  }
758 
759 
761  {
762  return m_collisionMeshData->m_numTriangles;
763  }
764 
765 
766  AGX_FORCE_INLINE agx::Vec3 Mesh::getTriangleVertex( size_t triangleIndex, uint_fast8_t localVertexIndex ) const
767  {
768  return m_collisionMeshData->m_vertices[m_collisionMeshData->m_indices[3 * triangleIndex + localVertexIndex]];
769  }
770 
771 
772  AGX_FORCE_INLINE agx::Vec3 Mesh::getTriangleNormal( size_t triangleIndex ) const
773  {
774  return m_collisionMeshData->m_normals[triangleIndex];
775  }
776 
777 
778  AGX_FORCE_INLINE size_t Mesh::getGlobalVertexIndex( size_t triangleIndex, uint_fast8_t localVertexIndex ) const
779  {
780  return m_collisionMeshData->m_indices[3 * triangleIndex + localVertexIndex];
781  }
782 
783 
785  {
786  return m_collisionMeshData->m_triangleMaximumEdgeLengths[triangleIndex];
787  }
788 
789 
791  {
792  return m_collisionMeshData->m_totalMaximumEdgeLength;
793  }
794 
795 
796  AGX_FORCE_INLINE uint32_t Mesh::getHalfEdgePartnerEdge( size_t globalEdgeIndex ) const
797  {
798  return m_collisionMeshData->m_halfEdges[globalEdgeIndex];
799  }
800 
801 
803  {
804  return m_collisionMeshData->m_valid;
805  }
806 
807 
809  {
810  return (m_collisionMeshData->m_valid && m_collisionMeshData->m_closed);
811  }
812 
814  {
815  return m_collisionMeshData->m_center;
816  }
817 
818 
820  {
821  return m_collisionMeshData->m_volume;
822  }
823 
824 
826  {
827  return mass * m_collisionMeshData->m_inertia;
828  }
829 
830 
832  {
833  return m_collisionMeshData->m_isTerrain;
834  }
835 
837  {
838  return m_collisionMeshData->m_hasInternalCenterPoint;
839  }
840 
841 
843  {
844  return m_collisionMeshData->m_bottomMargin;
845  }
846 
847 
849  {
850  if (newMargin >= 0) {
851  m_collisionMeshData->m_bottomMargin = newMargin;
854  }
855  }
856 
857 
858  AGX_FORCE_INLINE bool Mesh::isValidEdgeIndex(size_t globalEdgeIndex ) const
859  {
860  return globalEdgeIndex < m_collisionMeshData->m_indices.size();
861  }
862 
863 
864  AGX_FORCE_INLINE bool Mesh::isValidTriangleIndex(size_t globalTriangleIndex ) const
865  {
866  return globalTriangleIndex < m_collisionMeshData->m_numTriangles;
867  }
868 
869 
871  {
872  return m_collisionMeshData.get();
873  }
874 
875 
877  {
878  return m_collisionMeshData->m_hasHalfEdge;
879  }
880 
881 
882  AGX_FORCE_INLINE const AabbTree* Mesh::getBvhTree() const
883  {
884  return m_aabbTree;
885  }
886 
887 
888 
889  // From class VertexEdgeCirculator.
890 
892  {
893  if (m_valid) {
894  if (m_hasJustJumpedOverHole) {
895  // must have moved already to come here
896  // keep same triangle, just move local index
897  m_localEdgeIndex = (uint_fast8_t)((m_localEdgeIndex + (uint_fast8_t)1) % (uint_fast8_t)3);
898  m_hasJustJumpedOverHole = false;
899  } else {
900  m_hasMoved = true;
901  size_t he = m_mesh->getHalfEdgePartnerEdge(3 * m_triangleIndex + m_localEdgeIndex);
902  if (!m_mesh->isValidEdgeIndex(he)) {
903  // Found hole.
904  // Go all the way in counter clockwise direction from start.
905  m_triangleIndex = m_triangleStartIndex;
906  m_localEdgeIndex = (uint_fast8_t)((m_localEdgeStartIndex + (uint_fast8_t)2) % (uint_fast8_t)3);
907  m_hasJustJumpedOverHole = true;
908  size_t he2 = m_mesh->getHalfEdgePartnerEdge(3 * m_triangleIndex + m_localEdgeIndex);
909  while (m_mesh->isValidEdgeIndex( he2 )) {
910  m_triangleIndex = he2 / 3;
911  m_localEdgeIndex = (uint_fast8_t)((he2 + 2) % 3);
912  he2 = m_mesh->getHalfEdgePartnerEdge(3 * m_triangleIndex + m_localEdgeIndex);
913  }
914  } else {
915  // normal case not influenced by hole: continue in clockwise direction
916  m_triangleIndex = he / 3;
917  m_localEdgeIndex = (uint_fast8_t)((he + 1) % 3);
918  }
919  }
920  }
921  }
922 
923 
925  {
926  (*this)++;
927  return *this;
928  }
929 
930 
931 
933  {
934  return m_valid;
935  }
936 
937 
938 
940  {
941  return (m_valid && m_hasMoved && m_localEdgeIndex == m_localEdgeStartIndex &&
942  m_triangleIndex == m_triangleStartIndex);
943  }
944 
945 
946 
948  const
949  {
950  return m_mesh->getMeshData()->m_vertices[
951  m_mesh->getMeshData()->m_indices[3 * m_triangleIndex + m_localEdgeIndex]];
952  }
953 
954 
955 
957  const
958  {
959  return m_mesh->getMeshData()->m_vertices[
960  m_mesh->getMeshData()->m_indices[3 * m_triangleIndex + (m_localEdgeIndex + 1) % 3]];
961  }
962 
963 
965  {
966  return m_hasJustJumpedOverHole;
967  }
968 
969 
971  const
972  {
973  return Triangle( m_mesh->getTriangle( m_triangleIndex ));
974  }
975 
976 
978  {
979  return m_localEdgeIndex;
980  }
981 
982 
984  {
985  return m_triangleIndex;
986  }
987 
988 
990  {
991  return m_mesh.get();
992  }
993 
994 
996  const agx::AffineMatrix4x4& meshToWorld, const agx::AffineMatrix4x4& volumeToWorld,
997  agx::UInt32Vector& triangleIndices ) const
998  {
999  m_aabbTree->findCollision(&volume, std::back_inserter(triangleIndices), meshToWorld, volumeToWorld );
1000  }
1001 
1002 
1003 
1005  const agx::AffineMatrix4x4& meshToWorld, const agx::AffineMatrix4x4& volumeToWorld,
1006  agxData::LocalVector<agx::UInt32>& triangleIndices ) const
1007  {
1008  m_aabbTree->findCollision(&volume, std::back_inserter(triangleIndices), meshToWorld, volumeToWorld );
1009  }
1010 
1011 
1013  size_t triangleIndex,
1014  uint_fast8_t localVertexIndex ) const
1015  {
1016  return VertexEdgeCirculator( this, triangleIndex, localVertexIndex );
1017  }
1018 
1019 
1020 
1021  // From class FaceEdgeCirculator.
1022 
1024  {
1025  if (m_valid) {
1026  m_hasMoved = true;
1027  m_localEdgeIndex = (uint_fast8_t)((m_localEdgeIndex + (uint_fast8_t)1) % (uint_fast8_t)3);
1028  }
1029  }
1030 
1031 
1033  {
1034  (*this)++;
1035  return *this;
1036  }
1037 
1038 
1040  {
1041  return m_valid;
1042  }
1043 
1044 
1045 
1047  {
1048  return (m_valid && m_hasMoved && m_localEdgeIndex == 0);
1049  }
1050 
1051 
1052 
1054  const
1055  {
1056  return m_mesh->getMeshData()->m_vertices[
1057  m_mesh->getMeshData()->m_indices[3 * m_triangleIndex + m_localEdgeIndex]];
1058  }
1059 
1060 
1061 
1063  const
1064  {
1065  return m_mesh->getMeshData()->m_vertices[
1066  m_mesh->getMeshData()->m_indices[3 * m_triangleIndex + (m_localEdgeIndex + 1) % 3]];
1067  }
1068 
1069 
1071  const
1072  {
1073  return m_mesh->getTriangle( m_triangleIndex );
1074  }
1075 
1076 
1078  {
1079  return m_localEdgeIndex;
1080  }
1081 
1082 
1083 
1085  size_t triangleIndex ) const
1086  {
1087  return FaceEdgeCirculator( this, triangleIndex );
1088  }
1089 
1090 
1092  {
1093  return m_mesh.get();
1094  }
1095 
1097  {
1098  return m_localBound;
1099  }
1100 
1101 
1102 }
1103 
1104 #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:641
MeshConstRef m_mesh
Definition: Mesh.h:189
agx::Vec3 getEdgeStartVertex() const
Definition: Mesh.h:947
agx::Real getTriangleMaximumEdgeLength(size_t triangleIndex) const
Definition: Mesh.h:784
Mesh is a common base class for triangle meshes, such as Mesh or HeightField.
Definition: Mesh.h:68
AabbTreeRef m_aabbTree
Definition: Mesh.h:633
FaceEdgeCirculator createFaceEdgeCirculator(size_t triangleIndex) const
Creates an FaceEdgeCirculator pointing to this Triangle and a Voronoi region.
Definition: Mesh.h:1084
agx::Vec3 getEdgeEndVertex() const
Definition: Mesh.h:1062
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
VertexEdgeCirculator createVertexEdgeCirculator(size_t triangleIndex, uint_fast8_t localVertexIndex) const
Creates an VertexEdgeCirculator pointing to this Triangle and a Voronoi region.
Definition: Mesh.h:1012
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:724
const Mesh * getMesh() const
Definition: Mesh.h:717
bool isTerrain() const
Definition: Mesh.h:831
agx::UInt32 incrementModifiedCount()
Increment the number of times the shape have been modified.
Definition: Shape.h:459
size_t getHalfEdgePartnerGlobalEdgeIndex(uint_fast8_t localEdgeIndex) const
Definition: Mesh.h:689
agx::Vec3 getTriangleVertex(size_t triangleIndex, uint_fast8_t localVertexIndex) const
Returns one of the three vertices in a triangle.
Definition: Mesh.h:766
agx::Vec3 getNormal() const
This function returns the triangle normal (as stored in the collision mesh data). ...
Definition: Mesh.h:659
#define AGXPHYSICS_EXPORT
Pointer to a entity instance of type Physics.Geometry.Shape.
Definition: ShapeEntity.h:195
BoundingAABB m_localBound
Definition: Mesh.h:634
bool isValidTriangleIndex(size_t globalTriangleIndex) const
Definition: Mesh.h:864
const Triangle getTriangle(size_t triangleIndex) const
Definition: Mesh.h:730
const Triangle getHalfEdgePartner(uint_fast8_t localEdgeIndex) const
Definition: Mesh.h:695
agx::Real getMaximumEdgeLength() const
Definition: Mesh.h:683
#define AGX_FORCE_INLINE
Definition: Object.h:62
agx::Vec3 getVertex(uint_fast8_t localVertexIndex) const
Definition: Mesh.h:665
agx::Vector< TriangleLineSegmentResult > TriangleLineSegmentResultVector
Definition: Mesh.h:516
agx::Real getTotalMaximumEdgeLength() const
Definition: Mesh.h:790
size_t getHalfEdgePartnerLocalEdgeIndex(uint_fast8_t localEdgeIndex) const
Definition: Mesh.h:702
static size_t getGlobalTriangleIndex(size_t globalEdgeIndex)
Definition: Mesh.h:742
const CollisionMeshData * getMeshData() const
Definition: Mesh.h:870
AGXMODEL_EXPORT agx::Vec3 getCenter(const agxCollide::Mesh::Triangle &triangle)
bool isValidAndClosed() const
Definition: Mesh.h:808
Class in order to circulate over the edges connected to a Triangle&#39;s vertex.
Definition: Mesh.h:201
Templated vector class.
Definition: Vector.h:52
bool isValidEdgeIndex(size_t globalEdgeIndex) const
Definition: Mesh.h:858
const BoundingAABB & getLocalBound() const
Definition: Mesh.h:1096
static size_t getLocalEdgeIndex(size_t globalEdgeIndex)
Definition: Mesh.h:736
Class for more intuitive access to the Mesh&#39;s mesh data.
Definition: Mesh.h:77
const AabbTree * getBvhTree() const
Definition: Mesh.h:882
size_t getGlobalVertexIndex(uint_fast8_t localVertexIndex) const
Returns the global index of the vertex.
Definition: Mesh.h:647
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:848
agx::Vec3 getEdgeStartVertex() const
Definition: Mesh.h:1053
agx::Vec3 getEdgeEndVertex(uint_fast8_t localEdgeIndex) const
Definition: Mesh.h:677
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
virtual const BoundingAABB & updateBoundingVolume() override
Calculate the bounding volume based on the current Shape parameters including transformation.
uint32_t getHalfEdgePartnerEdge(size_t globalEdgeIndex) const
Definition: Mesh.h:796
const Mesh * getMesh() const
Definition: Mesh.h:989
const Triangle getTriangle() const
Definition: Mesh.h:970
size_t getNumVertices() const
Definition: Mesh.h:748
Struct used in calculateTriangleOverlapsAlongLineSegment.
Definition: Mesh.h:504
Class in order to circulate over the edges connected to a Triangle&#39;s face.
Definition: Mesh.h:289
agx::Vec3 getTriangleNormal(size_t triangleIndex) const
Definition: Mesh.h:772
const Triangle getTriangle() const
Definition: Mesh.h:1070
agx::Vec3 getEdgeStartVertex(uint_fast8_t localEdgeIndex) const
Definition: Mesh.h:671
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:995
uint_fast8_t getLocalEdgeIndex() const
Definition: Mesh.h:1077
#define agxAssert(expr)
Definition: debug.h:143
bool hasHalfEdgePartner(uint_fast8_t localEdgeIndex) const
Definition: Mesh.h:710
bool isValid() const
Definition: Mesh.h:802
virtual agx::Real getVolume() const override
Definition: Mesh.h:819
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:778
uint_fast8_t getLocalEdgeIndex() const
Definition: Mesh.h:977
size_t getTriangleIndex() const
Definition: Mesh.h:983
T * get() const
Definition: ref_ptr.h:256
Class for reading a binary stream of serialized data.
Definition: InputArchive.h:51
bool hasInternalCenterPoint() const
Definition: Mesh.h:836
Type
Define the type of a Shape.
Definition: Shape.h:58
agx::Real getBottomMargin() const
Definition: Mesh.h:842
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:924
virtual agx::Vec3 getCenter() const override
Definition: Mesh.h:813
agx::Vec3 getVertex(size_t globalVertexIndex) const
Definition: Mesh.h:754
double Real
Definition: Real.h:42
Axis aligned bounding box implementation.
Definition: BoundingAABB.h:37
agx::Vec3 getEdgeEndVertex() const
Definition: Mesh.h:956
size_t getNumTriangles() const
Definition: Mesh.h:760
bool isValid() const
Definition: Mesh.h:653
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:825
const Mesh * getMesh() const
Definition: Mesh.h:1091
bool hasHalfEdge() const
Definition: Mesh.h:876
uint32_t UInt32
Definition: Integer.h:40
TriangleLineSegmentResult(agx::UInt32 newTriangleIndex, agx::Real newLineParameter, bool newIsFrontFace)
Definition: Mesh.h:506
AGX_DECLARE_POINTER_TYPES(SpaceListener)
CollisionMeshDataRef m_collisionMeshData
Definition: Mesh.h:632
FaceEdgeCirculator & operator++()
Move circulator one step counter clockwise around the face.
Definition: Mesh.h:1032
GLenum type
Definition: gl.h:5539