Momentum Scripting v1
Loading...
Searching...
No Matches
GranularBody.h
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 without having a written signed agreement with Algoryx Simulation AB.
9
10Algoryx Simulation AB disclaims all responsibilities for loss or damage caused
11from using this software, unless otherwise stated in written agreements with
12Algoryx Simulation AB.
13*/
14#ifndef MOMENTUM_GRANULARBODY_H
15#define MOMENTUM_GRANULARBODY_H
16
17#include "momentum_namespace.h"
18#include "momentum_export.h"
19
20#include <memory>
21
22#include "Vec3.h"
23#include "EulerAngles.h"
24
25#include <agx/Physics/GranularBodyEntity.h>
26
27namespace MOMENTUM_NAMESPACE
28{
29 class Material;
30
35 class MOMENTUM_EXPORT GranularBody
36 {
37 public:
44 {
45 KINEMATICS = 2,
46 DYNAMICS = 3
47 };
48 public:
49#ifndef SWIG
53 GranularBody(agx::Physics::GranularBodyPtr);
54
59#endif
60
66
72
78
84
89
94 double getRadius() const;
95
100 double getMass() const;
101
107
112 Vec3 getForce() const;
113
118 Vec4 getColor() const;
119
125 bool isValid() const;
126
131 unsigned int getId() const;
132
133#ifndef AGX_MOMENTUM_ANALYSIS_API
140 void setPosition(const Vec3& position);
141
150 void setPosition(double x, double y, double z);
151
158 void setRotation(const Quat& q);
159
166 void setRotation(const EulerAngles& e);
167
174 void setLinearVelocity( const Vec3& velocity );
175
184 void setLinearVelocity( double vx, double vy, double vz );
185
192 void setAngularVelocity( const Vec3& angularVelocity );
193
202 void setAngularVelocity( double ax, double ay, double az );
203
213
221 void addForce(const Vec3& force);
222
230 void addForce(double fx, double fy, double fz);
231
239 void addTorque(const Vec3& torque);
240
248 void addTorque(double tx, double ty, double tz);
249
259 void setForce(const Vec3& force);
260
270 void setForce(double fx, double fy, double fz);
271
281 void setTorque(const Vec3& torque);
282
292 void setTorque(double tx, double ty, double tz);
293
301 void setRadius(double radius);
302
310 void setMass(double mass);
311
319 void setMaterial(const Material* material);
320
327 void setColor(const Vec4& color);
328
335 void destroy();
336
337 // Old methods that exists for backwards compatibility
338 void setVelocity( const Vec3& velocity );
339 void setVelocity( double vx, double vy, double vz );
340
341#endif
342
343 bool operator==(const GranularBody& other) const;
344
345#ifndef SWIG
346 bool is(agx::Physics::GranularBodyPtr granularBody) const;
347
348 agx::Physics::GranularBodyPtr ptr() const;
349#endif
350
352 std::string getMaterialUuidString() const;
354 private:
355#ifndef SWIG
357 agx::Physics::GranularBodyPtr m_granularBodyPtr;
359#endif
360 };
361
362 V1_DECLARE_CONTAINER_TYPE(GranularBody);
363}
364
365#endif
This class provides conversion services between Euler angles in any of the 24 conventions and corresp...
Definition: EulerAngles.h:64
A GranularBody class, representing a 6DOF spherical object that interacts with the environment trough...
Definition: GranularBody.h:36
void setAngularVelocity(const Vec3 &angularVelocity)
Set the world angular velocity of the GranularBody.
void addTorque(double tx, double ty, double tz)
Adds the torque, given in world coordinate frame, that will be affecting this GranularBody in the nex...
Vec4 getColor() const
Get the color that will be used during rendering of the GranularBody.
void setMass(double mass)
Explicitly set the mass of the GranularBody.
void setTorque(const Vec3 &torque)
Explicitly set the torque, given in world coordinate frame, that will be affecting this GranularBody ...
void setVelocity(const Vec3 &velocity)
Quat getRotation() const
Returns the current world orientation of the GranularBody.
GranularBody()
Null-constructor.
unsigned int getId() const
Gets the unique identifier id for the GranularBody.
void setRadius(double radius)
Explicitly set the radius of the GranularBody.
void setAngularVelocity(double ax, double ay, double az)
Set the world angular velocity of the GranularBody.
void destroy()
Tag the GranularBody for destruction at the end of the timestep.
void addForce(const Vec3 &force)
Adds the force, given in world coordinate frame, that will be affecting this GranularBody in the next...
Vec3 getVelocity() const
Returns the current world velocity of the GranularBody.
void setRotation(const Quat &q)
Set the rotation of the GranularBody relative to world coordinate system.
Vec3 getPosition() const
Returns the current world position of the GranularBody.
void setLinearVelocity(double vx, double vy, double vz)
Set the world linear velocity of the GranularBody.
GranularBody::MotionControl getMotionControl() const
void setForce(double fx, double fy, double fz)
Explicitly set the force, given in world coordinate frame, that will be affecting this GranularBody i...
double getRadius() const
Gets the radius of the GranularBody.
void setColor(const Vec4 &color)
Set the color that will be used during rendering of the GranularBody.
agx::Physics::GranularBodyPtr ptr() const
void setPosition(double x, double y, double z)
Set the world position of the GranularBody.
Material * getMaterial() const
Gets the active material on the GranularBody.
double getMass() const
Gets the mass of the GranularBody.
void setMaterial(const Material *material)
Set the material on the GranularBody.
bool isValid() const
Gets true/false if the active GranularBody is valid or not.
bool operator==(const GranularBody &other) const
void setMotionControl(GranularBody::MotionControl motionControl)
Assign new motion control state to this granular body.
void setPosition(const Vec3 &position)
Set the world position of the GranularBody.
void setForce(const Vec3 &force)
Explicitly set the force, given in world coordinate frame, that will be affecting this GranularBody i...
void setTorque(double tx, double ty, double tz)
Explicitly set the torque, given in world coordinate frame, that will be affecting this GranularBody ...
Vec3 getForce() const
Gets the current active force on the GranularBody that will be active during the next simulation step...
void addForce(double fx, double fy, double fz)
Adds the force, given in world coordinate frame, that will be affecting this GranularBody in the next...
void setRotation(const EulerAngles &e)
Set the rotation of the GranularBody relative to world coordinate system.
Vec3 getAngularVelocity() const
Returns the current world angular velocity of the GranularBody.
void addTorque(const Vec3 &torque)
Adds the torque, given in world coordinate frame, that will be affecting this GranularBody in the nex...
MotionControl
There are two forms of motion allowed : -KINEMATICS means that motion is scripted; -DYNAMICS means th...
Definition: GranularBody.h:44
bool is(agx::Physics::GranularBodyPtr granularBody) const
void setLinearVelocity(const Vec3 &velocity)
Set the world linear velocity of the GranularBody.
void setVelocity(double vx, double vy, double vz)
GranularBody(agx::Physics::GranularBodyPtr)
Create a wrapper around an agx::Physics::GranularBodyPtr.
A class describing a Material which is attached to a Geometry.
Definition: Material.h:41
The object holding quaternions and providing operations on these.
Definition: Quat.h:55
A 3 dimensional vector which can be used to define a point or a vector and contains basic arithmetic.
Definition: Vec3.h:40
A 4 dimensional vector and contains basic arithmetic.
Definition: Vec4.h:33
Namespace for Momentum Scripting API.
Definition: AffineMatrix4x4.h:29