SDLPP: formatting, make compileable on Linux
This commit is contained in:
+24
-24
@@ -6,37 +6,37 @@
|
||||
#include <iostream>
|
||||
|
||||
namespace SDLPP {
|
||||
template<typename T>
|
||||
class SDLPPSCOPE Line {
|
||||
template < typename T > class SDLPPSCOPE Line {
|
||||
public:
|
||||
Line() = delete;
|
||||
~Line() = default;
|
||||
Line( const Vec2D<T> &start, const Vec2D<T> &end )
|
||||
Line( const Vec2D< T > &start, const Vec2D< T > &end )
|
||||
: _start( start ), _end( end ) {
|
||||
updateMost();
|
||||
}
|
||||
Line( T x_1, T y_1, T x_2, T y_2 )
|
||||
: Line( { x_1, y_1 }, { x_2, y_2 } ) {}
|
||||
Line( const Vec2D<T> &start, const Vec2D<T> &end, bool infinite )
|
||||
: Line( start, end ), _infinite( infinite ) {}
|
||||
Line( T x_1, T y_1, T x_2, T y_2 ) : Line( { x_1, y_1 }, { x_2, y_2 } ) {}
|
||||
Line( const Vec2D< T > &start, const Vec2D< T > &end, bool infinite )
|
||||
: Line( start, end ) {
|
||||
_infinite = infinite;
|
||||
}
|
||||
Line( T x_1, T y_1, T x_2, T y_2, bool infinite )
|
||||
: Line( { x_1, y_1 }, { x_2, y_2 }, infinite ) {}
|
||||
Line(const Line &input) : Line(input.getStart(), input.getEnd()) {}
|
||||
Line &operator=(const Line &input) {
|
||||
Line( const Line &input ) : Line( input.getStart(), input.getEnd() ) {}
|
||||
Line &operator=( const Line &input ) {
|
||||
_start = input.getStart();
|
||||
_end = input.getEnd();
|
||||
updateMost();
|
||||
return *this;
|
||||
}
|
||||
void updateMost() {
|
||||
if(_start.getY() < _end.getY()) {
|
||||
if ( _start.getY() < _end.getY() ) {
|
||||
top = &_start;
|
||||
bottom = &_end;
|
||||
} else {
|
||||
top = &_end;
|
||||
bottom = &_start;
|
||||
}
|
||||
if(_start.getX() < _end.getX()) {
|
||||
if ( _start.getX() < _end.getX() ) {
|
||||
left = &_start;
|
||||
right = &_end;
|
||||
} else {
|
||||
@@ -44,10 +44,10 @@ public:
|
||||
right = &_start;
|
||||
}
|
||||
}
|
||||
const Vec2D<T> &getStart() const {
|
||||
const Vec2D< T > &getStart() const {
|
||||
return _start;
|
||||
}
|
||||
const Vec2D<T> &getEnd() const {
|
||||
const Vec2D< T > &getEnd() const {
|
||||
return _end;
|
||||
}
|
||||
double length() const {
|
||||
@@ -62,30 +62,30 @@ public:
|
||||
bool isInfinite() {
|
||||
return _infinite;
|
||||
}
|
||||
void add(const Vec2D<T> &vec) {
|
||||
void add( const Vec2D< T > &vec ) {
|
||||
_start += vec;
|
||||
_end += vec;
|
||||
}
|
||||
const Vec2D<T> &topmost() const {
|
||||
const Vec2D< T > &topmost() const {
|
||||
return *top;
|
||||
}
|
||||
const Vec2D<T> &bottomost() const {
|
||||
const Vec2D< T > &bottomost() const {
|
||||
return *bottom;
|
||||
}
|
||||
const Vec2D<T> &leftmost() const {
|
||||
const Vec2D< T > &leftmost() const {
|
||||
return *left;
|
||||
}
|
||||
const Vec2D<T> &rightmost() const {
|
||||
const Vec2D< T > &rightmost() const {
|
||||
return *right;
|
||||
}
|
||||
|
||||
private:
|
||||
Vec2D<T> _start;
|
||||
Vec2D<T> _end;
|
||||
Vec2D<T> *top = nullptr;
|
||||
Vec2D<T> *bottom = nullptr;
|
||||
Vec2D<T> *left = nullptr;
|
||||
Vec2D<T> *right = nullptr;
|
||||
Vec2D< T > _start;
|
||||
Vec2D< T > _end;
|
||||
Vec2D< T > *top = nullptr;
|
||||
Vec2D< T > *bottom = nullptr;
|
||||
Vec2D< T > *left = nullptr;
|
||||
Vec2D< T > *right = nullptr;
|
||||
bool _infinite = false;
|
||||
};
|
||||
} // namespace SDLPP
|
||||
|
||||
Reference in New Issue
Block a user