Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
C
coal
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Coal
coal
Commits
76518023
Unverified
Commit
76518023
authored
9 months ago
by
Louis Montaut
Browse files
Options
Downloads
Patches
Plain Diff
readme: update examples with new "coal" library name
parent
770369b6
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
README.md
+16
-16
16 additions, 16 deletions
README.md
with
16 additions
and
16 deletions
README.md
+
16
−
16
View file @
76518023
...
...
@@ -94,10 +94,10 @@ Here is an example of using HPP-FCL in C++:
// GJK or EPA can be called with this object.
// Consequently, after creating the BVH structure from the point cloud, this function
// also computes its convex hull.
std
::
shared_ptr
<
hpp
::
fc
l
::
ConvexBase
>
loadConvexMesh
(
const
std
::
string
&
file_name
)
{
hpp
::
fc
l
::
NODE_TYPE
bv_type
=
hpp
::
fc
l
::
BV_AABB
;
hpp
::
fc
l
::
MeshLoader
loader
(
bv_type
);
hpp
::
fc
l
::
BVHModelPtr_t
bvh
=
loader
.
load
(
file_name
);
std
::
shared_ptr
<
coa
l
::
ConvexBase
>
loadConvexMesh
(
const
std
::
string
&
file_name
)
{
coa
l
::
NODE_TYPE
bv_type
=
coa
l
::
BV_AABB
;
coa
l
::
MeshLoader
loader
(
bv_type
);
coa
l
::
BVHModelPtr_t
bvh
=
loader
.
load
(
file_name
);
bvh
->
buildConvexHull
(
true
,
"Qt"
);
return
bvh
->
convex
;
}
...
...
@@ -107,16 +107,16 @@ int main() {
// Hppfcl supports many primitive shapes: boxes, spheres, capsules, cylinders, ellipsoids, cones, planes,
// halfspace and convex meshes (i.e. convex hulls of clouds of points).
// It also supports BVHs (bounding volumes hierarchies), height-fields and octrees.
std
::
shared_ptr
<
hpp
::
fc
l
::
Ellipsoid
>
shape1
=
std
::
make_shared
<
hpp
::
fc
l
::
Ellipsoid
>
(
0.7
,
1.0
,
0.8
);
std
::
shared_ptr
<
hpp
::
fc
l
::
ConvexBase
>
shape2
=
loadConvexMesh
(
"../path/to/mesh/file.obj"
);
std
::
shared_ptr
<
coa
l
::
Ellipsoid
>
shape1
=
std
::
make_shared
<
coa
l
::
Ellipsoid
>
(
0.7
,
1.0
,
0.8
);
std
::
shared_ptr
<
coa
l
::
ConvexBase
>
shape2
=
loadConvexMesh
(
"../path/to/mesh/file.obj"
);
// Define the shapes' placement in 3D space
hpp
::
fc
l
::
Transform3s
T1
;
T1
.
setQuatRotation
(
hpp
::
fc
l
::
Quaternion3f
::
UnitRandom
());
T1
.
setTranslation
(
hpp
::
fc
l
::
Vec3s
::
Random
());
hpp
::
fc
l
::
Transform3s
T2
=
hpp
::
fc
l
::
Transform3s
::
Identity
();
T2
.
setQuatRotation
(
hpp
::
fc
l
::
Quaternion3f
::
UnitRandom
());
T2
.
setTranslation
(
hpp
::
fc
l
::
Vec3s
::
Random
());
coa
l
::
Transform3s
T1
;
T1
.
setQuatRotation
(
coa
l
::
Quaternion3f
::
UnitRandom
());
T1
.
setTranslation
(
coa
l
::
Vec3s
::
Random
());
coa
l
::
Transform3s
T2
=
coa
l
::
Transform3s
::
Identity
();
T2
.
setQuatRotation
(
coa
l
::
Quaternion3f
::
UnitRandom
());
T2
.
setTranslation
(
coa
l
::
Vec3s
::
Random
());
// Define collision requests and results.
//
...
...
@@ -127,19 +127,19 @@ int main() {
// Setting a positive security margin can be usefull in motion planning,
// i.e to prevent shapes from getting too close to one another.
// In physics simulation, allowing a negative security margin may be usefull to stabilize the simulation.
hpp
::
fc
l
::
CollisionRequest
col_req
;
coa
l
::
CollisionRequest
col_req
;
col_req
.
security_margin
=
1e-1
;
// A collision result stores the result of the collision test (signed distance between the shapes,
// witness points location, normal etc.)
hpp
::
fc
l
::
CollisionResult
col_res
;
coa
l
::
CollisionResult
col_res
;
// Collision call
hpp
::
fc
l
::
collide
(
shape1
.
get
(),
T1
,
shape2
.
get
(),
T2
,
col_req
,
col_res
);
coa
l
::
collide
(
shape1
.
get
(),
T1
,
shape2
.
get
(),
T2
,
col_req
,
col_res
);
// We can access the collision result once it has been populated
std
::
cout
<<
"Collision? "
<<
col_res
.
isCollision
()
<<
"
\n
"
;
if
(
col_res
.
isCollision
())
{
hpp
::
fc
l
::
Contact
contact
=
col_res
.
getContact
(
0
);
coa
l
::
Contact
contact
=
col_res
.
getContact
(
0
);
// The penetration depth does **not** take into account the security margin.
// Consequently, the penetration depth is the true signed distance which separates the shapes.
// To have the distance which takes into account the security margin, we can simply add the two together.
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment