forked from flexible-collision-library/fcl
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfcl_helper.h
81 lines (59 loc) · 2.13 KB
/
fcl_helper.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
//
// Created by Duzhong Chen on 2023/12/29.
//
#ifndef FCL_FCL_HELPER_H
#define FCL_FCL_HELPER_H
#include <memory>
#include <emscripten.h>
#include "fcl/broadphase/broadphase_dynamic_AABB_tree.h"
#include "fcl/broadphase/broadphase_dynamic_AABB_tree_array.h"
#include "fcl/broadphase/default_broadphase_callbacks.h"
using GJKSolverType = fcl::GJKSolverType;
class CollisionObjectDelegate : public fcl::CollisionObjectd {
public:
inline CollisionObjectDelegate(fcl::CollisionGeometry<double> *cgeom): CollisionObject(std::shared_ptr<fcl::CollisionGeometry<double>>(cgeom)) {
}
};
class DynamicAABBTreeCollisionManager : public fcl::DynamicAABBTreeCollisionManagerd {
public:
inline void defaultCollide(fcl::CollisionObjectd* obj, void* cdata) const {
this->collide(obj, cdata, fcl::DefaultCollisionFunction);
}
inline void internalCollide(void* cdata) const {
this->collide(cdata, fcl::DefaultCollisionFunction);
}
inline void collideWith(DynamicAABBTreeCollisionManager* manager, void* cdata) const {
this->collide(manager, cdata, fcl::DefaultCollisionFunction);
}
};
class DynamicAABBTreeCollisionManager_Array : public fcl::DynamicAABBTreeCollisionManager_Array<double> {
public:
inline void defaultCollide(fcl::CollisionObjectd* obj, void* cdata) const {
this->collide(obj, cdata, fcl::DefaultCollisionFunction);
}
inline void internalCollide(void* cdata) const {
this->collide(cdata, fcl::DefaultCollisionFunction);
}
inline void collideWith(DynamicAABBTreeCollisionManager_Array* manager, void* cdata) const {
this->collide(manager, cdata, fcl::DefaultCollisionFunction);
}
};
using DefaultCollisionDatad = fcl::DefaultCollisionData<double>;
class FclHelper {
public:
inline void vector3_set_x(fcl::Vector3d* vec3, double x) {
vec3->x() = x;
}
inline void vector3_set_y(fcl::Vector3d* vec3, double y) {
vec3->y() = y;
}
inline void vector3_set_z(fcl::Vector3d* vec3, double z) {
vec3->z() = z;
}
inline void vector3_set_values(fcl::Vector3d* vec3, double x, double y, double z) {
vec3->x() = x;
vec3->y() = y;
vec3->z() = z;
}
};
#endif // FCL_FCL_HELPER_H