RIT VEXU Core API
Loading...
Searching...
No Matches
geometry.h
1#pragma once
2
3#include "math/geometry/transform2d.h"
4
5#include <cmath>
6
10
11struct Rect {
12 Translation2d min;
13 Translation2d max;
14 static Rect from_min_and_size(Translation2d min, Translation2d size) { return {min, min + size}; }
15 Translation2d dimensions() const { return max - min; }
16 Translation2d center() const { return (min + max) / 2; }
17 double width() const { return max.x() - min.x(); }
18 double height() const { return max.y() - min.y(); }
19 bool contains(Translation2d p) const {
20 bool xin = p.x() > min.x() && p.x() < max.x();
21 bool yin = p.y() > min.y() && p.y() < max.y();
22 return xin && yin;
23 }
24};
Definition translation2d.h:22
double x() const
Definition translation2d.cpp:37
double y() const
Definition translation2d.cpp:44
Definition geometry.h:11