Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
O
ogs
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
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
Dmitri Naumov
ogs
Commits
a3bd9a68
Commit
a3bd9a68
authored
4 years ago
by
Tom Fischer
Browse files
Options
Downloads
Patches
Plain Diff
[MaL] Use Eigen in getAngle computation.
parent
c17b0a73
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
MathLib/MathTools.cpp
+8
-4
8 additions, 4 deletions
MathLib/MathTools.cpp
MathLib/MathTools.h
+1
-1
1 addition, 1 deletion
MathLib/MathTools.h
with
9 additions
and
5 deletions
MathLib/MathTools.cpp
+
8
−
4
View file @
a3bd9a68
...
...
@@ -42,13 +42,17 @@ double calcProjPntToLineAndDists(Point3d const& pp, Point3d const& pa,
return
(
p
-
proj_pnt
).
norm
();
}
double
getAngle
(
const
double
p0
[
3
],
const
double
p1
[
3
],
const
double
p2
[
3
]
)
double
getAngle
(
Point3d
const
&
p0
,
Point3d
const
&
p1
,
Point3d
const
&
p2
)
{
const
double
v0
[
3
]
=
{
p0
[
0
]
-
p1
[
0
],
p0
[
1
]
-
p1
[
1
],
p0
[
2
]
-
p1
[
2
]};
const
double
v1
[
3
]
=
{
p2
[
0
]
-
p1
[
0
],
p2
[
1
]
-
p1
[
1
],
p2
[
2
]
-
p1
[
2
]};
auto
const
a
=
Eigen
::
Map
<
Eigen
::
Vector3d
const
>
(
p0
.
getCoords
());
auto
const
b
=
Eigen
::
Map
<
Eigen
::
Vector3d
const
>
(
p1
.
getCoords
());
auto
const
c
=
Eigen
::
Map
<
Eigen
::
Vector3d
const
>
(
p2
.
getCoords
());
Eigen
::
Vector3d
const
v0
=
a
-
b
;
Eigen
::
Vector3d
const
v1
=
c
-
b
;
// apply Cauchy Schwarz inequality
return
std
::
acos
(
scalarProduct
<
double
,
3
>
(
v0
,
v1
)
/
(
std
::
sqrt
(
scalarProduct
<
double
,
3
>
(
v0
,
v0
))
*
sqrt
(
scalarProduct
<
double
,
3
>
(
v1
,
v1
))));
return
std
::
acos
(
(
v0
.
transpose
()
*
v1
/
(
v0
.
norm
()
*
v1
.
norm
()))(
0
,
0
));
}
double
scalarTriple
(
Eigen
::
Vector3d
const
&
u
,
Eigen
::
Vector3d
const
&
v
,
...
...
This diff is collapsed.
Click to expand it.
MathLib/MathTools.h
+
1
−
1
View file @
a3bd9a68
...
...
@@ -90,7 +90,7 @@ double calcProjPntToLineAndDists(MathLib::Point3d const& pp,
* @param p2 end point of edge 1
* @return the angle between the edges
*/
double
getAngle
(
const
double
p0
[
3
],
const
double
p1
[
3
],
const
double
p2
[
3
]
);
double
getAngle
(
Point3d
const
&
p0
,
Point3d
const
&
p1
,
Point3d
const
&
p2
);
/// Calculates the scalar triple (u x v) . w
double
scalarTriple
(
Eigen
::
Vector3d
const
&
u
,
Eigen
::
Vector3d
const
&
v
,
...
...
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