AGX Dynamics 2.41.1.2
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 <agxUtil/agxUtil.h>
21
22namespace agxCollide {
23 class Trimesh;
24}
25
26namespace agxUtil {
27
28 class ParallelTrimeshDeformer;
29
32
34 {
35 public:
36 BodyLocalOffset(const agx::RigidBody* relativeBody,
37 const agx::RigidBody* body,
38 agx::Real offsetReach,
39 agx::Real fullOffsetPercent,
40 agx::Vec3* relativePosition);
42 const agx::RigidBody* getBody() const;
49
51
54
56
57 protected:
65
67 };
68
69
75 {
76 public:
77
83 agxCollide::Geometry* trimeshGeometry);
84
108 bool activateDualFrameInterapolation( agx::Frame* interpolationFrame1,
109 agx::Frame* interpolationFrame2,
110 agx::Vec3 localMeshDir);
111
117
128 bool addLocalDeformation(const agx::RigidBody* relativeBody,
129 const agx::RigidBody* body,
130 agx::Real offsetReach,
131 agx::Real fullOffsetPercent,
132 agx::Vec3* relativePosition = nullptr);
133
137 void update();
138
139 void last(const agx::TimeStamp&) override;
140
145
150
154 bool isValid() const;
155
162
169
171
172
174
175
176 protected:
179
182
183 void removeNotification() override;
184
185
196#ifndef SWIG
201
203#endif
204
205 };
206
207
208
214 {
215 public:
216
218 void add(TrimeshDeformer* deformer);
219 bool remove(TrimeshDeformer* deformer);
220
221 void setParallel(bool flag);
222 bool getParallel() const;
223
224 protected:
225
226 void last(const agx::TimeStamp& time);
227
230
231
234
236
238 };
239}
240
#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:208
#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:43
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:45
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:52
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:42
agx::Real TimeStamp
Definition: TimeStamp.h:26