/*
Copyright 2014 Michele "King_DuckZ" Santullo
This file is part of CloonelJump.
CloonelJump 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.
CloonelJump 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 CloonelJump. If not, see .
*/
#ifndef id56F112C6551D44039D0C0270F573B35B
#define id56F112C6551D44039D0C0270F573B35B
#include "vector.hpp"
#include "vectormath.hpp"
namespace cloonel {
template
class Line {
public:
typedef Vector Point;
typedef T Scalar;
Line ( void ) {}
Line ( const Line& parOther );
Line ( const Point& parStart, const Point& parEnd );
Line ( const Point& parStart, const Point& parDirection, Scalar parLength ) : Line(parStart, parDirection * parLength) { }
~Line ( void ) noexcept = default;
Point& Start ( void ) { return m_points.x(); }
Point& End ( void ) { return m_points.y(); }
const Point& Start ( void ) const { return m_points.x(); }
const Point& End ( void ) const { return m_points.y(); }
Line& operator+= ( const Point& parRhs ) __attribute__((flatten));
Line& operator-= ( const Point& parRhs ) __attribute__((flatten));
private:
Vector m_points;
};
template
Line operator+ ( Line parLhs, const Vector& parRhs ) __attribute__((pure)) __attribute__((flatten));
template
Line operator- ( Line parLhs, const Vector& parRhs ) __attribute__((pure)) __attribute__((flatten));
template
Line operator+ ( const Vector& parLhs, Line parRhs ) __attribute__((pure)) __attribute__((flatten));
template
Line operator- ( const Vector& parLhs, Line parRhs ) __attribute__((pure)) __attribute__((flatten));
template
bool operator> ( const Vector& parLhs, const Line& parRhs ) __attribute__((pure));
template
bool operator< ( const Vector& parLhs, const Line& parRhs ) __attribute__((pure));
template
bool operator>= ( const Vector& parLhs, const Line& parRhs ) __attribute__((pure));
template
bool operator<= ( const Vector& parLhs, const Line& parRhs ) __attribute__((pure));
} //namespace cloonel
#include "line.inl"
#endif