Math tunes
This commit is contained in:
parent
32f53294d3
commit
c1ccef6fbb
2 changed files with 6 additions and 4 deletions
|
|
@ -120,14 +120,14 @@ namespace tp {
|
|||
}
|
||||
|
||||
// pos
|
||||
Vec2<Type> p1() { return pos; }
|
||||
Vec2<Type> p1() const { return pos; }
|
||||
|
||||
// pos + size
|
||||
Vec2<Type> p3() { return pos + size; }
|
||||
Vec2<Type> p3() const { return pos + size; }
|
||||
|
||||
Vec2<Type> p2() { return { pos.x, pos.y + size.y }; }
|
||||
Vec2<Type> p2() const { return { pos.x, pos.y + size.y }; }
|
||||
|
||||
Vec2<Type> p4() { return { pos.x + size.x, pos.y }; }
|
||||
Vec2<Type> p4() const { return { pos.x + size.x, pos.y }; }
|
||||
|
||||
inline bool isAbove(const Rect<Type>& rect) const { return (pos.y + size.y < rect.pos.y); }
|
||||
|
||||
|
|
|
|||
|
|
@ -360,6 +360,8 @@ namespace tp {
|
|||
Vec normal() { return { -y, x }; }
|
||||
|
||||
[[nodiscard]] alnf length2() const { return (x * x + y * y); }
|
||||
[[nodiscard]] halnf max() const { return tp::max(x, y); }
|
||||
[[nodiscard]] halnf min() const { return tp::min(x, y); }
|
||||
|
||||
[[nodiscard]] alnf length() const {
|
||||
Type const tmp = (Type) (x * x + y * y);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue