Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
dune-gfe
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
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
Sander, Oliver
dune-gfe
Commits
8285b225
Commit
8285b225
authored
13 years ago
by
Oliver Sander
Committed by
sander@FU-BERLIN.DE
13 years ago
Browse files
Options
Downloads
Patches
Plain Diff
make the 'distance' method simpler and faster
[[Imported from SVN: r8366]]
parent
17f93124
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
dune/gfe/rotation.hh
+7
-12
7 additions, 12 deletions
dune/gfe/rotation.hh
with
7 additions
and
12 deletions
dune/gfe/rotation.hh
+
7
−
12
View file @
8285b225
...
@@ -544,22 +544,17 @@ public:
...
@@ -544,22 +544,17 @@ public:
}
}
static
T
distance
(
const
Rotation
<
T
,
3
>&
a
,
const
Rotation
<
T
,
3
>&
b
)
{
static
T
distance
(
const
Rotation
<
T
,
3
>&
a
,
const
Rotation
<
T
,
3
>&
b
)
{
Quaternion
<
T
>
diff
=
a
;
// Distance in the unit quaternions: 2*arccos( ((a^{-1) b)_3 )
// But note that (a^{-1}b)_3 is actually <a,b> (in R^4)
T
sp
=
a
.
globalCoordinates
()
*
b
.
globalCoordinates
();
diff
.
invert
();
// Scalar product may be larger than 1.0, due to numerical dirt
diff
=
diff
.
mult
(
b
);
T
dist
=
2
*
std
::
acos
(
std
::
min
(
sp
,
1.0
)
);
// Make sure we do the right thing if a and b are not in the same sheet
// Make sure we do the right thing if a and b are not in the same sheet
// of the double covering of the unit quaternions over SO(3)
// of the double covering of the unit quaternions over SO(3)
T
dist
=
2
*
std
::
acos
(
std
::
min
(
diff
[
3
],
1.0
)
);
return
(
dist
>=
M_PI
)
?
(
2
*
M_PI
-
dist
)
:
dist
;
if
(
dist
>=
M_PI
)
return
2
*
M_PI
-
dist
;
// Compute the geodesical distance between a and b on SO(3)
// Due to numerical dirt, diff[3] may be larger than 1.
// In that case, use 1 instead of diff[3].
return
2
*
std
::
acos
(
std
::
min
(
diff
[
3
],
1.0
)
);
}
}
/** \brief Compute the vector in T_aSO(3) that is mapped by the exponential map
/** \brief Compute the vector in T_aSO(3) that is mapped by the exponential map
...
...
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