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
96c47efb
Commit
96c47efb
authored
5 years ago
by
rstrudel
Browse files
Options
Downloads
Patches
Plain Diff
Take into account jmirabel PR comments
parent
96254626
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/distance_capsule_capsule.cpp
+10
-8
10 additions, 8 deletions
src/distance_capsule_capsule.cpp
with
10 additions
and
8 deletions
src/distance_capsule_capsule.cpp
+
10
−
8
View file @
96c47efb
...
...
@@ -52,14 +52,14 @@ namespace fcl {
FCL_REAL
radius2
=
capsule2
->
radius
;
// direction of capsules
// ||d1|| = 2 * halfLength1
const
fcl
::
Vec3f
&
d1
=
2
*
halfLength1
*
tf1
.
getRotation
().
col
(
2
);
const
fcl
::
Vec3f
&
d2
=
2
*
halfLength2
*
tf2
.
getRotation
().
col
(
2
);
const
fcl
::
Vec3f
d1
=
2
*
halfLength1
*
tf1
.
getRotation
().
col
(
2
);
const
fcl
::
Vec3f
d2
=
2
*
halfLength2
*
tf2
.
getRotation
().
col
(
2
);
// Starting point of the segments
// p1 + d1 is the end point of the segment
const
fcl
::
Vec3f
&
p1
=
c1
-
d1
/
2
;
const
fcl
::
Vec3f
&
p2
=
c2
-
d2
/
2
;
const
fcl
::
Vec3f
&
r
=
p1
-
p2
;
const
fcl
::
Vec3f
p1
=
c1
-
d1
/
2
;
const
fcl
::
Vec3f
p2
=
c2
-
d2
/
2
;
const
fcl
::
Vec3f
r
=
p1
-
p2
;
FCL_REAL
a
=
d1
.
dot
(
d1
);
FCL_REAL
b
=
d1
.
dot
(
d2
);
FCL_REAL
c
=
d1
.
dot
(
r
);
...
...
@@ -76,6 +76,7 @@ namespace fcl {
s
=
t
=
0.0
;
FCL_REAL
distance
=
(
p1
-
p2
).
norm
();
Vec3f
normal
=
(
p1
-
p2
)
/
distance
;
result
.
normal
=
normal
;
distance
=
distance
-
(
radius1
+
radius2
);
result
.
min_distance
=
distance
;
if
(
request
.
enable_nearest_points
)
...
...
@@ -100,9 +101,9 @@ namespace fcl {
else
{
// Always non-negative, equal 0 if the segments are parallel
FCL_REAL
denom
=
a
*
e
-
b
*
b
;
FCL_REAL
denom
=
fmax
(
a
*
e
-
b
*
b
,
0
)
;
if
(
denom
!=
0.0
)
if
(
denom
>
EPSILON
)
{
s
=
CLAMP
((
b
*
f
-
c
*
e
)
/
denom
,
0.0
,
1.0
);
}
...
...
@@ -129,6 +130,7 @@ namespace fcl {
const
Vec3f
&
w2
=
p2
+
t
*
d2
;
FCL_REAL
distance
=
(
w1
-
w2
).
norm
();
Vec3f
normal
=
(
w1
-
w2
)
/
distance
;
result
.
normal
=
normal
;
// capsule spcecific distance computation
distance
=
distance
-
(
radius1
+
radius2
);
...
...
@@ -166,7 +168,7 @@ namespace fcl {
const
Vec3f
&
p1
=
distanceResult
.
nearest_points
[
0
];
const
Vec3f
&
p2
=
distanceResult
.
nearest_points
[
1
];
contact
.
pos
=
0.5
*
(
p1
+
p2
);
contact
.
normal
=
(
p2
-
p1
)
/
(
p2
-
p1
)
.
norm
()
;
contact
.
normal
=
distanceResult
.
norm
al
;
result
.
addContact
(
contact
);
return
1
;
}
...
...
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