/** Air Navigation Waypoint Intercept Demonstrator by Robert J Morton 21 Oct 1997*/ /* Plots the encounter on a 350 by 200 colour raster which is displayed by the applet class WayPtApp.class */ import java.awt.Color; class wpcolour { // Waypoint Colour Array double Pi = Math.PI, //the circular constant TwoPi = Pi + Pi, PiBy2 = Pi / 2; int XW = 330, // x-width: horizontal width of tracking area YH = 200; // y-height: vertical height of tracking area Color BGC, // background colour of track area ATC = Color.white, // aircraft track colour SRC, // selected radial colour GCC, // green circle colour RCC, // red circle colour r C[][]; // to store the picture so far wpcolour() { //CONSTRUCTOR C = new Color[XW][YH]; // create the tracking area array GCC = new java.awt.Color(0,255,72); // special bright green for circle RCC = new java.awt.Color(255,0,72); // special bright red for circle BGC = new java.awt.Color(0,0,160); // special browny-green for axes SRC = new java.awt.Color(0,192,192); // special cyan for selected radial } // DRAW APPROACH CONSTRUCTS ON THE DISPLAY RASTER void InitC(aircraft ac, waypoint wp, double OSR) { int i, j; for(i = 0 ; i < XW ; i++) // Set all pixels in the tracking for(j = 0 ; j < YH ; j++) // square to background colour. C[i][j] = BGC; // DRAW RED AND GREEN GUIDE CIRCLES double // radius of right-hand guide circle perpendicular to selected radial a = OSR + PiBy2, /* Co-ordinates of centre of right-hand guide circle expressed as displacements from the waypoint. */ xr = ac.r * Math.sin(a), yr = ac.r * Math.cos(a); // radius of left-hand guide circle/ perpendicular to selected radial a = OSR - PiBy2; /* Co-ordinates of centre of left-hand guide circle expressed as displacements from the waypoint. */ double xl = ac.r * Math.sin(a), yl = ac.r * Math.cos(a), x, y; // for every degree round a guide circle... for (a = 0; a <= TwoPi; a += .017453292) { /* Absolute co-ordinates of one point on a generic guide circle which is centred on the waypoint.*/ x = wp.X + ac.r * Math.sin(a); y = wp.Y + ac.r * Math.cos(a); // bias to right-hand circle and plot a green dot C[(int)(xr + x)][(int)(yr + y)] = GCC; // bias to left-hand circle and plot a red dot C[(int)(xl + x)][(int)(yl + y)] = RCC; } // DRAW THE SELECTED RADIAL LINE IN THE APPROPRIATE COLOUR for(i = 0 ; i < wp.R ; i++) { x = i * Math.sin(OSR); y = i * Math.cos(OSR); C[(int)(x + wp.X)][(int)(y + wp.Y)] = SRC; } int I = (int)wp.X, J = (int)wp.Y; // DRAW IN THE WAYPOINT ITSELF for(i = I - 2 ; i < I + 3 ; i++) // Draw the waypoint as a for(j = J - 2 ; j < J + 3 ; j++) // small white square... C[i][j] = ATC; C[I - 2][J - 2] = BGC; // ...rounded off at corners to C[I + 2][J + 2] = BGC; // make it into a circular blob. C[I - 2][J + 2] = BGC; C[I + 2][J - 2] = BGC; // DRAW THE LITTLE NORTH ARROW I = 30; J = 150; for(i = -10 ; i < 11 ; i++) C[I + i][J] = Color.white; for(j = -20 ; j < 21 ; j++) C[I][J + j] = Color.white; for(i = -3 ; i < 0 ; i++) { C[I + i][J + 20 + i] = Color.white; C[I - i][J + 20 + i] = Color.white; } for(j = -2 ; j < 3 ; j++) C[I - 2][J + 25 + j] = Color.white; for(j = -2 ; j < 3 ; j++) C[I + 2][J + 25 + j] = Color.white; for(j = -1 ; j < 2 ; j++) C[I - j][J + 25 + j] = Color.white; } void PlotPosn(aircraft ac) { // PLOT THE AIRCRAFT'S CURRENT POSITION C[(int)ac.x][(int)ac.y] = ATC; // plot its position on the } // tracking display raster }