AGX Dynamics 2.42.1.1
Loading...
Searching...
No Matches
TrimeshDeformer.h
Go to the documentation of this file.
1/*
2Copyright 2007-2025. Algoryx Simulation AB.
3
4All AGX source code, intellectual property, documentation, sample code,
5tutorials, scene files and technical white papers, are copyrighted, proprietary
6and confidential material of Algoryx Simulation AB. You may not download, read,
7store, distribute, publish, copy or otherwise disseminate, use or expose this
8material unless having a written signed agreement with Algoryx Simulation AB, or having been
9advised so by Algoryx Simulation AB for a time limited evaluation, or having purchased a
10valid commercial license from Algoryx Simulation AB.
11
12Algoryx Simulation AB disclaims all responsibilities for loss or damage caused
13from using this software, unless otherwise stated in written agreements with
14Algoryx Simulation AB.
15*/
16
17#pragma once
18
19#include <agx/agx.h>
20#include <agxCollide/Trimesh.h>
21#include <agxUtil/agxUtil.h>
22
23namespace agxCollide {
24 class Trimesh;
25}
26
27namespace agxUtil {
28
29 class ParallelTrimeshDeformer;
30
33
35 {
36 public:
37 BodyLocalOffset(const agx::RigidBody* relativeBody,
38 const agx::RigidBody* body,
39 agx::Real offsetReach,
40 agx::Real fullOffsetPercent,
41 agx::Vec3* relativePosition);
43 const agx::RigidBody* getBody() const;
50
52
55
57
58 protected:
66
68 };
69
70
76 {
77 public:
78
84 agxCollide::Geometry* trimeshGeometry);
85
109 bool activateDualFrameInterapolation( agx::Frame* interpolationFrame1,
110 agx::Frame* interpolationFrame2,
111 agx::Vec3 localMeshDir);
112
118
129 bool addLocalDeformation(const agx::RigidBody* relativeBody,
130 const agx::RigidBody* body,
131 agx::Real offsetReach,
132 agx::Real fullOffsetPercent,
133 agx::Vec3* relativePosition = nullptr);
134
138 void update();
139
140 void last(const agx::TimeStamp&) override;
141
146
151
155 bool isValid() const;
156
163
170
172
173
175
176
177 protected:
180
183
184 void removeNotification() override;
185
186
197#ifndef SWIG
202
204#endif
205
206 };
207
208
209
215 {
216 public:
217
219 void add(TrimeshDeformer* deformer);
220 bool remove(TrimeshDeformer* deformer);
221
222 void setParallel(bool flag);
223 bool getParallel() const;
224
225 protected:
226
227 void last(const agx::TimeStamp& time);
228
231
232
235
237
239 };
240}
241
#define AGX_DECLARE_POINTER_TYPES(type)
Definition: Referenced.h:254
#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 AGX_DECLARE_VECTOR_TYPES(type)
Definition: agx/Vector.h:34
The geometry representation used by the collision detection engine.
Definition: Geometry.h:92
Triangle mesh for geometric intersection tests.
Definition: Trimesh.h:40
Local scope vector.
Definition: LocalVector.h:44
Derive from this class to implement a listener for simulation step events.
This class is an abstract base class for all classes that can be stored and retrieved from an Archive...
Definition: Serializable.h:44
void collectAffectedVertices(const agxData::LocalVector< agx::Vec3 > &worldVertices)
agx::Vec3 getWorldOffsetVector() const
agx::Real getFullOffsetPercent()
BodyLocalOffset(const agx::RigidBody *relativeBody, const agx::RigidBody *body, agx::Real offsetReach, agx::Real fullOffsetPercent, agx::Vec3 *relativePosition)
const IndexVec3HashVector & getAffectedVertices() const
IndexVec3HashVector m_affectedVertices
const agx::RigidBody * m_body
agx::Vec3 m_relativeRelativeTranslate
agx::Vec3 getOriginalRelativeTranslate() const
agx::Real getOffsetReach() const
agx::HashVector< size_t, agx::Vec3 > IndexVec3HashVector
agx::Vec3 calculateRelativeTranslate() const
void setFullOffsetPercent(agx::Real percent)
const agx::RigidBody * getBody() const
const agx::RigidBody * m_relativeBody
agx::Real getFullOffsetReach() const
bool remove(TrimeshDeformer *deformer)
void removeNotification()
Called when this listener is removed from the simulation.
TrimeshDeformerSetVector m_deformers
agx::SetVector< TrimeshDeformerRef > TrimeshDeformerSetVector
void add(TrimeshDeformer *deformer)
void last(const agx::TimeStamp &time)
Called after a step is taken in the simulation Implement this method in the derived class to get call...
void addNotification()
Called when this listener is added to the simulation.
agx::AffineMatrix4x4 m_localFrame1VertexRotation
agxCollide::TrimeshObserver m_trimesh
void activateLocalOffsetInterpolation()
Prepare all local offsets, and calculate weight for each effected vertex.
agxCollide::GeometryObserver m_trimeshGeometry
void setOwner(ParallelTrimeshDeformer *deformer)
TrimeshDeformer(agxCollide::Trimesh *trimesh, agxCollide::Geometry *trimeshGeometry)
agxCollide::Trimesh * getTrimesh()
bool getEnableUpdateCollisionGeometry() const
bool addLocalDeformation(const agx::RigidBody *relativeBody, const agx::RigidBody *body, agx::Real offsetReach, agx::Real fullOffsetPercent, agx::Vec3 *relativePosition=nullptr)
For simulation models that consist of several rigid bodies, but we like to have just one visual but i...
agx::Vector< agx::Vec3 > m_verticesRelative2
agxCollide::Geometry * getGeometry()
agx::FrameRef m_interpolationFrame1
agx::Vector< agx::Vec3 > m_verticesRelative1
void update()
Update the trimesh given the operations activated.
void updateLocalOffset(const BodyLocalOffsetRef offset)
agx::FrameRef m_interpolationFrame2
agx::observer_ptr< ParallelTrimeshDeformer > m_owner
void last(const agx::TimeStamp &) override
Called after a step is taken in the simulation Implement this method in the derived class to get call...
void removeNotification() override
Called when this listener is removed from the simulation.
void setEnableUpdateCollisionGeometry(bool enable)
Specify if the mesh collision properties, including mass properties and bounding box calculations nee...
agx::Vector< agx::Vec3 > m_originalVertices
BodyLocalOffsetRefVector m_localOffsets
bool activateDualFrameInterapolation(agx::Frame *interpolationFrame1, agx::Frame *interpolationFrame2, agx::Vec3 localMeshDir)
The dual frame interpolation will move all verticies of the trimesh in between the x-y planes of inte...
The object defining a frame of reference and providing transformations operations.
Definition: agx/Frame.h:68
This class is a combined container which has the find complexity of a HashTable, deterministic iterat...
Definition: HashVector.h:41
Base class providing referencing counted objects.
Definition: Referenced.h:120
The rigid body class, combining a geometric model and a frame of reference.
Definition: RigidBody.h:49
This class is a combined container which has the find complexity of a HashTable, deterministic iterat...
Definition: SetVector.h:38
Templated vector class.
Definition: agx/Vector.h:53
Smart pointer for handling referenced counted objects.
Definition: ref_ptr.h:30
This namespace consists of a set of classes for handling geometric intersection tests including boole...
The agxUtil namespace contain classes and methods for utility functionality.
double Real
Definition: Real.h:41
agx::Real TimeStamp
Definition: TimeStamp.h:26