git-svn-id: svn://db.shs.com.ru/pip@563 12ceb7fc-bf1f-11e4-8940-5bc7170c53b5
This commit is contained in:
12
src_main/_unsused/pigeometry.h → src_main/math/pigeometry.h
Executable file → Normal file
12
src_main/_unsused/pigeometry.h → src_main/math/pigeometry.h
Executable file → Normal file
@@ -20,7 +20,7 @@
|
||||
#ifndef PIGEOMETRY_H
|
||||
#define PIGEOMETRY_H
|
||||
|
||||
#include "pimath.h"
|
||||
#include "pimathbase.h"
|
||||
|
||||
template<typename Type>
|
||||
class PIP_EXPORT PIPoint {
|
||||
@@ -28,14 +28,14 @@ public:
|
||||
Type x;
|
||||
Type y;
|
||||
|
||||
PIPoint() {x = y = 0;};
|
||||
PIPoint() {x = y = 0;}
|
||||
PIPoint(Type x_, Type y_) {set(x_, y_);}
|
||||
|
||||
PIPoint<Type> & set(Type x_, Type y_) {x = x_; y = y_; return *this;}
|
||||
PIPoint<Type> & move(Type x_, Type y_) {x += x_; y += y_; return *this;}
|
||||
PIPoint<Type> & move(const PIPoint<Type> & p) {x += p.x; y += p.y; return *this;}
|
||||
double angleRad() const {return atan2(y, x);}
|
||||
int angleDeg() const {return round(atan2(y, x) * 180. / M_PI);}
|
||||
int angleDeg() const {return round(atan2(y, x) * rad2deg);}
|
||||
PIPoint<Type> toPolar(bool isDeg = false) const {return PIPoint<Type>(sqrt(x*x + y*y), isDeg ? angleDeg() : angleRad());}
|
||||
static PIPoint<Type> fromPolar(const PIPoint<Type> & p) {return PIPoint<Type>(p.y * cos(p.x), p.y * sin(p.x));}
|
||||
|
||||
@@ -52,7 +52,7 @@ public:
|
||||
};
|
||||
|
||||
template<typename Type>
|
||||
std::ostream & operator <<(std::ostream & s, const PIPoint<Type> & v) {s << '{' << v.x << ", " << v.y << '}'; return s;}
|
||||
PICout operator <<(PICout & s, const PIPoint<Type> & v) {s.setControl(0, true); s << '{' << v.x << ", " << v.y << '}'; s.restoreControl(); return s;}
|
||||
|
||||
template<typename Type>
|
||||
class PIP_EXPORT PIRect {
|
||||
@@ -62,7 +62,7 @@ public:
|
||||
Type x1;
|
||||
Type y1;
|
||||
|
||||
PIRect() {x0 = y0 = x1 = y1 = 0;};
|
||||
PIRect() {x0 = y0 = x1 = y1 = 0;}
|
||||
PIRect(Type x, Type y, Type w, Type h) {set(x, y, w, h);}
|
||||
PIRect(const PIPoint<Type> & tl, const PIPoint<Type> & br) {set(tl.x, tl.y, br.x, br.y);}
|
||||
PIRect(const PIPoint<Type> & p0, const PIPoint<Type> & p1, const PIPoint<Type> & p2) {set(piMin<Type>(p0.x, p1.x, p2.x), piMin<Type>(p0.y, p1.y, p2.y),
|
||||
@@ -122,7 +122,7 @@ public:
|
||||
};
|
||||
|
||||
template<typename Type>
|
||||
std::ostream & operator <<(std::ostream & s, const PIRect<Type> & v) {s << '{' << v.x0 << ", " << v.y0 << "; " << v.x1 - v.x0 << ", " << v.y1 - v.y0 << '}'; return s;}
|
||||
PICout operator <<(PICout & s, const PIRect<Type> & v) {s.setControl(0, true); s << '{' << v.x0 << ", " << v.y0 << "; " << v.x1 - v.x0 << ", " << v.y1 - v.y0 << '}'; s.restoreControl(); return s;}
|
||||
|
||||
typedef PIPoint<int> PIPointi;
|
||||
typedef PIPoint<uint> PIPointu;
|
||||
@@ -3,7 +3,7 @@
|
||||
#define PIVERSION_H
|
||||
|
||||
#define PIP_VERSION_MAJOR 1
|
||||
#define PIP_VERSION_MINOR 2
|
||||
#define PIP_VERSION_MINOR 3
|
||||
#define PIP_VERSION_REVISION 0
|
||||
#define PIP_VERSION_SUFFIX "_alpha"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user