pinocchio 4.1.0
A fast and flexible implementation of Rigid Body Dynamics algorithms and their analytical derivatives
Loading...
Searching...
No Matches
broadphase-manager-base.hpp
1//
2// Copyright (c) 2022 INRIA
3//
4
5#pragma once
6// IWYU pragma: begin_keep
7
8#include "pinocchio/macros.hpp"
9
10#include "pinocchio/multibody.hpp"
11
12#include "pinocchio/collision/broadphase-callbacks.hpp"
13// IWYU pragma: end_keep
14
15namespace pinocchio
16{
17
18 template<typename Derived>
20 {
22 BroadPhaseManagerBase() // for std::vector
23 : model_ptr(nullptr)
24 , geometry_model_ptr(nullptr)
25 , geometry_data_ptr(nullptr)
26 {
27 }
28
39
47
49 operator=(const BroadPhaseManagerBase & other) // Copy assignment operator
50 {
51 model_ptr = other.model_ptr;
54 return *this;
55 }
56
57 Derived & derived()
58 {
59 return static_cast<Derived &>(*this);
60 }
61 const Derived & derived() const
62 {
63 return static_cast<const Derived &>(*this);
64 }
65
68 bool check() const
69 {
70 return derived().check();
71 }
72
74 bool check(CollisionCallBackBase * callback) const
75 {
76 return derived().check(callback);
77 }
78
86 void update(bool compute_local_aabb = false)
87 {
88 derived().update(compute_local_aabb);
89 }
90
96 void update(GeometryData * geom_data_ptr_new)
97 {
98 derived().update(geom_data_ptr_new);
99 }
100
103 bool collide(CollisionObject & obj, CollisionCallBackBase * callback) const
104 {
105 return derived().collide(obj, callback);
106 }
107
109 bool collide(CollisionCallBackBase * callback) const
110 {
111 return derived().collide(callback);
112 }
113
115 bool collide(BroadPhaseManagerBase & other_manager, CollisionCallBackBase * callback) const
116 {
117 return derived().collide(other_manager.derived(), callback);
118 }
119
120 // /// @brief Performs distance computation between one object and all the objects belonging to
121 // the manager void distance(CollisionObject* obj, DistanceCallBackBase * callback) const;
122
123 // /// @brief Performs distance test for the objects belonging to the manager (i.e., N^2 self
124 // distance) void distance(DistanceCallBackBase * callback) const;
125
126 // /// @brief Performs distance test with objects belonging to another manager
127 // void distance(BroadPhaseCollisionManager* other_manager, DistanceCallBackBase * callback)
128 // const;
129
131 const Model & getModel() const
132 {
133 return *model_ptr;
134 }
135
137 const GeometryModel & getGeometryModel() const
138 {
139 return *geometry_model_ptr;
140 }
141
143 const GeometryData & getGeometryData() const
144 {
145 return *geometry_data_ptr;
146 }
147
149 GeometryData & getGeometryData()
150 {
151 return *geometry_data_ptr;
152 }
153
154 protected:
156 const Model * model_ptr;
157
159 const GeometryModel * geometry_model_ptr;
160
162 GeometryData * geometry_data_ptr;
163
164 }; // struct BroadPhaseManagerBase<Derived>
165
166} // namespace pinocchio
Main pinocchio namespace.
Definition treeview.dox:11
void update(GeometryData *geom_data_ptr_new)
Update the manager with a new geometry data.
const GeometryData & getGeometryData() const
Returns the geometry data associated to the manager.
bool collide(CollisionObject &obj, CollisionCallBackBase *callback) const
Performs collision test between one object and all the objects belonging to the manager.
BroadPhaseManagerBase(const Model *model_ptr, const GeometryModel *geometry_model_ptr, GeometryData *geometry_data_ptr)
Constructor from a given geometry model and geometry data.
BroadPhaseManagerBase(const BroadPhaseManagerBase &other)
Copy constructor.
const GeometryModel * geometry_model_ptr
Pointer to the geometry model.
const Model & getModel() const
Returns the model associated to the manager.
const Model * model_ptr
Pointer to the model.
GeometryData * geometry_data_ptr
Pointer to the geometry data.
bool check() const
Check whether the base broad phase manager is aligned with the current collision_objects.
bool check(CollisionCallBackBase *callback) const
Check whether the callback is inline with *this.
bool collide(BroadPhaseManagerBase &other_manager, CollisionCallBackBase *callback) const
Performs collision test with objects belonging to another manager.
GeometryData & getGeometryData()
Returns the geometry data associated to the manager.
const GeometryModel & getGeometryModel() const
Returns the geometry model associated to the manager.
void update(bool compute_local_aabb=false)
Update the manager from the current geometry positions and update the underlying coal broad phase man...
bool collide(CollisionCallBackBase *callback) const
Performs collision test for the objects belonging to the manager.