CN112802152A - Straight line drawing method based on coordinate rotation and aircraft cabin display system - Google Patents
Straight line drawing method based on coordinate rotation and aircraft cabin display system Download PDFInfo
- Publication number
- CN112802152A CN112802152A CN202011572506.1A CN202011572506A CN112802152A CN 112802152 A CN112802152 A CN 112802152A CN 202011572506 A CN202011572506 A CN 202011572506A CN 112802152 A CN112802152 A CN 112802152A
- Authority
- CN
- China
- Prior art keywords
- straight line
- rotation
- coordinate
- drawn
- points
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Pending
Links
- 238000000034 method Methods 0.000 title claims abstract description 24
- 238000004364 calculation method Methods 0.000 claims abstract description 22
- 239000011159 matrix material Substances 0.000 claims abstract description 11
- 230000001131 transforming effect Effects 0.000 abstract 1
- 238000010586 diagram Methods 0.000 description 3
- 238000009877 rendering Methods 0.000 description 3
- 238000012986 modification Methods 0.000 description 2
- 230000004048 modification Effects 0.000 description 2
- 238000006467 substitution reaction Methods 0.000 description 2
- 230000009466 transformation Effects 0.000 description 2
- 239000000956 alloy Substances 0.000 description 1
- 229910045601 alloy Inorganic materials 0.000 description 1
- 230000009286 beneficial effect Effects 0.000 description 1
- 238000006243 chemical reaction Methods 0.000 description 1
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T11/00—2D [Two Dimensional] image generation
- G06T11/20—Drawing from basic elements, e.g. lines or circles
- G06T11/203—Drawing of straight lines or curves
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T11/00—2D [Two Dimensional] image generation
- G06T11/001—Texturing; Colouring; Generation of texture or colour
Abstract
The coordinate rotation-based straight line drawing method and the airplane cockpit display system are provided, the calculation of each point of the straight line is not sequentially associated, the straight line drawing speed can be improved by fully utilizing the advantages of parallel calculation of a multi-core processor and an FPGA, and meanwhile, special processing is not needed to be carried out on the end point of the straight line. And transforming any angle straight line to be drawn into a horizontal reference straight line through coordinate rotation, thereby obtaining the color value of the corresponding position. Obtaining the length L, the line width W, the rotation matrix R and the reference straight line L' of the straight line L to be drawn through initial calculation, and estimating the range X of the linear coordinate to be drawn; calculating the positions of reference points P ' of the points P in the X range after rotation one by utilizing the rotation matrix R, and calculating the color value C of the points P according to the position relation between the reference points P ' and the reference straight line L '; and increasing the step to skip points which are not necessarily in the straight line L in the X through the distance between the P 'and the reference straight line L' in the calculation process.
Description
Technical Field
The invention possibly relates to the technical fields of an airplane cockpit display system, graphic processing and the like, in particular to a straight line drawing method based on coordinate rotation and an airplane cockpit display system.
Background
In conventional computer graphics, a Digital Differential Analyzer (DDA) algorithm and a Bresenham algorithm are generally used to draw a straight line. The DDA algorithm is a line segment scan conversion algorithm that samples line segments on one coordinate axis at unit intervals or obtains an increment or along another coordinate axis direction using the cartesian intercept equation of a straight line, thereby determining the coordinates of each point of the straight line step by step in a recursive manner along a straight line path. And finally, selecting the nearest pixel point for filling according to the distance between the coordinate and the adjacent pixel point. When a linear line is drawn by the DDA method, a large amount of time is required for floating-point addition and rounding in recursive calculation because the linear line is incremented or decimal. The Bresenham linear drawing algorithm improves the DDA algorithm, eliminates floating point type operation, only uses increment integer calculation, and improves the drawing efficiency.
For a straight line with a line width, the line width needs to be converted into the line width in the horizontal or vertical direction during drawing, then pixel points are filled in the vertical direction of a straight line reference point, and meanwhile special filling processing needs to be carried out on the straight line reference points.
The DDA algorithm and Bresenham algorithm used in traditional computer graphics are mainly used for single processor drawing, and draw a straight line in a point-by-point recursion scanning mode, and special processing is required to be performed on the straight line end point. In the linear drawing mode of point-by-point recursive scanning, because the drawn points have strict precedence relationship and can not realize parallel operation, the parallel computing capability of the current multi-core processor and FPGA is greatly improved, and the drawing speed can not be effectively improved.
Disclosure of Invention
The technical problems solved by the invention are as follows: the coordinate rotation-based straight line drawing method and the airplane cockpit display system are provided, the calculation of each point of the straight line is not sequentially associated, the straight line drawing speed can be improved by fully utilizing the advantages of parallel calculation of a multi-core processor and an FPGA, and meanwhile, special processing is not needed to be carried out on the end point of the straight line.
The technical scheme of the invention is as follows: a straight line drawing method based on coordinate rotation converts any angle straight line to be drawn into a horizontal reference straight line through coordinate rotation, and accordingly color values of corresponding positions are obtained.
Preferably, the method comprises the steps of:
obtaining the length L, the line width W, the rotation matrix R and the reference straight line L' of the straight line L to be drawn through initial calculation, and estimating the range X of the linear coordinate to be drawn;
calculating the positions of reference points P ' of the points P in the X range after rotation one by utilizing the rotation matrix R, and calculating the color value C of the points P according to the position relation between the reference points P ' and the reference straight line L ';
and increasing the step to skip points which are not necessarily in the straight line L in the X through the distance between the P 'and the reference straight line L' in the calculation process.
Preferably, the rotation matrix R is composed of a trigonometric function of an included angle θ between the line L to be drawn and the x-axis, specifically as follows:
Preferably, the passing is according to pointsPoint after coordinate rotationReferring to the distance of the straight line L', the coordinates of the next point are determinedThe specific method comprises the following steps:
when-W is less than or equal to y' is less than or equal to W +1, x of the next pointnext=x+1;
When y' < -W, the line drawing within this line ends.
Preferably, the predicted linear coordinate range X to be drawn is a rectangular area taking X (up down left right) (dy + W-W dx + W).
An aircraft cockpit display system using any of the above straight line drawing methods.
Preferably, the aircraft cockpit display system is implemented based on a multi-core processor and an FPGA hardware architecture.
The invention has the beneficial effects that: a straight line drawing method based on coordinate rotation is provided, and the method converts any angle straight line to be drawn into a horizontal reference straight line through coordinate rotation so as to obtain color values of corresponding positions. The calculation of each point of the straight line by the straight line drawing algorithm is not sequentially associated, and the straight line drawing speed can be improved by fully utilizing the advantages of parallel calculation of the multi-core processor and the FPGA. The straight line drawing algorithm does not need to perform special processing on the straight line endpoint, and the complexity of straight line drawing is reduced.
Drawings
FIG. 1 is a diagram illustrating parameters associated with a line to be drawn according to an embodiment of the present invention;
FIG. 2 is a reference line schematic of an embodiment of the present invention;
FIG. 3 is a schematic diagram of a next step of rendering coordinates according to an embodiment of the present invention;
fig. 4 is a functional block diagram of line drawing according to an embodiment of the present invention.
Detailed Description
The invention is more fully described in detail below
In a certain type of backup instrument, a graphic display unit adopts a DSP + FPGA framework, a DSP finishes initial calculation, and a FPGA realizes specific straight line drawing. The specific implementation mode is as follows:
1. initial calculation
And the graphics application software in the DSP calls a custom function DrawLine to set parameters and initially calculate linear drawing, and issues related data to the FPGA to draw graphics.
a) The parameter setting includes: starting pointTerminal pointLine width W and line Color. Wherein requires y1>y0。
b) The initial calculation includes:
rotating the matrix:where θ is the included angle between the straight line and the x-axis, sin θ is dy/l, and cos θ is dx/l.
c) Rendering parameter delivery
And sending the obtained parameters to the FPGA through an EMIF interface. The issued parameters are as follows: starting point P0Line width W, Color and horizontal turning mark swapxLinear vector ofA linear length l and a rotation matrix R.
2. Drawing straight lines
And the FPGA performs multi-line simultaneous drawing on the estimated linear coordinate range X to be drawn through four parallel linear drawing modules according to the linear parameters sent by the DSP.
a) Parallel control
The linear coordinate range x (up down left right) ((dy + W-W dx + W)) to be drawn is allocated to 4 linear drawing modules according to the line number, and the allocation principle is as follows:
straight line drawing module 0: the row number is 4n
Straight line drawing module 1: the row number is 4n +1
The straight line drawing module 2: the row number is 4n +2
The straight line drawing module 3: the row number is 4n +3
b) Coordinate transformation
The coordinate transformation module draws the straight line by line, and the drawing process is as follows:
Using rotation matrix to align current coordinatesRotating to obtain the coordinates after rotationThe specific calculation is as follows:
x′=xcosθ+ysinθ
y′=-xsinθ+ycosθ
when-W is less than or equal to y' is less than or equal to W +1, x of the next pointnext=x+1;
When y' < -W, the straight line drawing within the present line ends;
c) color calculation
And the color calculation module determines the color value of the current point according to the P 'and the reference straight line L'. The calculation method is as follows:
When x '< L' (left) -1: cx=0;
When L ' (left) -1. ltoreq. x ' < L ' (left): cx=x′+1-L′(left);
When L ' (left) ≦ x ' < L ' (right): cx=1;
When L ' (right) ≦ x ' < L ' (right) + 1: cx=L′(right)+1-x′;
When y '< L' (down) -1: cy=0;
When L ' (down) -1. ltoreq. y ' < L ' (down):Cy=y′+1-L′(down);
When L ' (down) ≦ y ' < L ' (up): cy=1;
When L ' (up) ≦ y ' < L ' (up) + 1: cy=L′(up)+1-y′;
C=Color×Cx×Cy…………………………………[6]
Wherein, Color is a Color value required by a straight line to be drawn.
d) Pixel fill
The pixel filling module fills the color value into the corresponding coordinate of the straight line, and fills the coordinate pixel as follows:
finally, it should be noted that: the above embodiments are only for illustrating the technical solutions of the present invention, but the scope of the present invention is not limited thereto, and any person skilled in the art can easily conceive various equivalent modifications or substitutions within the technical scope of the present invention, and these modifications or substitutions should be covered within the scope of the present invention.
Claims (8)
1. A straight line drawing method based on coordinate rotation is characterized in that any angle straight line needing to be drawn is converted into a horizontal reference straight line through coordinate rotation, and therefore color values of corresponding positions are obtained.
2. A coordinate rotation-based line drawing method according to claim 1, comprising the steps of:
obtaining the length L, the line width W, the rotation matrix R and the reference straight line L' of the straight line L to be drawn through initial calculation, and estimating the range X of the linear coordinate to be drawn;
calculating the positions of reference points P ' of the points P in the X range after rotation one by utilizing the rotation matrix R, and calculating the color value C of the points P according to the position relation between the reference points P ' and the reference straight line L ';
and increasing the step to skip points which are not necessarily in the straight line L in the X through the distance between the P 'and the reference straight line L' in the calculation process.
5. The coordinate rotation-based line drawing method of claim 2, wherein the passing basis point isPoint after coordinate rotationReferring to the distance of the straight line L', the coordinates of the next point are determinedThe specific method comprises the following steps:
when-W is less than or equal to y' is less than or equal to W +1, x of the next pointnext=x+1;
When y' < -W, the line drawing within this line ends.
6. The coordinate rotation-based line drawing method of claim 2, wherein the estimated linear coordinate range X to be drawn is a rectangular area of X (up down left right) ((dy + W-W dx + W)).
7. An aircraft cockpit display system using the line drawing method of any one of claims 1-6.
8. The aircraft cockpit display system of claim 7 where the aircraft cockpit display system is implemented based on a multi-core processor and FPGA hardware architecture.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202011572506.1A CN112802152A (en) | 2020-12-25 | 2020-12-25 | Straight line drawing method based on coordinate rotation and aircraft cabin display system |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202011572506.1A CN112802152A (en) | 2020-12-25 | 2020-12-25 | Straight line drawing method based on coordinate rotation and aircraft cabin display system |
Publications (1)
Publication Number | Publication Date |
---|---|
CN112802152A true CN112802152A (en) | 2021-05-14 |
Family
ID=75805270
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202011572506.1A Pending CN112802152A (en) | 2020-12-25 | 2020-12-25 | Straight line drawing method based on coordinate rotation and aircraft cabin display system |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN112802152A (en) |
Citations (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JPH03206579A (en) * | 1989-10-17 | 1991-09-09 | Mitsubishi Electric Corp | Graphic area filling device |
US6930686B1 (en) * | 1999-06-17 | 2005-08-16 | International Business Machines Corporation | Method and apparatus for drawing thick graphic primitives |
CN102063523A (en) * | 2010-11-22 | 2011-05-18 | 长沙景嘉微电子有限公司 | Method for realizing anti-aliasing of line segment integrating floating points and fixed points by using supersampling algorithm |
CN103213404A (en) * | 2012-01-17 | 2013-07-24 | 株式会社理光 | Information processing apparatus, information processing method, and system |
CN106910210A (en) * | 2017-03-03 | 2017-06-30 | 百度在线网络技术(北京)有限公司 | Method and apparatus for generating image information |
CN106971411A (en) * | 2017-03-13 | 2017-07-21 | 广东南方数码科技股份有限公司 | A kind of method and system of drawing image |
-
2020
- 2020-12-25 CN CN202011572506.1A patent/CN112802152A/en active Pending
Patent Citations (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JPH03206579A (en) * | 1989-10-17 | 1991-09-09 | Mitsubishi Electric Corp | Graphic area filling device |
US6930686B1 (en) * | 1999-06-17 | 2005-08-16 | International Business Machines Corporation | Method and apparatus for drawing thick graphic primitives |
CN102063523A (en) * | 2010-11-22 | 2011-05-18 | 长沙景嘉微电子有限公司 | Method for realizing anti-aliasing of line segment integrating floating points and fixed points by using supersampling algorithm |
CN103213404A (en) * | 2012-01-17 | 2013-07-24 | 株式会社理光 | Information processing apparatus, information processing method, and system |
CN106910210A (en) * | 2017-03-03 | 2017-06-30 | 百度在线网络技术(北京)有限公司 | Method and apparatus for generating image information |
CN106971411A (en) * | 2017-03-13 | 2017-07-21 | 广东南方数码科技股份有限公司 | A kind of method and system of drawing image |
Non-Patent Citations (1)
Title |
---|
贾银亮: "基于FPGA+DSP的飞机座舱综合图形显示技术研究", 《中国优秀博士学位论文全文数据库(电子期刊)信息科技辑》, no. 12, 15 December 2012 (2012-12-15), pages 18 - 34 * |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
JP2910979B2 (en) | Method and apparatus for generating sub-pixel mask in computer graphic system | |
JP5294313B2 (en) | Bezier curve drawing device, Bezier curve drawing method and program | |
JP3763136B2 (en) | Drawing method and drawing apparatus | |
JPH08510851A (en) | Image processing method and apparatus | |
JP5451285B2 (en) | Image processing apparatus and image processing method | |
JPH1186007A (en) | Method for finding rate of pixel covered with primitive | |
US20120075310A1 (en) | Arc spline gpu rasterization for cubic bezier drawing | |
JPH05307610A (en) | Texture mapping method and its device | |
US7616202B1 (en) | Compaction of z-only samples | |
CN112802152A (en) | Straight line drawing method based on coordinate rotation and aircraft cabin display system | |
US6865301B1 (en) | Reducing aliasing artifacts when shaping a digital image | |
KR100305461B1 (en) | Graphic processing device | |
US6711603B1 (en) | Fractional, arithmetic unit, fractional arithmetic method, set-up engine for handling graphic images and computer-readable medium | |
US6606097B1 (en) | Circuit for generating frame buffer values | |
US5502795A (en) | Antialias line generating method and antialias line generator | |
JP2008009897A (en) | Vector graphic drawing device and program thereof | |
US6529196B1 (en) | Efficient stroking of vectors with arbitrary endpoints | |
CN114741188A (en) | Graphic element processing method and device, electronic equipment and storage medium | |
JPH064679A (en) | Image processor | |
JP2588257B2 (en) | Contour approximation method | |
CN111260745A (en) | Optimal transmission theory-based simultaneous sampling and binding method | |
EP0642101A2 (en) | A wide line drawing method | |
Liu et al. | A Fast Anti-aliased Rendering Line Algorithm for Real Coordinate | |
JPH10228537A (en) | Pixel area calculating device | |
Xian et al. | Improved DDA line drawing anti-aliasing algorithm based on embedded graphics system |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination |