1 #ifndef CPP_COLLISION_INCLUDE_COLLISION_SOLVERS_TRAJECTORY_QUERIES_H_ 2 #define CPP_COLLISION_INCLUDE_COLLISION_SOLVERS_TRAJECTORY_QUERIES_H_ 19 : enable_verification(false),
22 fcl_broadphase_type(0),
23 fcl_num_buckets(1000),
24 auto_orientation(true),
25 optimize_triangles(true){};
42 namespace trajectory_queries {
64 namespace deprecated {
93 typedef Eigen::Matrix<int, Eigen::Dynamic, 1>
VectorXi;
94 typedef std::vector<OBB, Eigen::aligned_allocator<OBB>>::const_iterator
97 int size(
void)
const {
return traj_offsets_.size(); }
101 if (!(traj_id >= 0 && traj_id < size())) {
104 int start_step = start_step_(traj_id);
105 int end_step = start_step + traj_length_ - 1;
107 if (!((timestep >= start_step) && (timestep <= end_step))) {
111 if (!(aabbs_valid_)) computeAABBs();
113 int real_timestep = timestep - start_step;
114 int offset = traj_offsets_[traj_id] + real_timestep;
115 aabb = *(aabb_begin_ + offset);
116 obb = *(obb_begin_ + offset);
128 int length(
void)
const {
return traj_length_; }
131 EIGEN_MAKE_ALIGNED_OPERATOR_NEW
133 std::vector<OBB, Eigen::aligned_allocator<OBB>> rectangles,
134 int traj_length,
const VectorXi& start_step)
135 : rectangles_(rectangles),
136 traj_length_(traj_length),
137 start_step_(start_step) {
138 int num_traj = rectangles.size() / traj_length;
139 if (num_traj * traj_length != rectangles.size())
throw;
141 num_traj_ = num_traj;
143 traj_offsets_.resize(num_traj_);
145 for (
int cc1 = 0; cc1 < num_traj; cc1++) {
146 traj_offsets_[cc1] = cc1 * traj_length;
149 aabb_begin_ = aabbs_.begin();
150 obb_begin_ = rectangles_.begin();
156 aabbs_.reserve(rectangles_.size());
157 for (
int cc1 = 0; cc1 < rectangles_.size(); cc1++) {
158 aabbs_.push_back(rectangles_[cc1].
getAABB());
160 aabb_begin_ = aabbs_.begin();
165 int preprocess_inplace(
void);
168 std::vector<OBB, Eigen::aligned_allocator<OBB>> rectangles_;
169 mutable std::vector<AABB, Eigen::aligned_allocator<AABB>> aabbs_;
170 mutable std::vector<AABB, Eigen::aligned_allocator<AABB>>::iterator
172 std::vector<OBB, Eigen::aligned_allocator<OBB>>::iterator obb_begin_;
173 mutable bool aabbs_valid_;
175 std::vector<int> traj_offsets_;
176 VectorXi start_step_;
std::vector< T, boost::alignment::aligned_allocator< T, 16 > > aligned_vector
EIGEN_MAKE_ALIGNED_OPERATOR_NEW OBBDenseTrajectoryBatch(std::vector< OBB, Eigen::aligned_allocator< OBB >> rectangles, int traj_length, const VectorXi &start_step)
TimeVariantCollisionObject can contain a different CollisionObject or ShapeGroup at each time step...
std::size_t ccd_trajectory_test_polygon_enclosure_obb_sum(const ShapeGroup &sg, const RectangleOBB &pos1, const RectangleOBB &pos2, bool &res)
Checks if the over-approximative OBB box (OBB sum hull) for the two given OBB boxes boxes is enclosed...
int trajectories_collision_time_dynamic_obstacles(const aligned_vector< const collision::TimeVariantCollisionObject *> &trajectories_in, const aligned_vector< const collision::TimeVariantCollisionObject *> &dynamic_obstacles, TrajectoryQueryResult &res, const TrajectoryRequest &treq)
int computeAABBs(void) const
TrajectoryRequestBroadphaseClass
std::vector< OBB, Eigen::aligned_allocator< OBB > >::const_iterator OBBConstIterator
std::size_t ccd_trajectory_test_polygon_enclosure_chull(const ShapeGroup &sg, const RectangleOBB &pos1, const RectangleOBB &pos2, bool &res)
Checks if the convex hull of the Boolean union of two given OBB boxes is enclosed within the ShapeGro...
collision::detail::OBB OBB
ShapeGroup can contain simple shapes.
AABB getAABB(const CollisionObject *obj)
int get_object_at_time_ptr(int traj_id, int timestep, OBB &obb, AABB &aabb) const
int trajectory_preprocess_obb_sum(const TimeVariantCollisionObject *obj_old, TimeVariantCollisionObjectPtr &obj_new)
Preprocesses a TimeVariantCollisionObject for continuous collision detection using OBB sum hull for t...
std::size_t ccd_trajectory_test_collision_chull(const ShapeGroup &sg, const RectangleOBB &pos1, const RectangleOBB &pos2, bool &res)
Checks if the convex hull of the Boolean union of two given OBB boxes collides with any of the ShapeG...
int trajectories_enclosure_time_polygons_static(const aligned_vector< const collision::TimeVariantCollisionObject *> &trajectories_in, const collision::ShapeGroup &polygons, TrajectoryQueryResult &res, const TrajectoryRequest &treq)
int trajectories_collision_time_static_obstacles(const aligned_vector< const collision::TimeVariantCollisionObject *> &trajectories_in, const collision::ShapeGroup &static_obstacles, TrajectoryQueryResult &res, const TrajectoryRequest &treq)
VectorXi get_start_step(void) const
int get_start_step(int traj_id) const
TrajectoryQueryResultCollisionTime(aligned_vector< int > *res)
void invalidateAABBs(void)
TrajectoryRequestCollisionTime(void)
std::size_t ccd_trajectory_test_collision_obb_sum(const ShapeGroup &sg, const RectangleOBB &pos1, const RectangleOBB &pos2, bool &res)
Checks if the over-approximative OBB box (OBB sum hull) for the two given OBB boxes collides with any...
Eigen::Matrix< int, Eigen::Dynamic, 1 > VectorXi
TrajectoryRequestBroadphaseClass broadphase_class
std::shared_ptr< TimeVariantCollisionObject > TimeVariantCollisionObjectPtr