CN107067449A - A kind of polygonal rectangular window cutting system - Google Patents

A kind of polygonal rectangular window cutting system Download PDF

Info

Publication number
CN107067449A
CN107067449A CN201710247017.0A CN201710247017A CN107067449A CN 107067449 A CN107067449 A CN 107067449A CN 201710247017 A CN201710247017 A CN 201710247017A CN 107067449 A CN107067449 A CN 107067449A
Authority
CN
China
Prior art keywords
summit
line segment
intersection point
region code
zero
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
CN201710247017.0A
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.)
Individual
Original Assignee
Individual
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 Individual filed Critical Individual
Priority to CN201710247017.0A priority Critical patent/CN107067449A/en
Publication of CN107067449A publication Critical patent/CN107067449A/en
Pending legal-status Critical Current

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T11/002D [Two Dimensional] image generation
    • G06T11/60Editing figures and text; Combining figures or text

Landscapes

  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Image Generation (AREA)

Abstract

The invention belongs to graph processing technique field, more particularly to a kind of polygonal rectangular window cutting system, including input unit, processing center and storage part, the present invention is solved in the presence of largely computing repeatedly, algorithm is complicated and the problem of low efficiency, with improving efficiency of algorithm, good adaptability, it is directly perceived efficiently, when improving user's cutting figure experience effect advantageous effects.

Description

