A straight line drawing method based on coordinate rotation and aircraft cockpit display system

Convert straight lines into horizontal reference lines through coordinate rotation, and parallel calculations of multi-core processors and FPGAs solve the problem of limited drawing speed in multi-core environments, achieving efficient straight lines drawing.

CN112802152BActive Publication Date: 2024-11-26BEIJING QINGYUN AVIATION INSTR CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202011572506.1
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2020-12-25
Publication Date
2024-11-26
Estimated Expiration
2040-12-25

AI Technical Summary

Technical Problem

Traditional linear drawing algorithms cannot fully utilize parallel computing capabilities in multi-core processors and FPGA environments, and require special processing of linear endpoints, resulting in limited drawing speed.

Method used

A straight line drawing method based on coordinate rotation is adopted to convert a straight line of arbitrary angle into a horizontal reference line, the color value of the point is calculated through the rotation matrix, and parallel calculations are performed using a multi-core processor and FPGA, avoiding special processing of the line endpoints.

Benefits of technology

The linear drawing speed is improved, the drawing complexity is reduced, and the parallel computing power of multi-core processors and FPGAs is fully utilized to achieve efficient linear drawing.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN112802152B_ABST
    Figure CN112802152B_ABST
Patent Text Reader

Abstract

A straight line drawing method based on coordinate rotation and an aircraft cockpit display system are proposed. The calculation of each point of the straight line has no sequential correlation, which can fully utilize the advantages of multi-core processors and FPGA parallel computing to improve the straight line drawing speed, and no special processing is required for the endpoints of the straight line. The straight line of any angle to be drawn is transformed into a horizontal reference straight line by coordinate rotation, so as to obtain the color value of the corresponding position. The length l, line width W, rotation matrix R and reference straight line L' of the straight line to be drawn are obtained by initial calculation, and the coordinate range X of the straight line to be drawn is estimated; the rotation matrix R is used to calculate the position of the reference point P' after the point P is rotated within the range X one by one, and the color value C of the point P is calculated by the positional relationship between the reference point P' and the reference straight line L'; in the calculation process, the distance between P' and the reference straight line L' is used to increase the stepping and skip the points in X that are definitely not inside the straight line L.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention may relate to technical fields such as aircraft cockpit display systems and graphics processing, and in particular to a straight line drawing method based on coordinate rotation and an aircraft cockpit display system. Background Art

[0002] In traditional computer graphics, the digital differential analyzer (DDA) algorithm and the Bresenham algorithm are usually used to draw straight lines. The DDA algorithm is a line segment scan conversion algorithm. By sampling or sampling the line segment at unit intervals on one coordinate axis, the Cartesian intercept equation of the line is used to obtain the increment or along the other coordinate axis, thereby gradually recursively determining the coordinates of each point on the line along the straight line path. Finally, the nearest pixel point is selected to fill in the coordinates based on the distance between the coordinates and the adjacent pixel points. When the DDA method is used to draw a straight line, since the increment or is a decimal, a lot of time is required for floating-point addition and rounding during the recursive calculation. The Bresenham line drawing algorithm improves the DDA algorithm, eliminates floating-point operations, and only uses incremental integer calculations, which improves drawing efficiency.

[0003] For a straight line with line width, the line width needs to be converted into horizontal or vertical line width when drawing, and then the pixel points filled in the upper and lower directions of the line reference point are added. At the same time, the endpoints of the line need to be specially filled.

[0004] The DDA algorithm and Bresenham algorithm used in traditional computer graphics are mainly for single-processor drawing. They use point-by-point recursive scanning to draw straight lines, and require special processing of the line endpoints. This point-by-point recursive scanning line drawing method cannot achieve parallel computing due to the strict order relationship between the points drawn. Therefore, the current significant improvement in the parallel computing capabilities of multi-core processors and FPGAs cannot effectively improve the drawing speed. Summary of the invention

[0005] The technical problem solved by the present invention is as follows: a straight line drawing method based on coordinate rotation and an aircraft cockpit display system are proposed, in which the calculation of each point of the straight line has no sequence relationship, and the advantages of multi-core processors and FPGA parallel computing can be fully utilized to improve the straight line drawing speed, and at the same time, no special processing is required for the endpoints of the straight line.

[0006] The technical solution of the present invention is a straight line drawing method based on coordinate rotation, which transforms a straight line of any angle to be drawn into a horizontal reference straight line through coordinate rotation, thereby obtaining the color value of the corresponding position.

[0007] Preferably, the method comprises the steps of:

[0008] The length l, line width W, rotation matrix R and reference line L' of the line to be drawn are obtained through initial calculation, and the coordinate range X of the line to be drawn is estimated;

[0009] Using the rotation matrix R, calculate the position of the reference point P′ after the point P in the X range is rotated one by one, and calculate the color value C of the point P through the position relationship between the reference point P′ and the reference line L′;

[0010] During the calculation process, the distance between P′ and the reference straight line L′ is increased, and the step is skipped to the points in X that are definitely not inside the straight line L.

[0011] Preferably, the rotation matrix R is composed of trigonometric functions of the angle θ between the straight line L to be drawn and the x-axis, as follows:

[0012]

[0013] Preferably, the reference straight line L' is rectangle.

[0014] Preferably, the method according to the point The point after coordinate rotation Refer to the distance of the straight line L' to determine the coordinates of the next point The specific method is as follows:

[0015] When y′>W+1, the next point

[0016] When -W≤y′≤W+1, the x of the next point next =x+1;

[0017] When y′<-W, the drawing of the straight line in this row is finished.

[0018] Preferably, the estimated coordinate range X of the straight line to be drawn is a rectangular area of ​​X(up down left right)=(dy+W-W-Wdx+W).

[0019] An aircraft cockpit display system, wherein the aircraft cockpit display system uses any of the above-mentioned straight line drawing methods.

[0020] Preferably, the aircraft cockpit display system is implemented based on a multi-core processor and FPGA hardware architecture.

[0021] Beneficial effects of the present invention: A straight line drawing method based on coordinate rotation is proposed, wherein the method transforms a straight line of any angle to be drawn into a horizontal reference straight line through coordinate rotation, thereby obtaining the color value of the corresponding position. The straight line drawing algorithm of the present invention has no sequential correlation in the calculation of each point of the straight line, and can make full use of the advantages of multi-core processors and FPGA parallel computing to improve the straight line drawing speed. The straight line drawing algorithm of the present invention does not require special processing of the straight line endpoints, thereby reducing the complexity of straight line drawing. BRIEF DESCRIPTION OF THE DRAWINGS

[0022] Figure 1 Schematic diagram of parameters related to a straight line to be drawn according to an embodiment of the present invention;

[0023] Figure 2 is a reference straight line diagram of an embodiment of the present invention;

[0024] Figure 3 is a schematic diagram of the next drawing coordinate stepping of an embodiment of the present invention;

[0025] Figure 4 It is a block diagram of the straight line drawing principle of an embodiment of the present invention. DETAILED DESCRIPTION

[0026] The present invention is further described in detail below.

[0027] In a certain type of backup instrument, the graphic display unit adopts the DSP+FPGA architecture, the digital signal processor DSP completes the initial calculation, and the programmable logic device FPGA realizes the specific straight line drawing. The specific implementation method is as follows:

[0028] 1. Initial calculation

[0029] The graphics application software in DSP calls the custom function DrawLine to set the parameters and perform initial calculations for straight line drawing, and sends the relevant data to FPGA for graphics drawing.

[0030] a) Parameter settings include: starting point end Line width W and line color Color. It is required that y1>y0.

[0031] b) Initial calculation includes:

[0032] Straight line horizontal flip flag: swap x =(x0>x1)?1:0;

[0033] Line vector: Where dx = |x1-x0|, dy = y1-y0;

[0034] Straight line length:

[0035] Rotation matrix: Where θ is the angle between the straight line and the x-axis, sinθ=dy / l, cosθ=dx / l.

[0036] c) Drawing parameters are sent

[0037] The above parameters are sent to the FPGA through the EMIF interface. The parameters sent are as follows: starting point P0, line width W, color Color, horizontal flip flag swap x , Line Vector The length of the line l and the rotation matrix R.

[0038] 2. Straight line drawing

[0039] According to the straight line parameters sent by DSP, FPGA uses four parallel straight line drawing modules to draw multiple lines simultaneously for the estimated coordinate range X of the straight line to be drawn.

[0040] a) Parallel Control

[0041] The coordinate range of the line to be drawn X (up down left right) = (dy + W - W - W dx + W) is allocated to 4 line drawing modules according to the row number, with a total of dy + 2W rows. The allocation principle is as follows:

