AGXDynamics  2.31.1.0
WireShape.h
Go to the documentation of this file.
1 /*
2 Copyright 2007-2021. Algoryx Simulation AB.
3 
4 All AGX source code, intellectual property, documentation, sample code,
5 tutorials, scene files and technical white papers, are copyrighted, proprietary
6 and confidential material of Algoryx Simulation AB. You may not download, read,
7 store, distribute, publish, copy or otherwise disseminate, use or expose this
8 material unless having a written signed agreement with Algoryx Simulation AB, or having been
9 advised so by Algoryx Simulation AB for a time limited evaluation, or having purchased a
10 valid commercial license from Algoryx Simulation AB.
11 
12 Algoryx Simulation AB disclaims all responsibilities for loss or damage caused
13 from using this software, unless otherwise stated in written agreements with
14 Algoryx Simulation AB.
15 */
16 
17 #ifndef AGXCOLLIDE_WIRE_SHAPE_H
18 #define AGXCOLLIDE_WIRE_SHAPE_H
19 
20 #include <agx/agxPhysics_export.h>
22 #include <agxCollide/Shape.h>
23 #include <agxCollide/Capsule.h>
24 #include <agxStream/Serializable.h>
25 
26 namespace agxCollide
27 {
29 
45  {
46  public:
54  WireShape(
55  const agx::Real radius, const agx::Real height,
56  const agx::Vec3& previousEndPoint0 = agx::Vec3(),
57  const agx::Vec3& previousEndPoint1 = agx::Vec3());
58 
62  agx::Vec3 getPreviousEndPoint0() const;
63 
67  agx::Vec3 getPreviousEndPoint1() const;
68 
69  /*
70  Sets radius, height, and the first previous end points for continuous collision detection.
71  \param worldTransform New world transform of this wire shape.
72  \param radius The new radius.
73  \param height The new height.
74  \param previousEndPoint0 Corresponding to local Vec3(0, -0.5h, 0), but in world coordinates.
75  \param previousEndPoint1 Corresponding to local Vec3(0, 0.5h, 0), but in world coordinates.
76  */
77  agxCollide::BoundingAABB set( const agx::AffineMatrix4x4& worldTransform, const agx::Real radius, const agx::Real height, const agx::Vec3& previousEndPoint0, const agx::Vec3& previousEndPoint1 );
78 
79  virtual const BoundingAABB& updateBoundingVolume() override;
80  virtual BoundingAABB calculateLocalBound() const override;
81  static BoundingAABB calculateBound( const agx::AffineMatrix4x4& transform, const agx::Real radius, const agx::Real height, const agx::Vec3& previousEndPoint0, const agx::Vec3& previousEndPoint1 );
82 
84 
86 
87  protected:
88  WireShape();
89  virtual ~WireShape();
90  };
91 
92  /* Implementation */
94  {
95  return m_entity;
96  }
97 
99  {
100  return getEntity().previousPoint0();
101  }
102 
104  {
105  return getEntity().previousPoint1();
106  }
107 
108  AGX_FORCE_INLINE BoundingAABB WireShape::calculateBound( const agx::AffineMatrix4x4& transform, const agx::Real radius, const agx::Real height, const agx::Vec3& previousEndPoint0, const agx::Vec3& previousEndPoint1 )
109  {
110  const agx::Vec3 p1 = agx::Vec3( 0, height * agx::Real( 0.5 ), 0 ) * transform;
111  const agx::Vec3 p2 = agx::Vec3( 0, height * agx::Real( -0.5 ), 0 ) * transform;
112  const agx::Vec3& p3 = previousEndPoint0;
113  const agx::Vec3& p4 = previousEndPoint1;
114  const agx::Vec3 rVec( radius );
115 
118  return bound;
119  }
120 
121 }
122 
123 #endif
Vec3T< Real > Vec3
The object holding 3 dimensional vectors and providing basic arithmetic.
Definition: Vec3.h:36
Implements a Capsule shape for geometric intersection tests.
Definition: Capsule.h:34
agxCollide namespace consists of a set of classes for handling geometric intersection tests including...
void AGXCORE_EXPORT transform(void *target, const Format *targetFormat, const void *source, const Format *sourceFormat, size_t numElements)
Transform data between two buffers.
#define AGXPHYSICS_EXPORT
static BoundingAABB calculateBound(const agx::AffineMatrix4x4 &transform, const agx::Real radius, const agx::Real height, const agx::Vec3 &previousEndPoint0, const agx::Vec3 &previousEndPoint1)
Definition: WireShape.h:108
#define AGX_FORCE_INLINE
Definition: Object.h:63
agx::Physics::Geometry::WireShapePtr getEntity() const
Definition: WireShape.h:93
Internal class used by agxWire::Wire.
Definition: WireShape.h:44
static Vec3T componentMax(const Vec3T &v1, const Vec3T &v2)
Creates a new vector where each component is the maximum of this and the other vector.
Definition: Vec3Template.h:391
#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:206
agx::Vec3 getPreviousEndPoint0() const
Definition: WireShape.h:98
double Real
Definition: Real.h:42
Axis aligned bounding box implementation.
Definition: BoundingAABB.h:37
agx::Vec3 getPreviousEndPoint1() const
Definition: WireShape.h:103
Pointer to a entity instance of type Physics.Geometry.WireShape.
AGX_DECLARE_POINTER_TYPES(SpaceListener)
AGXCORE_EXPORT EntityModel * getEntity(const agx::Path &path)
Get a entity with a specified path.
static Vec3T componentMin(const Vec3T &v1, const Vec3T &v2)
Creates a new vector where each component is the minimum of this and the other vector.
Definition: Vec3Template.h:385