CN109685875A - A kind of GPU linear light gated feature modeling optimization method - Google Patents
A kind of GPU linear light gated feature modeling optimization method Download PDFInfo
- Publication number
- CN109685875A CN109685875A CN201811522858.9A CN201811522858A CN109685875A CN 109685875 A CN109685875 A CN 109685875A CN 201811522858 A CN201811522858 A CN 201811522858A CN 109685875 A CN109685875 A CN 109685875A
- Authority
- CN
- China
- Prior art keywords
- height
- difference
- straight line
- linear light
- gpu
- 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.)
- Granted
Links
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T15/00—3D [Three Dimensional] image rendering
- G06T15/005—General purpose rendering architectures
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T11/00—2D [Two Dimensional] image generation
- G06T11/40—Filling a planar surface by adding surface attributes, e.g. colour or texture
Landscapes
- Engineering & Computer Science (AREA)
- Physics & Mathematics (AREA)
- General Physics & Mathematics (AREA)
- Theoretical Computer Science (AREA)
- Computer Graphics (AREA)
- Image Generation (AREA)
Abstract
The present invention relates to computer hardware modeling technique fields, provide a kind of GPU linear light gated feature modeling optimization method, comprising the following steps: the starting and terminal point selection of step 1, straight line selects the beginning and end of straight line;Step 2, the height for calculating each member, whens scanned straight lines, calculate the height of each member according to linear equation;Step 3, the difference in height for calculating each member and starting point, the height of straight line starting point is retained, and the difference in height of current slice member and starting point is calculated according to height value obtained in the previous step;Step 4, boundary are compared, and difference in height and straight line whole height difference that step 3 calculates are compared: when this difference in height is greater than straight line difference in height, the height of this piece member is revised as terminal height, and otherwise this piece member height is kept.The present invention solves the problems, such as that the height threshold substituted by the accumulation of error exceeds, especially the skimble-scamble problem of adjacent lines intersection point when continuous setting-out, optimizes GPU linear light gated algorithm.
Description
Technical field
The present invention relates to computer hardware modeling technique fields more particularly to a kind of GPU linear light gated feature modeling to optimize
Method.
Background technique
Graphics processor chip (lower abbreviation GPU) is usually swept according to x-axis or y-axis stepping in line of rasterization pel
It retouches, but rasterization stage is all piece member in the step units of x-axis and y-axis, therefore the height value being calculated can only be rounded.
It is bound to when line light gated there are error, when certain length is arrived in scanning, error accumulation can break through the peak of setting.It is single
When solely drawing straight line (without reference to object), error effects are unobvious;But straight line ought be continuously drawn, or drawn with wireless small straight line
When one section of circular arc, error bring visual effect be it is unacceptable, these are all the technical issues that need to address.
Summary of the invention
It is an object of the present invention to provide a kind of GPU linear light gated feature modeling optimization methods.
The technical solution of the invention is as follows:
A kind of GPU linear light gated feature modeling optimization method, comprising the following steps:
The starting and terminal point selection of step 1, straight line, selects the beginning and end of straight line;
Step 2, the height for calculating each member, whens scanned straight lines, calculate the height of each member according to linear equation;
Step 3, the difference in height for calculating each member and starting point, the height of straight line starting point is retained, is obtained according to previous step
Height value calculate current slice member and starting point difference in height;
Step 4, boundary are compared, and difference in height and straight line whole height difference that step 3 calculates are compared: when this difference in height is big
When straight line difference in height, the height of this piece member is revised as terminal height, and otherwise this piece member height is kept.
Linear equation specifically: y=kx+b, wherein k is slope, and b is intercept.
The difference in height of straight line beginning and end is calculated, this difference in height is also the maximum difference in height of whole straight line.
The scanning direction of the straight line of step 1, selection are swept from low spot to high spot scan when beginning and end height is consistent
Retouch direction selection from left to right.
Beneficial effects of the present invention:
The present invention provides a kind of feature modeling optimization method, this method includes the starting and terminal point selection of straight line, straight line
The calculating of equation, straight line difference in height calculate, linear scanning boundary is compared and handled.The present invention is solved because the accumulation of error substitutes into
Height threshold the problem of exceeding, the especially skimble-scamble problem of adjacent lines intersection point when continuous setting-out optimizes GPU line grating
Change algorithm.
Detailed description of the invention
Fig. 1 is algorithm flow chart of the invention.
Specific embodiment
In the following with reference to the drawings and specific embodiments, technical solution of the present invention is clearly and completely stated.Obviously,
The embodiment stated is only a part of the embodiment of the present invention, instead of all the embodiments, based on the embodiments of the present invention,
Those skilled in the art are not making creative work premise every other embodiment obtained, belong to guarantor of the invention
Protect range.
It is an object of the present invention to provide a kind of GPU linear light gated feature modeling optimization methods.
The technical solution of the invention is as follows:
A kind of GPU linear light gated feature modeling optimization method, comprising the following steps:
1) the starting and terminal point selection of straight line:
The beginning and end of straight line is selected, while alsoing specify the scanning direction of straight line, is selected under normal circumstances from low spot
To high spot scan, when beginning and end height is consistent, scanning direction is selected from left to right.
2) calculating of linear equation:
Linear equation can be calculated according to the terminal of selection and starting point: y=kx+b, wherein k is slope, and b is intercept.
3) straight line difference in height calculates:
The difference in height of straight line beginning and end is calculated, this difference in height is also the maximum difference in height of whole straight line.
4) linear scanning boundary is compared and is handled:
4.1) height of each member is calculated:
The height of each member is calculated when scanned straight lines according to linear equation;
4.2) difference in height of each member and starting point is calculated:
The height of straight line starting point is retained, the height of current slice member and starting point is calculated according to height value obtained in the previous step
Difference;
4.2) boundary is compared and is handled:
The difference in height that previous step calculates is compared with straight line whole height difference: when this difference in height is greater than straight line difference in height
When, the height of this piece member is revised as terminal height, and otherwise this piece member height is kept.
Embodiment:
The invention will be described in further detail with reference to the accompanying drawing, please refers to Fig. 1.
A kind of GPU linear light gated feature modeling optimization method, comprising the following steps:
The starting and terminal point selection of step 1, straight line, selects the beginning and end of straight line, while alsoing specify the scanning of straight line
Direction is selected under normal circumstances from low spot to high spot scan, when beginning and end height is consistent, scanning direction selection from a left side to
It is right.
The calculating of step 2, linear equation can calculate linear equation according to the terminal of selection and starting point: y=kx+b,
Middle k is slope, and b is intercept.
Step 3, straight line difference in height calculate, and calculate the difference in height of straight line beginning and end, this difference in height is also whole straight line
Maximum difference in height.
Step 4, the height for calculating each member, whens scanned straight lines, calculate the height of each member according to linear equation.
Step 5, the difference in height for calculating each member and starting point, the height of straight line starting point is retained, is obtained according to previous step
Height value calculate current slice member and starting point difference in height.
Step 6, boundary are compared, and the difference in height that previous step calculates are compared with straight line whole height difference: when this difference in height
When greater than straight line difference in height, the height of this piece member is revised as terminal height, and otherwise this piece member height is kept.
Claims (4)
1. a kind of GPU linear light gated feature modeling optimization method, it is characterised in that: the following steps are included:
The starting and terminal point selection of step 1, straight line, selects the beginning and end of straight line;
Step 2, the height for calculating each member, whens scanned straight lines, calculate the height of each member according to linear equation;
Step 3, the difference in height for calculating each member and starting point, the height of straight line starting point are retained, according to height obtained in the previous step
The difference in height of angle value calculating current slice member and starting point;
Step 4, boundary are compared, and difference in height and straight line whole height difference that step 3 calculates are compared: when this difference in height is greater than directly
When line difference in height, the height of this piece member is revised as terminal height, and otherwise this piece member height is kept.
2. a kind of GPU linear light gated feature modeling optimization method as described in claim 1, it is characterised in that: linear equation tool
Body are as follows: y=kx+b, wherein k is slope, and b is intercept.
3. a kind of GPU linear light gated feature modeling optimization method as described in claim 1, it is characterised in that: calculate straight line and rise
The difference in height of point and terminal, this difference in height is also the maximum difference in height of whole straight line.
4. a kind of GPU linear light gated feature modeling optimization method as described in claim 1, it is characterised in that: the straight line of step 1
Scanning direction, select from low spot to high spot scan, when beginning and end height is consistent, scanning direction select from left to right.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201811522858.9A CN109685875B (en) | 2018-12-12 | 2018-12-12 | GPU line rasterization boundary calculation optimization method |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201811522858.9A CN109685875B (en) | 2018-12-12 | 2018-12-12 | GPU line rasterization boundary calculation optimization method |
Publications (2)
Publication Number | Publication Date |
---|---|
CN109685875A true CN109685875A (en) | 2019-04-26 |
CN109685875B CN109685875B (en) | 2023-03-24 |
Family
ID=66187578
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201811522858.9A Active CN109685875B (en) | 2018-12-12 | 2018-12-12 | GPU line rasterization boundary calculation optimization method |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN109685875B (en) |
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN111091487A (en) * | 2019-11-18 | 2020-05-01 | 中国航空工业集团公司西安航空计算技术研究所 | TLM microstructure for GPU hardware line element rasterization scanning algorithm |
Citations (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JPH05128272A (en) * | 1991-10-30 | 1993-05-25 | Hitachi Telecom Technol Ltd | Intersected point calculation method in straight line plotting processing |
JP2001283230A (en) * | 2000-04-03 | 2001-10-12 | Matsushita Electric Ind Co Ltd | Segment plotting method and segment plotter |
-
2018
- 2018-12-12 CN CN201811522858.9A patent/CN109685875B/en active Active
Patent Citations (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JPH05128272A (en) * | 1991-10-30 | 1993-05-25 | Hitachi Telecom Technol Ltd | Intersected point calculation method in straight line plotting processing |
JP2001283230A (en) * | 2000-04-03 | 2001-10-12 | Matsushita Electric Ind Co Ltd | Segment plotting method and segment plotter |
Non-Patent Citations (3)
Title |
---|
田泽等: "《基于扫描线填充的三角形图元双向光栅化技术》", 《小型微型计算机系统》 * |
袁超: "《直线Bresenham生成改进算法研究》", 《四川理工学院学报》 * |
马振新: "在显示器上描绘直线的要求和几种直线生成算法之比较", 《甘肃广播电视大学学报》 * |
Cited By (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN111091487A (en) * | 2019-11-18 | 2020-05-01 | 中国航空工业集团公司西安航空计算技术研究所 | TLM microstructure for GPU hardware line element rasterization scanning algorithm |
CN111091487B (en) * | 2019-11-18 | 2023-10-20 | 中国航空工业集团公司西安航空计算技术研究所 | TLM microstructure for GPU hardware line primitive raster scanning algorithm |
Also Published As
Publication number | Publication date |
---|---|
CN109685875B (en) | 2023-03-24 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US8749551B2 (en) | System and method for constructing triangular mesh surface of point cloud | |
US7418135B2 (en) | image processing apparatus, method therefor, and program | |
US8086024B2 (en) | Defect detection apparatus, defect detection method and computer program | |
CN110675471B (en) | Node connection line generation method, device, equipment and storage medium | |
CN109685875A (en) | A kind of GPU linear light gated feature modeling optimization method | |
JP2012244633A (en) | Method for processing highlight area and saturation area in digital image | |
CN109284062B (en) | Touch data processing method, device, terminal and medium | |
KR20160069453A (en) | Image proccessing apparatus and image proccessing method | |
CN114862897B (en) | Image background processing method and device and electronic equipment | |
CN111063292B (en) | Color gamut mapping method, color gamut mapping component, display device, and storage medium | |
CN109657328B (en) | TLM microstructure for GPU hardware line rasterization boundary algorithm | |
CN113139997B (en) | Depth map processing method, storage medium and terminal device | |
US20190236423A1 (en) | Two-dimensional code processing method and apparatus | |
CN113709302B (en) | Method and system for adjusting brightness of light-emitting device, electronic device and storage medium | |
US9305340B2 (en) | Drawing device and drawing program | |
CN111192216A (en) | Lane line smoothing method and system | |
CN108121541B (en) | Method for generating suggested position when adding two-dimensional interface component to canvas | |
JP2017107366A (en) | Image processing device and pogram | |
CN109272914B (en) | Method for compensating elliptical R angle in display area | |
CN110969567B (en) | GPU line character rasterization translation coordinate system scanning method | |
CN114741188A (en) | Graphic element processing method and device, electronic equipment and storage medium | |
KR102270230B1 (en) | Image process device and image proccessing method | |
CN113989238A (en) | Method for adjusting positioning deviation of pavement crack detection frame of nuclear power plant | |
KR102304932B1 (en) | Method and apparatus for processing graphics data and recording medium thereof | |
CN116954549B (en) | Audio processing method and device and electronic equipment |
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 | ||
GR01 | Patent grant | ||
GR01 | Patent grant |