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 PDF

Info

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
Application number
CN202011572506.1A
Other languages
Chinese (zh)
Inventor
张小永
王新玲
黄子硕
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Avic Beijing Keeven Aviation Instrument Co ltd
Original Assignee
Avic Beijing Keeven Aviation Instrument Co ltd
Priority date (The priority date 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 date listed.)
Filing date
Publication date
Application filed by Avic Beijing Keeven Aviation Instrument Co ltd filed Critical Avic Beijing Keeven Aviation Instrument Co ltd
Priority to CN202011572506.1A priority Critical patent/CN112802152A/en
Publication of CN112802152A publication Critical patent/CN112802152A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T11/002D [Two Dimensional] image generation
    • G06T11/20Drawing from basic elements, e.g. lines or circles
    • G06T11/203Drawing of straight lines or curves
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T11/002D [Two Dimensional] image generation
    • G06T11/001Texturing; 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

Straight line drawing method based on coordinate rotation and aircraft cabin display system
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:
Figure BDA0002860322520000021
preferably, the reference straight line L' is taken
Figure BDA0002860322520000022
Is rectangular.
Preferably, the passing is according to points
Figure BDA0002860322520000023
Point after coordinate rotation
Figure BDA0002860322520000024
Referring to the distance of the straight line L', the coordinates of the next point are determined
Figure BDA0002860322520000025
The specific method comprises the following steps:
when y'>W +1, next point
Figure BDA0002860322520000031
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 point
Figure BDA0002860322520000041
Terminal point
Figure BDA0002860322520000042
Line width W and line Color. Wherein requires y1>y0
b) The initial calculation includes:
Figure BDA0002860322520000043
straight line horizontal turning sign: swapx=(x0>x1)?1:0;
Figure BDA0002860322520000044
Straight line vector:
Figure BDA0002860322520000045
wherein dx ═ x1-x0|,dy=y1-y0
Figure BDA0002860322520000046
Length of straight line:
Figure BDA0002860322520000047
Figure BDA0002860322520000048
rotating the matrix:
Figure BDA0002860322520000049
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 of
Figure BDA00028603225200000410
A 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:
Figure BDA0002860322520000051
initial coordinate selection
The selected y-th line is used for drawing a starting point
Figure BDA0002860322520000052
Figure BDA0002860322520000053
Coordinate rotation calculation
Using rotation matrix to align current coordinates
Figure BDA0002860322520000054
Rotating to obtain the coordinates after rotation
Figure BDA0002860322520000055
The specific calculation is as follows:
x′=xcosθ+ysinθ
y′=-xsinθ+ycosθ
Figure BDA0002860322520000056
next rendering coordinate determination
Judging the coordinates of the next point according to P
Figure BDA0002860322520000057
The specific logic is as follows:
when y'>W +1, next point
Figure BDA0002860322520000058
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:
Figure BDA0002860322520000061
calculating interpolation coefficient C in x directionx
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′;
Figure BDA0002860322520000062
b) Calculating interpolation coefficient C in y directiony
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′;
Figure BDA0002860322520000063
Calculating a color value C
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:
when swapxWhen the number is equal to 1, the alloy is put into a container,
Figure BDA0002860322520000064
when swapxWhen the content is equal to 0, the content,
Figure BDA0002860322520000065
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.
3. The coordinate rotation-based straight line drawing method according to claim 2, wherein the rotation matrix R is composed of a trigonometric function of an included angle θ between the straight line L to be drawn and the x-axis, and specifically comprises the following steps:
Figure FDA0002860322510000011
4. the coordinate rotation-based line drawing method of claim 2, wherein the reference line L' is taken as
Figure FDA0002860322510000012
Is rectangular.
5. The coordinate rotation-based line drawing method of claim 2, wherein the passing basis point is
Figure FDA0002860322510000013
Point after coordinate rotation
Figure FDA0002860322510000014
Referring to the distance of the straight line L', the coordinates of the next point are determined
Figure FDA0002860322510000015
The specific method comprises the following steps:
when y'>W +1, next point
Figure FDA0002860322510000021
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.
CN202011572506.1A 2020-12-25 2020-12-25 Straight line drawing method based on coordinate rotation and aircraft cabin display system Pending CN112802152A (en)

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)

* Cited by examiner, † Cited by third party
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

Patent Citations (6)

* Cited by examiner, † Cited by third party
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)

* Cited by examiner, † Cited by third party
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