|
AGXDynamics
2.31.1.0
|
A convex class for geometric intersection tests. More...
#include <Convex.h>
Inheritance diagram for agxCollide::Convex:Public Types | |
| typedef agx::Vector< TriangleLineSegmentResult > | TriangleLineSegmentResultVector |
| enum | TrimeshOptionsFlags { CLOCKWISE_ORIENTATION = 0x1, NO_WARNINGS = 0x10, TERRAIN = 0x20, REMOVE_DUPLICATE_VERTICES = 0x40, RECALCULATE_NORMALS_GIVEN_FIRST_TRIANGLE = 0x80 } |
| Parameters for trimesh creation from data set. More... | |
| enum | Type { GROUP, BOX, CAPSULE, CYLINDER, LINE, PLANE, SPHERE, TRIMESH, HEIGHT_FIELD, CONVEX, WIRE_SHAPE, CONE, HOLLOW_CONE, HOLLOW_CYLINDER, NUM_TYPES } |
| Define the type of a Shape. More... | |
Public Member Functions | |
| Convex (const agx::Vec3Vector *vertices, const agx::UInt32Vector *indices, const char *sourceName, uint32_t optionsMask=Trimesh::REMOVE_DUPLICATE_VERTICES) | |
| Constructs a new Convex object from a vector of vertices and indices each. More... | |
| template<typename T > | |
| T * | as () |
| Subclass casting. More... | |
| template<typename T > | |
| const T * | as () const |
| ShapeGroup * | asGroup () |
| Auto-cast shape to group. More... | |
| const ShapeGroup * | asGroup () const |
| Auto-cast shape to group. More... | |
| template<typename T > | |
| T * | asSafe () |
| Safe subclass casting, return nullptr if template type does not match. More... | |
| template<typename T > | |
| const T * | asSafe () const |
| virtual agx::Real | calculateBoundingRadius (BoundingAABB &localAABB) const |
Calculate the bounding volume (AABB) into localAABB and calculate the bounding radius based on the new AABB size. More... | |
| virtual agx::SPDMatrix3x3 | calculateInertia (agx::Real mass) const override |
| Returns the inertia of the shape, scaled with the mass. Inherited from class Shape. More... | |
| virtual BoundingAABB | calculateLocalBound () const override |
| Calculate the bounding volume in the local coordinate system. More... | |
| virtual void | calculatePossibleTriangleOverlapsAlongLineSegment (const agx::Vec3 &segmentStartLocal, const agx::Vec3 &segmentEndLocal, agx::UInt32Vector &triangleIndices) const override |
| Calculates an array of triangle indices of the triangles whose bounding volumes get intersected by a line segment. More... | |
| virtual void | calculatePossibleTriangleOverlapsAlongLineSegment (const agx::Vec3 &segmentStartLocal, const agx::Vec3 &segmentEndLocal, agxData::LocalVector< agx::UInt32 > &triangleIndices) const override |
| Calculates an array of triangle indices of the triangles whose bounding volumes get intersected by a line segment. More... | |
| void | calculateTriangleOverlapsAlongLineSegment (const agx::Vec3 &segmentStartLocal, const agx::Vec3 &segmentEndLocal, TriangleLineSegmentResultVector &triangleResults) const |
| Calculates all triangle overlaps of a line segment with the mesh. More... | |
| 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. More... | |
| void | calculateTrianglesInVolume (const BoundingAABB &volume, const agx::AffineMatrix4x4 &meshToWorld, const agx::AffineMatrix4x4 &volumeToWorld, agxData::LocalVector< agx::UInt32 > &triangleIndices) const |
| virtual Shape * | clone () const override |
| Create a clone. More... | |
| FaceEdgeCirculator | createFaceEdgeCirculator (size_t triangleIndex) const |
| Creates an FaceEdgeCirculator pointing to this Triangle and a Voronoi region. More... | |
| VertexEdgeCirculator | createVertexEdgeCirculator (size_t triangleIndex, uint_fast8_t localVertexIndex) const |
| Creates an VertexEdgeCirculator pointing to this Triangle and a Voronoi region. More... | |
| Convex * | deepCopy () const |
| Creates a new Convex which copies data from this one. More... | |
| agx::Real | getBottomMargin () const |
| const BoundingAABB & | getBoundingVolume () const |
| const AabbTree * | getBvhTree () const |
| virtual agx::Vec3 | getCenter () const override |
| const char * | getClassName () const override |
| bool | getEnableSerialization () const |
| bool | getEnableUuidGeneration () |
| agx::Physics::Geometry::ShapePtr | getEntity () const |
| Geometry * | getGeometry () |
| const Geometry * | getGeometry () const |
| size_t | getGlobalVertexIndex (size_t triangleIndex, uint_fast8_t localVertexIndex) const |
| Returns the global index of one of the three vertices in a triangle. More... | |
| uint32_t | getHalfEdgePartnerEdge (size_t globalEdgeIndex) const |
| agx::UInt32 | getIndex () const |
| This index is given at creation of this object. More... | |
| const BoundingAABB & | getLocalBound () const |
| agx::AffineMatrix4x4 | getLocalTransform () const |
| const CollisionMeshData * | getMeshData () const |
| agx::UInt32 | getModifiedCount () const |
| size_t | getNumTriangles () const |
| size_t | getNumVertices () const |
| uint32_t | getOptionsMask () const |
| Gets option mask used when creating (can be interesting for debugging meshes). More... | |
| int | getReferenceCount () const |
| const agxCollide::RenderData * | getRenderData () const |
| If this is a ShapeGroup, then this method will return nullptr as the render data is stored in the actual children (Box, Mesh etc. More... | |
| const agx::String & | getSourceName () const |
| Gets source name used when creating (can be interesting for debugging meshes). More... | |
| agxStream::StorageAgent * | getStorageAgent () const override |
| virtual agx::Vec3 | getSupportPoint (const agx::Vec3 &supportDirection) const override |
| agx::Real | getTotalMaximumEdgeLength () const |
| agx::AffineMatrix4x4 | getTransform () const |
| const Triangle | getTriangle (size_t triangleIndex) const |
| agx::Real | getTriangleMaximumEdgeLength (size_t triangleIndex) const |
| agx::Vec3 | getTriangleNormal (size_t triangleIndex) const |
| agx::Vec3 | getTriangleVertex (size_t triangleIndex, uint_fast8_t localVertexIndex) const |
| Returns one of the three vertices in a triangle. More... | |
| agx::UInt8 | getType () const |
| const char * | getTypeName () const |
| agx::Uuid | getUuid () const |
| agx::Vec3 | getVertex (size_t globalVertexIndex) const |
| virtual agx::Real | getVolume () const override |
| const agx::String & | getWarnings () const |
| Gets warnings occurring when creating (can be interesting for debugging meshes). More... | |
| bool | hasHalfEdge () const |
| bool | hasInternalCenterPoint () const |
| virtual bool | hasSupportFunction () const override |
| Inherited from Shape. More... | |
| template<typename T > | |
| bool | is () const |
| Subclass test. More... | |
| bool | isConvexEdge (size_t globalEdgeIndex) const |
| Is an edge convex? Returns always true if half edge information is missing on this edge/the whole mesh. More... | |
| bool | isConvexVertex (size_t triangleIndex, size_t localVertexIndex) const |
| Is an vertex convex? Returns always true if half edge information is missing on this vertex/the whole mesh. More... | |
| bool | isFinished () const |
| bool | isGroup () const |
| bool | isTerrain () const |
| bool | isValid () const |
| bool | isValidAndClosed () const |
| bool | isValidEdgeIndex (size_t globalEdgeIndex) const |
| bool | isValidTriangleIndex (size_t globalTriangleIndex) const |
| virtual void | propagateTransform (const agx::AffineMatrix4x4 &transform) |
| void | reference (void *ptr=nullptr) const |
| Explicitly increment the reference count by one, indicating that this object has another pointer which is referencing it. More... | |
| virtual void | restore (agxStream::InputArchive &in) override |
| 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. More... | |
| void | setEnableSerialization (bool flag) |
| Set to false to disable serialization of this object. More... | |
| void | setFinished () |
| Tells this class that it is restored correctly and should not be deleted during destruction of an Archive. More... | |
| virtual void | setRenderData (agxCollide::RenderData *renderData) |
| Store render data with the Shape. More... | |
| void | setUuid (const agx::Uuid &uuid) |
| Explicitly set a Uuid on a serializable object. More... | |
| Convex * | shallowCopy () const |
| Creates a new Convex which shares data with this one. More... | |
| virtual void | store (agxStream::OutputArchive &out) const override |
| void | unreference (void *ptr=nullptr) const |
| Decrement the reference count by one, indicating that a pointer to this object is referencing it. More... | |
| void | unreference_nodelete () const |
| Decrement the reference count by one, indicating that a pointer to this object is referencing it. More... | |
| virtual const BoundingAABB & | updateBoundingVolume () override |
| Calculate the bounding volume based on the current Shape parameters including transformation. More... | |
| void | updateMeshGeometry (bool showWarnings, bool recalculateMassProperties=true) |
| Updates the mesh geometry data like normals or edge convexity. More... | |
Static Public Member Functions | |
| static BoundingAABB | calculateBound (const agx::AffineMatrix4x4 &transform, const BoundingAABB &localBound) |
| static agxStream::Serializable * | create () |
| static agxStream::Serializable * | create (agxStream::InputArchive &) |
| static const char * | getConstructClassId () |
| 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 triangle. More... | |
| static size_t | getGlobalTriangleIndex (size_t globalEdgeIndex) |
| static size_t | getLocalEdgeIndex (size_t globalEdgeIndex) |
| static const char * | getTypeName (agx::UInt8 type) |
| static void | setEnableUuidGeneration (bool flag) |
| Specify if there should be UUID:s generated for each new Serializable object. By default it is enabled. More... | |
| template<typename T > | |
| static bool | ValidateCast (const Referenced *object) |
Protected Member Functions | |
| virtual | ~Convex () |
| Hiding destructor. More... | |
| void | allocateObserverVector () const |
| void | calculateMassProperties (bool showWarnings) |
| Calculates mass properties. More... | |
| void | deleteUsingDeleteHandler () const |
| void | finalizeMeshTopology (bool showWarnings, uint32_t optionsMask) |
| Finalizes the mesh topology, including mesh legality checks as well as normal and maximum error bound calculation. More... | |
| void | generateUuid () |
| agx::UInt32 | incrementModifiedCount () |
| Increment the number of times the shape have been modified. More... | |
| void | setValuesAsShallowCopy (const Trimesh *other) |
| void | syncronizeShapeIndex () |
| virtual void | updateBvhTree () override |
| Update the bounding volume hierarchy. Internal method. More... | |
Static Protected Member Functions | |
| static DeleteHandler * | getDeleteHandler () |
| static void | setDeleteHandler (DeleteHandler *handler) |
| Internal: Set a DeleteHandler to which deletion of all referenced counted objects will be delegated to. More... | |
Protected Attributes | |
| AabbTreeRef | m_aabbTree |
| CollisionMeshDataRef | m_collisionMeshData |
| agx::Physics::Geometry::ShapeRef | m_entity |
| Geometry * | m_geometry |
| BoundingAABB | m_localBound |
| Mutex | m_mutex |
| ObserverContainer | m_observers |
| uint32_t | m_optionsMask |
| ShapeGroup * | m_parent |
| AtomicValue | m_refCount |
| agxCollide::RenderDataRef | m_renderData |
| agx::ref_ptr< const Trimesh > | m_shallowCopySource |
| agx::Index | m_shapeIndex |
| agx::String | m_sourceName |
| agx::String | m_warnings |
A convex class for geometric intersection tests.
More detailed ways of creating it can be found in agxUtil::ConvexReaderWriter.
|
inherited |
Parameters for trimesh creation from data set.
|
inherited |
| agxCollide::Convex::Convex | ( | const agx::Vec3Vector * | vertices, |
| const agx::UInt32Vector * | indices, | ||
| const char * | sourceName, | ||
| uint32_t | optionsMask = Trimesh::REMOVE_DUPLICATE_VERTICES |
||
| ) |
Constructs a new Convex object from a vector of vertices and indices each.
The vertices are assumed to be a convex hull, and the indices to connect them as triangle lists, where the triangles lie on the convex hull.
| vertices | Pointer to a Vector of vertices. Vertices should not be duplicates of each other. Has to have at least size 1. All content will be copied. No ownership will be taken. |
| indices | Pointer to a Vector of size_t indicating the vertices for each triangle by referring to the vertices parameter. All triangles described by a set of 3 indices each have to have counter-clockwise winding (all-clockwise-winding can be specified in TrimeshOptionsFlags). Has to have at least size 3. All content will be copied. No ownership will be taken. |
| sourceName | Name of the data source for debugging. |
| optionsMask | Options can be set as in enum TrimeshOptionsFlags. |
|
protectedvirtual |
Hiding destructor.
|
protectedinherited |
|
inherited |
Subclass casting.
Template type must match actual type, dynamic_cast assertion will fail otherwise.
Referenced by agx::InternalData::get(), agxVehicle::Track::getNode(), agx::InternalData::getOrCreate(), and agx::InternalData::hasData().
|
inherited |
|
inherited |
|
inherited |
|
inherited |
Safe subclass casting, return nullptr if template type does not match.
Referenced by agxUtil::CollectBodiesAndWiresVisitor::visit().
|
inherited |
|
staticinherited |
transform) AABB (localBound) Definition at line 417 of file Shape.h.
References AGX_FORCE_INLINE, and agxData::getEntity().
|
virtualinherited |
Calculate the bounding volume (AABB) into localAABB and calculate the bounding radius based on the new AABB size.
Reimplemented in agxCollide::Sphere.
|
overridevirtualinherited |
Returns the inertia of the shape, scaled with the mass. Inherited from class Shape.
Implements agxCollide::Shape.
|
overridevirtualinherited |
Calculate the bounding volume in the local coordinate system.
Implements agxCollide::Shape.
|
protectedinherited |
Calculates mass properties.
Should only be called within finalize.
|
inlineoverridevirtualinherited |
Calculates an array of triangle indices of the triangles whose bounding volumes get intersected by a line segment.
| segmentStartLocal | The segment starting point in trimesh coordinates. |
| segmentEndLocal | The segment ending point in trimesh coordinates. |
| triangleIndices | A vector of triangle indices. It will be emptied before being written to. |
Implements agxCollide::Mesh.
|
inlineoverridevirtualinherited |
Calculates an array of triangle indices of the triangles whose bounding volumes get intersected by a line segment.
| segmentStartLocal | The segment starting point in trimesh coordinates. |
| segmentEndLocal | The segment ending point in trimesh coordinates. |
| triangleIndices | A vector of triangle indices. It will be emptied before being written to. |
Implements agxCollide::Mesh.
|
inherited |
Calculates all triangle overlaps of a line segment with the mesh.
Tries to fix some corner cases such as:
| segmentStartLocal | The segment starting point in mesh coordinates. |
| segmentEndLocal | The segment ending point in mesh coordinates. |
| triangleResults | - Vector of resulting overlapped triangles |
|
inherited |
Calculates an array of triangle indices of the triangles that are within a bounding volume.
| volume | The bounding box. |
| meshToWorld | A transformation from the mesh's local frame to world coordinates. |
| volumeToWorld | A transformation from the volume's local frame to world coordinates. |
| triangleIndices | A vector of triangle indices. It will be emptied before writing to it. |
|
inherited |
|
overridevirtual |
Create a clone.
Reimplemented from agxCollide::Trimesh.
|
inlinestatic |
|
inlinestatic |
|
inlineinherited |
|
inlineinherited |
Creates an VertexEdgeCirculator pointing to this Triangle and a Voronoi region.
| triangleIndex | - Index of the triangle |
| localVertexIndex | The local index of the vertex that the VertexEdgeCirculator should point to. |
Definition at line 1012 of file Mesh.h.
Referenced by agxSDK::findMostParallelEdgeAmongNeighboringTriangles().
| Convex* agxCollide::Convex::deepCopy | ( | ) | const |
Creates a new Convex which copies data from this one.
(modifying one's data will not modify the other's). Less quick to create than shallowCopy (but faster than creating mesh from input data), double memory usage. The caller takes over possession of the pointer.
|
protectedinherited |
|
protectedinherited |
Finalizes the mesh topology, including mesh legality checks as well as normal and maximum error bound calculation.
Should only be called within finalize.
| showWarnings | - write warnings to output |
| optionsMask | - TrimeshOptionsFlags |
|
protectedinherited |
|
inherited |
|
inherited |
|
inherited |
|
overridevirtualinherited |
Reimplemented from agxCollide::Shape.
|
inlineoverridevirtual |
Reimplemented from agxStream::Serializable.
|
inlinestatic |
|
staticprotectedinherited |
|
inherited |
Definition at line 273 of file Serializable.h.
|
inherited |
|
inlineinherited |
Definition at line 395 of file Shape.h.
Referenced by agxCollide::Box::getHalfExtents(), agxWire::getNode(), and agxCollide::Sphere::getRadius().
|
inherited |
|
inherited |
|
staticinherited |
Computes the global edge index from a given triangle index and the local edge index within this triangle.
Mesh class.
| triangleIndex | The global triangle index. |
| localEdgeIndex | The local edge index within this triangle. |
Definition at line 724 of file Mesh.h.
Referenced by agxCollide::Mesh::Triangle::getHalfEdgePartnerGlobalEdgeIndex().
|
staticinherited |
|
inherited |
Returns the global index of one of the three vertices in a triangle.
| triangleIndex | Index of the triangle the vertex belongs to. |
| localVertexIndex | The vertex's index within the triangle (0 to 2). |
|
inherited |
|
inherited |
This index is given at creation of this object.
It is guaranteed to be unique for the lifetime of this library instance. As long as the application is running. This value is not serialized or restored. A new object will always get a new index no matter how it is created.
Definition at line 247 of file Serializable.h.
|
inherited |
|
staticinherited |
|
inherited |
|
inherited |
|
inherited |
|
inherited |
Definition at line 760 of file Mesh.h.
Referenced by agxWire::getNode().
|
inherited |
|
inherited |
Gets option mask used when creating (can be interesting for debugging meshes).
|
inherited |
|
inherited |
|
inherited |
Gets source name used when creating (can be interesting for debugging meshes).
|
inlineoverridevirtual |
Implements agxStream::Serializable.
|
overridevirtual |
Reimplemented from agxCollide::Shape.
Definition at line 119 of file Convex.h.
References agx::RealMax.
|
inherited |
|
inherited |
|
inlineinherited |
| triangleIndex | The index of the triangle. |
Definition at line 730 of file Mesh.h.
Referenced by agxSDK::calculateMeshOffset(), agxSDK::findMostParallelEdgeAmongNeighboringTriangles(), and agxWire::getNode().
|
inherited |
|
inherited |
|
inherited |
Returns one of the three vertices in a triangle.
| triangleIndex | Index of the triangle the vertex belongs to. |
| localVertexIndex | The vertex's index within the triangle (0 to 2). |
Definition at line 766 of file Mesh.h.
Referenced by agxSDK::findMostParallelEdgeAmongNeighboringTriangles().
|
inherited |
Definition at line 377 of file Shape.h.
Referenced by agxCollide::ColliderTable::getCollider().
|
staticinherited |
type
|
inherited |
|
inherited |
Definition at line 268 of file Serializable.h.
Referenced by agxSDK::UuidHashCollisionFilter::match().
|
inherited |
|
overridevirtualinherited |
Implements agxCollide::Shape.
|
inherited |
Gets warnings occurring when creating (can be interesting for debugging meshes).
Will be empty if there where no warnings, or if warnings have been deactivated (see getOptionsMask()).
|
inherited |
|
inherited |
|
overridevirtual |
Inherited from Shape.
Implementation.
Reimplemented from agxCollide::Shape.
|
protectedinherited |
Increment the number of times the shape have been modified.
Definition at line 459 of file Shape.h.
References AGX_FORCE_INLINE, and agxAssert.
|
inherited |
Subclass test.
Referenced by agx::Object::getAutoScopedResource(), agxData::EntityStorage::getInstances(), and agx::Object::getResource().
|
inherited |
Is an edge convex? Returns always true if half edge information is missing on this edge/the whole mesh.
Exactly straight edges will also be considered convex.
| globalEdgeIndex |
| Is | the edge convex? |
|
inherited |
Is an vertex convex? Returns always true if half edge information is missing on this vertex/the whole mesh.
Exactly straight edges will also be considered convex. Saddle points will return false. When encountering a hole, the edges until the whole will be considered.
| triangleIndex | The global index of the triangle |
| localVertexIndex | The local index of the vertex in the triangle |
| Is | the edge convex? |
|
inherited |
Definition at line 252 of file Serializable.h.
References AGX_FORCE_INLINE.
|
inherited |
Definition at line 381 of file Shape.h.
References agxData::getType().
|
inherited |
|
inherited |
|
inherited |
|
inherited |
|
inherited |
|
virtualinherited |
Explicitly increment the reference count by one, indicating that this object has another pointer which is referencing it.
This method should be used with care, always balanced with the same number of calls to unreference.
|
overridevirtual |
Reimplemented from agxCollide::Trimesh.
|
staticprotectedinherited |
Internal: Set a DeleteHandler to which deletion of all referenced counted objects will be delegated to.
|
inherited |
Set to false to disable serialization of this object.
It will just be ignored during serialization (writing). It is still possible to restore TO this object.
|
staticinherited |
Specify if there should be UUID:s generated for each new Serializable object. By default it is enabled.
|
inherited |
Tells this class that it is restored correctly and should not be deleted during destruction of an Archive.
|
virtualinherited |
Store render data with the Shape.
If the shape is a Group, the render data will be stored in all the children and NOT in the actual ShapeGroup. It is better to actually access the actual primitives and store the render data there instead of the group.
Explicitly set a Uuid on a serializable object.
Use this method with great care, as it can result in non-unique identifiers in the system!
| Convex* agxCollide::Convex::shallowCopy | ( | ) | const |
|
overridevirtual |
Reimplemented from agxCollide::Trimesh.
|
protectedinherited |
Decrement the reference count by one, indicating that a pointer to this object is referencing it.
If the reference count goes to zero, it is assumed that this object is no longer referenced and is automatically deleted.
This method should be used with care, always balanced with the same number of calls to reference.
Referenced by agxData::EntityRef< ContactMaterialPtr >::~EntityRef().
|
inherited |
Decrement the reference count by one, indicating that a pointer to this object is referencing it.
However, do not delete it, even if ref count goes to 0. Warning, unref_nodelete() should only be called if the user knows exactly who will be responsible for, one should prefer unref() over unref_nodelete() as the later can lead to memory leaks.
|
overridevirtualinherited |
Calculate the bounding volume based on the current Shape parameters including transformation.
Implements agxCollide::Shape.
|
overrideprotectedvirtualinherited |
Update the bounding volume hierarchy. Internal method.
Implements agxCollide::Mesh.
|
inherited |
Updates the mesh geometry data like normals or edge convexity.
Will update mass properties, bounding box and bounding volume hierarchy. Will be called after construction. It should also be called if vertex positions get modified after construction.
| showWarnings | Should warnings be printed out to cout? |
| recalculateMassProperties | Should the mass properties be computed/recomputed? |
|
staticinherited |
|
protectedinherited |
|
protectedinherited |
|
protectedinherited |
|
mutableprotectedinherited |
Definition at line 240 of file Referenced.h.
|
mutableprotectedinherited |
Definition at line 239 of file Referenced.h.
|
protectedinherited |
|
protectedinherited |
|
mutableprotectedinherited |
Definition at line 241 of file Referenced.h.
|
protectedinherited |
|
protectedinherited |
|
protectedinherited |
|
protectedinherited |
|
protectedinherited |