AGX Dynamics 2.42.3.1
Loading...
Searching...
No Matches
Box.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#ifndef AGXCOLLIDE_BOX_H
18#define AGXCOLLIDE_BOX_H
19
20#include <agxCollide/Shape.h>
22
23
24namespace agxCollide
25{
33 {
34 public:
39 Box( const agx::Vec3 halfExtents );
40
47 Box( agx::Real halfExtentX, agx::Real halfExtentY, agx::Real halfExtentZ );
48
49
54 void setHalfExtents( const agx::Vec3& halfExtents );
55
59 const agx::Vec3& getHalfExtents() const;
60
61 virtual Shape *clone() const override;
62 virtual agx::Real getVolume() const override;
63 virtual agx::SPDMatrix3x3 calculateInertia(agx::Real mass) const override;
64 virtual bool hasSupportFunction() const override;
65 virtual agx::Vec3 getSupportPoint( const agx::Vec3& supportDirection ) const override;
66 virtual const BoundingAABB& updateBoundingVolume() override;
67 virtual BoundingAABB calculateLocalBound() const override;
68
75 static BoundingAABB calculateBound(const agx::AffineMatrix4x4& transform, const agx::Vec3& halfExtents);
76
78
80
81 agx::Physics::Geometry::BoxPtr getEntity() const;
82
84
85 protected:
86 Box();
87
88 virtual ~Box();
89 };
90
91 /* Implementation */
92 inline const agx::Vec3& Box::getHalfExtents() const
93 {
94 return getEntity().halfExtents();
95 }
96
97 inline agx::Physics::Geometry::BoxPtr Box::getEntity() const
98 {
99 return m_entity;
100 }
101
102 AGX_FORCE_INLINE BoundingAABB Box::calculateBound(const agx::AffineMatrix4x4& transform, const agx::Vec3& halfExtents)
103 {
104 return BoundingAABB(BoundingAABB(-halfExtents, halfExtents), transform);
105 }
106}
107
108
109#endif
#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:207
#define AGXPHYSICS_EXPORT
Axis aligned bounding box implementation.
Definition: BoundingAABB.h:38
A box shape for geometric intersection tests.
Definition: Box.h:33
Box(const agx::Vec3 halfExtents)
Construct given half extents.
virtual agx::Real getVolume() const override
Return the volume of the shape.
virtual bool hasSupportFunction() const override
virtual agx::Vec3 getSupportPoint(const agx::Vec3 &supportDirection) const override
Returns the support point on face of the shape.
void setHalfExtents(const agx::Vec3 &halfExtents)
Set the half size of the box.
virtual agx::SPDMatrix3x3 calculateInertia(agx::Real mass) const override
Calculate the inertia for the shape given a mass.
Box(agx::Real halfExtentX, agx::Real halfExtentY, agx::Real halfExtentZ)
Construct given half extents.
virtual Shape * clone() const override
Create a clone.
virtual const BoundingAABB & updateBoundingVolume() override
Calculate the bounding volume based on the current Shape parameters including transformation.
virtual BoundingAABB calculateLocalBound() const override
Calculate the bounding volume in the local coordinate system.
The geometry representation used by the collision detection engine.
Definition: Geometry.h:92
Base class for a shape.
Definition: Shape.h:58
Pointer to a entity instance of type Physics.Geometry.Box.
Definition: BoxEntity.h:161
Specialized type of matrices for holding symmetric positive definite matrices.
Definition: SPDMatrix3x3.h:48
#define DOXYGEN_END_INTERNAL_BLOCK()
Definition: macros.h:89
#define DOXYGEN_START_INTERNAL_BLOCK()
Definition: macros.h:88
#define AGX_FORCE_INLINE
Definition: macros.h:58
This namespace consists of a set of classes for handling geometric intersection tests including boole...
The agx namespace contains the dynamics/math part of the AGX Dynamics API.
double Real
Definition: Real.h:41