PIRect complete
This commit is contained in:
@@ -65,8 +65,28 @@ public:
|
||||
y += p.y;
|
||||
return *this;
|
||||
}
|
||||
PIPoint<Type> translated(Type x_, Type y_) const {
|
||||
PIPoint<Type> rp(*this);
|
||||
rp.translate(x_, y_);
|
||||
return rp;
|
||||
}
|
||||
PIPoint<Type> translated(const PIPoint<Type> & p) const {
|
||||
PIPoint<Type> rp(*this);
|
||||
rp.translate(p);
|
||||
return rp;
|
||||
}
|
||||
PIPoint<Type> & move(Type x_, Type y_) {return translate(x_, y_);}
|
||||
PIPoint<Type> & move(const PIPoint<Type> & p) {return translate(p);}
|
||||
PIPoint<Type> moved(Type x_, Type y_) const {
|
||||
PIPoint<Type> rp(*this);
|
||||
rp.translate(x_, y_);
|
||||
return rp;
|
||||
}
|
||||
PIPoint<Type> moved(const PIPoint<Type> & p) const {
|
||||
PIPoint<Type> rp(*this);
|
||||
rp.translate(p);
|
||||
return rp;
|
||||
}
|
||||
double angleRad() const {return atan2(y, x);}
|
||||
double angleDeg() const {return toDeg(atan2(y, x));}
|
||||
PIPoint<Type> toPolar(bool isDeg = false) const {return PIPoint<Type>(sqrt(x*x + y*y), isDeg ? angleDeg() : angleRad());}
|
||||
|
||||
Reference in New Issue
Block a user