A graphic pruning method, device and medium based on spatial geometry

Through the graphic trimming method based on spatial geometry, the intersection distance and angle are calculated, and the straight line segments and arcs are redrawn, the problem of local trimming of complex graphics in the existing technology is solved, and the trimming of any two-dimensional graphics is realized to adapt to various types of The demand for the scenario.

CN114549550BActive Publication Date: 2024-12-13TONGEN (SHANGHAI) ENG TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202210135417.3
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-02-14
Publication Date
2024-12-13
Estimated Expiration
2042-02-14

AI Technical Summary

Technical Problem

Existing graphic trimming methods cannot effectively deal with the local trimming problem of complex graphics, especially when multiple two-dimensional graphics are used as trimming graphics, it cannot meet the trimming needs of various types of graphics.

Method used

The graphic trimming method based on spatial geometry is adopted to obtain the graphics that need to be trimmed and the pruned graphics, calculate the intersection distance and angle, sort the intersection points, and re-draw straight line segments and arcs to realize the trimming of any number and type of two-dimensional graphics.

Benefits of technology

It realizes the trimming of any number and type of two-dimensional graphics, adapts to various scenarios, meets the trimming needs of complex graphics, and improves the flexibility and efficiency of graphics trimming.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114549550B_ABST
    Figure CN114549550B_ABST
Patent Text Reader

Abstract

The present invention provides a graphic trimming method, device and medium based on spatial geometry. The graphic trimming method includes the following steps: S1, obtaining a graphic to be trimmed, and obtaining an inputted trimmed graphic; S2, the trimmed graphic is a straight line segment, calculating all the intersections of the trimmed graphics and the straight line segment, and then calculating the distances from these intersections to the starting point of the straight line segment; then recording the distances from the trimming point to the starting point of the straight line segment; sorting all the distances from small to large, and obtaining the graphic intersections adjacent to the trimming point according to the distance from the starting point of the straight line segment; using the starting point of the straight line segment and the left intersection as the starting point and end point of the new straight line segment, and using the right intersection and the end point of the straight line segment as the starting point and end point, and redrawing the new straight line segment; S3, the new graphic generated after trimming is placed in the trimmed graphic to perform the next intersection calculation until the trimming is completed; S4, trimming is completed, and the trimmed graphic is released. The present invention performs trimming according to the geometric properties of the graphic itself, and can adapt to various scenarios.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of graphics technology, and in particular to a graphics pruning method, device and medium based on space geometry. Background Art

[0002] Graphics pruning refers to pruning the part between any two intersections of any two-dimensional graphics in space when there are multiple intersections with other graphics on the graphics. The pruning of complex graphics can often be decomposed into the pruning of basic graphics such as straight line segments. Therefore, the pruning of basic graphics has always been a research hotspot. For example, the Liang-Barsky algorithm and the Sutherland-Hodgeman algorithm require that the pruning polygon is a rectangle, while the pruning polygon of the Greiner-Hormann algorithm and the Weiler algorithm can be a general polygon. These algorithms can efficiently remove the part of the two-dimensional graphics that exceeds the pruning polygon, but they cannot realize the local pruning problem of any two-dimensional graphics when any two-dimensional graphics are used as pruning graphics.

[0003] Due to the diversity of two-dimensional polygons, the existing graphics pruning methods cannot meet the pruning requirements of various types of graphics when all types of graphics are used as pruning graphics.

[0004] The background description provided herein is for the purpose of generally presenting the context of the present disclosure. Unless otherwise indicated herein, the materials described in this section are not prior art to the claims of this application and are not admitted to be prior art by inclusion in this section. Summary of the invention

[0005] In view of the above technical problems in the related art, the present invention proposes a graphic pruning method based on spatial geometry, which comprises the following steps:

[0006] S1, obtain the graphics to be pruned, and obtain the input pruned graphics;

[0007] S2, if the trimmed figure is a straight line segment, calculate all the intersection points of the trimmed figure and the straight line segment, and then calculate the distance from these intersection points to the starting point of the straight line segment; then record the distance from the trimming point to the starting point of the straight line segment; sort all the distances from small to large, and obtain the intersection points of the figure adjacent to the trimming point according to the distance from the starting point of the straight line segment; take the starting point of the straight line segment and the left intersection point as the starting point and end point of the new straight line segment, and take the right intersection point and the end point of the straight line segment as the starting point and end point, and redraw the new straight line segment;

[0008] S3, the new graph generated after pruning is placed in the pruned graph to perform the next intersection calculation until the pruning is completed;

[0009] S4, ends pruning and releases the pruned graphics.

[0010] Specifically, step S2 also includes:

[0011] S21, if the figure to be pruned is a multi-line segment, traverse each straight line segment of the multi-line segment, calculate the intersection of the figure on this straight line segment according to the method of finding the intersection between the straight line segment and other figures, and then record the distance and number from the intersection to the starting point of the multi-line segment; calculate the distance from the pruning point to the starting point of the multi-line segment, sort the distances of all the intersections of the figure and the starting point of the multi-line segment from small to large, and obtain the intersection of the figure adjacent to the pruning point according to the distance between the intersection of the figure and the starting point of the multi-line segment; finally, change the endpoint list of the multi-line segment and redraw the new multi-line segment.

[0012] Specifically, step S2 also includes:

[0013] S22, if the trimmed figure is a circle, record the angle between the trimming point and the line connecting the circle center and the X-axis; record all the intersection points of the trimmed circle and the trimming figure, and then calculate the angle between all the intersection points and the line connecting the circle center and the X-axis; sort all the angles from small to large, obtain the adjacent figure intersection points of the trimming point, use the two adjacent intersection points of the trimming point as the starting point and end point of the new arc, and draw a new arc.

[0014] Specifically, step S22 also includes:

[0015] S23, if the trimmed figure is an arc, determine whether the intersection point is on the arc. If the intersection point is not on the arc, the intersection point is not used as the calculated intersection point.

[0016] Specifically, step S1 specifically includes obtaining the trimmed graphics by means of frame selection.

[0017] In a second aspect, another embodiment of the present invention discloses a graphic pruning device based on spatial geometry, which includes the following units:

[0018] A pruned graphics acquisition unit, used to acquire a graphics to be pruned and to acquire an input pruned graphics;

[0019] The trimming unit is used to calculate all the intersections of the trimmed graphics and the straight line segment when the trimmed graphics are straight line segments, and then calculate the distances from these intersections to the starting point of the straight line segment; then record the distances from the trimming point to the starting point of the straight line segment; sort all the distances from small to large, and obtain the intersections of the graphics adjacent to the trimming point according to the distances from the starting point of the straight line segment; use the starting point of the straight line segment and the left intersection as the starting point and end point of the new straight line segment, and use the right intersection point and the end point of the straight line segment as the starting point and end point, and redraw the new straight line segment;

[0020] The new graphics generating unit, after trimming, places the new graphics generated into the selected two-dimensional graphics for the next intersection calculation until the trimming is completed;

[0021] Release the cell, end trimming, and release the selected 2D graphics.

[0022] Specifically, the multi-line segment pruning unit, when the pruned graphic is a multi-line segment, traverses each straight line segment of the multi-line segment, calculates the graphic intersection on this straight line segment according to the method of finding the intersection between the straight line segment and other graphics, and then records the distance and number from the intersection to the starting point of the multi-line segment; calculates the distance from the pruning point to the starting point of the multi-line segment, sorts the distances between all the graphic intersections and the starting point of the multi-line segment from small to large, and obtains the graphic intersection adjacent to the pruning point according to the distance between the graphic intersection and the starting point of the multi-line segment; finally, changes the endpoint list of the multi-line segment and redraws the new multi-line segment.

[0023] Specifically, in the circle trimming unit, the trimmed figure is a circle, and the angle between the trimming point and the center of the circle and the X-axis is recorded; all intersection points of the trimmed circle and the trimming figure are recorded, and then the angle between all intersection points and the center of the circle and the X-axis is calculated; all angles are sorted from small to large, and the adjacent figure intersection points of the trimming point are obtained, and the two adjacent intersection points of the trimming point are used as the starting point and end point of the new arc to draw a new arc.

[0024] Specifically, the arc trimming unit, the trimmed figure is an arc, that is, based on the calculation that the trimmed figure is a circle, a judgment is added as to whether the intersection point is on the arc. If the intersection point is not on the arc, the intersection point is not used as the calculated intersection point.

[0025] In a third aspect, another embodiment of the present invention discloses a non-volatile storage medium having a computer program stored thereon, wherein the computer program implements the steps of the above method when executed by a processor.

[0026] This embodiment can realize the pruning of any number of pruned graphics of any type when any number of two-dimensional graphics of any type are used as pruning graphics. This embodiment performs pruning according to the geometric properties of the graphics themselves and can adapt to various scenarios. BRIEF DESCRIPTION OF THE DRAWINGS

[0027] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.

[0028] Figure 1 It is a schematic diagram of a flow chart of a space-based graphics pruning method provided by an embodiment of the present invention;

[0029] Figure 2 is a schematic diagram of a user interface of a graphic to be pruned provided by an embodiment of the present invention;

[0030] Figure 3is a schematic diagram of trimming points and trimmed graphics provided by an embodiment of the present invention;

[0031] Figure 4 is a schematic diagram of a new graphic generated after pruning provided by an embodiment of the present invention;

[0032] Figure 5 is a schematic diagram of the intersection of a straight line segment and a trimmed figure provided by an embodiment of the present invention;

[0033] Figure 6 Schematic diagram of the starting point and trimming point of a straight line segment provided by an embodiment of the present invention;

[0034] Figure 7 is a schematic diagram of adjacent intersections provided by an embodiment of the present invention;

[0035] Figure 8 is a schematic diagram of creating a straight line segment provided by an embodiment of the present invention;

[0036] Fig. 9 is a schematic diagram of 7 straight line segments of a multi-line segment provided by an embodiment of the present invention;

[0037] Fig.10 is a schematic diagram of the intersection points on the 4th and 5th straight line segments provided in an embodiment of the present invention;

[0038] Fig.11 is a schematic diagram of the distance between the intersection point and the starting point provided by an embodiment of the present invention;

[0039] Fig.12 is a schematic diagram of the distance from the trimming point to the starting point provided by an embodiment of the present invention;

[0040] Fig.13 is a schematic diagram of creating a new multi-line segment provided by an embodiment of the present invention;

[0041] Fig.14 It is a schematic diagram of the angle between the trimming point and the line connecting the center of the circle to the x-axis provided by an embodiment of the present invention;

[0042] Fig.15 is a schematic diagram of the intersection of a pruned circle and a pruned figure provided by an embodiment of the present invention;

[0043] Fig.16 is a schematic diagram of the angles of all intersection points and the line connecting the center of the circle from the X-axis provided by an embodiment of the present invention;

[0044] Fig.17 is a schematic diagram of adjacent intersections provided by an embodiment of the present invention;

[0045] Fig.18 is a schematic diagram of creating a new arc provided by an embodiment of the present invention;

[0046] Fig.19is a schematic diagram of calculating intersection points of arcs provided by an embodiment of the present invention;

[0047] Fig. 20 is a schematic diagram of a released trimming and a trimmed graphic provided by an embodiment of the present invention;

[0048] Fig.21 is a schematic diagram of a graphic pruning device based on spatial geometry provided by an embodiment of the present invention;

[0049] Fig. 22 It is a schematic diagram of a graphic pruning device based on spatial geometry provided by an embodiment of the present invention. DETAILED DESCRIPTION

[0050] The following will be combined with the accompanying drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field belong to the scope of protection of the present invention. Embodiment 1

[0051] refer to Figure 1 This embodiment discloses a graphic pruning method based on spatial geometry, which includes the following steps:

[0052] S1, obtain the graphics to be pruned, and obtain the input pruned graphics;

[0053] Specifically, the spatial geometry-based graphics pruning method of this embodiment can be used in a graphics system with a graphical user interface, referring to Figure 2 , Figure 2 A schematic diagram of a user interface of a figure to be trimmed is shown, which includes different figures, such as a circle, a straight line segment, etc.

[0054] This embodiment first obtains the user's trimming instruction, which can be entered by clicking a command or by inputting a shortcut key, and this embodiment does not make any specific restrictions.

[0055] Specifically, after inputting the trimming command, the trimming mode is entered. The user can input the trimming graphics, for example, by selecting the trimming graphics. More generally, the trimming graphics may not be input, and all graphics in the current display interface are used as the trimming graphics by default.

[0056] In addition, the user may also obtain the trimming graphic by clicking or double-clicking or other methods, which is not specifically limited in this embodiment.

[0057] Furthermore, the user can input the trimmed graphics. For example, the user can obtain the trimmed graphics by clicking. Figure 3, the user clicks ( Figure 3 A point in the image (a cross mark in the image) is trimmed to become a trimming point, and the trimming point is located on straight line 1, so straight line 1 is the trimmed image. The other selected images are trimming images.

[0058] S2, the pruned figure is a straight line segment, calculate all the pruned figures (see Figure 5 ) and the straight line segment, and then calculate the distance from these intersection points to the starting point of the straight line segment (see Figure 6 ); then record the distance from the trimming point to the starting point of the straight line segment (see Figure 7 ). Sort all distances from small to large, and obtain the intersection of the graphics adjacent to the trimming point according to the distance from the starting point of the straight line segment (see Figure 8 ); Use the starting point of the straight line segment and the left intersection point as the starting point and end point of the new straight line segment, and use the right intersection point and the end point of the straight line segment as the starting point and end point, and redraw the new straight line segment (see Fig. 9 );

[0059] This embodiment calculates the intersection points of straight line segments, the intersection points of straight line segments and polyline segments, and the intersection points of straight line segments and circles based on spatial geometry. The intersection points of straight line segments and text are the intersection points of the four sides formed by the four corner points of the straight line segment and the text. When calculating the intersection points of straight line segments and arcs, the intersection points of the straight line segments and the circle are calculated first, and then the angles of the starting and ending points of the arc are used to determine whether the intersection points are on the arc. If so, it is the intersection point of the straight line and the arc.

[0060] S3, the new graph generated after pruning is placed in the pruned graph for the next intersection calculation (see Figure 4 ) until the trimming is complete.

[0061] S4, end pruning, release the pruned graphics (see Fig. 20 ).

[0062] The specific step S2 also includes:

[0063] S21, the figure to be pruned is a polyline segment, traverse each straight line segment of the polyline segment (see Fig.10 ), calculate the intersection point of the figure on this straight line segment according to the method of finding the intersection point of a straight line segment with other figures (see Fig.11 ), and then record the distance and number from the intersection to the starting point of the multi-line segment (see Fig.12 ); Calculate the distance from the trimming point to the starting point of the multi-line segment, sort the distances between all the graphic intersections and the starting point of the multi-line segment from small to large, and obtain the graphic intersections adjacent to the trimming point according to the distances between the graphic intersections and the starting point of the multi-line segment (see Fig.13 ); Finally, change the endpoint list of the polyline segment and redraw the new polyline segment (see Fig.14 ).

[0064] This embodiment calculates the intersection points of a polyline segment and a straight line segment, the intersection points of a polyline segment and a polyline segment, the intersection points of a polyline segment and a circle, the intersection points of a polyline segment and text, and the intersection points of a polyline segment and an arc based on spatial geometry.

[0065] The specific step S2 also includes:

[0066] S22, the trimmed figure is a circle, record the angle between the trimming point and the center of the circle and the X axis (see Fig.15 ). Record all intersections between the circle (trimmed figure) and the trimmed figure (see Fig.16 ), and then calculate the angle between all the intersection points and the line connecting the center of the circle and the X axis (see Fig.17 ). Sort all angles from small to large and obtain the adjacent graphic intersection points of the trimming point (see Fig.18 ), use the two adjacent intersection points of the trimming points as the starting point and end point of the new arc, and draw a new arc (see Fig.19 ).

[0067] This embodiment calculates the intersection points of a circle and a straight line segment, and the intersection points of a circle and a polyline segment according to spatial geometry. The intersection points of circles are calculated in three cases: coplanar (separate, tangent, and intersecting), non-coplanar and parallel, and non-coplanar and non-parallel. The calculation of the intersection points of a circle and an arc adds a judgment of whether the intersection points of a graphic are on the arc on the basis of the calculation of the intersection points of circles. The calculation of a circle and text is converted into the calculation of the four sides of the circle and text.

[0068] The specific step S2 also includes:

[0069] S23, the trimmed figure is an arc, that is, based on the calculation of the trimmed figure being a circle, a judgment is added as to whether the intersection point is on the arc. If the intersection point is not on the arc, the intersection point is not used as the calculated intersection point (see Fig. 20 ).

[0070] This embodiment can realize the pruning of any number of pruned graphics of any type when any number of two-dimensional graphics of any type are used as pruning graphics. This embodiment performs pruning according to the geometric properties of the graphics themselves and can adapt to various scenarios. Embodiment 2

[0071] refer to Fig.21 , this embodiment discloses a graphic pruning device based on spatial geometry, which includes the following units:

[0072] A pruned graphics acquisition unit, used to acquire a graphics to be pruned and to acquire an input pruned graphics;

[0073] Specifically, the spatial geometry-based graphics pruning method of this embodiment can be used in a graphics system with a graphical user interface, referring to Figure 2 , Figure 2A schematic diagram of a user interface with trimming graphics is shown, which includes different graphics, such as circles, straight line segments, etc.

[0074] This embodiment first obtains the user's trimming instruction, which can be entered by clicking a command or by inputting a shortcut key, and this embodiment does not make any specific restrictions.

[0075] Specifically, after inputting the trimming command, the trimming mode is entered. The user can input the trimming graphics, for example, by selecting the trimming graphics. More generally, the trimming graphics may not be input, and all graphics in the current display interface are used as the trimming graphics by default.

[0076] In addition, the user may also obtain the trimming graphic by clicking or double-clicking or other methods, which is not specifically limited in this embodiment.

[0077] Furthermore, the user can input the trimmed graphics. For example, the user can obtain the trimmed graphics by clicking. Figure 3 , the user clicks ( Figure 3 A point in the image (a cross mark in the image) is trimmed to become a trimming point, and the trimming point is located on straight line 1, so straight line 1 is the trimmed image. The other selected images are trimming images.

[0078] The trimming unit is used to calculate all the intersections of the trimmed graphics and the straight line segment when the trimmed graphics are straight line segments, and then calculate the distances from these intersections to the starting point of the straight line segment; and then record the distances from the trimming point to the starting point of the straight line segment. All distances are sorted from small to large, and the intersections of the graphics adjacent to the trimming point are obtained according to the distances from the starting point of the straight line segment; the starting point of the straight line segment and the left intersection point are used as the starting point and end point of the new straight line segment, and the right intersection point and the end point of the straight line segment are used as the starting point and end point, and the new straight line segment is redrawn;

[0079] This embodiment calculates the intersection points of straight line segments, the intersection points of straight line segments and polyline segments, and the intersection points of straight line segments and circles based on spatial geometry. The intersection points of straight line segments and text are the intersection points of the four sides formed by the four corner points of the straight line segment and the text. When calculating the intersection points of straight line segments and arcs, the intersection points of the straight line segments and the circle are calculated first, and then the angles of the starting and ending points of the arc are used to determine whether the intersection points are on the arc. If so, it is the intersection point of the straight line and the arc.

[0080] The new graphics generating unit, after pruning, places the new graphics generated into the pruned graphics for the next intersection calculation until the pruning is completed.

[0081] Release the unit, end trimming, and release the trimmed graphics.

[0082] The specific trimming unit also includes:

[0083] The multi-line segment pruning unit, the pruned figure is a multi-line segment, traverses each straight line segment of the multi-line segment, calculates the figure intersection on this straight line segment according to the method of finding the intersection point between the straight line segment and other figures, and then records the distance and number from the intersection point to the starting point of the multi-line segment; calculates the distance from the pruning point to the starting point of the multi-line segment, sorts the distances between all the figure intersections and the starting point of the multi-line segment from small to large, and obtains the figure intersection adjacent to the pruning point according to the distance between the figure intersection and the starting point of the multi-line segment; finally, changes the endpoint list of the multi-line segment and redraws the new multi-line segment.

[0084] This embodiment calculates the intersection points of a polyline segment and a straight line segment, the intersection points of a polyline segment and a polyline segment, the intersection points of a polyline segment and a circle, the intersection points of a polyline segment and text, and the intersection points of a polyline segment and an arc based on spatial geometry.

[0085] The specific trimming unit also includes:

[0086] Circle trimming unit, the trimmed figure is a circle, record the angle between the trimming point and the center of the circle and the X-axis. Record all the intersections of the circle (the trimmed figure) and the trimming figure, and then calculate the angle between all the intersections and the center of the circle and the X-axis. Sort all the angles from small to large, get the adjacent figure intersections of the trimming point, use the two adjacent intersections of the trimming point as the starting point and end point of the new arc, and draw a new arc.

[0087] This embodiment calculates the intersection points of a circle and a straight line segment, and the intersection points of a circle and a polyline segment according to spatial geometry. The intersection points of circles are calculated in three cases: coplanar (separate, tangent, and intersecting), non-coplanar and parallel, and non-coplanar and non-parallel. The calculation of the intersection points of a circle and an arc adds a judgment of whether the intersection points of a graphic are on the arc on the basis of the calculation of the intersection points of circles. The calculation of a circle and text is converted into the calculation of the four sides of the circle and text.

[0088] The specific trimming unit also includes:

[0089] Arc trimming unit, the trimmed figure is an arc, that is, based on the calculation that the trimmed figure is a circle, a judgment is added as to whether the intersection point is on the arc. If the intersection point is not on the arc, the intersection point is not used as the calculated intersection point.

[0090] This embodiment can realize the pruning of any number of pruned graphics of any type when any number of two-dimensional graphics of any type are used as pruning graphics. This embodiment performs pruning according to the geometric properties of the graphics themselves and can adapt to various scenarios. Embodiment 3

[0091] refer to Fig. 22 , Fig. 22: is a schematic diagram of the structure of a spatial geometry-based image cropping device of this embodiment. The spatial geometry-based image cropping device 20 of this embodiment includes a processor 21, a memory 22, and a computer program stored in the memory 22 and executable on the processor 21. When the processor 21 executes the computer program, the steps in the above method embodiment are implemented. Alternatively, when the processor 21 executes the computer program, the functions of each module / unit in the above device embodiments are implemented.

[0092] Exemplarily, the computer program may be divided into one or more modules / units, which are stored in the memory 22 and executed by the processor 21 to complete the present invention. The one or more modules / units may be a series of computer program instruction segments capable of completing specific functions, which are used to describe the execution process of the computer program in the spatial geometry-based image trimming device 20. For example, the computer program may be divided into the modules in Embodiment 2. For the specific functions of each module, please refer to the working process of the device described in the above embodiment, which will not be repeated here.

[0093] The image cropping device 20 based on spatial geometry may include, but is not limited to, a processor 21 and a memory 22. Those skilled in the art may understand that the schematic diagram is merely an example of the image cropping device 20 based on spatial geometry, and does not constitute a limitation on the image cropping device 20 based on spatial geometry, and may include more or fewer components than shown in the figure, or combine certain components, or different components, for example, the image cropping device 20 based on spatial geometry may also include input and output devices, network access devices, buses, etc.

[0094] The processor 21 may be a central processing unit (CPU), or other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. A general-purpose processor may be a microprocessor or any conventional processor, etc. The processor 21 is the control center of the spatial geometry-based image trimming device 20, and uses various interfaces and lines to connect various parts of the entire spatial geometry-based image trimming device 20.

[0095] The memory 22 can be used to store the computer program and / or module. The processor 21 realizes various functions of the image trimming device 20 based on spatial geometry by running or executing the computer program and / or module stored in the memory 22 and calling the data stored in the memory 22. The memory 22 can mainly include a program storage area and a data storage area, wherein the program storage area can store an operating system, an application required for at least one function (such as a sound playback function, an image playback function, etc.), etc.; the data storage area can store data created according to the use of the mobile phone (such as audio data, a phone book, etc.), etc. In addition, the memory 22 can include a high-speed random access memory, and can also include a non-volatile memory, such as a hard disk, a memory, a plug-in hard disk, a smart memory card (Smart Media Card, SMC), a secure digital (Secure Digital, SD) card, a flash card (Flash Card), at least one disk storage device, a flash memory device, or other volatile solid-state storage devices.

[0096] Wherein, if the module / unit integrated in the image trimming device 20 based on spatial geometry is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on such an understanding, the present invention implements all or part of the processes in the above-mentioned embodiment method, and can also be completed by instructing the relevant hardware through a computer program. The computer program can be stored in a computer-readable storage medium. When the computer program is executed by the processor 21, the steps of the above-mentioned method embodiments can be implemented. Wherein, the computer program includes computer program code, and the computer program code can be in source code form, object code form, executable file or some intermediate form. The computer-readable medium can include: any entity or device capable of carrying the computer program code, recording medium, U disk, mobile hard disk, disk, optical disk, computer memory, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), electrical carrier signal, telecommunication signal and software distribution medium, etc. It should be noted that the content contained in the computer-readable medium can be appropriately increased or decreased according to the requirements of legislation and patent practice in the jurisdiction. For example, in some jurisdictions, according to legislation and patent practice, computer-readable media does not include electrical carrier signals and telecommunication signals.

[0097] It should be noted that the device embodiments described above are merely schematic, wherein the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the scheme of this embodiment. In addition, in the accompanying drawings of the device embodiments provided by the present invention, the connection relationship between the modules indicates that there is a communication connection between them, which may be specifically implemented as one or more communication buses or signal lines. A person of ordinary skill in the art may understand and implement it without paying any creative effort.

[0098] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principle of the present invention should be included in the protection scope of the present invention.

Claims

1. A graphics pruning method based on spatial geometry, comprising the following steps: S1, obtain the graphics to be pruned, and obtain the input pruned graphics; S2, if the trimmed figure is a straight line segment, calculate all the intersection points of the trimmed figure and the straight line segment, and then calculate the distances from these intersection points to the starting point of the straight line segment; then record the distances from the trimmed point to the starting point of the straight line segment; sort all the distances from small to large, and obtain the intersection points of the figures adjacent to the trimmed point according to the distances from the starting point of the straight line segment; Use the starting point of the straight line segment and the left intersection point as the starting point and end point of the new straight line segment, and use the right intersection point and the end point of the straight line segment as the starting point and end point, and redraw the new straight line segment; S3, the new graph generated after pruning is placed in the pruned graph to perform the next intersection calculation until the pruning is completed; S4, end pruning and release the pruned graphics; Step S2 also includes: S21, if the figure to be pruned is a multi-line segment, traverse each straight line segment of the multi-line segment, calculate the intersection of the figure on this straight line segment according to the method of finding the intersection between the straight line segment and other figures, and then record the distance and number from the intersection to the starting point of the multi-line segment; calculate the distance from the pruning point to the starting point of the multi-line segment, sort the distances of all the intersections of the figure and the starting point of the multi-line segment from small to large, and obtain the intersection of the figure adjacent to the pruning point according to the distance between the intersection of the figure and the starting point of the multi-line segment; finally, change the endpoint list of the multi-line segment and redraw the new multi-line segment; Step S2 also includes: S22, if the trimmed figure is a circle, record the angle between the trimming point and the line connecting the circle center and the X-axis; record all the intersection points of the trimmed circle and the trimmed figure, and then calculate the angle between the line connecting all the intersection points and the circle center and the X-axis; sort all the angles from small to large, obtain the adjacent figure intersection points of the trimming point, use the two adjacent intersection points of the trimming point as the starting point and end point of the new arc, and draw a new arc; Step S22 also includes: S23, if the trimmed figure is an arc, determine whether the intersection point is on the arc. If the intersection point is not on the arc, the intersection point is not used as the calculated intersection point.

2. According to the method of claim 1, step S1 specifically includes obtaining the trimming figure by frame selection.

3. A graphic pruning device based on spatial geometry, comprising the following units: A pruned graphics acquisition unit, used to acquire a graphics to be pruned and to acquire an input pruned graphics; The trimming unit is used to calculate all the intersections of the trimmed graphics and the straight line segments when the trimmed graphics are straight line segments, and then calculate the distances from these intersections to the starting points of the straight line segments; then record the distances from the trimming points to the starting points of the straight line segments; sort all the distances from small to large, and obtain the intersections of the graphics adjacent to the trimming points according to the distances from the starting points of the straight line segments; Use the starting point of the straight line segment and the left intersection point as the starting point and end point of the new straight line segment, and use the right intersection point and the end point of the straight line segment as the starting point and end point, and redraw the new straight line segment; The new graphics generating unit, after trimming, places the new graphics generated into the selected two-dimensional graphics for the next intersection calculation until the trimming is completed; Release the unit, end trimming, and release the selected two-dimensional graphics; The multi-line segment pruning unit, the pruned figure is a multi-line segment, traverses each straight line segment of the multi-line segment, calculates the intersection point of the figure on this straight line segment according to the method of finding the intersection point of the straight line segment and other figures, and then records the distance and number from the intersection point to the starting point of the multi-line segment; Calculate the distance from the trimming point to the starting point of the multi-line segment, sort the distances between all the graphic intersections and the starting point of the multi-line segment from small to large, and obtain the graphic intersections adjacent to the trimming point based on the distances between the graphic intersections and the starting point of the multi-line segment; Finally, change the endpoint list of the polyline segment and redraw the new polyline segment; The circle trimming unit, the trimmed figure is a circle, and the angle between the trimming point and the center of the circle and the X-axis is recorded; all the intersection points between the trimmed circle and the trimming figure are recorded, and then the angle between the line connecting all the intersection points and the center of the circle and the X-axis is calculated; all the angles are sorted from small to large, and the adjacent figure intersection points of the trimming point are obtained, and the two adjacent intersection points of the trimming point are used as the starting point and end point of the new arc to draw a new arc; Arc trimming unit, the trimmed figure is an arc, that is, based on the calculation that the trimmed figure is a circle, a judgment is added as to whether the intersection point is on the arc. If the intersection point is not on the arc, the intersection point is not used as the calculated intersection point.

4. A non-volatile storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 2 are implemented.