| With the continuous development of avionics technology and virtual technology,there have been an increasing number of electronic systems on aircraft. Electronic flightinstrument system made up of HUD(head-up display), MFD(multi-function display) etchas come out. Currently, traditional electromechanical instruments on the aircraft arebeing gradually replaced by electronic instruments. Electronic instrument controlled bycomputer has diverse display forms and centralized information, even has multiplefunctions. Most of the aviation instruments are believed to become electronic instrumentsin the near future. Virtual aviation instruments are mainly used in various flight simulatorscurrently while in the future they can be ported directly to real aircrafts.Virtual aviation instrument based on the open three-dimensional graphics libraryOpenGL is researched, designed and realized by C language in this paper. System designis elaborated in this paper and the associated OpenGL technologies including coordinatetransformation, blending, texture mapping and clipping are introduced. The realizationprocess is described in detail and the achieved result is displayed at the end. Theassociated two-dimensional clipping algorithm with a rectangular window is deeplystudied in this paper as graphics clipping is commonly used in virtual aviation instrument.The Cohen-Sutherland line clipping algorithm and the Sutherland-Hodgman polygonclipping algorithm are both improved in this paper.On the basis of the Cohen-Sutherland encoding, the positional relationship betweenthe segment and the rectangular is further subdivided. The number and location of theintersection points of the segment and the window are determined by judging thepositional relationship between the segment and the clipping window vertices, so thatinvalid intersection calculations are avoided. When using the straight line which theclipping window border lies on to clip the polygon, the treatment of the untreated verticesafter processing two intersections can be simplified by counting intersections in Sutherland-Hodgman algorithm. The purpose of optimizing the algorithm is achieved byskipping unnecessary judgements. The experimental data shows that the improvedCohen-Sutherland line clipping algorithm consumes shorter time than the originalalgorithm which means the efficiency of the algorithm has been improved. The improvedSutherland-Hodgman algorithm consumes shorter time than the original algorithm whenclipping convex polygons which have many sides. With the increasing number of sides ofthe polygon, the ratio of the saving time saved by the improved algorithm increases whichmeans the effect of improvements is more obvious. |