Track::Direction dir = guessTrackDirection();
-
+ // If we a drawing along the X axis then the track must curve to the
+ // Y axis somewhere
+ // If X is the longer dimension then the curve is at the end after
+ // a straight section, otherwise the curve is at the beginning
+ if (dir == Axis::X) {
+ if (xLength > yLength) {
+ log() << "Curve X->Y at end";
+ }
+ else {
+ log() << "Curve X->Y at start";
+ }
+ }
+ else {
+ // Otherwise the track must curve to the X axis
+ if (yLength > xLength) {
+ log() << "Curve Y->X at end";
+ }
+ else {
+ log() << "Curve Y->X at start";
+ }
+ }
+
+ ITrackSegmentPtr curve = makeCurvedTrack();
+ myMap->setTrackAt(myDragBegin, curve);
}
// Called when the user has finished dragging a rectangle for track
glBegin(GL_QUADS);
for (double theta = startAngle; theta < finishAngle; theta += step) {
glNormal3d(0.0, 1.0, 0.0);
- glVertex3d(R * cos(theta), 0.1, R * sin(theta));
- glNormal3d(0.0, 1.0, 0.0);
- glVertex3d(R * cos(theta + step), 0.1, R * sin(theta + step));
- glNormal3d(0.0, 1.0, 0.0);
+ glVertex3d(r * cos(theta), 0.1, r * sin(theta));
glVertex3d(r * cos(theta + step), 0.1, r * sin(theta + step));
- glNormal3d(0.0, 1.0, 0.0);
- glVertex3d(r * cos(theta), 0.1, r * sin(theta));
+ glVertex3d(R * cos(theta + step), 0.1, R * sin(theta + step));
+ glVertex3d(R * cos(theta), 0.1, R * sin(theta));
}
glEnd();
+ // I really have no idea how to compute the normals here!
+ glPushAttrib(GL_ENABLE_BIT);
+ glDisable(GL_CULL_FACE);
+
// Outer edge
glBegin(GL_QUADS);
for (double theta = startAngle; theta < finishAngle; theta += step) {
- glNormal3d(cos(theta), 0.0, sin(theta));
- glVertex3d(R * cos(theta), 0.1, R * sin(theta));
glNormal3d(cos(theta), 0.0, sin(theta));
glVertex3d(R * cos(theta), 0.0, R * sin(theta));
+
glNormal3d(cos(theta + step), 0.0, sin(theta + step));
glVertex3d(R * cos(theta + step), 0.0, R * sin(theta + step));
- glNormal3d(cos(theta + step), 0.1, sin(theta + step));
+
+ glNormal3d(cos(theta + step), 0.0, sin(theta + step));
glVertex3d(R * cos(theta + step), 0.1, R * sin(theta + step));
+
+ glNormal3d(cos(theta), 0.0, sin(theta));
+ glVertex3d(R * cos(theta), 0.1, R * sin(theta));
}
glEnd();
for (double theta = startAngle; theta < finishAngle; theta += step) {
glNormal3d(-cos(theta), 0.0, -sin(theta));
glVertex3d(r * cos(theta), 0.1, r * sin(theta));
+
glNormal3d(-cos(theta), 0.0, -sin(theta));
glVertex3d(r * cos(theta), 0.0, r * sin(theta));
+
glNormal3d(-cos(theta + step), 0.0, -sin(theta + step));
glVertex3d(r * cos(theta + step), 0.0, r * sin(theta + step));
- glNormal3d(-cos(theta + step), 0.1, -sin(theta + step));
+
+ glNormal3d(-cos(theta + step), 0.0, -sin(theta + step));
glVertex3d(r * cos(theta + step), 0.1, r * sin(theta + step));
}
glEnd();
+ glPopAttrib();
+
glPopMatrix();
}