[0042] Line drawing module 0: row number is 4n

[0043] Line drawing module 1: row number is 4n+1

[0044] Line drawing module 2: row number is 4n+2

[0045] Line drawing module 3: row number is 4n+3

[0046] b) Coordinate transformation

[0047] The coordinate transformation module draws the straight line line by line. The drawing process is as follows:

[0048] Initial coordinate selection

[0049] Select the yth row to draw the starting point

[0050] Coordinate rotation calculation

[0051] Use the rotation matrix to transform the current coordinates Rotate and get the rotated coordinates The specific calculation is as follows:

[0052] x′=xcosθ+ysinθ

[0053] y′=-xsinθ+ycosθ

[0054] Next drawing coordinate determination

[0055] Determine the coordinates of the next point based on P′ The specific logic is as follows:

[0056] When y′>W+1, the next point

[0057] When -W≤y′≤W+1, the x of the next point next =x+1;

[0058] When y′<-W, the drawing of the straight line in this row ends;

[0059] c) Color calculation

[0060] The color calculation module determines the color value of the current point based on P' and the reference straight line L'. The calculation method is as follows:

[0061] Calculate the x-direction interpolation coefficient C x

[0062] When x′<L′(left)-1: C x =0;

[0063] When L′(left)-1≤x′<L′(left): C x =x′+1-L′(left);

[0064] When L′(left)≤x′<L′(right): C x =1;

[0065] When L′(right)≤x′<L′(right)+1: C x =L′(right)+1-x′;

[0066] b) Calculate the interpolation coefficient C in the y direction y

[0067] When y′<L′(down)-1: C y =0;

[0068] When L′(down)-1≤y′<L′(down): C y =y′+1-L′(down);

[0069] When L′(down)≤y′<L′(up): C y =1;

[0070] When L′(up)≤y′<L′(up)+1: C y =L′(up)+1-y′;

[0071] Calculate the color value C

[0072] C=Color×C x ×C y ……………………………………[6]

[0073] Among them, Color is the color value required for the straight line to be drawn.

[0074] d) Pixel filling

[0075] The pixel filling module fills the color value into the corresponding coordinates of the line, and fills in the coordinate pixel as follows:

[0076] When swap x =1,

[0077] When swap x = 0,

[0078] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, but the protection scope of the present invention is not limited thereto. Any technician familiar with the field can easily think of various equivalent modifications or substitutions within the technical scope disclosed by the present invention, and these modifications or substitutions should all be covered within the protection scope of the present invention.

Claims

1. A straight line drawing method based on coordinate rotation, characterized in that: By rotating the coordinates, the straight line at any angle to be drawn is transformed into a horizontal reference straight line, thereby obtaining the color value at the corresponding position; The method described comprises the following steps: The length l, line width W, rotation matrix R and reference line L' of the line to be drawn are obtained through initial calculation, and the coordinate range X of the line to be drawn is estimated; Using the rotation matrix R, calculate the position of the reference point P′ after the point P in the X range is rotated one by one, and calculate the color value C of the point P through the position relationship between the reference point P′ and the reference line L′; By point The point after coordinate rotation The distance from the reference line L' determines the coordinates of the next point The specific method is as follows: When y′>W+1, the next point θ is the angle between the straight line L to be drawn and the x-axis; When -W≤y′≤W+1, the x of the next point next =x+1; When y′<-W, the drawing of the straight line in this row ends; During the calculation process, the distance between P′ and the reference straight line L′ is increased, and the step is skipped to the points in X that are definitely not inside the straight line L.

2. A straight line drawing method based on coordinate rotation according to claim 1, characterized in that: The rotation matrix R is composed of trigonometric functions of the angle θ between the straight line L to be drawn and the x-axis, as follows:

3. A straight line drawing method based on coordinate rotation according to claim 1, characterized in that: The reference straight line L' is taken rectangle.

4. A straight line drawing method based on coordinate rotation according to claim 1, characterized in that: The estimated coordinate range X of the straight line to be drawn is a rectangular area of ​​X(up down left right)=(dy+WWW dx+W).

5. Aircraft cockpit display system, characterized in that: The aircraft cockpit display system uses the straight line drawing method described in any one of claims 1-4.

6. The aircraft cockpit display system according to claim 5, characterized in that: The aircraft cockpit display system is implemented based on a multi-core processor and FPGA hardware architecture.