From 9473e1fa1e18c8abef9a3a43b15aa8dca62cdde1 Mon Sep 17 00:00:00 2001 From: Alex Zolotarev Date: Wed, 19 Jan 2011 01:55:36 +0200 Subject: [PATCH] Added static assert in distance for unsigned point types --- geometry/distance.hpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/geometry/distance.hpp b/geometry/distance.hpp index de22bece4a..28b9aa7147 100644 --- a/geometry/distance.hpp +++ b/geometry/distance.hpp @@ -1,12 +1,19 @@ #pragma once + #include "../base/base.hpp" +#include + // Similarly to namespace m2 - 2d math, this is a namespace for nd math. namespace mn { template class DistanceToLineSquare { +private: + // we do not support unsigned points!!! + STATIC_ASSERT(std::numeric_limits::is_signed); + public: DistanceToLineSquare(PointT p0, PointT p1) : m_P0(p0), m_P1(p1), m_D(m_P1 - m_P0), m_D2(DotProduct(m_D, m_D)), m_InvD2(1.0 / m_D2)