summaryrefslogtreecommitdiff
path: root/src/RaceTrack.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/RaceTrack.java')
-rw-r--r--src/RaceTrack.java68
1 files changed, 68 insertions, 0 deletions
diff --git a/src/RaceTrack.java b/src/RaceTrack.java
new file mode 100644
index 0000000..969d636
--- /dev/null
+++ b/src/RaceTrack.java
@@ -0,0 +1,68 @@
+
+import robotrace.Vector;
+
+/**
+ * Implementation of a race track that is made from Bezier segments.
+ */
+class RaceTrack {
+
+ /**
+ * Array with control points for the O-track.
+ */
+ private Vector[] controlPointsOTrack;
+
+ /**
+ * Array with control points for the L-track.
+ */
+ private Vector[] controlPointsLTrack;
+
+ /**
+ * Array with control points for the C-track.
+ */
+ private Vector[] controlPointsCTrack;
+
+ /**
+ * Array with control points for the custom track.
+ */
+ private Vector[] controlPointsCustomTrack;
+
+ /**
+ * Constructs the race track, sets up display lists.
+ */
+ public RaceTrack() {
+ // code goes here ...
+ }
+
+ /**
+ * Draws this track, based on the selected track number.
+ */
+ public void draw(int trackNr) {
+
+ // The test track is selected
+ if (0 == trackNr) {
+ // code goes here ...
+ } else if (1 == trackNr) { // The O-track is selected
+ // code goes here ...
+ } else if (2 == trackNr) { // The L-track is selected
+ // code goes here ...
+ } else if (3 == trackNr) { // The C-track is selected
+ // code goes here ...
+ } else if (4 == trackNr) { // The custom track is selected
+ // code goes here ...
+ }
+ }
+
+ /**
+ * Returns the position of the curve at 0 <= {@code t} <= 1.
+ */
+ public Vector getPoint(double t) {
+ return Vector.O; // <- code goes here
+ }
+
+ /**
+ * Returns the tangent of the curve at 0 <= {@code t} <= 1.
+ */
+ public Vector getTangent(double t) {
+ return Vector.O; // <- code goes here
+ }
+}