summaryrefslogtreecommitdiffstats
path: root/dev/a2-carsoccer/ball.h
diff options
context:
space:
mode:
authorunknown <paulx161@umn.edu>2021-02-02 18:35:09 -0600
committerunknown <paulx161@umn.edu>2021-02-02 18:35:09 -0600
commit7ea1b2c0320d74152d33e74718a39319a7a0e507 (patch)
tree7c2995f547889f00e381449b5c91dbb0abd1a0c3 /dev/a2-carsoccer/ball.h
parentAdded /dev/gfxtest/* (diff)
downloadcsci4611-7ea1b2c0320d74152d33e74718a39319a7a0e507.tar
csci4611-7ea1b2c0320d74152d33e74718a39319a7a0e507.tar.gz
csci4611-7ea1b2c0320d74152d33e74718a39319a7a0e507.tar.bz2
csci4611-7ea1b2c0320d74152d33e74718a39319a7a0e507.tar.lz
csci4611-7ea1b2c0320d74152d33e74718a39319a7a0e507.tar.xz
csci4611-7ea1b2c0320d74152d33e74718a39319a7a0e507.tar.zst
csci4611-7ea1b2c0320d74152d33e74718a39319a7a0e507.zip
Added worksheet and support code for assignment 2
Diffstat (limited to '')
-rw-r--r--dev/a2-carsoccer/ball.h40
1 files changed, 40 insertions, 0 deletions
diff --git a/dev/a2-carsoccer/ball.h b/dev/a2-carsoccer/ball.h
new file mode 100644
index 0000000..65a96a4
--- /dev/null
+++ b/dev/a2-carsoccer/ball.h
@@ -0,0 +1,40 @@
+/** CSci-4611 Assignment 2: Car Soccer
+ */
+
+#ifndef BALL_H_
+#define BALL_H_
+
+#include <mingfx.h>
+
+/// Small data structure for a ball
+class Ball {
+public:
+
+ /// The constructor sets the radius and calls Reset() to start the ball at
+ /// the center of the field
+ Ball() : radius_(2.6f) {
+ Reset();
+ }
+
+ /// Nothing special needed in the constructor
+ virtual ~Ball() {}
+
+
+ void Reset() {
+ position_ = Point3(0, radius_, 0);
+ }
+
+ float radius() { return radius_; }
+
+ Point3 position() { return position_; }
+ void set_position(const Point3 &p) { position_ = p; }
+
+
+private:
+ // You will probably need to store some additional data here, e.g., velocity
+
+ Point3 position_;
+ float radius_;
+};
+
+#endif