Disclosure of Invention
The invention mainly aims to provide a box surface containing track control point picking method and device facing a point cloud model, and aims to solve the technical problem that in the process of directly selecting proper path control points on a three-dimensional point cloud model, the three-dimensional point cloud model cannot keep a fixed posture, and the relationship among a plurality of selected path control points is difficult to maintain, so that the method and device are very difficult to complete.
In order to achieve the above object, the present invention provides a method for picking up a trajectory control point containing box surface facing a point cloud model, comprising the steps of:
determining all triangular plates for generating the surface of the given point cloud model by using a triangular gridding processing algorithm, and constructing all the triangular plates into a triangular plate array;
constructing a minimum containing box according to the maximum coordinate value and the minimum coordinate value of the given point cloud model in a three-dimensional coordinate system;
selecting 1 containing surface from the 6 containing surfaces of the smallest containing box as a working surface;
setting a point on the working surface as a target point, and constructing a ray which passes through the target point along the normal vector direction of the working surface;
finding the triangular plates of the given point cloud model surface penetrated by the ray, and constructing the triangular plates of the given point cloud model surface penetrated by the ray into a triangular plate linked list;
and searching the triangular plate chain table for the triangular plate of the given point cloud model surface which is closest to the working surface and penetrated by the ray, taking the intersection point of the triangular plate of the given point cloud model surface which is closest to the working surface and penetrated by the ray and the ray as a projection point, and taking the target point on the working surface as a track control point.
Preferably, the step of finding the triangular patches of the given point cloud model surface traversed by the ray and constructing the triangular patches of the given point cloud model surface traversed by the ray as a triangular patch linked list comprises:
judging whether the triangular plate array is traversed or not;
if the triangular plate array is judged not to be traversed, judging whether the ray passes through the current triangular plate;
and if the ray is judged to pass through the current triangular plate, adding the current triangular plate into the triangular plate linked list.
Preferably, the step of judging whether the ray passes through the current triangle comprises:
acquiring the normal vector of the current triangular plate;
judging whether an included angle between the normal vector of the working surface and the normal vector of the current triangular plate is larger than 90 degrees or not;
if the included angle is larger than 90 degrees, judging that the ray does not penetrate through the current triangular plate;
and if the included angle is smaller than or equal to 90 degrees, continuously judging whether the ray passes through the current triangular plate.
Preferably, the step of continuously judging whether the ray passes through the current triangle comprises the following steps:
projecting three vertexes of the current triangular plate to the working surface along the normal vector direction of the working surface to obtain three projection points of the three vertexes corresponding to each other on the working surface;
constructing the target point on the working surface and the three projection points into three vectors in sequence;
calculating included angles between every two of the three vectors;
judging whether the sum of the included angles is equal to 360 degrees or not;
if the sum of the included angles is equal to 360 degrees, the ray is judged to penetrate through the current triangular plate;
and if the sum of the included angles is not equal to 360 degrees, judging that the ray does not pass through the current triangular plate.
Preferably, the length of the linked list of triangular plates is at most 20.
The invention further provides a box surface containing track control point picking device facing the point cloud model, which comprises:
the triangular plate array construction module is used for determining all triangular plates for generating the surface of the given point cloud model by using a triangular gridding processing algorithm and constructing all the triangular plates into a triangular plate array;
the minimum containing box constructing module is used for constructing a minimum containing box according to the maximum coordinate value and the minimum coordinate value of the given point cloud model in the three-dimensional coordinate system;
a working face selection module for selecting 1 containing face from the 6 containing faces of the smallest containing box as a working face;
the ray construction module is used for setting a point on the working surface as a target point and constructing a ray which passes through the target point along the normal vector direction of the working surface;
the triangular plate linked list construction module is used for searching triangular plates of the given point cloud model surface penetrated by the ray and constructing the triangular plates of the given point cloud model surface penetrated by the ray into a triangular plate linked list;
and the track control point module is used for searching the triangular plate of the given point cloud model surface which is closest to the working surface and is penetrated by the ray in the triangular plate linked list, taking the intersection point of the ray and the triangular plate of the given point cloud model surface which is closest to the working surface and is penetrated by the ray as a projection point, and taking the target point on the working surface as a track control point.
Preferably, the triangle list building module includes:
the triangular plate array traversal judgment submodule is used for judging whether the triangular plate array is traversed or not;
the ray passes through the triangular plate judgment submodule and is used for judging whether the ray passes through the current triangular plate or not if the ray is judged to have not passed through the triangular plate array;
and adding a triangular plate sub-module to the triangular plate linked list, wherein the triangular plate sub-module is used for adding the current triangular plate to the triangular plate linked list if the ray is judged to pass through the current triangular plate.
Preferably, the ray passing triangular plate judgment sub-module comprises:
the triangular plate normal vector acquisition unit is used for acquiring the normal vector of the current triangular plate;
the normal vector included angle judging unit is used for judging whether an included angle between the normal vector of the working surface and the normal vector of the current trigonometric sheet is larger than 90 degrees or not;
the ray does not pass through the triangular plate judging unit and is used for judging that the ray does not pass through the current triangular plate if the included angle is larger than 90 degrees;
and the ray passing through the triangular plate continuous judging unit is used for continuously judging whether the ray passes through the current triangular plate or not if the included angle is smaller than or equal to 90 degrees.
Preferably, the ray passing through triangle piece continuous judging unit includes:
the projection point obtaining subunit is configured to project the three vertices of the current triangular plate to the working surface along a normal vector direction of the working surface, so as to obtain three projection points of the three vertices on the working surface, where the three projection points correspond to each other one by one;
the vector construction subunit is used for constructing the target point on the working surface and the three projection points into three vectors in sequence;
the vector included angle calculating subunit is used for calculating included angles between every two of the three vectors;
the sum of included angles judging subunit is used for judging whether the sum of the included angles is equal to 360 degrees or not;
the ray passing triangular plate judging subunit is used for judging that the ray passes through the current triangular plate if the sum of the included angles is equal to 360 degrees;
and the ray does not pass through the triangular plate judging subunit, and is used for judging that the ray does not pass through the current triangular plate if the sum of the included angles is not equal to 360 degrees.
Preferably, the length of the linked list of the triangular plates constructed in the triangular plate linked list constructing module is at most 20.
Through the steps, the only minimum containing box can be constructed according to the maximum coordinate value and the minimum coordinate value of the given point cloud model in the three-dimensional coordinate system, and one containing surface of the minimum containing box is selected as the working surface, so that the point selection can be realized in a fixed visual angle and a fixed operation plane, the operation is simple, convenient and intuitive, the data processing flow is simplified, various alignments can be operated by referring to a CAD sketch, the normalization of a track control point is improved, and the corresponding processing quality is further improved.
And overcomes two disadvantages of the existing traditional method: the method comprises the following steps that (1) track points are planned on a 2D drawing and are not operated; and although the point selection on the 3D model curved surface is intuitive, the fixed posture or the posture cannot be kept in the point selection process, and the relationship among multiple points is difficult to maintain in a three-dimensional space. The method of selecting points on the containing surface of the smallest containing box also achieves the advantages of good processing effect and better consistency with the actual working scene.
Detailed Description
It should be understood that the specific embodiments described herein are merely illustrative of the invention and are not intended to limit the invention.
Referring to fig. 1, fig. 1 is a schematic flowchart of a first embodiment of a box surface containing trajectory control point picking method for a point cloud model according to the present invention.
And step S1, constructing a triangular plate array.
Namely, a triangular gridding processing algorithm is used for determining all triangular plates for generating the surface of the given point cloud model, and all the triangular plates are constructed into a triangular plate array.
And step S2, constructing a minimum containing box.
Namely, a minimum containing box is constructed according to the maximum coordinate value and the minimum coordinate value of the given point cloud model in the three-dimensional coordinate system.
And step S3, selecting a working surface.
I.e. 1 containing face is selected as the working face from among the 6 containing faces of the smallest containing box.
Step S4, target points are set and rays are constructed.
Namely, a point is set on the working surface as a target point, and a ray passing through the target point along the normal vector direction of the working surface is constructed.
And step S5, constructing a triangular plate linked list.
I.e. finding the triangular patches of the given point cloud model surface traversed by the ray and constructing the triangular patches of the given point cloud model surface traversed by the ray as a triangular patch linked list.
And step S6, finding the triangular plate closest to the working surface, and taking the target point on the working surface as a track control point.
Finding the triangular plate of the given point cloud model surface penetrated by the ray and closest to the working surface in the triangular plate linked list, taking the intersection point of the triangular plate of the given point cloud model surface penetrated by the ray and closest to the working surface and the ray as a projection point, and taking the target point on the working surface as a track control point
Through the steps, the only minimum containing box can be constructed according to the maximum coordinate value and the minimum coordinate value of the given point cloud model in the three-dimensional coordinate system, and one containing surface of the minimum containing box is selected as the working surface, so that the point selection can be realized in a fixed visual angle and a fixed operation plane, the operation is simple, convenient and visual, the data processing flow is simplified, various alignments can be operated by referring to a CAD sketch, the standardization of a track control point is improved, and the corresponding processing quality is improved.
And overcomes two disadvantages of the existing traditional method: the method comprises the following steps that (1) track points are planned on a 2D drawing and are not operated; and although the point selection on the 3D model curved surface is intuitive, the fixed posture or the posture cannot be kept in the point selection process, and the relationship among multiple points is difficult to maintain in a three-dimensional space. The method of selecting points on the containing surface of the smallest containing box also achieves the advantages of good processing effect and better consistency with the actual working scene.
Referring to fig. 2, fig. 2 is a schematic flowchart of a second embodiment of the method for picking up trajectory control points containing box surfaces facing a point cloud model according to the present invention. As shown in fig. 2, based on the above embodiment of fig. 1, the step S5 of constructing the triangle linked list includes:
and step S51, whether the triangular plate array is traversed or not.
Namely, whether the triangular plate array is traversed or not is judged. If the triangle array is determined to be traversed, executing step S6, otherwise updating the current triangle and executing step S52.
Step S52, whether the ray passed through the current triangle.
Namely, if the triangular plate array is judged not to be traversed, whether the ray passes through the current triangular plate is judged. If the ray is determined to pass through the current triangle, performing step S53; if it is determined that the ray does not pass through the current triangle, step S51 is performed.
And step S53, adding the current triangular plate into the triangular plate linked list.
If the ray is judged to pass through the current triangular plate, adding the current triangular plate into the triangular plate linked list.
By the method for traversing all the triangular plates on the surface of the three-dimensional point cloud model, all the triangular plates which are traversed by the ray can be easily found, and omission does not exist. The method is easy to realize by an algorithm program, so that the processing process is simple, convenient and visual, the data processing flow is simplified, and the operability is better.
Referring to fig. 3, fig. 3 is a schematic flowchart of a third embodiment of the method for picking up trajectory control points containing box surfaces facing a point cloud model according to the present invention. As shown in fig. 3, based on the embodiment of fig. 2, the step S52 includes:
and S521, acquiring the normal vector of the current triangular plate.
Namely, the normal vector of the current triangular plate is obtained.
And S522, judging whether the normal vector included angle between the working surface and the current triangular plate is larger than 90 degrees.
Namely, whether the included angle between the normal vector of the working surface and the normal vector of the current triangular plate is larger than 90 degrees is judged. If the included angle is larger than 90 degrees, executing step S523; if the included angle is determined to be less than or equal to 90 degrees, step S524 is executed.
And S523, judging that the ray does not penetrate through the current triangular plate.
That is, if the included angle is greater than 90 degrees, it is determined that the ray does not pass through the current triangle, and then step S51 is performed.
And S524, continuously judging whether the ray passes through the current triangular plate.
Namely, if the included angle is smaller than or equal to 90 degrees, whether the ray passes through the current triangular plate is continuously judged. If the ray is judged to pass through the current triangular plate, executing the step S53; if the ray is not determined to pass through the current triangle, step S51 is executed.
By judging whether the included angle between the normal vector of the working surface and the normal vector of the current triangular plate is larger than 90 degrees or not, the triangular plate with the included angle larger than 90 degrees can be filtered out from the candidate triangular plates, the calculation that whether the filtered triangular plates penetrate the triangular plate or not in the subsequent judgment of rays is avoided, the calculation time and the calculation resources are saved, the calculation complexity is reduced, and the processing efficiency is improved. And the calculation method of the normal vector is relatively simple, is easy to realize by an algorithm program, and has accurate and reliable results, thereby simplifying the data processing flow and having better operability.
Referring to fig. 4, fig. 4 is a schematic flowchart of a fourth embodiment of the method for picking up trajectory control points containing box surfaces facing a point cloud model according to the present invention. As shown in fig. 4, based on the above embodiment of fig. 3, the step S524 of continuously determining whether the ray passes through the current triangle includes:
and S5241, obtaining three corresponding projection points of the three vertexes of the current triangular plate on the working surface.
Namely, three vertexes of the current triangular plate are projected to the working surface along the normal vector direction of the working surface, and three projection points of the three vertexes corresponding to each other on the working surface are obtained.
And S5242, constructing three vectors.
Namely, the target point on the working surface and the three projection points are constructed into three vectors in sequence.
S5243, calculating the included angle between every two three vectors.
Namely, the included angle between every two of the three vectors is calculated.
S5244, judging whether the sum of the included angles is equal to 360 degrees.
Namely, whether the sum of the included angles is equal to 360 degrees is judged. If the sum of the included angles is judged to be equal to 360 degrees, the ray can be judged to penetrate through the current triangular plate, and the step S5245 is executed; if the sum of the included angles is determined not to be equal to 360 degrees, it can be determined that the ray does not pass through the current triangle, and step S5246 is performed.
S5245, judging that the ray passes through the current triangular plate.
That is, if the sum of the included angles is equal to 360 degrees, it is determined that the ray passes through the current triangle, and then step S53 is performed.
S5246, the ray is judged not to pass through the current triangular plate.
That is, if the sum of the included angles is not equal to 360 degrees, it is determined that the ray does not pass through the current triangle, and then step S51 is performed.
The calculation for judging whether the ray passes through the triangular plate can be mapped to the operation surface from the plane of the triangular plate through the steps, so that the calculation complexity is reduced, the algorithm program is simpler, and the calculation result is accurate and reliable, so that the method has better operability.
Further, based on the above-mentioned embodiments of fig. 1 to 4, the length of the linked list of the triangular plates is at most 20. .
By setting the length of the linked list of the triangular plates, the number of rays passing through the current triangular plate is limited to 20, and the performability of the algorithm program is ensured.
The above-described trajectory control point picking method for box surface containing of point cloud model in the first embodiment of the trajectory control point picking method for box surface containing of point cloud model according to the present invention can be realized by the trajectory control point picking apparatus for box surface containing of point cloud model provided in the first embodiment of the trajectory control point picking apparatus for box surface containing of point cloud model according to the present invention.
Referring to fig. 5, fig. 5 provides a trajectory control point picking device facing a box surface of a point cloud model according to a first embodiment of the trajectory control point picking device facing a box surface of a point cloud model, the device comprising:
and the triangular plate array construction module 10 is used for determining all triangular plates for generating the surface of the given point cloud model by using a triangular gridding processing algorithm and constructing all the triangular plates into a triangular plate array.
And a minimum containing box constructing module 20, configured to construct a minimum containing box according to the maximum coordinate value and the minimum coordinate value of the given point cloud model in the three-dimensional coordinate system.
A work surface selection module 30 for selecting 1 containing surface as a work surface from among the 6 containing surfaces of said smallest containing box.
And the ray construction module 40 is used for setting a point on the working surface as a target point and constructing a ray which passes through the target point along the normal vector direction of the working surface.
And the triangular plate linked list building module 50 is used for searching the triangular plate of the given point cloud model surface penetrated by the ray and building the triangular plate of the given point cloud model surface penetrated by the ray into a triangular plate linked list.
And the trajectory control point module 60 is configured to search the triangular plate of the given point cloud model surface passed through by the ray, which is closest to the working surface, from the triangular plate linked list, and use an intersection point of the ray and the triangular plate of the given point cloud model surface passed through by the ray, which is closest to the working surface, as a projection point, and use the target point on the working surface as a trajectory control point.
Through the module, the unique minimum containing box can be constructed according to the maximum coordinate value and the minimum coordinate value of the given point cloud model in the three-dimensional coordinate system, and one containing surface of the minimum containing box is selected as a working surface, so that the point selection can be realized in a fixed visual angle and a fixed operation plane, the operation is simple, convenient and visual, the data processing flow is simplified, various alignments can be operated by referring to a CAD sketch, the standardization of a track control point is improved, and the corresponding processing quality is further improved.
And overcomes two disadvantages of the existing traditional method: the method comprises the following steps that (1) track points are planned on a 2D drawing and are not operated; and although the point selection on the 3D model curved surface is intuitive, the fixed posture or the posture cannot be kept in the point selection process, and the relationship among multiple points is difficult to maintain in a three-dimensional space. The method of selecting points on the containing surface of the smallest containing box also achieves the advantages of good processing effect and better consistency with the actual working scene.
The above-described trajectory control point picking method for box surface containing of point cloud model in the second embodiment of the trajectory control point picking method for box surface containing of point cloud model according to the present invention can be realized by the trajectory control point picking apparatus for box surface containing of point cloud model provided in the second embodiment of the trajectory control point picking apparatus for box surface containing of point cloud model according to the present invention.
Referring to fig. 6, a second embodiment of the box surface containing track control point picking apparatus for a point cloud model according to the present invention provides a box surface containing track control point picking apparatus for a point cloud model, and based on the embodiment shown in fig. 5, the triangle piece linked list constructing module 50 includes:
and a triangular plate array traversal judging submodule 510 for judging whether the triangular plate array is traversed completely.
That is, the triangle array traversal judging sub-module 510 judges whether the triangle array is traversed completely. If the triangular plate array is judged to be traversed, the ray passes through the triangular plate judgment submodule 520 to judge whether the ray passes through the current triangular plate, otherwise, the triangular plate linked list additional triangular plate submodule 530 adds the current triangular plate into the triangular plate linked list.
And the ray passes through the triangular plate judgment submodule 520, and is used for judging whether the ray passes through the current triangular plate or not if the triangular plate array is judged not to be traversed.
And a triangle sub-module 530 is added to the triangle chain table for adding the current triangle into the triangle chain table if the ray is judged to pass through the current triangle.
By the method for traversing all the triangular plates on the surface of the three-dimensional point cloud model adopted by the module, all the triangular plates which are penetrated by the ray can be easily searched, and omission is avoided. And the method is easy to realize by an algorithm program, so that the processing process is simple, convenient and visual, the data processing flow is simplified, and the method has better operability.
The third embodiment of the method for picking up the locus control point containing box surface facing the point cloud model according to the present invention can be implemented by the apparatus for picking up the locus control point containing box surface facing the point cloud model provided in the third embodiment of the apparatus for picking up the locus control point containing box surface facing the point cloud model according to the present invention.
Referring to fig. 7, a third embodiment of the trajectory control point picking apparatus for containing box surfaces facing a point cloud model according to the present invention provides a trajectory control point picking apparatus for containing box surfaces facing a point cloud model, and based on the embodiment shown in fig. 6, the ray passing triangle judgment sub-module 520 includes:
a triangular plate normal vector obtaining unit 521, configured to obtain a normal vector of the current triangular plate.
And a normal vector included angle determining unit 522, configured to determine whether an included angle between the normal vector of the working surface and the normal vector of the current triangular plate is greater than 90 degrees.
Namely, whether the included angle between the normal vector of the working surface and the normal vector of the current triangular plate is larger than 90 degrees is judged. If the included angle is determined to be greater than 90 degrees, the ray does not pass through the triangular plate determination unit 523, and it is determined that the ray does not pass through the current triangular plate; if the included angle is determined to be smaller than or equal to 90 degrees, the ray passing through the triangular plate continuous determination unit 524 continuously determines whether the ray passes through the current triangular plate.
The ray does not pass through the triangular plate determination unit 523, and is configured to determine that the ray does not pass through the current triangular plate if the included angle is greater than 90 degrees.
And a ray passing through triangular plate continuous judging unit 524, configured to continuously judge whether the ray passes through the current triangular plate if the included angle is smaller than or equal to 90 degrees.
By judging whether the included angle between the normal vector of the working surface and the normal vector of the current triangular plate is larger than 90 degrees or not, the triangular plate with the included angle larger than 90 degrees can be filtered out from the candidate triangular plates, the calculation that whether the filtered triangular plates penetrate the triangular plate or not in the subsequent judgment of rays is avoided, the calculation time and the calculation resources are saved, the calculation complexity is reduced, and the processing efficiency is improved. And the calculation method of the normal vector is relatively simple, is easy to realize by an algorithm program, and has accurate and reliable results, thereby simplifying the data processing flow and having better operability.
The trajectory control point picking method facing the box surface of the point cloud model in the fourth embodiment of the trajectory control point picking method facing the box surface of the point cloud model of the present invention can be realized by the trajectory control point picking device facing the box surface of the point cloud model provided in the fourth embodiment of the trajectory control point picking device facing the box surface of the point cloud model of the present invention.
Referring to fig. 8, a third embodiment of the quotation processing apparatus according to the present invention provides a quotation processing apparatus, and based on the embodiment shown in fig. 7, the ray-passing triangle sheet continuation judging unit 524 includes:
the projection point obtaining subunit 5241 is configured to project the three vertices of the current triangular plate to the working surface along the normal vector direction of the working surface, so as to obtain three projection points of the three vertices on the working surface, where the three projection points correspond to each other one by one.
A vector construction subunit 5242, configured to construct the target point and the three projection points on the working surface into three vectors in sequence.
And a vector angle calculation subunit 5243, configured to calculate an angle between each two of the three vectors.
A sum of included angles determination subunit 5244, configured to determine whether the sum of included angles is equal to 360 degrees.
Namely, whether the sum of the included angles is equal to 360 degrees is judged. If the sum of the included angles is determined to be equal to 360 degrees, it may be determined that the ray passes through the current triangle, and the ray passing triangle determination subunit 5245 determines that the ray passes through the current triangle; if it is determined that the sum of the included angles is not equal to 360 degrees, it may be determined that the ray does not pass through the current triangle and ray not pass through triangle determination subunit 5246 determines that the ray does not pass through the current triangle.
The ray passes through the triangular plate determination subunit 5245, which is configured to determine that the ray passes through the current triangular plate if the sum of the included angles is equal to 360 degrees.
The ray does not pass through the triangle patch determination subunit 5246, which is configured to determine that the ray does not pass through the current triangle patch if the sum of the included angles is not equal to 360 degrees.
Therefore, the calculation for judging whether the ray passes through the triangular plate can be mapped to the operation surface from the plane of the triangular plate, the calculation complexity is reduced, the algorithm program is simpler, the calculation result is accurate and reliable, and the operability is better.
Further, based on the above-mentioned embodiments of fig. 5 to 8, the length of the linked list of triangular plates constructed in the triangular plate linked list constructing module 50 is at most 20.
By setting the length of the linked list of the triangular plates, the number of rays passing through the current triangular plate is limited to 20, and the performability of the algorithm program is ensured.
It should be noted that, in this document, 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 an … …" does not exclude the presence of other like elements in a process, method, article, or apparatus that comprises the element.
The above-mentioned serial numbers of the embodiments of the present invention are merely for description and do not represent the merits of the embodiments.
It will be apparent to those skilled in the art that the above-described block units or steps of the present invention may be implemented by a general purpose computing device, or alternatively, they may be implemented by program code executable by a computing device, so that they may be stored in a storage device and executed by a computing device, and in some cases, the steps shown or described may be performed in a different order than here, or they may be separately fabricated into individual integrated circuit modules, or multiple ones of them may be fabricated into a single integrated circuit module. Thus, the present invention is not limited to any specific combination of hardware and software.
Through the above description of the embodiments, those skilled in the art will clearly understand that the method of the above embodiments can be implemented by software plus a necessary general hardware platform, and certainly can also be implemented by hardware, but in many cases, the former is a better implementation manner. Based on such understanding, the technical solutions of the present invention may be embodied in the form of a software product, which is stored in a storage medium (such as ROM/RAM, magnetic disk, optical disk) and includes instructions for enabling a terminal device (such as a mobile phone, a computer, a server, an air conditioner, or a network device) to execute the method according to the embodiments of the present invention.
The above description is only a preferred embodiment of the present invention, and not intended to limit the scope of the present invention, and all modifications of equivalent structures and equivalent processes, which are made by using the contents of the present specification and the accompanying drawings, or directly or indirectly applied to other related technical fields, are included in the scope of the present invention.