A kind of polygonal rectangular window cutting system
Technical field
The invention belongs to graph processing technique field, more particularly to a kind of polygonal rectangular window cutting system.
Background technology
In vector graphics rendering system, figure to display is often more much larger than window, therefore need not in order to reduce The drafting wanted using display window, it is necessary to cut vector graphics, so as to improve the efficiency of display.It is graphics system that two dimension, which is cut, In one of the most basic, the most commonly used operation, and the cutting of all X-Y schemes can be attributed to the cutting of shape changeable, Traditional trimming algorithm mainly has Sutherland-Hodgman algorithms and Liang-Barsky algorithms.Itself all it is as straight Line clipping algorithm, polygon is then cut, be by window while where straight line by while cut, for rectangular window Exactly need the cropped polygon of four traversals.The core of Cohen-Sutherland line cutting algorithms is all straight lines End points distributes one and represents 4 binary region codes of its relative position, thus judge straight line and position relationship rapidly and Give up the line segment outside window, why efficiency comparison is low for traditional polygon clipping method, wherein topmost reason is exactly Need to cut polygon using each edge of window successively, prior art exist largely compute repeatedly, algorithm complexity and The problem of efficiency is low.
The content of the invention
The present invention provides a kind of polygonal rectangular window cutting system, to solve in above-mentioned background technology in terms of a large amount of repetitions The problem of calculation, complicated algorithm and low efficiency.
Technical problem solved by the invention is realized using following technical scheme:A kind of polygonal rectangular window is cut out Cut system, it is characterised in that including:Input unit, processing center and storage part;
The processing center is used for:
Region code is obtained respectively to the first summit and the second summit, the region code of region code and the second summit to the first summit is entered Row xor operation and/or operation;
If the result of xor operation is zero, whether the region code for judging the second summit is zero, if the region code on the second summit is Zero, it is determined that the line segment of input does not record the second summit outside window, if the region code on the second summit is not zero, it is determined that defeated The line segment entered is in window and by the second summit journal in result set;
If the result of xor operation is not zero, whether the region code for judging the second summit is zero, if the region code on the second summit It is zero, it is determined that window intersection point is simultaneously recorded in order note by the line segment of input and the line segment intersection formation window intersection point of rectangular window Record in result set, if the region code on the second summit is zero, it is determined that the line segment intersection shape of the line segment of input and two rectangular windows Into the first intersection point and the second intersection point, the first described intersection point is recorded in result set, second intersection point is not recorded in result set And the line segment intersection formation that the first intersection point and the second summit are defined as draw up line segment and a rectangular window is drawn up intersection point and will Intersection point journal draw up in result set.
Further, two end regions yard that obtain are to be computed obtaining two end regions codes or through acquisition two of tabling look-up Individual end region code.
Further, the input unit is used for the first summit and the second summit for inputting any one line segment of polygon.
Further, the storage part is used to store result set.
Beneficial effects of the present invention are:
1 this patent is using input unit, processing center and storage part is included, and the processing center is used for:To the first summit and second Summit obtains region code respectively, and the region code of region code and the second summit to the first summit carries out xor operation and/or operation, If the result of xor operation is zero, whether the region code for judging the second summit is zero, if the region code on the second summit is zero, It is determined that the line segment of input does not record the second summit outside window, if the region code on the second summit is not zero, it is determined that input Line segment, in result set, if the result of xor operation is not zero, judges the second top in window and by the second summit journal Whether the region code of point is zero, if the region code on the second summit is zero, it is determined that the line segment of input and the line segment phase of rectangular window Friendship forms window intersection point and window intersection point is recorded in into journal in result set, if the region code on the second summit is zero, really Surely line segment intersection the first intersection point of formation and the second intersection point of the line segment inputted and two rectangular windows, the first described intersection point is remembered Record in result set, second intersection point is not recorded in result set and the first intersection point and the second summit are defined as into a line segment of drawing up Intersection point and the intersection point journal that will draw up are drawn up in result set with the formation of the line segment intersection of rectangular window, due to that can cut complexity Polygon, and can retain summit order, it is most important that only need to once travel through shape changeable vertex sequence, greatly improve Efficiency of algorithm.
The multiplication cross opposite vertexes and linear relation of 2 this patent bivectors are differentiated, in window completely in the side of straight line In the case of need not find intersection.For the particularity of rectangular window, a kind of polygonal method of cutting out has been invented --- it is based on The polygon fast cutting method of rectangular window.This method can not only simple, intuitive efficiently, also with good adaptability.
3 this patents obtain rapidly the position relationship with window, according to polygonal by the region code of two end points of line segment Order addition intersection point, summit or window summit, all steps of operation one are completed, the characteristics of algorithm has intuitively efficiently.
4th, this patent has wide range of applications, and improves experience effect when user cuts figure.
Brief description of the drawings
Fig. 1 is a kind of structure chart of polygonal rectangular window cutting system of the present invention;
Fig. 2 is a kind of schematic diagram of polygonal rectangular window cutting system of the present invention.
Embodiment
The present invention is described further below in conjunction with accompanying drawing:
In figure:1- input units, 2- processing centers, 3- storage parts.
Embodiment:
The present embodiment includes:As shown in figure 1, a kind of polygonal rectangular window cutting system, including input unit 1, processing center 2 With storage part 3;
The processing center 2 is used for:
Region code is obtained respectively to the first summit and the second summit, the region code of region code and the second summit to the first summit is entered Row xor operation and/or operation;
If the result of xor operation is zero, whether the region code for judging the second summit is zero, if the region code on the second summit is Zero, it is determined that the line segment of input does not record the second summit outside window, if the region code on the second summit is not zero, it is determined that defeated The line segment entered is in window and by the second summit journal in result set;
If the result of xor operation is not zero, whether the region code for judging the second summit is zero, if the region code on the second summit It is zero, it is determined that window intersection point is simultaneously recorded in order note by the line segment of input and the line segment intersection formation window intersection point of rectangular window Record in result set, if the region code on the second summit is zero, it is determined that the line segment intersection shape of the line segment of input and two rectangular windows Into the first intersection point and the second intersection point, the first described intersection point is recorded in result set, second intersection point is not recorded in result set And the line segment intersection formation that the first intersection point and the second summit are defined as draw up line segment and a rectangular window is drawn up intersection point and will Intersection point journal draw up in result set.
Due to the polygon of complexity can be cut, and summit order can be retained, it is most important that only need to once time Shape changeable vertex sequence is gone through, efficiency of algorithm is substantially increased.
Further, the multiplication cross opposite vertexes and linear relation of bivector are differentiated, in window completely in the side of straight line In the case of need not find intersection.For the particularity of rectangular window, a kind of polygonal method of cutting out has been invented --- it is based on The polygon fast cutting method of rectangular window.This method can not only simple, intuitive efficiently, also with good adaptability.
It is described to obtain two end region codes to be computed obtaining two end region codes or obtain two end points through tabling look-up Region code.
The input unit 1 is used for the first summit and the second summit for inputting any one line segment of polygon.
The storage part 3 is used to store result set.
By the region code of two end points of line segment, the position relationship with window is obtained rapidly, is added according to polygonal order Plus intersection point, summit or window summit, all steps of operation one completions, the characteristics of algorithm has directly perceived efficient
Operation principle:As shown in figure 1, this patent calculates the region code of two end points of line segment first, two region codes are carried out different Or or operation.The result of XOR is equal to 0 and represents that line segment, in same area, now directly can add or abandon the line segment.It is different Or result be not equal to 0, then analyzed according to different values, each value all corresponds to two to a kind similar situation, Wo Menke To judge whether line segment intersects with window according to XOR value, and intersect with any a line of window, reduce intersecting computing. If the result of XOR is not 0, at this moment line segment and window can regard some summit that straight line bypasses window as also without intersection point, Window summit can also regard the projection on window of line segment as, therefore addition window summit is into result set, because adding twice Plus same vertices are nonsensical, so in order to simplify result, it is only necessary to which addition is once.The result obtained after once traveling through It is possibly comprised on window edge and overlaps and line segment in opposite direction, what problem this will not brings for figure shows, We can also will further cut result and be split as the figure of multiple simple, intuitives, but the premise so done is recorded in window Each intersection point and order on each bar side of mouth, while also needing to carry out route searching, add amount of calculation, therefore in blank map Do not use this method during the cutting of shape, the present invention is solved in the presence of largely computing repeatedly, complicated algorithm and the problem of low efficiency, is had Be improved efficiency of algorithm, good adaptability, it is directly perceived efficiently, improve the Advantageous of experience effect when user cuts figure Effect.
Using technical scheme, or those skilled in the art is under the inspiration of technical solution of the present invention, design Go out similar technical scheme, and reach above-mentioned technique effect, be to fall into protection scope of the present invention.

