Roomba Controller Dashboard 1
A GUI and TCP client application that is used to control a Roomba for Computer Engineering 2880 @ Iowa State
Loading...
Searching...
No Matches
util.hpp
Go to the documentation of this file.
1
5#ifndef UTIL_H
6#define UTIL_H
7
8#include <cmath>
9
10
11/*
12 * calculates the orientation of the ordered triplet (p, q, r)
13* @return
14 * 0 -> p, q, r are collinear
15 * 1 -> Clockwise
16 * 2 -> Counterclockwise
17*/
18double orientation(double px2, double py, double qx, double qy, double rx, double ry);
19
20
21/*
22 * checks if point q lies on the line segment 'pr'
23*/
24bool onSegment(double px, double py, double qx, double qy, double rx, double ry);
25
26
27/*
28 * determines if line segments (p1, q1) and (p2, q2) intersect
29*/
30bool doIntersect(double p1x, double p1y, double q1x, double q1y, double p2x, double p2y, double q2x, double q2y);
31
32/*
33* function to check if the line intersects a given rectangle
34* @param cx1 the x position of the first bound of the line
35* @param cy1 the y position of the first bound of the line
36* @param cx2 the x position of the second bound of the line
37* @param cy2 the y position of the second bound of the line
38* @param rx1 the x position of the first rectangular X coordinate
39* @param ry1 the y position of the first rectangular Y coordinate
40* @param rx2 the x position of the second rectangular X coordinate
41* @param ry2 the y position of the second rectangular Y coordinate
42* @param rx3 the x position of the third rectangular X coordinate
43* @param ry3 the y position of the third rectangular Y coordinate
44* @param rx4 the x position of the fourth rectangular X coordinate
45* @param ry4 the y position of the fourth rectangular Y coordinate
46* @return whether the line intersects the position
47*/
48bool lineIntersectsRectangle(double cx1, double cy1, double cx2, double cy2, double rx1, double ry1, double rx2, double ry2, double rx3, double ry3, double rx4, double ry4);
49
50
51
52#endif // UTIL_H
53
bool doIntersect(double p1x, double p1y, double q1x, double q1y, double p2x, double p2y, double q2x, double q2y)
Definition util.cpp:18
bool lineIntersectsRectangle(double cx1, double cy1, double cx2, double cy2, double rx1, double ry1, double rx2, double ry2, double rx3, double ry3, double rx4, double ry4)
Definition util.cpp:46
double orientation(double px2, double py, double qx, double qy, double rx, double ry)
Definition util.cpp:7
bool onSegment(double px, double py, double qx, double qy, double rx, double ry)
Definition util.cpp:13