/*
* This file is part of libgim.
*
* libgim is free software: you can redistribute it and/or modify it under the
* terms of the GNU General Public License as published by the Free Software
* Foundation, either version 3 of the License, or (at your option) any later
* version.
*
* libgim is distributed in the hope that it will be useful, but WITHOUT ANY
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
* details.
*
* You should have received a copy of the GNU General Public License
* along with libgim. If not, see .
*
* Copyright 2011 Danny Robson
*/
#ifndef __UTIL_POINT_HPP
#define __UTIL_POINT_HPP
#include "vector.hpp"
#include "detail/coord.hpp"
#include
#include
#include
namespace util {
/// An n-dimensional position in space.
template
struct point : public detail::coord_data {
static_assert (S > 0, "point dimensions must be strictly positive.");
point ();
template
point (T ...t): detail::coord_data {std::forward (t)...} { ; }
double distance (const point &) const;
double distance2 (const point &) const;
double manhattan (const point &) const;
point& operator*= (double);
point operator* (double) const;
point operator- (const point&) const;
point operator+ (const util::vector&) const;
point& operator+= (const util::vector&);
util::vector to (const point&) const;
template point redim (void);
void sanity (void) const;
};
typedef point<2> point2;
typedef point<3> point3;
template
std::ostream& operator<< (std::ostream&, const util::point&);
}
#endif // __UTIL_POINT_HPP