Disclosure of Invention
In view of the above technical problems, embodiments of the present application provide a method and an apparatus for shape scanning, so as to implement complex region scanning, overcome the restriction on scanning tasks caused by single circular and rectangular region scanning, and complete custom irregular traversal of a convex polygon region.
In a first aspect, an embodiment of the present invention provides a profile scanning method, including:
determining a region to be scanned;
dividing the area to be scanned into N-shaped edges;
dividing the N-polygon into S divided regions;
carrying out shape scanning on the S segmentation areas;
any internal angle of the N-polygon is less than 180 degrees, N is a positive integer greater than or equal to 3, and S is less than or equal to N-1.
Further, dividing the region to be scanned into N-sided polygons specifically includes:
converting the area to be scanned into mathematical coordinates;
dividing the area to be scanned into N-shaped edges on the mathematical coordinates;
wherein the origin of the mathematical coordinates is an initialization zero point of the scanning system.
Further, the method for dividing the regions comprises the following steps:
dividing the N-shaped area into S divided areas along the ordinate direction by taking the abscissa of each vertex of the N-shaped polygon as a dividing boundary;
the S divided areas are numbered from left to right from 1 to S, the 1 st divided area and the S th divided area are triangles, and the other divided areas are trapezoids.
Further, an embodiment of the present application further provides a method for determining vertex coordinates of the S divided regions, which specifically includes:
the vertex coordinates of the S divided regions are (a)i,bi);
The vertex coordinates (a)i,bi) On the N-polygon, starting from the leftmost vertex, in the clockwise direction, the number of i increases by 1 from 1, i has a value of 1 to2Q,Q=S+1;
Wherein (a)1,b1) And (a)2Q,b2Q) Overlapping, all being the leftmost vertex; (a)Q,bQ) And (a)Q+1,bQ+1) Overlap, both the rightmost vertices.
Further, an embodiment of the present application further provides a method for scanning each segmented region, which may specifically include: and starting from the 1 st segmented region on the leftmost side, sequentially scanning the shapes of the S segmented regions from left to right respectively. For each sub-region, the scanning method is as follows, i.e. scanning upwards first and then downwards:
taking the coordinate at the leftmost end of each divided area as a starting point, and taking the vertex with a small longitudinal coordinate value as a starting point if the leftmost end has two coordinates;
the abscissa is stepped to the right once and scanned upwards;
if the scanning is carried out to the upper boundary of the divided area, judging whether the divided area is completely scanned or not, if the scanning is completely scanned, finishing the scanning of the divided area, and starting the scanning of the next divided area; if the divided area is not scanned completely, the horizontal coordinate is stepped to the right once and is scanned downwards;
if the scanning is carried out to the lower boundary of the divided area, judging whether the divided area is scanned completely, if so, finishing the scanning of the divided area, and starting the scanning of the next divided area; if the divided area is not scanned completely, the horizontal coordinate is stepped to the right once and is scanned upwards;
wherein the one step to the right is moving the abscissa rightward by a distance m.
Preferably, the scanning may be performed first downwards and then upwards, specifically:
taking the coordinate at the leftmost end of each divided area as a starting point, and taking the vertex with a large longitudinal coordinate value as a starting point if the leftmost end has two coordinates;
the abscissa is stepped to the right once and scanned downwards;
if the scanning is carried out to the lower boundary of the divided area, judging whether the divided area is scanned completely, if so, finishing the scanning of the divided area, and starting the scanning of the next divided area; if the divided area is not scanned completely, the horizontal coordinate is stepped to the right once and is scanned upwards;
if the scanning is carried out to the upper boundary of the divided area, judging whether the divided area is completely scanned or not, if the scanning is completely scanned, finishing the scanning of the divided area, and starting the scanning of the next divided area; if the divided area is not scanned completely, the horizontal coordinate is stepped to the right once and is scanned downwards;
wherein the one step to the right is moving the abscissa rightward by a distance m.
Preferably, the method for determining the upper boundary of the divided region by scanning may be: when the ordinate of the scanning position is greater than or equal to Bs, determining to scan the upper boundary of the divided region, wherein the Bs is the upper boundary of the divided region corresponding to the abscissa position of the scanning position;
preferably, the method for determining that the scan reaches the lower boundary of the divided region may be: and when the ordinate of the scanning position is less than or equal to Bd, determining the lower boundary of the divided region scanned to, wherein Bd is the lower boundary of the divided region corresponding to the abscissa of the scanning position.
Further, when all the divided areas are completely scanned, the whole area to be scanned is completely scanned.
Preferably, before dividing the region to be scanned into N-sided polygons on the mathematical coordinates, the method further includes:
rotating the area to be scanned clockwise by 90 degrees by taking an original point as a center, and determining new mathematical coordinates x ', y'; wherein the origin of the new mathematical coordinate is an initialization zero point of the scanning system, x '═ -y, y' ═ x; x, y are the mathematical coordinates before rotation.
In a second aspect, an embodiment of the present invention further provides a profile scanning system, which is used to implement the above profile scanning method.
In the embodiment of the invention, the area to be scanned is divided by the method of the embodiment, and then each divided area is scanned respectively, so that the problem of scanning and measuring the complex area by the three-dimensional topography measuring instrument is solved, the scanning and measuring efficiency is improved, and the stability and the reliability are improved.
Detailed Description
In order to make the objects, technical solutions and advantages of the present invention clearer, the present invention will be described in further detail with reference to the accompanying drawings, and it is apparent that the described embodiments are only a part of the embodiments of the present invention, not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
Some of the words that appear in the text are explained below:
1. the term "and/or" in the embodiments of the present invention describes an association relationship of associated objects, and indicates that three relationships may exist, for example, a and/or B may indicate: a exists alone, A and B exist simultaneously, and B exists alone. The character "/" generally indicates that the former and latter associated objects are in an "or" relationship.
2. In the embodiments of the present application, the term "plurality" means two or more, and other terms are similar thereto.
In order to solve the problem that traversal scanning of a special area cannot be met in the prior art, the application provides a shape scanning method and system to achieve rapid traversal of a convex polygon area, complete a scanning task of a complex area, complete self-defined irregular traversal of the convex polygon area and improve functionality of a measuring system.
The method and the device are based on the same application concept, and because the principles of solving the problems of the method and the device are similar, the implementation of the device and the method can be mutually referred, and repeated parts are not repeated.
Various embodiments of the present application will be described in detail below with reference to the accompanying drawings. It should be noted that the display sequence of the embodiment of the present application only represents the sequence of the embodiment, and does not represent the merits of the technical solutions provided by the embodiments.
Example one
Referring to fig. 1, a schematic diagram of a profile scanning method provided in an embodiment of the present application is shown, where the method includes:
and S101, determining a region to be scanned.
S102, dividing the area to be scanned into N-sided polygons.
The N-polygon can be an irregular N-polygon defined by a user, and is determined according to the topographic features of the area to be scanned.
It should be noted that the N-polygon is a convex N-polygon, that is, any internal angle of the N-polygon is less than 180 degrees. The size of N is determined by the shape of the area to be scanned and the scanning precision requirement, and N is more than or equal to 3. In general, the larger N, the higher the scanning accuracy.
Preferably, the region to be scanned is converted into mathematical coordinates, and then the region to be scanned is divided into N-sided polygons on the mathematical coordinates. Where the origin of the mathematical coordinates is the initialized zero point of the scanning system.
As shown in fig. 2, the resulting N-sided polygon is divided, and N vertex coordinates of the N-sided polygon are recorded. The coordinates of N vertexes are sequentially (x) from the extreme left vertex along the clockwise direction1,y1),(x2,y2),(x3,y3)…(xN,yN). As an example, as shown in FIG. 5, the region to be scanned is divided into 5 polygons, and the vertex coordinates are (x) respectively1,y1),(x2,y2),(x3,y3),(x4,y4),(x5,y5)。
And S103, dividing the N-polygon into S divided areas.
Dividing the N-shaped area into S divided areas along the ordinate direction by taking the abscissa of each vertex of the N-shaped polygon as a dividing boundary;
the S divided areas are numbered from left to right from 1 to S, the 1 st divided area and the S th divided area are triangles, and the other divided areas are trapezoids.
Specifically, as shown in FIG. 3, the N vertex coordinates (x) of the N-sided polygon1,y1),(x2,y2),(x3,y3)…(xN,yN) The cutting method comprises the following steps:
the first step is as follows: arranging vertex coordinates from small to large according to an abscissa x, and if the abscissas of the two vertexes are the same, reserving the vertex coordinates with small ordinate values to form S +1 coordinates, which are marked as (x'1,y’1),(x’2,y’2),(x’3,y’3)…(x’S+1,y’S+1) I.e. x'1,x’2,x’3,……,x’S+1Arranging from small to large; wherein, (x'1,y’1) Is the leftmost vertex, (x'S+1,y’S+1) The rightmost vertex. Wherein S<=N-1。
Second oneThe method comprises the following steps: from (x'2,y’2) From start to (x'S,y’S) At each vertex, the N-sided polygon is divided into S regions by cutting along the ordinate direction.
Third, as shown in fig. 4, the vertex coordinates of all the divided regions are determined. Specifically, the vertex coordinates of all the divided regions are determined from the leftmost vertex in the clockwise direction of the N-polygon region, and the coordinates are expressed as (a)i,bi) I increases by 1 from 1 to 2Q, wherein (a)1,b1) And (a)2Q,b2Q) Overlap, all the leftmost vertices. (a) toQ,bQ) And (a)Q+1,bQ+1) Overlap, both the rightmost vertices. Wherein Q is S + 1.
As a typical example, the present embodiment provides a 5-sided cutting example as shown in fig. 6 for easy understanding. The vertex coordinates of the 5-sided polygon are (1,3), (3,6), (6,5), (7,3), (4,2) in the clockwise direction from the leftmost vertex, and the steps of division are given below.
In the first step, the vertex coordinates are arranged from small to large on the abscissa x, namely (1,3), (3,6), (4,2), (6,5), (7,3), for a total of 5 vertices;
in the second step, as shown in fig. 7,3 vertexes, i.e., (3,6), (4,2), (6,5), starting from the 2 nd vertex to the 4 th vertex are cut along the ordinate direction to divide the 5-sided polygonal region into 4 regions. Wherein, the 1 st area and the 4 th area are triangles, and the other areas are trapezoids;
thirdly, as shown in fig. 7, from the leftmost vertex, along the clockwise direction of the N-polygon region, determining that the vertex coordinates of all the divided regions are 2 × 10 vertices (4+1), where: (1,3),(3,6),(4,5.67),(6,5),(7,3),(7,3),(6,2.67),(4,2),(3,2.33),(1,3). Wherein, the 1 st vertex and the 10 th vertex are overlapped, the coordinates are all (1,3), the 5 th vertex and the 6 th vertex are overlapped, and the coordinates are all (7, 3).
And S104, carrying out shape scanning on the S segmentation areas.
The scanning sequence is that the S divided areas are respectively scanned from left to right in shape from the 1 st divided area at the leftmost.
Preferably, for each segmented region, the scanning method includes:
step A: taking the coordinate at the leftmost end of each divided area as a starting point, and taking the vertex with a small longitudinal coordinate value as a starting point if the leftmost end has two coordinates;
and B: the abscissa is stepped to the right once and scanned upwards;
and C: if the scanning is carried out to the upper boundary of the divided area, judging whether the divided area is completely scanned or not, if the scanning is completely scanned, finishing the scanning of the divided area, and starting the scanning of the next divided area; if the divided area is not scanned completely, the abscissa is stepped to the right once, and scanning is performed downwards, namely step D is executed;
step D: if the scanning is carried out to the lower boundary of the divided area, judging whether the divided area is scanned completely, if so, finishing the scanning of the divided area, and starting the scanning of the next divided area; if the divided area is not scanned completely, the horizontal coordinate is stepped to the right once, and the step C is executed after the horizontal coordinate is scanned upwards;
the step to the right is to move the abscissa to the right by a distance m, the upward scanning refers to scanning from the ordinate in a small-to-large direction, and the downward scanning refers to scanning from the ordinate in a large-to-small direction.
As another preferred embodiment, for each of the divided regions, the scanning method may further be:
step W: taking the coordinate at the leftmost end of each divided area as a starting point, and taking the vertex with a large longitudinal coordinate value as a starting point if the leftmost end has two coordinates;
step X: the abscissa is stepped to the right once and scanned downwards;
step Y: if the scanning is carried out to the lower boundary of the divided area, judging whether the divided area is scanned completely, if so, finishing the scanning of the divided area, and starting the scanning of the next divided area; if the divided area is not scanned completely, the abscissa is stepped to the right once, and the step Z is executed after the abscissa is scanned upwards;
step Z: if the scanning is carried out to the upper boundary of the divided area, judging whether the divided area is completely scanned or not, if the scanning is completely scanned, finishing the scanning of the divided area, and starting the scanning of the next divided area; if the divided area is not scanned completely, the abscissa is stepped to the right once, and scanning is performed downwards, namely step Y is executed;
the step to the right is to move the abscissa to the right by a distance m, the upward scanning refers to scanning from the ordinate in a small-to-large direction, and the downward scanning refers to scanning from the ordinate in a large-to-small direction.
Preferably, the present embodiment further provides a method for determining whether to scan to the upper boundary of the segmentation region, specifically:
determining an upper boundary scanned to the divided region when the ordinate of the scanning position is greater than or equal to Bs, wherein the value of Bs is determined by the following formula:
where S is the number of the divided region, n is the cumulative number of steps to the right, and a and b are the vertex coordinates of the divided region determined in S103.
Preferably, the present embodiment further provides a method for determining whether to scan to the lower boundary of the segmentation region, specifically:
when the ordinate of the scanning position is less than or equal to Bd, determining the lower boundary scanned to the segmentation area, wherein the value of Bd is determined by the following formula:
where S is the number of the divided region, n is the cumulative number of steps to the right, a, b are the vertex coordinates of the divided region specified in S103, and Q is S + 1.
Preferably, the present embodiment further provides a method for determining whether the scanning of the segmentation region is completed, which may specifically be: if as+m*n≥as+1And determining that the scanning of the segmentation area is finished, wherein S is the number of the segmentation area, and n is the accumulated number of rightward stepping. That is, when the right boundary of the divided region is scanned, the divided region is scanned completely.
Preferably, the embodiment further provides a method for determining whether the scanning of the whole area to be scanned is completed, which may specifically be: and if the scanning of the S-th segmentation area is finished, the scanning of the area to be scanned is finished. That is, when all the S scanning areas are completely scanned, the whole area to be scanned is completely scanned.
By the method, the area to be scanned is segmented, and each segmented area is scanned respectively, so that the problem of scanning and measuring the complex area by the three-dimensional topography measuring instrument is solved, the scanning and measuring efficiency is improved, and the stability and the reliability are improved.
Example two
As shown in fig. 8, the present embodiment further provides a profile scanning method. The cutting method of the divided region may be performed along the direction of the abscissa in addition to the cutting along the direction of the ordinate. To achieve cutting along the abscissa direction, the original N-polygon may be transformed as follows:
step I, taking an original point as a center, and clockwise rotating the area to be scanned by 90 degrees;
step II, determining new mathematical coordinates x ', y'. Wherein the origin of the new mathematical coordinate is the initialization zero point of the scanning system, x '-y, y' -x. x, y are the mathematical coordinates before rotation.
After transformation, on the x ', y' coordinates, segmentation is performed according to the same step of S103, and scanning is performed according to the method of step S104, which is not described again in this embodiment.
By the method of the embodiment, cutting and scanning in the abscissa direction of the original N-shaped polygon can be realized.
EXAMPLE III
As shown in fig. 9, this embodiment further provides a topography scanning system, where the scanning system is configured to implement the method described in the first embodiment or the second embodiment, so as to achieve the same effect as in the first embodiment or the second embodiment, and details of this embodiment are not repeated.
It will be apparent to those skilled in the art that various changes and modifications may be made in the present application without departing from the spirit and scope of the application. Thus, if such modifications and variations of the present application fall within the scope of the claims of the present application and their equivalents, the present application is intended to include such modifications and variations as well.