Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
OpenDAS
dlib
Commits
5edab25c
Commit
5edab25c
authored
May 23, 2018
by
Davis King
Browse files
Added angle_between_lines()
parent
ec150f8d
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
24 additions
and
0 deletions
+24
-0
dlib/geometry/line.h
dlib/geometry/line.h
+12
-0
dlib/geometry/line_abstract.h
dlib/geometry/line_abstract.h
+12
-0
No files found.
dlib/geometry/line.h
View file @
5edab25c
...
...
@@ -6,6 +6,7 @@
#include "line_abstract.h"
#include "vector.h"
#include <utility>
#include "../numeric_constants.h"
namespace
dlib
{
...
...
@@ -172,6 +173,17 @@ namespace dlib
return
cnt
;
}
// ----------------------------------------------------------------------------------------
inline
double
angle_between_lines
(
const
line
&
a
,
const
line
&
b
)
{
auto
tmp
=
put_in_range
(
0.0
,
1.0
,
std
::
abs
(
dot
(
a
.
normal
(),
b
.
normal
())));
return
std
::
acos
(
tmp
)
*
180
/
pi
;
}
// ----------------------------------------------------------------------------------------
}
...
...
dlib/geometry/line_abstract.h
View file @
5edab25c
...
...
@@ -145,6 +145,18 @@ namespace dlib
exists then this function returns a point with Inf values in it.
!*/
// ----------------------------------------------------------------------------------------
double
angle_between_lines
(
const
line
&
a
,
const
line
&
b
);
/*!
ensures
- returns the angle, in degrees, between the given lines. This is a number in
the range [0 90].
!*/
// ----------------------------------------------------------------------------------------
template
<
typename
T
>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment