CN112241575A - Automatic drawing line exploration algorithm based on obstacles - Google Patents

Automatic drawing line exploration algorithm based on obstacles Download PDF

Info

Publication number
CN112241575A
CN112241575A CN202011068939.3A CN202011068939A CN112241575A CN 112241575 A CN112241575 A CN 112241575A CN 202011068939 A CN202011068939 A CN 202011068939A CN 112241575 A CN112241575 A CN 112241575A
Authority
CN
China
Prior art keywords
point
line
connection
exploration
determining
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
CN202011068939.3A
Other languages
Chinese (zh)
Other versions
CN112241575B (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.)
Tongji University
Original Assignee
Tongji University
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 Tongji University filed Critical Tongji University
Priority to CN202011068939.3A priority Critical patent/CN112241575B/en
Publication of CN112241575A publication Critical patent/CN112241575A/en
Application granted granted Critical
Publication of CN112241575B publication Critical patent/CN112241575B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F30/00Computer-aided design [CAD]
    • G06F30/10Geometric CAD
    • G06F30/18Network design, e.g. design based on topological or interconnect aspects of utility systems, piping, heating ventilation air conditioning [HVAC] or cabling
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F30/00Computer-aided design [CAD]
    • G06F30/20Design optimisation, verification or simulation

Landscapes

  • Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • Theoretical Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Geometry (AREA)
  • Computer Hardware Design (AREA)
  • General Engineering & Computer Science (AREA)
  • Evolutionary Computation (AREA)
  • Computational Mathematics (AREA)
  • Pure & Applied Mathematics (AREA)
  • Mathematical Optimization (AREA)
  • Mathematical Analysis (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Air Conditioning Control Device (AREA)
  • Testing Of Short-Circuits, Discontinuities, Leakage, Or Incorrect Line Connections (AREA)

Abstract

The invention discloses an automatic drawing line exploration algorithm based on obstacles, which can solve the problem of connecting lines among rectangular objects, can be used for connecting lines of a schematic diagram of an air-conditioning water system and comprises the following steps: s1, gridding a to-be-connected line graph, determining a connection limiting area, defining an obstacle point matrix, determining a to-be-connected line connection set, and determining characteristic attributes of each to-be-connected line connection; s2, according to the obstacle set, connecting a line in the connection set to be connected; s3, storing the best connecting line of the connection into a connecting point set; and S4, repeating the steps S2 and S3 until all the connecting lines are connected. Compared with the existing algorithm, the method can solve the problem of actual connection of the heating, ventilating and air conditioning water system schematic diagram which cannot be solved by the existing algorithm, and has better practical significance.

Description

Automatic drawing line exploration algorithm based on obstacles
Technical Field
The invention relates to the technical field of visual data, in particular to a line exploration algorithm based on obstacles, which can be used for connecting water system schematic diagrams in the field of heating, ventilating and air conditioning.
Background
In the automatic mapping problem, after the layout of the graphics is determined, the graphics with different connection relationships need to be connected by orthogonal lines, and the process is called as connecting lines. The connection problem of the graph can be regarded as a path finding problem or a simple connection problem. At present, a plurality of relatively mature algorithms exist for the routing problem, but because the routing problem of automatic mapping needs to ensure less bending, the searching of a proper routing algorithm is obviously more effective.
The introduction of the 1969 line discovery algorithm allowed people to see an automatic mapping problem with reduced computational effort of eosin. The early line exploration algorithm is a non-grid wiring algorithm, and the basic idea is that a search line is respectively drawn from a starting point A and a target point B on the assumption that no obstacle exists, wherein the line passing through A is vertical, the line passing through B is horizontal, and when the obstacle is encountered, the search line is turned to be an escape line until the two lines are intersected with each other, and at the moment, the path is the searched path. The method ensures less bending and greatly reduces the calculation amount.
The air conditioning system is an indispensable component of modern buildings, and creates a comfortable residential and office environment for people. Unlike the home air conditioners that have been standardized early on, the centralized air conditioning system is limited by the complexity of the building, the design process still needs to be customized, and the degree of automation is very low. In recent years, with the continuous development of artificial intelligence technology, artificial intelligence methods are widely applied in the heating, ventilating and air conditioning field, but at present, research on automatically drawing two-dimensional drawings related to heating, ventilating and air conditioning is still blank.
Disclosure of Invention
The invention provides a line exploration algorithm based on obstacles for overcoming the new difficulty of the specific automatic mapping process, aims to comprehensively consider the specific problems of the size of a graph, the association between the graph and a connecting line point and the like, solves the problem that the obstacles appearing in the connecting line of the water system schematic diagram in the heating, ventilating and air conditioning field are associated with the graph to be connected, and promotes the development of the automatic mapping technology in the field needing to solve similar problems.
Technical scheme
An obstacle-based line exploration algorithm, comprising the steps of:
s1, gridding a to-be-connected graph, and determining a connection limiting area; meanwhile, defining an obstacle set, a connection set and a connection set to be connected, and determining the characteristic attribute of each connection set to be connected;
s2, connecting one line in the connection set to be connected in the step S1 according to the obstacle set defined in the step S1, and storing the best connection line of the connection in the connection set defined in the step S1;
and S3, repeating the step S2 until all the connecting wires are connected.
The step S1 specifically includes:
s11, global gridding treatment: regarding the drawing range as a connecting line limiting area, and performing discrete gridding processing on the connecting line limiting area to obtain a two-dimensional grid;
s12, obstacle point set: integrally gridding any rectangular object to be connected, and gridding and dispersing the compact rectangle into a series of points; coding each grid point, and storing the gridded obstacle points in an obstacle point set;
s13, a connection set to be connected: each connection is composed of a connecting line and connecting points at two ends of the connecting line; assigning all connections to corresponding connection point information and initialized connection information, wherein a set formed by all the connections is a connection set to be connected;
s14, initializing a connection set: a set is created for storing the connection lines generated in step S2.
The step S2 specifically includes:
s21, parameter initialization: determining the direction of the initial search line according to the connection entering direction by taking the connection starting point as a wiring starting point (namely an initial search line starting point);
s22, determining a wiring range and a connection termination line: determining a wiring range according to a connection entry point, a connection exit point, a connection in-out direction and a drawing range; determining a connection termination line according to the connection exit point and the connection exit direction, wherein the connection termination line has the characteristic of penetrating through the connection exit point and being vertical to the exit direction;
s23, determining an initial exploration line: determining the end point of the current exploration line according to the wiring range, the starting point of the current wiring and the direction of the exploration line, and determining the exploration line according to the starting point and the end point;
s24, determining a first-step wiring range: defining a first-step wiring range as a first-step wiring trial range; determining that some points exist in the set of obstacle points determined in step S12 on the search line determined in step S23, and then determining the first-step wiring range as a line segment (excluding an end point) between the starting point and the nearest obstacle point; if the points on the search line determined in the step S23 do not exist in the set of obstacle points determined in the step S12, determining a line segment with the first-step wiring range as a starting point to an end point of the search line;
s25, determining a first step inflection point set and an attempt connecting set: defining a first inflection point set to store points in the first wiring range, and storing the points in the set from near to far from a starting point; initializing an empty set as a trial connection set for storing all the alternative connections obtained by calculation of the current connection;
s26, determining a first step inflection point: sequentially taking points from the first inflection point set of S25 as first inflection points and also as the starting points of new search lines;
s27, determining a new exploration line: determining a first inflection point as a starting point of a new exploration line, and determining a new exploration line direction and an exploration line terminal point according to a wiring range and a terminal point position;
s28, checking the validity of the current exploration line: if the current exploration line is effective, continuing the next step; if the current exploration line is invalid but only the exit connection direction check fails, changing the end point of the current exploration line to the connection termination line determined in the step S22, determining the point as a new inflection point, continuing the next step, and otherwise, jumping to the step S214 and selecting the next first step inflection point;
s29, determining a new inflection point: when the new inflection point is determined, skipping the step; otherwise, searching points on the search line in the obstacle point set, if the points exist, determining a point before the nearest obstacle point on the search line as the current search line terminal point, and determining the point as a new inflection point; if the point does not exist, determining the endpoint of the exploration line as a new inflection point;
s210, determining a new exploration line: determining a new exploration line direction and an exploration line terminal point according to the wiring range and the terminal point position by taking the new inflection point as a new exploration line starting point;
s211, checking the validity of the current exploration line: if the current exploration line is effective and does not reach the terminal point, continuing the next step; if the current exploration line is invalid but only the exit connection direction check fails, changing the terminal point of the current exploration line to the connection termination line determined in the step S22, determining the point as a new inflection point, and continuing the next step; returning to the step S26 when the current exploration line is invalid and the exit connection direction check passes but the dead point check does not pass, and selecting the next first step inflection point; otherwise, returning to the step S29, and moving the new inflection point determined in the step S29 backward by one;
s212, repeating the exploration in the steps S29, S210 and S211 until the exploration reaches the end point;
s213, storage wiring attempt: storing the wiring in the trial wiring set determined in the S25, returning to the step S26, and selecting the next point in the S25 initial inflection point set as a new initial inflection point;
s214, judging the end of connection: when all the points in the first step inflection point set are used as first step inflection points and the wiring is tried to be finished in S25, carrying out the next step; otherwise, returning to the step S26, and selecting the next point in the S25 first step inflection point set as a new first step inflection point;
s215, determining a final routing path: comparing the inflection points of all the routing attempt paths in the attempt connection line set in S25, and taking the minimum inflection point as a final routing path; when the number of inflection points is the same, comparing the distance between the inflection point of the first step and the connection starting point, and taking the shortest one as the final routing path;
s216, storing the optimal connection line: the line that the final routing mode of the connection obtained in step S215 is the optimal connection of the connection, and the numbers of all the points on the optimal connection are stored in the connection point set initialized in step S14.
The checking of the validity of the current search line in steps S28 and S211 specifically includes:
and (3) collinear inspection: the new search line is collinear with the connection line which is stored in the connection line set in S14, the collinear check is failed, and the current search is invalid; the new search line is not collinear with the connection line stored in the connection line set in S14, and the collinear check is passed;
checking the outlet connection direction: if the current exploration line direction is the same as the direction of the connection outlet and the current exploration line does not pass through the connection terminal, the detection of the outlet connection direction is not passed; otherwise, the outlet connection direction is checked to pass;
and (3) dead point inspection: the new inflection point is different from the end point, and the end point of the current exploration line is the end point, the current wiring already enters a dead point, and the dead point inspection is not passed; the new inflection point is different from the end point, and the end point of the current exploration line is not the end point, and the dead point check is passed; the new inflection point is the same as the end point, the dead point check passes but the end point is reached, and S213 is skipped to for storage;
if and only if the collinear inspection, the exit connection direction inspection and the dead point inspection are passed, the current probe line can be judged to be effective.
The collinear check in the current search line validity check in steps S28 and S211 specifically includes:
storing all points on the existing connecting line into a connecting line point set; for the inflection point determined by each exploration, taking a line segment from the inflection point to the end point of the next exploration line, searching each point on the line segment in a line point set, and taking out all points existing in the line point set to form a cross point set; for each point in the intersection point set, searching whether two adjacent points in the direction perpendicular to the next exploration direction (the exploration direction after turning) exist in the connecting line point set or not, if the two adjacent points exist in the connecting line point set, determining that the two adjacent points are intersected, and if one adjacent point does not exist, determining that the two adjacent points are collinear; when the collinearity is judged to be true, the inflection point should be checked back to avoid the collinearity.
Technical solution of the embodiment
An automatic drawing line exploration algorithm based on obstacles is applied to connecting lines of air-conditioning water system schematic diagram loop block topology and connecting lines of component topology, and comprises the following steps:
s1, gridding a to-be-connected graph, determining a connection limiting area, determining a graph needing to be avoided in a connection process as a barrier, dispersing the graph into a plurality of barrier points according to gridding, defining a barrier point matrix and storing the barrier point matrix; determining the connection relation of the connection to be completed as the connection to be connected, defining and storing a connection set to be connected, and determining the characteristic attribute of each connection to be connected; the connection set is initialized to store the connections to be generated in step S2.
And S2, performing connection attempt on each connection in the connection set to be connected determined in the S1 according to the obstacle point matrix defined and stored in the step S1, and storing the optimal connection of the connection into the connection set initialized in the S1 after the optimal connection is subjected to gridding and discretization into a plurality of points according to the S1. (core algorithm step)
And S3, repeating the step S2 until all the connecting wires are connected.
Further, the specific method of step S1 is as follows:
s11, global gridding treatment: will draw the drawing range [ x1,x2]×[y1,y2](wherein x1<x2,y1<y2) And (4) regarding the connection limiting area as a connection limiting area, and performing discrete gridding processing on the connection limiting area to obtain a two-dimensional grid Net (Nx, Ny).
S12, obstacle point matrix: the objects to be connected are laid out before connection and have known sizes, and can be equivalent to rectangular frames, and the positions and the sizes of the equivalent rectangular frames are determined, so that the objects can be integrally gridded and dispersed into a series of points. Let the cross-axial grid spacing be dxWith a longitudinal axial grid spacing of dyCalculating the number of grid columns NxAnd the number of grid lines NyAnd coding each grid point, and coding grid points k in the ith row and j column from the lower left corner of the graph as follows: pt isk=(j-1)×Ny+ (i-1). Storing the gridded obstacle points in an obstacle point matrix NptIn (1).
S13, a connection set to be connected: each connection consists of a connecting line and connecting points at both ends of the connecting line. The connection point has a connection point number attribute corresponding to the position and a direction attribute of the connection. And assigning all connections to corresponding connection point information and initialized connection information, wherein a set formed by all the connections is a connection set to be connected.
S14, initializing a connection set: a set L is established for storing the connection lines to be generated in step S2.
Further, the direction described in step S13 is defined as follows:
for any point (x) on the graph0,y0) Another point (x) exists on the directional link/directional search line1,y1) To determineSense direction D, having:
Figure BDA0002706854670000051
further, the specific method of step S2 is as follows:
s21, parameter initialization: the direction of the current probe line is determined from the connection entry direction, using the connection start point a as the wiring start point C.
S22, determining a wiring range and a connection termination line: and determining a wiring range according to the connection entry point, the connection exit point, the connection in-out direction and the drawing range. The end line of the connection termination line has the characteristic of passing through the connection exit point and being vertical to the exit direction;
s23, determining an initial exploration line: and determining a search line end point D and a search line CD according to the wiring range, the current wiring starting point and the search line direction.
S24, determining a first-step wiring range: defining a first-step wiring range as a first-step wiring trial range; set of obstacle points N determined at S12ptSearching for the point on the probe line determined in the step S23, and if the point exists, determining a first-step wiring range BeginRange as a line segment CP (excluding C and P) between the starting point and the nearest obstacle point P; if not, determining the first-step wiring range BeginRange as a line segment CD (excluding C) from the starting point to the end point D of the search line.
S25, determining a first step inflection point set and an attempt connecting set: defining a first step inflection point set to store points in a first step wiring range BeginRange, and storing the points in the set from near to far in sequence from a starting point; initializing an empty set as a trial connection set for storing all the alternative connections obtained by calculation of the current connection;
s26, determining a first step inflection point: sequentially taking points from the first inflection point set of S25 as first inflection points and also as a starting point C of a new search line;
s27, determining a new exploration line: and determining a new wire probing direction and a wire probing end point D according to the wiring range and the end point B position.
S28, checking the validity of the current exploration line: if the current probe line CD is valid, continuing the next step; when the current exploration line CD is invalid but only the exit connection direction check is failed, changing the current exploration line end point D to the end line of the connection termination line determined in S22, determining that the end line is a new inflection point, continuing the next step, otherwise, jumping to the step S214, and selecting the next first step inflection point;
s29, determining a new inflection point: when the new inflection point is determined, skipping the step; otherwise, N is concentrated in the obstacle pointptSearching for a point on the exploration line, if the point exists, determining a point before the nearest barrier point P on the exploration line as a current exploration line terminal point D, and determining the point as a new inflection point; if the point D does not exist, determining the end point D of the exploration line as a new inflection point;
s210, determining a new exploration line: determining a new exploration line direction and an exploration line end point D according to the wiring range and the end point B position by taking the new inflection point as a new exploration line starting point C;
s211, checking the validity of the current exploration line: when the current probe line CD is effective and does not reach the terminal, continuing the next step; changing the terminal point D of the current probe line CD to the connection termination line determined in the step S22, determining the point as a new inflection point, and continuing the next step; returning to the step S26 when the current exploration line is invalid and the exit connection direction check passes but the dead point check does not pass, and selecting the next first step inflection point; otherwise, returning to the step S29, and moving the new inflection point determined in the step S29 backward by one;
s212, repeating the exploration of the steps S29, S210 and S211 until the exploration reaches an end point B;
s213, storage wiring attempt: storing the wiring in the set of attempted wirings determined at S25;
s214, judging the end of connection: when all the points in the first step inflection point set are used as first step inflection points and the wiring is tried to be finished in S25, carrying out the next step; otherwise, returning to the step S26, and selecting the next point in the S25 first step inflection point set as a new first step inflection point;
s215, determining a final routing path: comparing the inflection points of all the routing attempt paths in the attempt connection line set in S25, and taking the minimum inflection point as a final routing path; when the number of inflection points is the same, comparing the distance between the inflection point of the first step and the connection starting point, and taking the shortest one as the final routing path;
s216, storing the optimal connection line: the line that the final routing mode of the connection obtained in step S215 is the optimal connection of the connection, and the numbers of all the points on the optimal connection are stored in the connection point set initialized in step S14.
Further, the end line of the connection termination line described in step S22 is defined as follows:
in order to realize a connecting line form according with the outlet direction, a turning end line is reserved. When the exploration direction is consistent with the exit direction but the exploration line and the exit point are not on the same straight line, the user still needs to turn twice, and the end line reserves space to finish the last turn.
Further, the first wiring range described in step S24 is defined as follows:
due to the limitation of the direction of the inlet and the outlet of the connection, the first section of search line of the connection cannot point to the target, which causes the path to be longer and causes unnecessary intersection. Introducing point-by-point exploration into the first section of exploration, setting the distance from the first section of exploration to the nearest barrier point as d lattices, respectively solving the lines of the grids of the first step of exploration and the grids of [1, d ], and finally solving the routing mode with the least turning and the shortest routing of the first step.
Further, the checking of the validity of the current search line in steps S28 and S211 specifically includes:
and (3) collinear inspection: the new search line is collinear with the connection line which is stored in the connection line set in S14, the collinear check is failed, and the current search is invalid; the new search line is not collinear with the connection line stored in the connection line set in S14, and the collinear check is passed;
checking the outlet connection direction: if the current exploration line direction is the same as the direction of the connection outlet and the current exploration line does not pass through the connection terminal, the detection of the outlet connection direction is not passed; otherwise, the outlet connection direction is checked to pass;
and (3) dead point inspection: the new inflection point is different from the end point, and the end point of the current exploration line is the end point, the current wiring already enters a dead point, and the dead point inspection is not passed; the new inflection point is different from the end point, and the end point of the current exploration line is not the end point, and the dead point check is passed; the new inflection point is the same as the end point, the dead point check passes but the end point is reached, and S213 is skipped to for storage;
if and only if the collinear inspection, the exit connection direction inspection and the dead point inspection are passed, the current probe line can be judged to be effective.
Further, the collinearity check in the current search line validity check in steps S28 and S211 is defined as follows:
all points on the existing connecting line are stored in a connecting line point set L. And for the inflection point determined by each exploration, taking the inflection point from the current inflection point to the terminal line segment CD of the next exploration line, searching each point on the line segment CD in a connecting point set L, and taking out all points existing in the connecting point set to form a cross point set N'. For each point in the cross point set N', whether two adjacent points in the direction perpendicular to the next exploration direction (the exploration direction after turning) exist in the connecting point set L or not is searched, if yes, the intersection is determined, and if one does not exist, the collineation can be determined. If the collinearity is judged to be true, the inflection point should be checked back to avoid the collinearity.
Further, the specific method of step S3 is as follows:
and when all the connections to be connected in the connection set to be connected in the S13 are connected and stored in the connection set defined in the S14, ending the algorithm.
Compared with the prior art, the invention has the beneficial effects that:
the problem that obstacles which cannot be solved in the existing algorithm are correlated with the graph to be connected is solved, and particularly, a connecting line starts from any position of the graph to be connected; the sizes of the figures are different from each other and are mutually obstructed in the connection process; the graph on which the connection point is based may be an obstacle to the generation of connection lines to the connection point. Compared with the existing algorithm, the method solves the problem of actual connection which cannot be solved by the existing algorithm, and has better practical significance.
Drawings
FIG. 1 is a schematic flow diagram of an obstacle-based line exploration algorithm;
FIG. 2-1 is a schematic of a general single-line diagram wiring problem;
FIG. 2-2 is a single line graph join problem solved by the present algorithm;
FIG. 3 is a schematic view of a connection line direction of the connection points;
FIG. 4-1 is a schematic representation of the connection, junction, and rectangular relationship;
FIG. 4-2 is a schematic view of the correlation between connections, connection points, and rectangles;
FIG. 5 is a schematic representation of the basic principle of an obstacle-based line exploration algorithm;
FIG. 6 is a schematic view of the case where no connection terminal line is provided;
FIG. 7 is a schematic representation of the first step improved barrier-based line exploration algorithm rationale;
FIG. 8 is a schematic of a dead-spot process;
fig. 9 is a schematic diagram of alignment judgment, in which 1 denotes crossing and 2 denotes alignment.
Detailed Description
Embodiments of the present invention will be described in detail below with reference to the accompanying drawings.
The algorithm disclosed by the invention is suitable for application practice of an automatic mapping technology of an air conditioning water system schematic diagram in the field of designing heating ventilation air conditioners. In the automatic mapping of the air-conditioning water system schematic diagram, a loop topology model and a component topology model of a water system schematic diagram both need to be connected, and the connection problem of the loop topology model and the component topology model meets the connection problem of the conventional automatic mapping problem, and has the characteristics of short connection, less connection bending and less crossing, and the following problems that the existing algorithm cannot solve the problem that the barriers and the graph to be connected are associated with each other are specifically as follows:
(1) the connecting line does not start from the center of the rectangle, but starts from any position of the rectangle;
(2) the sizes of the connected rectangles are different from each other, and the rectangles are mutually obstructed in the connection process;
(3) the rectangle on which the connection point is based may be an obstacle to the generation of a connection line to the connection point.
The above explains the objects referred to in practical application by these "lines" such as "connection lines" or "connection lines" appearing in the technical solution of the present invention. It should be emphasized that the technical solution of the present invention is directed to an automatic mapping application technology for designing a schematic diagram of an air conditioning water system in the field of heating, ventilation and air conditioning, rather than a set of algorithm rules.
Fig. 2-1 and 2-2 show the comparison between the single-line diagram connection problem solved by the algorithm of the present invention and the general problem. The line exploration algorithm based on the obstacles can be used for realizing the connection of a heating, ventilating and air-conditioning water system schematic diagram loop topological model and a component topological model. The connection problem solved by the method is characterized in that:
(1) the connecting line does not start from the center of the rectangle, but starts from any position of the rectangle;
(2) the sizes of the connected rectangles are different from each other, and the rectangles are mutually obstructed in the connection process;
(3) the rectangle on which the connection point is based may be an obstacle to the generation of a connection line to the connection point.
The topology/component topology model (see fig. 2-1) of the heating, ventilating and air conditioning water system to be connected means a loop topology/component topology model formed by a series of rectangles representing different loops/components generated by hiding a series of details of a schematic diagram of the air conditioning water system and laying out the rectangles.
The core part of the obstacle-based line exploration algorithm is the generation of a specific connection line, and before designing a specific connection line generation mode, related concepts need to be defined.
(1) Canvas meshing and point numbering
Will draw the drawing range [ x1,x2]×[y1,y2](wherein x1<x2,y1<y2) And (4) regarding the connection limiting area as a connection limiting area, and performing discrete gridding processing on the connection limiting area to obtain a two-dimensional grid Net (Nx, Ny).
Let the cross-axial grid spacing be dxWith a longitudinal axial grid spacing of dyCalculating the number of grid columns NxAnd the number of grid lines NyAnd coding each grid point, and coding grid points k in the ith row and j column from the lower left corner of the graph as follows: pt isk=(j-1)×Ny+(i-1)。
(2) Obstacle point generation and obstacle point matrix Npt
A series of rectangles with the central points arranged are arranged on the model canvas to be connected, the points to be connected are attached to the sides of the rectangles, the positions of the points to be connected are known, and the orientation relations of the points to be connected and the respective attached rectangles are different. The rectangle not only serves as an attachment base for the connection point, but also blocks the search line in the connection line. A series of rectangles on the canvas are made obstacles. To reduce unnecessary inter-wiring crossings, where rectangles are considered dense obstacles, it is not possible for a connection line to pass through a rectangle to connect to a connection point.
At this time, the central point of the rectangle is a known quantity through layout, and the shape attribute of the rectangle is also a known quantity, namely, the position and the size of the rectangle are determined, so that the whole grid can be formed, and the dense rectangular grid is discretized into a series of points. Storing the gridded obstacle points in an obstacle point matrix NptIn (1).
(3) Connection point, direction and connection line direction
Since the rectangle representing the loop/component is considered a solid obstacle, the connection points are attached to the obstacle and external connection lines through the connection points cannot pass through the inside of the rectangle. That is, the connection direction of the connection point is completely limited, and needs to be defined algorithmically.
Before the entering and exiting directions of the connecting lines are defined, the direction definition in the algorithm is defined, and the direction definition is suitable for the direction of the search line and the entering and exiting directions. For any point (x) on the graph0,y0) Another point (x) exists on the directional link/directional search line1,y1) Defining the direction D, there are:
Figure BDA0002706854670000101
the direction of the line connecting the connection points is limited by the rectangular obstacles attached to the connection points, and can be defined as the direction perpendicular to the sides of the rectangle where the connection points are located and outward. Fig. 3 shows the direction of the entry and exit of the connection points on the four sides of the rectangle, and the direction of the connection lines of the points located on the four corners of the rectangle is determined according to the orientation of the connection points connected thereto.
(4) Connection definition
A connection consists of two connection points and a wire connecting them, which is also subordinate to the loop/component to which it corresponds, since the connection points are attached to a rectangle representing the loop/component, see fig. 4-1.
Each connection has access to the direction of the connection between its two connection points, defining that any one connection point is the entry point of the connection and the other connection point is the exit point of the connection. The in-and-out direction of the connection can be determined completely, respectively the direction of the connection line connecting the entry points and the direction of the connection line connecting the exit points, see fig. 4-2. Then, for a known to-be-connected graph, a connection set C with both determined in-out point and in-out direction can be obtained.
Obtaining a set of obstacle points NptAfter connecting set C, the line search connection can be started.
The basic principle of the obstacle-based line exploration algorithm is to explore a line for an arbitrary connection starting from the connection entry point, according to the connection entry direction. At the set of obstacle points NptThe nearest obstacle point blocking the search line is searched, the search line is steered before the obstacle point, and then the search line is continued to be made towards the target direction. The search line is continued until the connection exit point is reached in the opposite direction to the specified connection exit direction, see fig. 5.
It should be noted that the dotted line end (i.e., the connection terminal line) is a turning terminal line reserved for realizing a connection line form conforming to the outlet direction. When the exploration direction is consistent with the exit direction but the exploration line and the exit point are not on the same straight line, it means that exploration still needs to turn twice to reach the exit point, a space must be reserved before the exit point to complete the last turn, otherwise the exploration line directly points to the exit point after the turn once, and the connection line meeting the exit direction cannot be completed due to the obstacle, as shown in fig. 6.
Due to the limitation of the directions of the inlet and the outlet of the connection, the first section of search line of the connection cannot point to the target, which causes the path to be longer and causes unnecessary intersection when more connection lines exist. Aiming at the phenomenon, the invention considers introducing point-by-point exploration into the first section of exploration, respectively solving the lines of the grids searched in the first step by the distance d from the first section of exploration to the nearest barrier point, and finally solving the routing mode with the least turning and the shortest routing in the first step, as shown in figure 7.
On the basis of the basic principle, the processing needs to be performed for some special cases.
When there are more obstacles in the graph and the starting point and the ending point of the connection are far away, the line exploration may have a dead point of stepping, i.e. the end point of the exploration direction is the target but no path is available in front, and the path is abandoned, as shown in fig. 8.
All the connecting lines only consider the condition of a single connecting line, and in the actual connecting process, a plurality of connecting lines are needed, and the connecting lines can be crossed or even collinear. A small number of intersections can be tolerated, but co-linearity is a critical avoidance. Firstly, the existing connecting line is generated into a connecting line point set L. For the inflection point determined by each exploration, the current inflection point (starting point of the next exploration line) is taken to reach the end point segment CD of the next exploration line, each point on the segment CD is searched in the connecting point set L, and all points existing in the connecting point set are taken out to form a cross point set N'. For each point in the intersection point set N', it is searched whether two adjacent points in a direction perpendicular to the next search direction (search direction after turning) exist in the connecting point set L, and if both exist, it is determined to be an intersection (shown in fig. 9 as 1), and if one does not exist, it is determined to be a collineation (shown in fig. 9 as 2). If the collinearity is judged to be true, the inflection point should be checked back to avoid the collinearity.
The example of obstacle-based line exploration method then comprises the following steps:
after determining the obstacle point set NptDefining a connection point and a connection set C of connection directions, and initializing a connection point set L. For all connections in the connection set, the starting point is a and the end point is B:
(1) and initializing parameters, taking the connection starting point A as a wiring starting point C, and determining the direction of the current probe line according to the connection entering direction.
(2) And determining a wiring range according to the connection entry point, the connection exit point, the connection in-out direction and the drawing range.
(3) And determining a search line end point D and a search line CD according to the wiring range, the current wiring starting point and the search line direction.
(4) Concentration of N at the points of obstacleptSearching points on the search line, and if the points exist, determining a first-step wiring range BeginRange as a line segment CP (excluding C and P) between the starting point and the nearest obstacle point P; if not, determining the first-step wiring range BeginRange as a line segment CD (excluding C) from the starting point to the end point D of the search line.
(5) The points on the beginRange are taken from the near to the far from the starting point as the first inflection point and also as the starting point C of the new probe line.
(6) And determining a new wire probing direction and a wire probing end point D according to the wiring range and the position of the end point B.
(7) Performing collineation check, if the collineation is judged to be true, giving up the wiring attempt, turning to the step (5), and selecting a new first inflection point; and if the collinearity is judged to be false, determining a new exploration line CD according to the starting point, the end point and the exploration line direction of the new exploration line.
(8) And checking whether the current direction of the probe line is the same as the direction of the connection outlet. If the current probe line is the same as the connection terminal, judging whether the current probe line passes through the connection terminal. If the end point of the search line does not pass through the connection end point, the end point D of the search line needs to be changed to the end line.
(9) Concentration of N at the points of obstacleptSearching for a point on the exploration line, and if the point exists, determining that a point before the nearest barrier point P on the exploration line is a next inflection point (namely a new exploration line starting point); if not, determining the probe line end point D as the next inflection point (i.e. the new probe line start point).
(10) And (4) checking whether the new inflection points are the same as the end points, if so, finishing one wiring attempt, storing, returning to the step (5), selecting new first inflection points, and if all the first inflection points finish the wiring attempt, jumping to the step (13). If not, judging whether the end point of the current exploration line is the end point, if so, the wiring already enters a dead point, abandoning the wiring attempt, and returning to the step (5).
(11) And determining a new wire probing direction and a wire probing end point D according to the wiring range and the position of the end point B.
(12) Performing collinearity check, if the collinearity is judged to be true, the inflection point (namely the starting point of the new exploration line) needs to be checked back, and returning to the step (10); and if the collinearity is judged to be false, determining a new exploration line CD according to the starting point, the end point and the exploration line direction of the new exploration line. And returning to the step (8).
(13) Comparing the number of inflection points of all the wiring trial paths, and taking the minimum number of inflection points as a final wiring path; if the number of the inflection points is the same, comparing the distance between the first inflection point and the connection starting point, and taking the shortest one as the final routing path.
The main characteristics of the obstacle-based line exploration method in the example are:
(1) and (5) carrying out global gridding processing. The barrier gridding processing enables the connecting line to be related to the barrier and simultaneously be independent from the barrier in calculation, and also enables the information storage of the barrier to be more visual, so that non-point-by-point exploration becomes possible; the connection line gridding processing can greatly reduce the amount of exploration connection line calculation.
(2) Defining departure and arrival directions. The departure and arrival directions are perpendicular to the rectangle of the connection point in principle, so as to deal with the situation that the departure and arrival directions are obstacles, and meanwhile, the conflict between the water inlet line and the water outlet line is avoided when the single-line model is changed into the double-line model.
(3) The first step of exploration is performed several times. The first search may not be directed to the target due to limited departure and arrival directions, which may result in a long path and may cause unnecessary intersections when there are many links. And a plurality of times of exploration is introduced to the first step, and finally, the path with the minimum inflection point is selected, so that the problem can be effectively solved. Meanwhile, the dead point phenomenon can be dealt with to a certain extent by searching for a plurality of times.
The above is a specific embodiment of the present invention, which is easy to describe, and the protection scope of the present invention is not limited thereto. Those skilled in the art, having the benefit of this disclosure, may effect numerous modifications thereto and changes may be made without departing from the scope of the invention in its broader aspects.

Claims (6)

1. An obstacle-based line exploration algorithm, comprising the steps of:
s1, gridding a to-be-connected graph, and determining a connection limiting area; meanwhile, defining an obstacle set, a connection set and a connection set to be connected, and determining the characteristic attribute of each connection set to be connected;
s2, connecting one line in the connection set to be connected in the step S1 according to the obstacle set defined in the step S1, and storing the best connection line of the connection in the connection set defined in the step S1;
and S3, repeating the step S2 until all the connecting wires are connected.
2. The obstacle-based line exploration algorithm according to claim 1, wherein said step S1 specifically comprises:
s11, global gridding treatment: regarding the drawing range as a connecting line limiting area, and performing discrete gridding processing on the connecting line limiting area to obtain a two-dimensional grid;
s12, obstacle point set: integrally gridding any rectangular object to be connected, and gridding and dispersing the compact rectangle into a series of points; coding each grid point, and storing the gridded obstacle points in an obstacle point set;
s13, a connection set to be connected: each connection is composed of a connecting line and connecting points at two ends of the connecting line; assigning all connections to corresponding connection point information and initialized connection information, wherein a set formed by all the connections is a connection set to be connected;
s14, initializing a connection set: a set is created for storing the connection lines generated in step S2.
3. The obstacle-based line exploration algorithm according to claim 1, wherein said step S2 specifically comprises:
s21, parameter initialization: determining the direction of the initial search line according to the connection entering direction by taking the connection starting point as a wiring starting point (namely an initial search line starting point);
s22, determining a wiring range and a connection termination line: determining a wiring range according to a connection entry point, a connection exit point, a connection in-out direction and a drawing range; determining a connection termination line according to the connection exit point and the connection exit direction, wherein the connection termination line has the characteristic of penetrating through the connection exit point and being vertical to the exit direction;
s23, determining an initial exploration line: determining the end point of the current exploration line according to the wiring range, the starting point of the current wiring and the direction of the exploration line, and determining the exploration line according to the starting point and the end point;
s24, determining a first-step wiring range: defining a first-step wiring range as a first-step wiring trial range; determining that some points exist in the set of obstacle points determined in step S12 on the search line determined in step S23, and then determining the first-step wiring range as a line segment (excluding an end point) between the starting point and the nearest obstacle point; if the points on the search line determined in the step S23 do not exist in the set of obstacle points determined in the step S12, determining a line segment with the first-step wiring range as a starting point to an end point of the search line;
s25, determining a first step inflection point set and an attempt connecting set: defining a first inflection point set to store points in the first wiring range, and storing the points in the set from near to far from a starting point; initializing an empty set as a trial connection set for storing all the alternative connections obtained by calculation of the current connection;
s26, determining a first step inflection point: sequentially taking points from the first inflection point set of S25 as first inflection points and also as the starting points of new search lines;
s27, determining a new exploration line: determining a first inflection point as a starting point of a new exploration line, and determining a new exploration line direction and an exploration line terminal point according to a wiring range and a terminal point position;
s28, checking the validity of the current exploration line: if the current exploration line is effective, continuing the next step; if the current exploration line is invalid but only the exit connection direction check fails, changing the end point of the current exploration line to the connection termination line determined in the step S22, determining the point as a new inflection point, continuing the next step, and otherwise, jumping to the step S214 and selecting the next first step inflection point;
s29, determining a new inflection point: when the new inflection point is determined, skipping the step; otherwise, searching points on the search line in the obstacle point set, if the points exist, determining a point before the nearest obstacle point on the search line as the current search line terminal point, and determining the point as a new inflection point; if the point does not exist, determining the endpoint of the exploration line as a new inflection point;
s210, determining a new exploration line: determining a new exploration line direction and an exploration line terminal point according to the wiring range and the terminal point position by taking the new inflection point as a new exploration line starting point;
s211, checking the validity of the current exploration line: if the current exploration line is effective and does not reach the terminal point, continuing the next step; if the current exploration line is invalid but only the exit connection direction check fails, changing the terminal point of the current exploration line to the connection termination line determined in the step S22, determining the point as a new inflection point, and continuing the next step; returning to the step S26 when the current exploration line is invalid and the exit connection direction check passes but the dead point check does not pass, and selecting the next first step inflection point; otherwise, returning to the step S29, and moving the new inflection point determined in the step S29 backward by one;
s212, repeating the exploration in the steps S29, S210 and S211 until the exploration reaches the end point;
s213, storage wiring attempt: storing the wiring in the trial wiring set determined in the S25, returning to the step S26, and selecting the next point in the S25 initial inflection point set as a new initial inflection point;
s214, judging the end of connection: when all the points in the first step inflection point set are used as first step inflection points and the wiring is tried to be finished in S25, carrying out the next step; otherwise, returning to the step S26, and selecting the next point in the S25 first step inflection point set as a new first step inflection point;
s215, determining a final routing path: comparing the inflection points of all the routing attempt paths in the attempt connection line set in S25, and taking the minimum inflection point as a final routing path; when the number of inflection points is the same, comparing the distance between the inflection point of the first step and the connection starting point, and taking the shortest one as the final routing path;
s216, storing the optimal connection line: the line that the final routing mode of the connection obtained in step S215 is the optimal connection of the connection, and the numbers of all the points on the optimal connection are stored in the connection point set initialized in step S14.
4. The obstacle-based line exploration algorithm according to claim 3, wherein said current exploration line validity checks in steps S28 and S211 are specifically:
and (3) collinear inspection: the new search line is collinear with the connection line which is stored in the connection line set in S14, the collinear check is failed, and the current search is invalid; the new search line is not collinear with the connection line stored in the connection line set in S14, and the collinear check is passed;
checking the outlet connection direction: if the current exploration line direction is the same as the direction of the connection outlet and the current exploration line does not pass through the connection terminal, the detection of the outlet connection direction is not passed; otherwise, the outlet connection direction is checked to pass;
and (3) dead point inspection: the new inflection point is different from the end point, and the end point of the current exploration line is the end point, the current wiring already enters a dead point, and the dead point inspection is not passed; the new inflection point is different from the end point, and the end point of the current exploration line is not the end point, and the dead point check is passed; the new inflection point is the same as the end point, the dead point check passes but the end point is reached, and S213 is skipped to for storage;
if and only if the collinear inspection, the exit connection direction inspection and the dead point inspection are passed, the current probe line can be judged to be effective.
5. The obstacle-based line exploration algorithm according to claim 3, wherein said collinear check in the current exploration line validity checks of steps S28 and S211 is specifically:
storing all points on the existing connecting line into a connecting line point set; for the inflection point determined by each exploration, taking a line segment from the inflection point to the end point of the next exploration line, searching each point on the line segment in a line point set, and taking out all points existing in the line point set to form a cross point set; for each point in the intersection point set, searching whether two adjacent points in the direction perpendicular to the next exploration direction (the exploration direction after turning) exist in the connecting line point set or not, if the two adjacent points exist in the connecting line point set, determining that the two adjacent points are intersected, and if one adjacent point does not exist, determining that the two adjacent points are collinear; when the collinearity is judged to be true, the inflection point should be checked back to avoid the collinearity.
6. The obstacle-based line exploration algorithm according to claim 1, wherein said step S3 specifically comprises:
and when the to-be-connected link set completely traverses in the S13, finishing the algorithm.
CN202011068939.3A 2020-09-28 2020-09-28 Automatic drawing line exploration algorithm based on obstacles Active CN112241575B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202011068939.3A CN112241575B (en) 2020-09-28 2020-09-28 Automatic drawing line exploration algorithm based on obstacles

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202011068939.3A CN112241575B (en) 2020-09-28 2020-09-28 Automatic drawing line exploration algorithm based on obstacles

Publications (2)

Publication Number Publication Date
CN112241575A true CN112241575A (en) 2021-01-19
CN112241575B CN112241575B (en) 2022-11-11

Family

ID=74168700

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202011068939.3A Active CN112241575B (en) 2020-09-28 2020-09-28 Automatic drawing line exploration algorithm based on obstacles

Country Status (1)

Country Link
CN (1) CN112241575B (en)

Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20030132995A1 (en) * 1998-10-16 2003-07-17 Kia Silverbrook Supply mechanism for an inkjet printhead
US20050005937A1 (en) * 2003-06-20 2005-01-13 Farrugia Steven Paul Method and apparatus for improving the comfort of CPAP
CN101045432A (en) * 2006-03-16 2007-10-03 杨铭域 Auxiliary driving method and system
US20080028352A1 (en) * 2004-06-01 2008-01-31 Pulsic Limited Automatically Routing Nets with Variable Spacing
CN101592486A (en) * 2009-06-22 2009-12-02 廖云开 Star measuring scale gauge
CN102117350A (en) * 2009-12-31 2011-07-06 中国科学院微电子研究所 Automatic positioning method for physical short circuit positions among multiple line networks
CN108629061A (en) * 2017-03-23 2018-10-09 南京南瑞继保电气有限公司 A kind of power distribution network line chart automatic generation method of hybrid layout

Patent Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20030132995A1 (en) * 1998-10-16 2003-07-17 Kia Silverbrook Supply mechanism for an inkjet printhead
US20050005937A1 (en) * 2003-06-20 2005-01-13 Farrugia Steven Paul Method and apparatus for improving the comfort of CPAP
US20080028352A1 (en) * 2004-06-01 2008-01-31 Pulsic Limited Automatically Routing Nets with Variable Spacing
CN101045432A (en) * 2006-03-16 2007-10-03 杨铭域 Auxiliary driving method and system
CN101592486A (en) * 2009-06-22 2009-12-02 廖云开 Star measuring scale gauge
CN102117350A (en) * 2009-12-31 2011-07-06 中国科学院微电子研究所 Automatic positioning method for physical short circuit positions among multiple line networks
CN108629061A (en) * 2017-03-23 2018-10-09 南京南瑞继保电气有限公司 A kind of power distribution network line chart automatic generation method of hybrid layout

Also Published As

Publication number Publication date
CN112241575B (en) 2022-11-11

Similar Documents

Publication Publication Date Title
US10139236B2 (en) Route generation program, route generation method and route generation apparatus
CN108335356B (en) Automatic generation method of three-dimensional model of subway station
CN112179351B (en) Three-dimensional obstacle avoidance track planning method based on pre-planned path optimization RRT algorithm
JP4905210B2 (en) Three-dimensional internal space model generation method, apparatus, and program
CN107045656B (en) Intelligent scenic spot tour route planning method based on improved ant colony algorithm
CN112149217A (en) Method and device for generating three-dimensional indoor navigation scene, electronic equipment and storage medium
JP2008083112A (en) Network data generating device, network data generating program, mobile terminal, and data structure
CN111159811A (en) Underground garage layout method, device, equipment and storage medium
CN108426579A (en) A kind of floor inner track net automatic generation method
CN114161416A (en) Robot path planning method based on potential function
CN114777793B (en) BIM map extraction and path planning method for any navigation subject
CN112241575B (en) Automatic drawing line exploration algorithm based on obstacles
CN111501496A (en) Method and device for determining road elevation
CN111102980B (en) Path generation method and device and electronic equipment
JP3372910B2 (en) Apparatus and method for creating polygon road network data
CN115391878A (en) Building drawing identification and model construction method suitable for building human settlements environment simulation
CN108319751B (en) Automatic generation method of pipeline model of three-dimensional equipment of subway station pipeline
JP7448312B2 (en) Automatic routing method and device
CN114943113B (en) Method, system, storage medium and device for arranging diffusers in polygonal rooms
CN114818226B (en) Pipeline arrangement generating method, device, equipment and storage medium for plate building
CN115758543A (en) Automatic layout method for underground garage lane illumination
Xie et al. An interactive approach for generating spatial architecture layout based on graph theory
CN116305486B (en) Routing and wiring method, device and equipment for geothermal coil and readable storage medium
CN115950439B (en) Bidirectional RRT path planning method and device, electronic equipment and storage medium
CN102867095A (en) Bus wiring method

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