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
d7e02bc0
Commit
d7e02bc0
authored
13 years ago
by
Oliver Sander
Committed by
sander@FU-BERLIN.DE
13 years ago
Browse files
Options
Downloads
Patches
Plain Diff
implement the various derivatives of the squared distance
[[Imported from SVN: r7415]]
parent
d4660189
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
dune/gfe/rigidbodymotion.hh
+72
-8
72 additions, 8 deletions
dune/gfe/rigidbodymotion.hh
with
72 additions
and
8 deletions
dune/gfe/rigidbodymotion.hh
+
72
−
8
View file @
d7e02bc0
...
...
@@ -100,32 +100,96 @@ struct RigidBodyMotion
}
/** \brief Compute the Hessian of the squared distance function keeping the first argument fixed */
static
Dune
::
FieldMatrix
<
double
,
7
,
7
>
secondDerivativeOfDistanceSquaredWRTSecondArgument
(
const
RigidBodyMotion
<
dim
,
ctype
>
&
p
,
const
RigidBodyMotion
<
dim
,
ctype
>
&
q
)
{
DUNE_THROW
(
Dune
::
NotImplemented
,
"!"
);
static
Dune
::
FieldMatrix
<
double
,
7
,
7
>
secondDerivativeOfDistanceSquaredWRTSecondArgument
(
const
RigidBodyMotion
<
dim
,
ctype
>
&
p
,
const
RigidBodyMotion
<
dim
,
ctype
>
&
q
)
{
Dune
::
FieldMatrix
<
double
,
7
,
7
>
result
(
0
);
// The linear part
Dune
::
FieldMatrix
<
double
,
3
,
3
>
linearPart
=
RealTuple
<
3
>::
secondDerivativeOfDistanceSquaredWRTSecondArgument
(
p
.
r
,
q
.
r
);
for
(
int
i
=
0
;
i
<
3
;
i
++
)
for
(
int
j
=
0
;
j
<
3
;
j
++
)
result
[
i
][
j
]
=
linearPart
[
i
][
j
];
// The rotation part
Dune
::
FieldMatrix
<
double
,
4
,
4
>
rotationPart
=
Rotation
<
dim
,
ctype
>::
secondDerivativeOfDistanceSquaredWRTSecondArgument
(
p
.
q
,
q
.
q
);
for
(
int
i
=
0
;
i
<
4
;
i
++
)
for
(
int
j
=
0
;
j
<
4
;
j
++
)
result
[
3
+
i
][
3
+
j
]
=
rotationPart
[
i
][
j
];
return
result
;
}
/** \brief Compute the mixed second derivate \partial d^2 / \partial da db
Unlike the distance itself the squared distance is differentiable at zero
*/
static
Dune
::
FieldMatrix
<
double
,
7
,
7
>
secondDerivativeOfDistanceSquaredWRTFirstAndSecondArgument
(
const
RigidBodyMotion
<
dim
,
ctype
>
&
p
,
const
RigidBodyMotion
<
dim
,
ctype
>
&
q
)
{
DUNE_THROW
(
Dune
::
NotImplemented
,
"!"
);
static
Dune
::
FieldMatrix
<
double
,
7
,
7
>
secondDerivativeOfDistanceSquaredWRTFirstAndSecondArgument
(
const
RigidBodyMotion
<
dim
,
ctype
>
&
p
,
const
RigidBodyMotion
<
dim
,
ctype
>
&
q
)
{
Dune
::
FieldMatrix
<
double
,
7
,
7
>
result
(
0
);
// The linear part
Dune
::
FieldMatrix
<
double
,
3
,
3
>
linearPart
=
RealTuple
<
3
>::
secondDerivativeOfDistanceSquaredWRTFirstAndSecondArgument
(
p
.
r
,
q
.
r
);
for
(
int
i
=
0
;
i
<
3
;
i
++
)
for
(
int
j
=
0
;
j
<
3
;
j
++
)
result
[
i
][
j
]
=
linearPart
[
i
][
j
];
// The rotation part
Dune
::
FieldMatrix
<
double
,
4
,
4
>
rotationPart
=
Rotation
<
dim
,
ctype
>::
secondDerivativeOfDistanceSquaredWRTFirstAndSecondArgument
(
p
.
q
,
q
.
q
);
for
(
int
i
=
0
;
i
<
4
;
i
++
)
for
(
int
j
=
0
;
j
<
4
;
j
++
)
result
[
3
+
i
][
3
+
j
]
=
rotationPart
[
i
][
j
];
return
result
;
}
/** \brief Compute the third derivative \partial d^3 / \partial dq^3
Unlike the distance itself the squared distance is differentiable at zero
*/
static
Tensor3
<
double
,
7
,
7
,
7
>
thirdDerivativeOfDistanceSquaredWRTSecondArgument
(
const
RigidBodyMotion
<
dim
,
ctype
>
&
p
,
const
RigidBodyMotion
<
dim
,
ctype
>
&
q
)
{
DUNE_THROW
(
Dune
::
NotImplemented
,
"!"
);
static
Tensor3
<
double
,
7
,
7
,
7
>
thirdDerivativeOfDistanceSquaredWRTSecondArgument
(
const
RigidBodyMotion
<
dim
,
ctype
>
&
p
,
const
RigidBodyMotion
<
dim
,
ctype
>
&
q
)
{
Tensor3
<
double
,
7
,
7
,
7
>
result
(
0
);
// The linear part
Tensor3
<
double
,
3
,
3
,
3
>
linearPart
=
RealTuple
<
3
>::
thirdDerivativeOfDistanceSquaredWRTSecondArgument
(
p
.
r
,
q
.
r
);
for
(
int
i
=
0
;
i
<
3
;
i
++
)
for
(
int
j
=
0
;
j
<
3
;
j
++
)
for
(
int
k
=
0
;
k
<
3
;
k
++
)
result
[
i
][
j
][
k
]
=
linearPart
[
i
][
j
][
k
];
// The rotation part
Tensor3
<
double
,
4
,
4
,
4
>
rotationPart
=
Rotation
<
dim
,
ctype
>::
thirdDerivativeOfDistanceSquaredWRTSecondArgument
(
p
.
q
,
q
.
q
);
for
(
int
i
=
0
;
i
<
4
;
i
++
)
for
(
int
j
=
0
;
j
<
4
;
j
++
)
for
(
int
k
=
0
;
k
<
4
;
k
++
)
result
[
3
+
i
][
3
+
j
][
3
+
j
]
=
rotationPart
[
i
][
j
][
k
];
return
result
;
}
/** \brief Compute the mixed third derivative \partial d^3 / \partial da db^2
Unlike the distance itself the squared distance is differentiable at zero
*/
static
Tensor3
<
double
,
7
,
7
,
7
>
thirdDerivativeOfDistanceSquaredWRTFirst1AndSecond2Argument
(
const
RigidBodyMotion
<
dim
,
ctype
>
&
p
,
const
RigidBodyMotion
<
dim
,
ctype
>
&
q
)
{
DUNE_THROW
(
Dune
::
NotImplemented
,
"!"
);
static
Tensor3
<
double
,
7
,
7
,
7
>
thirdDerivativeOfDistanceSquaredWRTFirst1AndSecond2Argument
(
const
RigidBodyMotion
<
dim
,
ctype
>
&
p
,
const
RigidBodyMotion
<
dim
,
ctype
>
&
q
)
{
Tensor3
<
double
,
7
,
7
,
7
>
result
(
0
);
// The linear part
Tensor3
<
double
,
3
,
3
,
3
>
linearPart
=
RealTuple
<
3
>::
thirdDerivativeOfDistanceSquaredWRTFirst1AndSecond2Argument
(
p
.
r
,
q
.
r
);
for
(
int
i
=
0
;
i
<
3
;
i
++
)
for
(
int
j
=
0
;
j
<
3
;
j
++
)
for
(
int
k
=
0
;
k
<
3
;
k
++
)
result
[
i
][
j
][
k
]
=
linearPart
[
i
][
j
][
k
];
// The rotation part
Tensor3
<
double
,
4
,
4
,
4
>
rotationPart
=
Rotation
<
dim
,
ctype
>::
thirdDerivativeOfDistanceSquaredWRTFirst1AndSecond2Argument
(
p
.
q
,
q
.
q
);
for
(
int
i
=
0
;
i
<
4
;
i
++
)
for
(
int
j
=
0
;
j
<
4
;
j
++
)
for
(
int
k
=
0
;
k
<
4
;
k
++
)
result
[
3
+
i
][
3
+
j
][
3
+
j
]
=
rotationPart
[
i
][
j
][
k
];
return
result
;
}
...
...
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