]> git.localhorst.tv Git - sdl-test8.git/blobdiff - src/geometry/Ray2D.h
added collision engine, more or less stole gameplay from sdl-test7
[sdl-test8.git] / src / geometry / Ray2D.h
diff --git a/src/geometry/Ray2D.h b/src/geometry/Ray2D.h
new file mode 100644 (file)
index 0000000..408a061
--- /dev/null
@@ -0,0 +1,35 @@
+/*
+ * Ray2D.h
+ *
+ *  Created on: Apr 25, 2012
+ *      Author: holy
+ */
+
+#ifndef GEOMETRY_RAY2D_H_
+#define GEOMETRY_RAY2D_H_
+
+#include "Vector2D.h"
+
+namespace geometry {
+
+template<typename Scalar>
+class Ray2D {
+
+       public:
+               explicit Ray2D(const Vector2D<Scalar> &directionUnit = Vector2D<Scalar>(), const Vector2D<Scalar> &origin = Vector2D<Scalar>())
+                               : direction(directionUnit), origin(origin) { };
+
+       public:
+               Vector2D<Scalar> &Direction(void) { return direction; };
+               Vector2D<Scalar> &Origin(void) { return origin; };
+               const Vector2D<Scalar> &Direction(void) const { return direction; };
+               const Vector2D<Scalar> &Origin(void) const { return origin; };
+
+       private:
+               Vector2D<Scalar> direction, origin;
+
+};
+
+}
+
+#endif /* GEOMETRY_RAY2D_H_ */