Claims (4)

1. a kind of polygonal rectangular window cutting system, it is characterised in that including input unit, processing center and storage part;
The processing center is used for:
Region code is obtained respectively to the first summit and the second summit, the region code of region code and the second summit to the first summit is entered Row xor operation and/or operation;
If the result of xor operation is zero, whether the region code for judging the second summit is zero, if the region code on the second summit is Zero, it is determined that the line segment of input does not record the second summit outside window, if the region code on the second summit is not zero, it is determined that defeated The line segment entered is in window and by the second summit journal in result set;
If the result of xor operation is not zero, whether the region code for judging the second summit is zero, if the region code on the second summit It is zero, it is determined that window intersection point is simultaneously recorded in order note by the line segment of input and the line segment intersection formation window intersection point of rectangular window Record in result set, if the region code on the second summit is zero, it is determined that the line segment intersection shape of the line segment of input and two rectangular windows Into the first intersection point and the second intersection point, the first described intersection point is recorded in result set, second intersection point is not recorded in result set And the line segment intersection formation that the first intersection point and the second summit are defined as draw up line segment and a rectangular window is drawn up intersection point and will Intersection point journal draw up in result set.
2. a kind of polygonal rectangular window cutting system according to claim 1, it is characterised in that the acquisition two End region code is to be computed obtaining two end regions codes or two end region codes are obtained through tabling look-up.
3. a kind of polygonal rectangular window cutting system according to claim 1, it is characterised in that the input unit is used In first summit and the second summit of input any one line segment of polygon.
4. a kind of polygonal rectangular window cutting system according to claim 1, it is characterised in that the storage part is used In storage result set.
CN201710247017.0A 2017-04-17 2017-04-17 A kind of polygonal rectangular window cutting system Pending CN107067449A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201710247017.0A CN107067449A (en) 2017-04-17 2017-04-17 A kind of polygonal rectangular window cutting system

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201710247017.0A CN107067449A (en) 2017-04-17 2017-04-17 A kind of polygonal rectangular window cutting system

