Summary of the invention
The purpose of the present invention is to solve the defects that triangle filling speed in the prior art is slow, provide a kind of for light
Quarter, the triangle fill method of machine Grid of vector data solved the above problems.
To achieve the goals above, technical scheme is as follows:
A kind of triangle fill method for litho machine Grid of vector data, comprising the following steps:
Triangle pretreatment carries out line segment split-packet to triangle, and the line segment split-packet is located at first quartile
It is interior;
The coordinate value for calculating the X point under identical Y value carries out parallel processing for the line segment grouping in line segment aggregate Z, counts
Calculate the coordinate value of X point under identical Y value;
Data filling carries out parallel filling processing to the line segment grouping in line segment aggregate Z.
Below the triangle preprocess method:
Triangle is carried out in rectangular coordinate system to judge three sides of a triangle two-by-two laterally to cross on the basis of Y value
Between whether there is the identical coordinate points of Y value;If it exists, the identical two edges of coordinate points Y value will be present to be grouped, form line
Section grouping, all line segment grouping composition line segment aggregate Z.
Under the identical Y value of described calculating X point coordinate value the following steps are included:
For the line segment grouping in line segment aggregate Z, the identical X axis coordinate point x of Y value is calculatedaAnd xb;
It calculates current line segment Y value and corresponds to X axis coordinate point xaValue, calculation formula is as follows:
xa=(x1(y2-y0)-x2(y1-y0))/x2(y1-y0)
Wherein, (x1,y1) and (x2,y2) it is respectively point xaThe extreme coordinates value of place line segment, y0For the Y of current coordinate point
Value;
It calculates current line segment Y value and corresponds to X axis coordinate point xbValue, calculation formula is as follows:
xb=(x3(y4-y0)-x4(y3-y0))/x4(y3-y0)
Wherein, (x3,y3) and (x4,y4) it is respectively point xbThe extreme coordinates value of place line segment, y0For the Y of current coordinate point
Value.
The described data filling the following steps are included:
Set look-up table H and look-up table G;
To the two lines section in line segment grouping, on the basis of Y value, by the identical two intersection point x of Y valueaAnd xbBetween filled out
It fills;Its fill method is as follows:
Compare xaAnd xbSize, if xa> xb, then by xaValue is assigned to xLarge,By xbValue is assigned to xsmall;
If xa< xb, then by xbValue is assigned to xLarge,By xaValue is assigned to xsmall;
With xlargeValue establish look-up table H, with xsmallValue establish look-up table G;
In look-up table H, by xlargeX is arranged in the left sidelargeA 1, xlargeThe right settingA 0, whereinFor picture
Overall width;
In look-up table G, by xsmallX is arranged in the left sidesmallA 0, xsmallThe right settingA 1, whereinFor picture
Overall width;
Look-up table H and look-up table G are carried out and arithmetic operation, then xlargeWith xsmallBetween filling finish.
Beneficial effect
A kind of triangle fill method for litho machine Grid of vector data of the invention, leads to compared with prior art
The filling that FPGA technology realizes triangle is crossed, filling speed is improved, to improve the production capacity of direct-write lithography machine.The present invention saves
The length of FPGA assembly line, while saving FPGA resource, multichannel in the case where same resource may be implemented while filling.Together
When the present invention draw and become without using BRESENHAM line algorithm, compared with being filled after BRESENHAM line algorithm, RAM resource benefit
With less.The parallel processing of each step can be achieved, and have programmable features.
Specific embodiment
The effect of to make to structure feature of the invention and being reached, has a better understanding and awareness, to preferable
Examples and drawings cooperation detailed description, is described as follows:
As shown in Figure 1, a kind of triangle fill method for litho machine Grid of vector data of the present invention, packet
Include following steps:
The first step, triangle pretreatment.Line segment split-packet is carried out to triangle, the line segment split-packet is located at the
In one quadrant, triangle is split into the combination of line segment.Below its method for splitting:
Triangle is carried out in rectangular coordinate system to judge three sides of a triangle two-by-two laterally to cross on the basis of Y value
Between whether there is the identical coordinate points of Y value.If it exists, the identical two edges of coordinate points Y value will be present to be grouped, form line
Section grouping, all line segment grouping composition line segment aggregate Z.
As shown in Figure 2 a, the lateral scribing line to being carried out in triangle ABC on the basis of Y value, then it can be found that composition triangle
In three line segments AB, BC, AC of shape, a upper scribing line, generates intersection point x in line segment AB and line segment AC respectively in Fig. 2aAnd xb,
Middle xaFor a bit on line segment AB, xbFor a bit on line segment AC.Equally, next scribing line in Fig. 2 a, in line segment BC and line
Intersection point x is generated respectively in section ACcAnd xd, wherein xcFor a bit on line segment BC, xdFor a bit on line segment AC.Therefore, exist
Triangle ABC in Fig. 2 a is AB and AC and AC and BC there are the side of the identical coordinate points of Y value.As shown in Figure 2 b, will
While AB and while AC form line segment and be grouped ABAC, as shown in Figure 2 c, by while AC and while BC form a line segment and be grouped ACBC, and
Line segment grouping ABAC and line segment grouping ACBC then form line segment aggregate Z.Shown in Fig. 2 a, while AB with while BC that Y value is then not present is identical
The case where, therefore, this two sides do not form line segment grouping.
Second step calculates the coordinate value of the X point under identical Y value.Located parallel for the line segment grouping in line segment aggregate Z
Reason, calculates the coordinate value of X point under identical Y value.Using the parallel processing technique of FPGA, to multiple lines in line segment aggregate Z
Section grouping carries out parallel processing.By taking Fig. 2 a as an example, the line segment grouping ABAC and line segment split at this by upper step is grouped ACBC,
ABAC is grouped to line segment simultaneously and line segment is grouped ACBC parallel processing.Calculate the coordinate of X point under identical Y value on line segment grouping ABAC
Value, i.e. xaAnd xb;Calculate the coordinate value of X point under identical Y value on line segment grouping ABAC and line segment grouping ACBC, i.e. xcAnd xd, thus
Improve processing speed.Wherein steps are as follows for the calculating of a certain line segment grouping:
(1) for the line segment grouping in line segment aggregate Z, the identical X axis coordinate point x of Y value is calculatedaAnd xb.Herein with line
For section grouping ABAC, there are multiple Y values thereon, it is therefore desirable to calculate corresponding X axis coordinate point x for each Y valuea
And xb, just it is able to achieve to X axis coordinate point xaWith xbBetween filling.It, can be using ascending order in order for the calculating of different Y values
It carries out, i.e., sequentially calculates y0、y1、y2…yn;It can also be carried out in order using descending, i.e., sequentially calculate yn…y2、y1、y0;It can also
It is calculated with being arbitrarily directed to Y value, is arrived as long as the Y value being involved in calculates.
(2) as shown in figure 3, calculating current line segment Y value corresponds to X axis coordinate point xaValue, calculation formula is as follows:
xa=(x1(y2-y0)-x2(y1-y0))/x2(y1-y0)
Wherein, (x1,y1) and (x2,y2) it is respectively point xaThe extreme coordinates value of place line segment, y0For current coordinate point (xaInstitute
Be related to) Y value.
(3) it calculates current line segment Y value and corresponds to X axis coordinate point xbValue, calculation formula is as follows:
xb=(x3(y4-y0)-x4(y3-y0))/x4(y3-y0)
Wherein, (x3,y3) and (x4,y4) it is respectively point xbThe extreme coordinates value of place line segment, y0For current coordinate point (xaInstitute
Be related to) Y value.
Similarly, it also uses above method to be grouped ABAC parallel computation with line segment in line segment grouping ACBC and goes out corresponding X value.?
After upper the end of the step, by taking Fig. 2 b and Fig. 2 c as an example, it is grouped on ABAC and line segment grouping ACBC in line segment, has calculated that identical Y value
Corresponding xaAnd xbOr xcAnd xd, in subsequent step, it is only necessary to be directed to xaAnd xbOr xcAnd xdIt is filled 1.
Third step, data filling carry out parallel filling processing to the line segment grouping in line segment aggregate Z.Equally, it carries out herein
Filling processing also can be based on FPGA technology and carry out parallel processing, and the lookup in FPGA Programmable Technology is applied in this step
Table technology, thus by multiple xaAnd xbOr xcAnd xdIt is included in look-up table, then directly carries out the logical operation between two tables,
To quickly calculate the coordinate points that need to fill 1.The specific steps of which are as follows:
(1) according to FPGA technology, look-up table H and look-up table G is set, look-up table H is for storing xaWith xbTwo o'clock ratio is larger
Point coordinate set, look-up table G is for storing xaWith xbLesser coordinate set of two o'clock ratio.
(2) ACBC or line segment grouping ABAC are grouped to the two lines section in line segment grouping, such as line segment.On the basis of Y value,
This is by taking line segment is grouped ABAC as an example, by the identical two intersection point x of Y valueaAnd xbBetween be filled.Its fill method is as follows:
A, compare xaAnd xbSize, if xa> xb, then by xaValue is assigned to xlarge, by xbValue is assigned to xsmall;
If xa< xb, then by xbValue is assigned to xlarge, by xaValue is assigned to xsmall.Since computer calculates xaAnd xbValue after,
It is it is not apparent how be based on xaAnd xbCarry out the filling (filling 1) of image block.Therefore x is designed hereinlargeAnd xsmallTwo changes
Magnitude, cooperation are filled, wherein xlargeIndicate xaAnd xbBetween the larger value, xsmallIndicate xaAnd xbBetween smaller value.
B, with xlargeValue establish look-up table H, with xsmalValue establish look-up table G, be equivalent to herein by searching for table H and
Line segment is grouped the corresponding X-coordinate value of the identical Y value of AB and AC on ABAC and is gathered by look-up table G.
C, in look-up table H, by xlargeX is arranged in the left sidelargeA 1, i.e., it is more a little bigger for X value, by its left side 0 to xlarge
Range is set as 1;xlargeThe right settingA 0, i.e., it is more a little bigger for X value, by its right xlargeExtremelyIt is all set to 0.For picture overall width, usually 256.
D, in look-up table G, by xsmallX is arranged in the left sidesmallA 0, i.e., for X value compared with dot, its left side 0 of needle to xsmall
Range is set as 0;xsmallThe right settingA 1, i.e., for X value compared with dot, for its right xsmallExtremelyIt is all set to
1.EquallyFor picture overall width, usually 256.
E, by look-up table H and look-up table G progress and arithmetic operation, it is then just 1 that with operation, only the two, which is 1,
Therefore by look-up table H and look-up table G carry out with after operation, it is concluded that xlargeWith xsmallBetween be 1 structure, then complete
xlargeWith xsmallBetween filling.
After to all line segments grouping in line segment aggregate Z simultaneously parallel filling processing, the filling work of triangle ABC is complete
At.The parallel processing for utilizing FPGA herein, not only may be implemented the parallel filling of ABAC, BCAC, can also realize multiple triangles
The parallel filling of shape improves filling speed, filling while 16 triangles at most may be implemented.
The basic principles, main features and advantages of the present invention have been shown and described above.The technology of the industry
Personnel are it should be appreciated that the present invention is not limited to the above embodiments, and what is described in the above embodiment and the description is only the present invention
Principle, various changes and improvements may be made to the invention without departing from the spirit and scope of the present invention, these variation and
Improvement is both fallen in the range of claimed invention.The present invention claims protection scope by appended claims and its
Equivalent defines.