9 #include <argos3/core/utility/configuration/argos_exception.h>
16 std::vector<CDynamics3DShapeManager::SBoxResource>
17 CDynamics3DShapeManager::m_vecBoxResources;
23 std::vector<SBoxResource>::iterator itBoxResource;
24 for(itBoxResource = std::begin(m_vecBoxResources);
25 itBoxResource != std::end(m_vecBoxResources);
27 if(itBoxResource->HalfExtents == c_half_extents)
break;
30 if(itBoxResource == std::end(m_vecBoxResources)) {
32 m_vecBoxResources.emplace(itBoxResource, c_half_extents);
34 return std::static_pointer_cast<btCollisionShape>(itBoxResource->Shape);
40 CDynamics3DShapeManager::SBoxResource::SBoxResource(
const btVector3& c_half_extents) :
41 HalfExtents(c_half_extents),
42 Shape(new btBoxShape(c_half_extents)) {}
47 std::vector<CDynamics3DShapeManager::SCylinderResource>
48 CDynamics3DShapeManager::m_vecCylinderResources;
54 std::vector<SCylinderResource>::iterator itCylinderResource;
55 for(itCylinderResource = std::begin(m_vecCylinderResources);
56 itCylinderResource != std::end(m_vecCylinderResources);
57 ++itCylinderResource) {
58 if(itCylinderResource->HalfExtents == c_half_extents)
break;
61 if(itCylinderResource == std::end(m_vecCylinderResources)) {
63 m_vecCylinderResources.emplace(itCylinderResource, c_half_extents);
65 return std::static_pointer_cast<btCollisionShape>(itCylinderResource->Shape);
71 CDynamics3DShapeManager::SCylinderResource::SCylinderResource(
const btVector3& c_half_extents) :
72 HalfExtents(c_half_extents),
73 Shape(new btCylinderShape(c_half_extents)) {}
78 std::vector<CDynamics3DShapeManager::SSphereResource>
79 CDynamics3DShapeManager::m_vecSphereResources;
85 std::vector<SSphereResource>::iterator itSphereResource;
86 for(itSphereResource = std::begin(m_vecSphereResources);
87 itSphereResource != std::end(m_vecSphereResources);
89 if(itSphereResource->Radius == f_radius)
break;
92 if(itSphereResource == std::end(m_vecSphereResources)) {
94 m_vecSphereResources.emplace(itSphereResource, f_radius);
96 return std::static_pointer_cast<btCollisionShape>(itSphereResource->Shape);
102 CDynamics3DShapeManager::SSphereResource::SSphereResource(btScalar f_radius) :
104 Shape(new btSphereShape(f_radius)) {}
109 std::vector<CDynamics3DShapeManager::SConvexHullResource>
110 CDynamics3DShapeManager::m_vecConvexHullResources;
116 std::vector<SConvexHullResource>::iterator itConvexHullResource;
117 for(itConvexHullResource = std::begin(m_vecConvexHullResources);
118 itConvexHullResource != std::end(m_vecConvexHullResources);
119 ++itConvexHullResource) {
120 if(itConvexHullResource->Points == vec_points)
break;
123 if(itConvexHullResource == std::end(m_vecConvexHullResources)) {
124 itConvexHullResource =
125 m_vecConvexHullResources.emplace(itConvexHullResource, vec_points);
127 return std::static_pointer_cast<btCollisionShape>(itConvexHullResource->Shape);
133 CDynamics3DShapeManager::SConvexHullResource::SConvexHullResource(
const std::vector<btVector3>& vec_points) :
135 Shape(new btConvexHullShape) {
137 for(
const btVector3& c_point : vec_points) {
138 Shape->addPoint(c_point);
The namespace containing all the ARGoS related code.
static std::shared_ptr< btCollisionShape > RequestBox(const btVector3 &c_half_extents)
static std::shared_ptr< btCollisionShape > RequestSphere(btScalar f_radius)
static std::shared_ptr< btCollisionShape > RequestConvexHull(const std::vector< btVector3 > &vec_points)
static std::shared_ptr< btCollisionShape > RequestCylinder(const btVector3 &c_half_extents)