Publications (1)

Publication Number Publication Date
CN107067449A true CN107067449A (en) 2017-08-18

Family

ID=59600207

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201710247017.0A Pending CN107067449A (en) 2017-04-17 2017-04-17 A kind of polygonal rectangular window cutting system

Country Status (1)

Country Link
CN (1) CN107067449A (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107909623A (en) * 2017-11-30 2018-04-13 东华大学 A kind of rectangular window method of cutting out based on Projective decomposition
CN109272955A (en) * 2018-11-06 2019-01-25 信利半导体有限公司 GIP trace-diagram processing method and GIP trace-diagram processing unit

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107909623A (en) * 2017-11-30 2018-04-13 东华大学 A kind of rectangular window method of cutting out based on Projective decomposition
CN109272955A (en) * 2018-11-06 2019-01-25 信利半导体有限公司 GIP trace-diagram processing method and GIP trace-diagram processing unit
CN109272955B (en) * 2018-11-06 2021-02-12 信利半导体有限公司 GIP routing graph processing method and GIP routing graph processing device

Similar Documents

Publication Publication Date Title
CN102622370B (en) Method and device for acquisition of route description and electronic map server
EP2369565B1 (en) Method for re-using photorealistic 3d landmarks for nonphotorealistic 3d maps
CN110889014B (en) D 3-based display method of enterprise association relationship map
CN107798721A (en) A kind of processing method and processing device of cloud data and point cloud rendering intent and device
CN102360507A (en) Polygon clipping method based on intersection point sorting
CN109238298A (en) A kind of unmanned paths planning method with avoidance
CN110362927A (en) A kind of BIM model light-weight technologg method and system that multilayer optimizes step by step
CN107067449A (en) A kind of polygonal rectangular window cutting system
CN106251331A (en) The extracting method of atural object in a kind of inclination measurement scene
WO2024037236A1 (en) Intersection plane generation method and apparatus, device, storage medium and program product
CN104216333B (en) The method for realizing cut-sytle pollination in digital control system based on two-dimensional development figure
CN106897043B (en) Data super-high-resolution display system and display method applied to spliced screen
CN104462204A (en) Visualization method of two sorts of associated hierarchical data
Schulz Drawing graphs with few arcs
CN101394489B (en) Subtitle rendering efficiency bottle neck automatically positioning method based on template and parameter step length
CN104143214A (en) Electronic map polygon triangulation method and device
CN110389992A (en) Method for visualizing, device, equipment and the storage medium of navigation vector data
CN101449293A (en) Multi-track of video objects
Hayashi et al. Initial positioning method for online and real-time dynamic graph drawing of time varying data
CN106296824B (en) A kind of T-mesh local refinement implementation method based on half of data structure
CN103310409B (en) A kind of Tile-based renders the fast triangle block method of framework GPU
CN102663805A (en) Projection-based view frustum cutting method
CN105513008B (en) A kind of image processing method and device
CN103886118B (en) Re-synthesis method for integrated circuit heterogeneous logic unit
CN105718233A (en) Distortion-free drawing method of head up display multi-line-width triangle

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
WD01 Invention patent application deemed withdrawn after publication

Application publication date: 20170818

WD01 Invention patent application deemed withdrawn after publication