AGX Dynamics  2.38.0.2
WireShape.h
Go to the documentation of this file.
1 /*
2 Copyright 2007-2024. 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 #pragma once
18 
19 #include <agx/agxPhysics_export.h>
21 #include <agxCollide/Shape.h>
22 #include <agxCollide/Capsule.h>
23 #include <agxStream/Serializable.h>
24 
25 namespace agxCollide
26 {
28 
44  {
45  public:
53  WireShape(
54  const agx::Real radius, const agx::Real height,
55  const agx::Vec3 previousEndPoint0 = agx::Vec3(),
56  const agx::Vec3 previousEndPoint1 = agx::Vec3());
57 
61  agx::Vec3 getPreviousEndPoint0() const;
62 
66  agx::Vec3 getPreviousEndPoint1() const;
67 
68  /*
69  Sets radius, height, and the first previous end points for continuous collision detection.
70  \param worldTransform New world transform of this wire shape.
71  \param radius The new radius.
72  \param height The new height.
73  \param previousEndPoint0 Corresponding to local Vec3(0, -0.5h, 0), but in world coordinates.
74  \param previousEndPoint1 Corresponding to local Vec3(0, 0.5h, 0), but in world coordinates.
75  */
76  agxCollide::BoundingAABB set( const agx::AffineMatrix4x4& worldTransform, const agx::Real radius, const agx::Real height, const agx::Vec3& previousEndPoint0, const agx::Vec3& previousEndPoint1 );
77 
78  virtual const BoundingAABB& updateBoundingVolume() override;
79  virtual BoundingAABB calculateLocalBound() const override;
80  static BoundingAABB calculateBound( const agx::AffineMatrix4x4& transform, const agx::Real radius, const agx::Real height, const agx::Vec3& previousEndPoint0, const agx::Vec3& previousEndPoint1 );
81 
83 
85 
86  protected:
87  WireShape();
88  virtual ~WireShape();
89  };
90 
91  /* Implementation */
93  {
94  return m_entity;
95  }
96 
98  {
99  return getEntity().previousPoint0();
100  }
101 
103  {
104  return getEntity().previousPoint1();
105  }
106 
107  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 )
108  {
109  const agx::Vec3 p1 = agx::Vec3( 0, height * agx::Real( 0.5 ), 0 ) * transform;
110  const agx::Vec3 p2 = agx::Vec3( 0, height * agx::Real( -0.5 ), 0 ) * transform;
111  const agx::Vec3& p3 = previousEndPoint0;
112  const agx::Vec3& p4 = previousEndPoint1;
113  const agx::Vec3 rVec( radius );
114 
117  return bound;
118  }
119 
120 }
agxPhysics_export.h
Shape.h
agxCollide::Capsule
Implements a Capsule shape for geometric intersection tests.
Definition: Capsule.h:34
agx::Real
double Real
Definition: Real.h:42
agxData::transform
void AGXCORE_EXPORT transform(void *target, const Format *targetFormat, const void *source, const Format *sourceFormat, size_t numElements)
Transform data between two buffers.
agx::Physics::Geometry::WireShapePtr::previousPoint1
AGXPHYSICS_EXPORT agx::Vec3 & previousPoint1()
agx::AffineMatrix4x4T< Real >
agxCollide::WireShape::calculateBound
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:107
WireShapeEntity.h
agxCollide::BoundingAABB
Axis aligned bounding box implementation.
Definition: BoundingAABB.h:37
AGXSTREAM_DECLARE_SERIALIZABLE
#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
agxCollide::Shape::m_entity
agx::Physics::Geometry::ShapeRef m_entity
Definition: Shape.h:266
AGXPHYSICS_EXPORT
#define AGXPHYSICS_EXPORT
agxCollide::WireShape
Internal class used by agxWire::Wire.
Definition: WireShape.h:43
agx::Vec3T< Real >::componentMin
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:379
agx::Vec3
Vec3T< Real > Vec3
The object holding 3 dimensional vectors and providing basic arithmetic.
Definition: Vec3.h:36
agxCollide::WireShape::getEntity
agx::Physics::Geometry::WireShapePtr getEntity() const
Definition: WireShape.h:92
agx::Vec3T< Real >::componentMax
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:385
Serializable.h
agxCollide
This namespace consists of a set of classes for handling geometric intersection tests including boole...
Definition: ContactForceFilterParticipant.h:22
agxCollide::WireShape::getPreviousEndPoint0
agx::Vec3 getPreviousEndPoint0() const
Definition: WireShape.h:97
agxCollide::AGX_DECLARE_POINTER_TYPES
AGX_DECLARE_POINTER_TYPES(SpaceListener)
agx::Vec3T< Real >
agxCollide::WireShape::getPreviousEndPoint1
agx::Vec3 getPreviousEndPoint1() const
Definition: WireShape.h:102
Capsule.h
AGX_FORCE_INLINE
#define AGX_FORCE_INLINE
Definition: macros.h:58
agx::Physics::Geometry::WireShapePtr
Pointer to a entity instance of type Physics.Geometry.WireShape.
Definition: WireShapeEntity.h:171
agxData::getEntity
AGXCORE_EXPORT EntityModel * getEntity(const agx::Path &path)
Get a entity with a specified path.
agx::Physics::Geometry::WireShapePtr::previousPoint0
AGXPHYSICS_EXPORT agx::Vec3 & previousPoint0()