AGX Dynamics 2.41.2.0
Loading...
Searching...
No Matches
ObserverFrame.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 <agx/RigidBody.h>
21#include <agx/Frame.h>
22
23#ifdef _MSC_VER
24# pragma warning(push)
25# pragma warning(disable:4355) //Disable 'this' : used in base member initializer list warning
26#endif
27
28namespace agx
29{
30 class DynamicsSystem;
31
35
36
42 {
43 public:
44
45
46 public:
53 ObserverFrame( const agx::Name& name = "", agx::RigidBody* body = nullptr, const agx::AffineMatrix4x4& transform = agx::AffineMatrix4x4());
60
66 agx::Frame* getFrame();
67
73 const agx::Frame* getFrame() const;
74
82 void setTransform( const agx::AffineMatrix4x4& matrix );
83
88
94
99
104 void setLocalPosition( const agx::Vec3& p );
105
113
118 void setRotation( const agx::Quat& q );
119
125
131
136
141 void setLocalRotation( const agx::Quat& q );
142
148
153
158
169
174 void setPosition( const agx::Vec3& p );
175
183
189 void setEnable( bool enable );
190
195 bool getEnable() const;
196
201 bool isEnabled() const;
202
207
212
213
219
225
229 agx::Vec3 transformVectorToWorld(const agx::Vec3& vectorLocal) const;
230
234 agx::Vec3 transformVectorToLocal(const agx::Vec3& vectorWorld) const;
235
239 agx::Vec3 transformPointToWorld(const agx::Vec3& pointLocal) const;
240
244 agx::Vec3 transformPointToLocal(const agx::Vec3& pointWorld) const;
245
250
255
260
265
270
275
280
285
290
295
300
305
310
315
320
325
332
339
343 void detach();
344
346
351
355 const agx::RigidBody* getRigidBody() const;
356
360 agx::RigidBody* getRigidBody();
361
366 void setName( const agx::Name& name );
367
376
378
379 protected:
380 friend class DynamicsSystem;
381
382 virtual ~ObserverFrame();
383
389
390 private:
391 void init(const agx::Name& name, agx::RigidBody* body, const agx::AffineMatrix4x4& transform = agx::AffineMatrix4x4() );
392
393 private:
394 DynamicsSystem* m_mainSystem;
395
396 FrameRef m_frame;
397 bool m_enabled;
398 agx::Name m_name;
399 agx::RigidBodyRef m_rigidBody;
400 };
401
403 {
404 return m_enabled;
405 }
406
408 {
409 return m_enabled;
410 }
411
413 {
414 return m_frame.get();
415 }
416
418 {
419 return m_frame.get();
420 }
421
423 {
424 return m_rigidBody.get();
425 }
426
428 {
429 return m_rigidBody.get();
430 }
431
432} // namespace agx
433
434#ifdef _MSC_VER
435# pragma warning(pop)
436#endif
437
#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
This class is an abstract base class for all classes that can be stored and retrieved from an Archive...
Definition: Serializable.h:45
The complete physical system with bodies, interactions, data layout, time stepper,...
This class provides conversion services between Euler angles in any of the 24 conventions and corresp...
Definition: EulerAngles.h:70
The object defining a frame of reference and providing transformations operations.
Definition: agx/Frame.h:68
Representation of a name string.
Definition: Name.h:33
With this class you can attach an ObserverFrame object relative to a RigidBody.
Definition: ObserverFrame.h:42
bool isEnabled() const
Access the state enable flag.
void attachWithWorldTransform(agx::RigidBody *body, const agx::AffineMatrix4x4 &transform=agx::AffineMatrix4x4())
Attach the ObserverFrame to a rigid body.
void setLocalPosition(const agx::Vec3 &p)
Assign the parent relative translate of this frame.
void detach()
Detach the current rigid body, setting the current rigid body to the world and the frame to identity.
bool setCmAndInertiaInObserver(agx::RigidBody *body, const agx::SPDMatrix3x3 &inertia)
Set the specified inertia in the frame of the observer on the rigid body.
void setRotation(const agx::Quat &q)
Set the rotation of the frame relative to world frame.
agx::Vec3 transformPointToWorld(const agx::Vec3 &pointLocal) const
void setName(const agx::Name &name)
Assign new name to this ObserverFrame.
void setPosition(agx::Real x, agx::Real y, agx::Real z)
Assign the final (world) translate of this frame.
agx::Vec3 getRelativePosition(const agx::RigidBody *body) const
agx::Frame * getParentFrame()
void setLocalRotation(const agx::Quat &q)
Assign the parent relative rotation of this frame.
agx::Vec3 getRelativePosition(const agx::ObserverFrame *obs) const
const agx::AffineMatrix4x4 & getLocalTransform() const
agx::Vec3 transformVectorToWorld(const agx::Vec3 &vectorLocal) const
agx::Quat getRelativeRotation(const agx::ObserverFrame *obs) const
agx::Vec3 getRelativeAngularVelocity(const agx::ObserverFrame *obs) const
agx::Vec3 getLocalPosition() const
agx::Vec3 transformPointToLocal(const agx::Vec3 &pointWorld) const
agx::Vec3 getRelativeAcceleration(const agx::RigidBody *body) const
agx::Vec3 getRelativeAngularVelocity(const agx::RigidBody *body) const
ObserverFrame(const agx::Name &name="", agx::RigidBody *body=nullptr, const agx::AffineMatrix4x4 &transform=agx::AffineMatrix4x4())
Construct given name.
agx::Quat getRotation() const
Current model frame rotation, given in world coordinate frame.
agx::Vec3 getPosition() const
Current model frame position, given in world coordinate frame.
void setSystem(agx::DynamicsSystem *system)
Assign dynamics system which this body belongs to.
agx::Name getName() const
agx::Quat getLocalRotation() const
agx::RigidBody * getAttachment() const
void setRotation(const agx::OrthoMatrix3x3 &m)
Set the rotation of the frame relative to world frame.
agx::Quat getRelativeRotation(const agx::RigidBody *body) const
agx::Vec3 getAngularVelocity() const
agx::Vec3 getRelativeVelocity(const agx::RigidBody *body) const
void setRotation(const agx::EulerAngles &e)
Set the rotation of the frame relative to world frame.
agx::Vec3 getAngularAcceleration() const
bool getEnable() const
Access the state enable flag.
agx::Vec3 getVelocity() const
const agx::RigidBody * getRigidBody() const
bool setParentFrame(agx::Frame *frame)
Set the parent Frame of this ObserverFrame.
agx::DynamicsSystem * getSystem()
agx::Frame * getFrame()
Returns the model frame containing model the transformation and utilities to manipulate position,...
virtual ~ObserverFrame()
void setLocalTransform(const agx::AffineMatrix4x4 &matrix)
Assign the local transformation matrix for this frame ignoring any eventual parent transformation.
agx::Vec3 getAcceleration() const
ObserverFrame(agx::RigidBody *body, const agx::AffineMatrix4x4 &transform=agx::AffineMatrix4x4())
Construct without name.
const agx::Frame * getParentFrame() const
void attach(agx::RigidBody *body, const agx::AffineMatrix4x4 &transform=agx::AffineMatrix4x4())
Attach the ObserverFrame to a rigid body.
void setLocalRotation(const agx::EulerAngles &e)
Assign the parent relative rotation of this frame.
void setLocalPosition(agx::Real x, agx::Real y, agx::Real z)
Assign the parent relative translate of this frame.
void setPosition(const agx::Vec3 &p)
Assign the final (world) translate of this frame.
void setTransform(const agx::AffineMatrix4x4 &matrix)
This method will set the local matrix of this frame to be the matrix m multiplied with the inverse of...
agx::Vec3 transformVectorToLocal(const agx::Vec3 &vectorWorld) const
agx::Vec3 getRelativeAngularAcceleration(const agx::ObserverFrame *obs) const
const agx::DynamicsSystem * getSystem() const
agx::Vec3 getRelativeAngularAcceleration(const agx::RigidBody *body) const
agx::Vec3 getRelativeAcceleration(const agx::ObserverFrame *obs) const
agx::Vec3 getRelativeVelocity(const agx::ObserverFrame *obs) const
void setEnable(bool enable)
Change state enable of this ObserverFrame.
Specialized types of matrices for holding orthogonal transformation matrices.
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
Specialized type of matrices for holding symmetric positive definite matrices.
Definition: SPDMatrix3x3.h:49
This class is a combined container which has the find complexity of a HashTable, deterministic iterat...
Definition: SetVector.h:38
T * get() const
Definition: ref_ptr.h:256
#define CALLABLE
Definition: macros.h:72
#define AGX_FORCE_INLINE
Definition: macros.h:58
The agx namespace contains the dynamics/math part of the AGX Dynamics API.
agx::SetVector< ObserverFrameRef > ObserverFrameRefSetVector
Definition: ObserverFrame.h:34
double Real
Definition: Real.h:42
void AGXPHYSICS_EXPORT init()
Initialize AGX Dynamics API including thread resources and must be executed before using the AGX API.