Go to the documentation of this file.
6 #ifndef OPENMPCD_VECTOR2D_HPP
7 #define OPENMPCD_VECTOR2D_HPP
18 #include <boost/static_assert.hpp>
19 #include <boost/type_traits/is_same.hpp>
20 #include <boost/type_traits/remove_cv.hpp>
133 typename boost::remove_cv<T>::type
139 const T ret =
dot(rhs) / divisor;
171 return x == rhs.x && y == rhs.y;
193 #endif //OPENMPCD_VECTOR2D_HPP
OPENMPCD_CUDA_HOST_AND_DEVICE T getY() const
Returns the y coordinate.
OPENMPCD_CUDA_HOST_AND_DEVICE T getAngle(const Vector2D &rhs) const
Returns the the angle between this vector and the given one.
OPENMPCD_CUDA_HOST_AND_DEVICE T getX() const
Returns the x coordinate.
Contains information on certain types.
#define OPENMPCD_DEBUG_ASSERT(assertion)
Asserts that the given expression evaluates to true, but only if OPENMPCD_DEBUG is defined.
const OPENMPCD_CUDA_HOST_AND_DEVICE T dot(const Vector2D &rhs) const
Returns the scalar product of this vector with the given vector.
#define OPENMPCD_CUDA_HOST_AND_DEVICE
Denotes a function to be callable both from the Host and from a CUDA Device.
OPENMPCD_CUDA_HOST_AND_DEVICE Vector2D(const T x_, const T y_)
Constructs a vector from its coordinates.
OPENMPCD_CUDA_HOST_AND_DEVICE T getCosineOfAngle(const Vector2D &rhs) const
Returns the cosine of the angle between this vector and the given one.
OPENMPCD_CUDA_HOST_AND_DEVICE RealType getMagnitudeSquared() const
Returns the square of the magnitude of this vector.
TypeTraits< T >::RealType RealType
The real-value type matching T.
OPENMPCD_CUDA_HOST_AND_DEVICE RealType getMagnitude() const
Returns the magnitude of this vector.
OPENMPCD_CUDA_HOST_AND_DEVICE T sqrt(const T x)
Returns the sqaure root of the argument.
OPENMPCD_CUDA_HOST_AND_DEVICE bool operator==(const Vector2D &rhs) const
Equality operator.
OPENMPCD_CUDA_HOST_AND_DEVICE bool operator!=(const Vector2D &rhs) const
Inequality operator.
OPENMPCD_CUDA_HOST_AND_DEVICE boost::enable_if< boost::is_floating_point< T >, T >::type getRealPart(const T &val)
Returns the real part of the given value.
OPENMPCD_CUDA_HOST_AND_DEVICE Vector2D()
Constructs a vector from the default values of the T type.
static const OPENMPCD_CUDA_HOST_AND_DEVICE T dot(const Vector2D< T > &lhs, const Vector2D< T > &rhs)
Returns the scalar product two vectors.
OPENMPCD_CUDA_HOST_AND_DEVICE T acos(const T x)
Returns the arc cosine of the argument.