Commit 5edab25c authored by Davis King's avatar Davis King

Added angle_between_lines()

parent ec150f8d
......@@ -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;
}
// ----------------------------------------------------------------------------------------
}
......
......@@ -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>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment