CN117351064A - Method and device for calculating filling cumulative area, storage medium and computer equipment - Google Patents

Method and device for calculating filling cumulative area, storage medium and computer equipment Download PDF

Info

Publication number
CN117351064A
CN117351064A CN202311542692.8A CN202311542692A CN117351064A CN 117351064 A CN117351064 A CN 117351064A CN 202311542692 A CN202311542692 A CN 202311542692A CN 117351064 A CN117351064 A CN 117351064A
Authority
CN
China
Prior art keywords
closed
area
curves
region
boundary
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
Application number
CN202311542692.8A
Other languages
Chinese (zh)
Other versions
CN117351064B (en
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.)
Zwcad Software Co ltd
Original Assignee
Zwcad Software Co ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Zwcad Software Co ltd filed Critical Zwcad Software Co ltd
Priority to CN202311542692.8A priority Critical patent/CN117351064B/en
Publication of CN117351064A publication Critical patent/CN117351064A/en
Application granted granted Critical
Publication of CN117351064B publication Critical patent/CN117351064B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/60Analysis of geometric attributes
    • G06T7/62Analysis of geometric attributes of area, perimeter, diameter or volume
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/10Segmentation; Edge detection
    • G06T7/187Segmentation; Edge detection involving region growing; involving region merging; involving connected component labelling

Landscapes

  • Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • Computer Vision & Pattern Recognition (AREA)
  • General Physics & Mathematics (AREA)
  • Theoretical Computer Science (AREA)
  • Geometry (AREA)
  • Image Analysis (AREA)
  • Image Generation (AREA)

Abstract

The application provides a method and a device for calculating a filling cumulative area, a storage medium and computer equipment. The method comprises the following steps: identifying a closed boundary of the target graphic; defining a boundary direction for a closed boundary of the target graph, and constructing a graph structure; if the graph structure has overlapping curves, identifying the number of curves with the boundary direction being clockwise and the number of curves with the boundary direction being anticlockwise in each group of overlapping curves; based on the number of the clockwise curves and the number of the anticlockwise curves in each group of overlapping curves, counteracting the overlapping curves in opposite directions, and performing secondary duplicate removal if the number of the remaining overlapping curves in the same direction after counteraction is multiple, wherein the graph structure after treatment is used as a first graph; traversing a curve in the first graph based on the randomly selected search direction, identifying an effective occlusion region in the graph structure; and calculating the coverage area of the effective closed area to obtain the filling accumulated area. The method and the device can improve the calculation efficiency and accuracy of the filling accumulation area.

Description

Method and device for calculating filling cumulative area, storage medium and computer equipment
Technical Field
The present disclosure relates to the field of computer aided design, and in particular, to a method and apparatus for calculating a filling cumulative area, a storage medium, and a computer device.
Background
Computer aided design (Computer Aided Design, CAD) is a technique for assisting a designer in performing a design work by using a computer, and is widely used in the fields of building construction, interior design, mechanical drawing, and the like.
When designing by CAD, the filling accumulated area needs to be calculated based on the graph drawn by the user, in the prior art, the filling construction area is generally adopted, the final area calculation area is obtained by utilizing the union of three-dimensional Boolean operation, the calculated amount is large, and the calculation efficiency is low.
Disclosure of Invention
The embodiment of the application provides a method, a device, a storage medium and computer equipment for calculating a filling accumulation area, which can improve the calculation efficiency and accuracy of the filling accumulation area.
In a first aspect, the present application provides a method for calculating a filling cumulative area, the method including:
identifying a closed boundary of the target graphic;
defining a boundary direction for a closed boundary of the target graph; wherein the boundary direction of the closed boundary of the outermost layer is defined as the same direction; for closed boundaries with inclusion relationships, the boundary directions of the closed boundaries of adjacent levels are opposite;
constructing a graph structure based on the target graph after defining the boundary direction; the graph structure has no intersecting curve, no single-degree node and no single-degree node association curve;
if the graph structure has overlapping curves, identifying the number of curves with the boundary direction being clockwise and the number of curves with the boundary direction being anticlockwise in each group of overlapping curves;
based on the number of the clockwise curves and the number of the anticlockwise curves in each group of overlapping curves, canceling the overlapping curves in opposite directions one by one, if the number of the remaining overlapping curves in the same direction after canceling is multiple, performing secondary duplication elimination, and taking the processed graph structure as a first graph;
traversing a curve in the first graph based on a randomly selected search direction, identifying valid closed regions in the graph structure; the effective occlusion region includes only a maximum occlusion region and a hole region not covered by other occlusion regions;
and calculating the coverage area of the effective closed area to obtain a filling accumulated area.
In one embodiment, before performing the traversing of the curves in the first graph based on the randomly selected search direction, the method further comprises:
and if the graph structure does not have an overlapping curve, determining the graph structure as the first graph.
In one embodiment, the building a graph structure based on the target graph after defining the boundary direction includes:
and decomposing the intersected curves in the target graph after the boundary direction is defined into a plurality of disjoint curves, and eliminating all single-degree nodes and the associated curves of the single-degree nodes to obtain the graph structure.
In one embodiment, the traversing the curve in the first graph based on the randomly selected search direction, identifying the valid closed region in the graph structure, comprises:
optionally selecting one of nodes of the first graph as a searching starting point, taking any directional curve which the searching starting point belongs to as a starting edge, and rotating to search the next edge around the other node of the directional curve based on the searching direction until a repeated directional curve is searched, and determining the area enclosed by each directional curve searched this time as a closed area;
if the non-searched directed curves exist, optionally selecting a node from the non-searched directed curves as a searching starting point to search a closed region until all the directed curves of the first graph are traversed, and determining the closed region obtained by searching as a candidate closed region;
judging whether the candidate closed region is a maximum closed region or not;
if the candidate closed region is the maximum closed region, determining the candidate closed region as an effective closed region;
if the candidate closed region is not the maximum closed region, judging whether the candidate closed region is a hole region or not;
if the candidate closed region is a hole region and the hole region is not contained by another hole region, judging whether the hole region is contained by another closed boundary except the closed boundary to which the hole region belongs;
if not, the hole area is determined to be an effective closed area.
In one embodiment, the determining whether the candidate occlusion region is a maximum occlusion region includes:
identifying whether each adjacent edge of the candidate closed region is adjacent along the closing direction of the candidate closed region;
if all adjacent edges of the candidate closed regions are adjacent along the closing direction of the closed regions, judging whether the candidate closed regions are contained by other closed regions or not;
if not, judging that the candidate closed region is the maximum closed region.
In one embodiment, the determining whether the candidate occlusion region is a hole region includes:
identifying whether the boundary direction of each curve in the candidate closed region is opposite to the boundary direction of the outermost closed boundary defined in the graph structure;
and if the boundary direction of each curve in the candidate closed region is opposite to the boundary direction of the outermost closed boundary defined in the graph structure, determining the candidate closed region as a hole region.
In one embodiment, the calculating the coverage area of the effective closed area, to obtain the filling cumulative area, includes:
calculating the area of the maximum closed area and the area of the hole area in the effective closed area respectively;
and calculating the area difference between the maximum closed area and the hole area with the inclusion relationship in the effective closed area to obtain the filling accumulated area.
In a second aspect, the present application provides a fill cumulative area calculation apparatus, the apparatus comprising:
the first recognition module is used for recognizing the closed boundary of the target graph;
a direction definition module for defining a boundary direction for a closed boundary of the target graph; wherein the boundary direction of the closed boundary of the outermost layer is defined as the same direction; for closed boundaries with inclusion relationships, the boundary directions of the closed boundaries of adjacent levels are opposite;
the diagram structure construction module is used for constructing a diagram structure based on the target graph after the boundary direction is defined; the graph structure has no intersecting curve, no single-degree node and no single-degree node association curve;
the second identifying module is used for identifying the number of curves with the boundary direction being clockwise and the number of curves with the boundary direction being anticlockwise in each group of overlapped curves when the overlapped curves exist in the graph structure;
the duplicate removal processing module is used for counteracting overlapping curves in opposite directions one by one based on the number of the curves in the clockwise direction and the number of the curves in the anticlockwise direction in each group of overlapping curves, and performing duplicate removal if the number of the remaining overlapping curves in the same direction after counteraction is multiple, and taking the processed graph structure as a first graph;
a third identifying module for identifying an effective closed region in the graph structure based on traversing the curve in the first graph in the randomly selected search direction; the effective occlusion region includes only a maximum occlusion region and a hole region not covered by other occlusion regions;
and the calculating module is used for calculating the coverage area of the effective closed area to obtain a filling accumulated area.
In a third aspect, the present application provides a storage medium having stored therein computer readable instructions which, when executed by one or more processors, cause the one or more processors to perform the steps of the method of populating a cumulative area calculation as described in any one of the above.
In a fourth aspect, the present application provides a computer device comprising: one or more processors, and memory;
the memory has stored therein computer readable instructions which, when executed by the one or more processors, perform the steps of the fill cumulative area calculation method as described in any one of the above.
From the above technical solutions, the embodiments of the present application have the following advantages:
according to the filling cumulative area calculation method, the device, the storage medium and the computer equipment, the boundary direction is defined for the closed boundary of the target graph from outside to inside in an alternating reverse mode, a graph structure without an intersecting curve, without single-degree nodes and without single-degree node association curves is constructed, the overlapping curves are de-duplicated based on the boundary direction of the overlapping curves in the closed boundaries, a first graph is obtained, curves in the first graph are traversed based on randomly selected search directions, the effective closed areas in the graph structure are identified, and the coverage area of the effective closed areas is calculated, namely the filling cumulative area. And the curves on each closed boundary are de-duplicated based on the defined boundary direction, so that invalid closed regions in the identification of subsequent valid closed regions can be reduced, the accurate identification of hole regions is facilitated, the identification accuracy of the valid closed regions corresponding to the filling accumulated area is improved, and further the calculation of the filling accumulated area is rapidly and efficiently realized.
Drawings
In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings that are required in the embodiments or the description of the prior art will be briefly described below, it being obvious that the drawings in the following description are only some embodiments of the present application, and that other drawings may be obtained according to these drawings without inventive faculty for a person skilled in the art.
FIG. 1 is a flow chart of a method for calculating a fill cumulative area in one embodiment;
FIG. 2 is a diagram of a target defining a boundary direction, in one embodiment;
FIG. 3 is a first graph obtained after the target graph in FIG. 2 is de-duplicated;
FIG. 4 is a schematic illustration of a "bridge" line;
FIG. 5 is a flowchart illustrating a step of determining whether a candidate occlusion region is a maximum occlusion region in one embodiment;
FIG. 6 is a diagram of a target defining a boundary direction in another embodiment;
FIG. 7 is a block diagram of a fill cumulative area calculation device, in one embodiment;
FIG. 8 is an internal block diagram of a computer device, in one embodiment.
Detailed Description
The following description of the embodiments of the present application will be made clearly and fully with reference to the accompanying drawings, in which it is evident that the embodiments described are only some, but not all, of the embodiments of the present application. All other embodiments, which can be made by one of ordinary skill in the art without undue burden from the present disclosure, are within the scope of the present disclosure.
As shown in fig. 1, an embodiment of the present application provides a method for calculating a filling cumulative area, including:
step S101, a closed boundary of the target pattern is identified.
The target graph is a graph input by a user or a graph selected by the user in the input graphs, and if the graph is not selected by the user, all graphs input by the user are defaulted as target graphs; and if the user selects the graph, taking the selected graph as a target graph.
Step S102, defining a boundary direction for the closed boundary of the target graph.
Wherein the boundary direction of the closed boundary of the outermost layer is defined as the same direction; for closed boundaries where containment relationships exist, the boundary directions of the closed boundaries of adjacent levels are opposite. Boundary directions are alternately defined for all closed boundaries in the target graph in terms of inclusion relationships, for example, if the boundary direction of the closed boundary of the outermost layer is defined as a clockwise direction, the boundary direction of the closed boundary of the sub-outer layer which is included only by the closed boundary of the outermost layer is defined as a counterclockwise direction. In this embodiment, the boundary direction is defined randomly, and only the boundary direction rule is required to be satisfied, without manual definition.
Referring to fig. 2, the target pattern is composed of a first filled region (composed of a hole region MLJK and a non-hole region ABCH) of a solid line and a second filled region NEFI of a broken line. If the boundary direction of the outermost layer is defined as the clockwise direction, the boundary direction of the closed boundary MLKJ is defined as the counterclockwise direction because the closed boundary ABCH and the closed boundary NEFI are both the outermost layer boundaries.
Step S103, constructing a graph structure based on the target graph after defining the boundary direction.
The graph structure has no intersecting curve, no single-degree node and no single-degree node association curve. The association curve of a certain node refers to a curve taking the node as one of the endpoints; the single-out degree node refers to a node whose association curve only has one, and whose association curve also has another end point. Referring to fig. 2, an exemplary curve NE is to be disassembled from node D into two curves MD and DE, and curve NI is to be disassembled into three curves NM, MJ, JI.
In one embodiment, intersecting curves in the target graph after the boundary direction is defined are disassembled into a plurality of non-intersecting curves, and all single-degree nodes and associated curves of the single-degree nodes are removed to obtain a graph structure. In one embodiment, if the target graph is a graph without an intersection curve, without a single-degree node and without a single-degree node association curve, the target graph after defining the boundary direction is directly used as the graph structure.
Step S104, identifying whether the graph structure has an overlapping curve.
In step S105, if the graph structure does not have an overlapping curve, the graph structure is determined as the first graph.
In step S106, if the graph structure has overlapping curves, the number of curves with the boundary direction being clockwise and the number of curves with the boundary direction being counterclockwise in each set of overlapping curves are identified.
Step S107, based on the number of the clockwise curves and the number of the anticlockwise curves in each group of overlapping curves, offset the overlapping curves in opposite directions one by one, and if the number of the remaining overlapping curves in the same direction after offset is multiple, perform secondary duplication elimination, and take the processed graph structure as a first graph.
Referring to fig. 2, there is an overlapping curve between the nodes M and J in the graph structure, one belonging to the closed boundary MLKJ and one belonging to the closed boundary MLKJ, and the overlapping curve includes MJ in the counterclockwise direction and JM in the clockwise direction according to the boundary directions of the two. Thus, these two curves will undergo cancellation, resulting in a first pattern as shown in fig. 3.
If the overlapping curves are curves in the same boundary direction, one curve in the same boundary direction is reserved.
Step S108, traversing curves in the first graph based on the randomly selected search direction, and identifying effective closed areas in the graph structure.
Wherein the effective occlusion region includes only the maximum occlusion region and the hole region not covered by the other occlusion regions. Illustratively, the closed region enclosed by MLKJ in fig. 2 is a hole region, but is covered by the non-hole region enclosed by NEFI, and thus belongs to an ineffective closed region.
The search direction is not changed after being selected in the process of searching a closed area, and the directional curve is always searched along the selected search direction until the search of the closed area is completed.
Step S109, calculating the coverage area of the effective closed area to obtain the filling accumulation area.
The maximum closed area and the hole area are used for distinguishing and identifying when the effective closed area is identified, so that the area is calculated according to the maximum closed area and the hole area, and the filling accumulated area can be obtained by carrying out area difference according to the inclusion relation.
According to the filling cumulative area calculation method provided by the embodiment, the boundary direction is defined for the closed boundary of the target graph in an alternating reverse mode from outside to inside, a graph structure without an intersecting curve, without a single-degree node and without a single-degree node association curve is constructed, the overlapping curves are de-duplicated based on the boundary direction of the overlapping curves in each closed boundary to obtain a first graph, curves in the first graph are traversed based on randomly selected search directions, the effective closed areas in the graph structure are identified, and the coverage area of the effective closed areas is calculated, namely the filling cumulative area. And the curves on each closed boundary are de-duplicated based on the defined boundary direction, so that invalid closed regions in the identification of subsequent valid closed regions can be reduced, the accurate identification of hole regions is facilitated, the identification accuracy of the valid closed regions corresponding to the filling accumulated area is improved, and further the calculation of the filling accumulated area is rapidly and efficiently realized.
In one embodiment, the identifying the valid occlusion region in the graph structure based on traversing the curve in the first graph in the randomly selected search direction includes:
optionally selecting one of nodes of the first graph as a searching starting point, taking any directional curve to which the searching starting point belongs as a starting edge, and rotating to search the next edge around the other node of the directional curve based on the searching direction until the repeated directional curve is searched, and determining the area surrounded by the directional curves searched at this time as a closed area;
if the non-searched directed curve exists, optionally selecting a node from the non-searched directed curve as a searching starting point to search the closed region until all the directed curves of the first graph are traversed, and determining the closed region obtained by searching as a candidate closed region;
judging whether the candidate occlusion region is a maximum occlusion region;
if the candidate occlusion region is the maximum occlusion region, determining the candidate occlusion region as an effective occlusion region;
if the candidate closed region is not the maximum closed region, judging whether the candidate closed region is a hole region or not;
if the candidate closed region is a hole region and the hole region is not contained by another hole region, judging whether the hole region is contained by another closed boundary outside the closed boundary to which the hole region belongs;
if not, the hole area is determined as an effective closed area.
In this embodiment, the directional curve of the first graph is the direction to be considered of the searched curve, which is not necessarily the same as the boundary direction, and if the same curve is searched in opposite directions in the searching process, the curves searched in two directions are considered to be two directional curves, respectively, in this way, the "bridge" (i.e. the curve connecting two closed boundaries in the undirected graph, such as L1 shown in fig. 4) can be ignored, and the closed region can be formed in a compatible manner with various linearities such as straight line segments, spline curves, arcs, and the like. And judging whether all candidate closed areas searched by traversing the first graph are valid closed areas, namely judging whether the candidate closed areas are maximum closed areas or hole areas which are not covered by other closed areas.
As shown in fig. 5, in one embodiment, the determining whether the candidate occlusion region is the maximum occlusion region includes:
in step S501, it is identified whether each adjacent edge of the candidate closed region is adjacent along the closing direction of the candidate closed region.
In step S502, if each adjacent edge of the candidate closed region is adjacent along the closing direction of the closed region, it is determined whether the candidate closed region is included in other closed regions.
Step S503, if not, determining that the candidate occlusion region is the maximum occlusion region.
In step S504, if any adjacent sides of the candidate closed region are not adjacent along the closing direction of the closed region, or each adjacent side of the candidate closed region is adjacent along the closing direction of the closed region but the candidate closed region is contained by other closed regions, it is determined that the candidate region is not the maximum closed region.
The closing direction of the candidate closing area is the direction of sequentially passing through the nodes when searching the candidate closing area; the adjacent edges refer to edges which are found in any two adjacent searches in a closed area in the searching process, and referring to fig. 3, AB and BC are the adjacent edges, and it is determined whether the adjacent edges are adjacent along the closing direction of the closed area, that is, whether the adjacent edges rotate according to the closing direction with the joint, which is common with the edge with the front search sequence as the starting edge, as the center, and sweep other edges, and if the next edge that is swept by rotation is the adjacent edge of the starting edge, the closing directions of the closed areas of the two adjacent edges are adjacent. For example, referring to fig. 3, if the point a is taken as the searching start point, the AB is taken as the starting edge, the searching direction is counterclockwise, one of the searched candidate closed regions is AB-BC-CD-DN-NM-ML-LK-KJ-JI-IG-GH-HA, the closing direction is clockwise, and the adjacent edges CD and DN are not adjacent in the clockwise direction and are adjacent in the counterclockwise direction, for example, and therefore, the closed region does not satisfy the condition that each of the adjacent edges is adjacent along the closing direction of the candidate closed region. For the first graph shown in fig. 3, if the point a is taken as a searching start point, the point AB is taken as a starting edge, the searching direction is clockwise, one candidate closed region is searched for as AB-BC-CD-DE-EF-FG-GH-HA, the closing direction is clockwise, and any two adjacent edges are adjacent along the closing direction of the candidate closed region. And when the condition is met, if the condition that the candidate closed region is not contained by other closed regions is met at the same time, determining that the candidate closed region is the maximum closed region and belongs to the effective closed region.
In one embodiment, the determining whether the candidate occlusion region is a hole region includes:
identifying whether the boundary direction of each curve in the candidate closed region is opposite to the boundary direction of the outermost closed boundary defined in the graph structure;
and if the boundary direction of each curve in the candidate closed region is opposite to the boundary direction of the outermost closed boundary defined in the graph structure, determining the candidate closed region as a hole region.
It will be appreciated that the hole region is a region contained by the outermost closed boundary, and therefore, the filtering may be performed according to the boundary direction first, and if the boundary direction of each curve in the candidate closed region is the same as the boundary direction of the outermost closed boundary defined in the graph structure, or the boundary direction of any curve in the candidate closed region is the same as the boundary direction of the outermost closed boundary defined in the graph structure, the candidate closed region is not necessarily the hole region, otherwise, if the boundary direction of each curve in the candidate closed region is opposite to the boundary direction of the outermost closed boundary defined in the graph structure, the hole region is necessarily the hole region. In the embodiment, the preliminary screening of the hole area can be rapidly performed by utilizing the defined boundary direction, so that the non-hole area which is easily misjudged as the hole area in the complex graph can be eliminated, and the accuracy of the subsequent effective closed area identification is improved.
In one embodiment, the calculating the coverage area of the effective closed area, to obtain the filling cumulative area, includes:
calculating the area of the maximum closed area and the area of the hole area in the effective closed area respectively;
and calculating the area difference between the maximum closed area and the hole area with the inclusion relation in the effective closed area to obtain the filling accumulated area.
As shown in the target pattern of fig. 2, the identified effective occlusion region is only the maximum occlusion region AB-BC-CD-DE-EF-FG-GH-HA, and thus the filled cumulative area is the area of the maximum occlusion region.
Referring to the target pattern shown in fig. 6, the identified effective occlusion region includes the maximum occlusion region AB-BC-CD-DE-EF-FG-GH-HA and the hole region OMJP, and thus the difference between the areas of the maximum occlusion region AB-BC-CD-DE-EF-FG-GH-HA and the hole region OMJP is calculated to obtain the filling cumulative area.
It should be understood that, although the steps in the flowcharts related to the embodiments described above are sequentially shown as indicated by arrows, these steps are not necessarily sequentially performed in the order indicated by the arrows. The steps are not strictly limited to the order of execution unless explicitly recited herein, and the steps may be executed in other orders. Moreover, at least some of the steps in the flowcharts described in the above embodiments may include a plurality of steps or a plurality of stages, which are not necessarily performed at the same time, but may be performed at different times, and the order of the steps or stages is not necessarily performed sequentially, but may be performed alternately or alternately with at least some of the other steps or stages.
The filling and accumulating area calculating device provided in the embodiment of the present application is described below, and the filling and accumulating area calculating device described below and the filling and accumulating area calculating method described above may be referred to correspondingly.
Referring to fig. 7, an embodiment of the present application provides a filling cumulative area calculating device 700, including:
a first recognition module 701 for recognizing a closed boundary of the target graphic;
a direction definition module 702, configured to define a boundary direction for a closed boundary of the target graphic; wherein the boundary direction of the closed boundary of the outermost layer is defined as the same direction; for closed boundaries with inclusion relationships, the boundary directions of the closed boundaries of adjacent levels are opposite;
a graph structure construction module 703, configured to construct a graph structure based on the target graph after defining the boundary direction; the graph structure has no intersecting curve, no single-degree node and no single-degree node association curve;
a second identifying module 704, configured to identify, when there are overlapping curves in the graph structure, the number of curves in each set of overlapping curves whose boundary direction is clockwise, and the number of curves in each set of overlapping curves whose boundary direction is counterclockwise;
the deduplication processing module 705 is configured to offset the overlapping curves in opposite directions one by one based on the number of curves in the clockwise direction and the number of curves in the counterclockwise direction in each set of overlapping curves, and perform secondary deduplication if the remaining overlapping curves in the same direction after offset are multiple, and use the processed graph structure as a first graph;
a third identifying module 706, configured to identify a valid closed region in the graph structure based on traversing the curve in the first graph in the randomly selected search direction; the effective occlusion region includes only a maximum occlusion region and a hole region not covered by other occlusion regions;
and a calculating module 707, configured to calculate a coverage area of the effective closed area, so as to obtain a filling cumulative area.
In one embodiment, the deduplication processing module is further configured to perform the steps of:
and if the graph structure does not have an overlapping curve, determining the graph structure as the first graph.
In one embodiment, the graph structure building module is configured to perform the steps of:
and decomposing the intersected curves in the target graph after the boundary direction is defined into a plurality of disjoint curves, and eliminating all single-degree nodes and the associated curves of the single-degree nodes to obtain the graph structure.
In one embodiment, the third identification module is configured to perform the steps of:
optionally selecting one of nodes of the first graph as a searching starting point, taking any directional curve which the searching starting point belongs to as a starting edge, and rotating to search the next edge around the other node of the directional curve based on the searching direction until a repeated directional curve is searched, and determining the area enclosed by each directional curve searched this time as a closed area;
if the non-searched directed curves exist, optionally selecting a node from the non-searched directed curves as a searching starting point to search a closed region until all the directed curves of the first graph are traversed, and determining the closed region obtained by searching as a candidate closed region;
judging whether the candidate closed region is a maximum closed region or not;
if the candidate closed region is the maximum closed region, determining the candidate closed region as an effective closed region;
if the candidate closed region is not the maximum closed region, judging whether the candidate closed region is a hole region or not;
if the candidate closed region is a hole region and the hole region is not contained by another hole region, judging whether the hole region is contained by another closed boundary except the closed boundary to which the hole region belongs;
if not, the hole area is determined to be an effective closed area.
In one embodiment, the third identification module is further configured to perform the steps of:
identifying whether each adjacent edge of the candidate closed region is adjacent along the closing direction of the candidate closed region;
if all adjacent edges of the candidate closed regions are adjacent along the closing direction of the closed regions, judging whether the candidate closed regions are contained by other closed regions or not;
if not, judging that the candidate closed region is the maximum closed region.
In one embodiment, the third identification module is further configured to perform the steps of:
identifying whether the boundary direction of each curve in the candidate closed region is opposite to the boundary direction of the outermost closed boundary defined in the graph structure;
and if the boundary direction of each curve in the candidate closed region is opposite to the boundary direction of the outermost closed boundary defined in the graph structure, determining the candidate closed region as a hole region.
In one embodiment, the computing module is configured to perform the steps of:
calculating the area of the maximum closed area and the area of the hole area in the effective closed area respectively;
and calculating the area difference between the maximum closed area and the hole area with the inclusion relationship in the effective closed area to obtain the filling accumulated area.
The above division of the modules in the packed cumulative area computing device is merely for illustration, and in other embodiments, the packed cumulative area computing device may be divided into different modules as needed to perform all or part of the functions of the packed cumulative area computing device. The respective modules in the above-described filling cumulative area calculation apparatus may be implemented in whole or in part by software, hardware, and a combination thereof. The above modules may be embedded in hardware or may be independent of a processor in the computer device, or may be stored in software in a memory in the computer device, so that the processor may call and execute operations corresponding to the above modules.
In one embodiment, the present application also provides a storage medium having stored therein computer readable instructions which, when executed by one or more processors, cause the one or more processors to perform the steps of the method for populating a cumulative area calculation as described in any one of the embodiments above.
In one embodiment, the present application further provides a computer device having computer readable instructions stored therein, the one or more processors, when executing the computer readable instructions, performing the steps of the method for calculating a packed cumulative area according to any one of the embodiments above.
In one embodiment, a computer device is provided, which may be a terminal, and the internal structure thereof may be as shown in fig. 8. The computer device includes a processor, a memory, a communication interface, a display screen, and an input device connected by a system bus. Wherein the processor of the computer device is configured to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operation of the operating system and computer programs in the non-volatile storage media. The communication interface of the computer device is used for carrying out wired or wireless communication with an external terminal, and the wireless mode can be realized through WIFI, a mobile cellular network, NFC (near field communication) or other technologies. The computer program when executed by a processor implements a method of fill cumulative area calculation. The display screen of the computer equipment can be a liquid crystal display screen or an electronic ink display screen, and the input device of the computer equipment can be a touch layer covered on the display screen, can also be keys, a track ball or a touch pad arranged on the shell of the computer equipment, and can also be an external keyboard, a touch pad or a mouse and the like.
It will be appreciated by those skilled in the art that the structure shown in fig. 8 is merely a block diagram of some of the structures associated with the present application and is not limiting of the computer device to which the present application may be applied, and that a particular computer device may include more or fewer components than shown, or may combine certain components, or have a different arrangement of components.
Those skilled in the art will appreciate that implementing all or part of the above described methods may be accomplished by way of a computer program stored on a non-transitory computer readable storage medium, which when executed, may comprise the steps of the embodiments of the methods described above. Any reference to memory, database, or other medium used in the various embodiments provided herein may include at least one of non-volatile and volatile memory. The nonvolatile Memory may include Read-Only Memory (ROM), magnetic tape, floppy disk, flash Memory, optical Memory, high density embedded nonvolatile Memory, resistive random access Memory (ReRAM), magnetic random access Memory (Magnetoresistive Random Access Memory, MRAM), ferroelectric Memory (Ferroelectric Random Access Memory, FRAM), phase change Memory (Phase Change Memory, PCM), graphene Memory, and the like. Volatile memory can include random access memory (Random Access Memory, RAM) or external cache memory, and the like. By way of illustration, and not limitation, RAM can be in the form of a variety of forms, such as static random access memory (Static Random Access Memory, SRAM) or dynamic random access memory (Dynamic Random Access Memory, DRAM), and the like. The databases referred to in the various embodiments provided herein may include at least one of relational databases and non-relational databases. The non-relational database may include, but is not limited to, a blockchain-based distributed database, and the like. The processors referred to in the embodiments provided herein may be general purpose processors, central processing units, graphics processors, digital signal processors, programmable logic units, quantum computing-based data processing logic units, etc., without being limited thereto.
Finally, it is further noted that relational terms such as first and second, and the like are used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions. Moreover, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising one … …" does not exclude the presence of other like elements in a process, method, article, or apparatus that comprises the element.
Furthermore, the terms "first," "second," and the like, are used for descriptive purposes only and are not to be construed as indicating or implying a relative importance or implicitly indicating the number of technical features indicated. Thus, a feature defining "a first" or "a second" may explicitly or implicitly include at least one such feature. In the description of the present application, the meaning of "plurality" is at least two, such as two, three, etc., unless explicitly defined otherwise.
In the present specification, each embodiment is described in a progressive manner, and each embodiment focuses on the difference from other embodiments, and may be combined according to needs, and the same similar parts may be referred to each other.
The previous description of the disclosed embodiments is provided to enable any person skilled in the art to make or use the present application. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the generic principles defined herein may be applied to other embodiments without departing from the spirit or scope of the application. Thus, the present application is not intended to be limited to the embodiments shown herein but is to be accorded the widest scope consistent with the principles and novel features disclosed herein.

Claims (10)

1. A method of calculating a fill cumulative area, the method comprising:
identifying a closed boundary of the target graphic;
defining a boundary direction for a closed boundary of the target graph; wherein the boundary direction of the closed boundary of the outermost layer is defined as the same direction; for closed boundaries with inclusion relationships, the boundary directions of the closed boundaries of adjacent levels are opposite;
constructing a graph structure based on the target graph after defining the boundary direction; the graph structure has no intersecting curve, no single-degree node and no single-degree node association curve;
if the graph structure has overlapping curves, identifying the number of curves with the boundary direction being clockwise and the number of curves with the boundary direction being anticlockwise in each group of overlapping curves;
based on the number of the clockwise curves and the number of the anticlockwise curves in each group of overlapping curves, canceling the overlapping curves in opposite directions one by one, if the number of the remaining overlapping curves in the same direction after canceling is multiple, performing secondary duplication elimination, and taking the processed graph structure as a first graph;
traversing a curve in the first graph based on a randomly selected search direction, identifying valid closed regions in the graph structure; the effective occlusion region includes only a maximum occlusion region and a hole region not covered by other occlusion regions;
and calculating the coverage area of the effective closed area to obtain a filling accumulated area.
2. The method of packed cumulative area calculation according to claim 1, wherein prior to performing said traversing curves in said first graph based on randomly selected search directions, said method further comprises:
and if the graph structure does not have an overlapping curve, determining the graph structure as the first graph.
3. The method according to claim 1 or 2, wherein the building of the graph structure based on the target graph after defining the boundary direction includes:
and decomposing the intersected curves in the target graph after the boundary direction is defined into a plurality of disjoint curves, and eliminating all single-degree nodes and the associated curves of the single-degree nodes to obtain the graph structure.
4. The method of claim 1 or 2, wherein the traversing the curve in the first graph based on the randomly selected search direction, identifying valid closed regions in the graph structure, comprises:
optionally selecting one of nodes of the first graph as a searching starting point, taking any directional curve which the searching starting point belongs to as a starting edge, and rotating to search the next edge around the other node of the directional curve based on the searching direction until a repeated directional curve is searched, and determining the area enclosed by each directional curve searched this time as a closed area;
if the non-searched directed curves exist, optionally selecting a node from the non-searched directed curves as a searching starting point to search a closed region until all the directed curves of the first graph are traversed, and determining the closed region obtained by searching as a candidate closed region;
judging whether the candidate closed region is a maximum closed region or not;
if the candidate closed region is the maximum closed region, determining the candidate closed region as an effective closed region;
if the candidate closed region is not the maximum closed region, judging whether the candidate closed region is a hole region or not;
if the candidate closed region is a hole region and the hole region is not contained by another hole region, judging whether the hole region is contained by another closed boundary except the closed boundary to which the hole region belongs;
if not, the hole area is determined to be an effective closed area.
5. The method of calculating a fill cumulative area according to claim 4, wherein said determining whether said candidate occlusion region is a maximum occlusion region comprises:
identifying whether each adjacent edge of the candidate closed region is adjacent along the closing direction of the candidate closed region;
if all adjacent edges of the candidate closed regions are adjacent along the closing direction of the closed regions, judging whether the candidate closed regions are contained by other closed regions or not;
if not, judging that the candidate closed region is the maximum closed region.
6. The method of calculating a fill cumulative area according to claim 4, wherein said determining whether said candidate closed area is a hole area comprises:
identifying whether the boundary direction of each curve in the candidate closed region is opposite to the boundary direction of the outermost closed boundary defined in the graph structure;
and if the boundary direction of each curve in the candidate closed region is opposite to the boundary direction of the outermost closed boundary defined in the graph structure, determining the candidate closed region as a hole region.
7. The method of calculating a fill cumulative area of claim 4, wherein said calculating a coverage area of said effective closed area, comprises:
calculating the area of the maximum closed area and the area of the hole area in the effective closed area respectively;
and calculating the area difference between the maximum closed area and the hole area with the inclusion relationship in the effective closed area to obtain the filling accumulated area.
8. A fill cumulative area calculation apparatus, the apparatus comprising:
the first recognition module is used for recognizing the closed boundary of the target graph;
a direction definition module for defining a boundary direction for a closed boundary of the target graph; wherein the boundary direction of the closed boundary of the outermost layer is defined as the same direction; for closed boundaries with inclusion relationships, the boundary directions of the closed boundaries of adjacent levels are opposite;
the diagram structure construction module is used for constructing a diagram structure based on the target graph after the boundary direction is defined; the graph structure has no intersecting curve, no single-degree node and no single-degree node association curve;
the second identifying module is used for identifying the number of curves with the boundary direction being clockwise and the number of curves with the boundary direction being anticlockwise in each group of overlapped curves when the overlapped curves exist in the graph structure;
the duplicate removal processing module is used for counteracting overlapping curves in opposite directions one by one based on the number of the curves in the clockwise direction and the number of the curves in the anticlockwise direction in each group of overlapping curves, and performing duplicate removal if the number of the remaining overlapping curves in the same direction after counteraction is multiple, and taking the processed graph structure as a first graph;
a third identifying module for identifying an effective closed region in the graph structure based on traversing the curve in the first graph in the randomly selected search direction; the effective occlusion region includes only a maximum occlusion region and a hole region not covered by other occlusion regions;
and the calculating module is used for calculating the coverage area of the effective closed area to obtain a filling accumulated area.
9. A storage medium, characterized by: the storage medium having stored therein computer readable instructions which, when executed by one or more processors, cause the one or more processors to perform the steps of the packed cumulative area calculation method of any one of claims 1 to 7.
10. A computer device, comprising: one or more processors, and memory;
the memory has stored therein computer readable instructions which, when executed by the one or more processors, perform the steps of the packed cumulative area calculation method of any one of claims 1 to 7.
CN202311542692.8A 2023-11-20 2023-11-20 Method and device for calculating filling cumulative area, storage medium and computer equipment Active CN117351064B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202311542692.8A CN117351064B (en) 2023-11-20 2023-11-20 Method and device for calculating filling cumulative area, storage medium and computer equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202311542692.8A CN117351064B (en) 2023-11-20 2023-11-20 Method and device for calculating filling cumulative area, storage medium and computer equipment

Publications (2)

Publication Number Publication Date
CN117351064A true CN117351064A (en) 2024-01-05
CN117351064B CN117351064B (en) 2024-03-01

Family

ID=89361579

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202311542692.8A Active CN117351064B (en) 2023-11-20 2023-11-20 Method and device for calculating filling cumulative area, storage medium and computer equipment

Country Status (1)

Country Link
CN (1) CN117351064B (en)

Citations (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20060083418A1 (en) * 2003-02-11 2006-04-20 Qinetiq Limited Image analysis
CN104123738A (en) * 2014-08-06 2014-10-29 铁道第三勘察设计院集团有限公司 Method for discovering minimal closed region surrounding given points in two-dimensional graph
CN106506899A (en) * 2015-09-08 2017-03-15 东莞市智觉电子科技有限公司 A kind of image acquisition based on machine vision and method for reconstructing and device
CN109064395A (en) * 2018-06-19 2018-12-21 广东数相智能科技有限公司 A kind of bookshelf image split-joint method, electronic equipment and storage medium made an inventory based on books
CN109883321A (en) * 2019-02-15 2019-06-14 江苏大学 A kind of block area measuring device and method based on Beidou positioning
CN111681300A (en) * 2020-06-02 2020-09-18 西安电子科技大学 Method for obtaining target area composed of outline sketch lines
CN112116590A (en) * 2020-10-09 2020-12-22 北方工业大学 Method for identifying machining boundary of out-of-tolerance area of complex curved surface part
CN115563096A (en) * 2022-10-31 2023-01-03 浙江有数数智科技有限公司 Closed park deduplication method based on longitude and latitude
CN116383282A (en) * 2023-04-17 2023-07-04 上海中通吉网络技术有限公司 Method and device for rapidly counting area of coverage area of fence

Patent Citations (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20060083418A1 (en) * 2003-02-11 2006-04-20 Qinetiq Limited Image analysis
CN104123738A (en) * 2014-08-06 2014-10-29 铁道第三勘察设计院集团有限公司 Method for discovering minimal closed region surrounding given points in two-dimensional graph
CN106506899A (en) * 2015-09-08 2017-03-15 东莞市智觉电子科技有限公司 A kind of image acquisition based on machine vision and method for reconstructing and device
CN109064395A (en) * 2018-06-19 2018-12-21 广东数相智能科技有限公司 A kind of bookshelf image split-joint method, electronic equipment and storage medium made an inventory based on books
CN109883321A (en) * 2019-02-15 2019-06-14 江苏大学 A kind of block area measuring device and method based on Beidou positioning
CN111681300A (en) * 2020-06-02 2020-09-18 西安电子科技大学 Method for obtaining target area composed of outline sketch lines
CN112116590A (en) * 2020-10-09 2020-12-22 北方工业大学 Method for identifying machining boundary of out-of-tolerance area of complex curved surface part
CN115563096A (en) * 2022-10-31 2023-01-03 浙江有数数智科技有限公司 Closed park deduplication method based on longitude and latitude
CN116383282A (en) * 2023-04-17 2023-07-04 上海中通吉网络技术有限公司 Method and device for rapidly counting area of coverage area of fence

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
覃斌 等: "基于转向法的大规模空间封闭图形高效识别", 计算机工程, vol. 35, no. 14, 31 July 2009 (2009-07-31), pages 184 - 186 *

Also Published As

Publication number Publication date
CN117351064B (en) 2024-03-01

Similar Documents

Publication Publication Date Title
US9881114B2 (en) Virtual hierarchical layer propagation
Lambourne et al. Brepnet: A topological message passing system for solid models
US7436407B2 (en) Topology determination, decomposable shape generation, and structured mesh generation
CN105389324A (en) Methods and systems for distributed computation of graph data
Elsheikh et al. A reliable triangular mesh intersection algorithm and its application in geological modelling
CN110544255B (en) Method and system for segmenting triangular mesh holes for 3D printing
Ohori et al. Validation and automatic repair of planar partitions using a constrained triangulation
KR20180016354A (en) Automatic generation of test layouts for verifying a DRC deck
Dyken et al. Simultaneous curve simplification
Meijers Simultaneous & topologically-safe line simplification for a variable-scale planar partition
JP2004038630A (en) Numerical analysis device using mixed lattice type solution-adaptive lattice approach
CN117351064B (en) Method and device for calculating filling cumulative area, storage medium and computer equipment
Aubry et al. A surface remeshing approach
Colin de Verdière Multicuts in planar and bounded-genus graphs with bounded number of terminals
Funken et al. A coarsening algorithm on adaptive red-green-blue refined meshes
CN117253052B (en) Maximum closure area identification method and device, storage medium and computer equipment
Zhu et al. Automatic hierarchical mid-surface abstraction of thin-walled model based on rib decomposition
CA2919051A1 (en) Global grid building in reverse faulted areas by an optimized unfaulting method
Xu et al. Computing the map of geometric minimal cuts
Liu et al. Repair of STL errors
Peng et al. Using the A Algorithm to Find Optimal Sequences for Area Aggregation
Wang et al. Robust computation of 3D Apollonius diagrams
Sundar et al. A unified approach towards computing Voronoi diagram, medial axis, Delaunay graph and α-hull of planar closed curves using touching discs
de Oliveira et al. Novel graph-based adaptive triangular mesh refinement for finite-volume discretizations
CN117609412B (en) Spatial object association method and device based on network structure information

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