A data measurement method based on a three-dimensional mesh model and related equipment

By obtaining measurement commands from a 3D mesh model, parsing them, and performing intersection detection, the problem of low measurement accuracy of 3D mesh model data is solved, achieving high-precision and low-cost measurement results.

CN115239910BActive Publication Date: 2026-02-06SHENZHEN ZHONGKE ZHIMEI TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202210798517.4
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-07-06
Publication Date
2026-02-06
Estimated Expiration
2042-07-06

AI Technical Summary

Technical Problem

Existing data measurement methods based on 3D mesh models suffer from low accuracy and high cost, especially when high-precision measurements are difficult to achieve due to the influence of triangular mesh density.

Method used

By acquiring measurement instructions, the measurement points are parsed and intersection detection is performed based on the mesh patches of the preset initial model. The target ray and spatial points are calculated, and the measurement results are determined by combining discrete rules and plane mapping.

Benefits of technology

It improves the accuracy of data measurement, reduces measurement costs, and adapts to different types of measurement commands such as surface distance, surface area, and volume measurement.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115239910B_ABST
    Figure CN115239910B_ABST
Patent Text Reader

Abstract

The application discloses a data measurement method based on a three-dimensional grid model and related equipment, and the method comprises the following steps: obtaining a measurement instruction; analyzing the measurement instruction to obtain a plurality of measurement points; for each measurement point, calculating a target ray corresponding to the measurement point according to a screen position coordinate corresponding to the measurement point; performing intersection detection on the target ray based on a grid sheet of a preset initial model to determine a target space point corresponding to the screen position coordinate; and calculating a measurement result corresponding to the measurement instruction based on the target space point. The application reduces the calculation amount and improves the calculation speed on the basis of improving the calculation accuracy based on the three-dimensional grid model.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the technical field of data processing, in particular to a data measurement method based on a three-dimensional mesh model and related equipment. BACKGROUND

[0002] Three-dimensional surveying is a means of intuitively expressing spatial information by using point, line, and surface information. With the development of technology, users hope that three-dimensional surveying can not only obtain a general outline, but also obtain three-dimensional data of a target through a digital three-dimensional model. Therefore, the application of non-contact data measurement of objects through three-dimensional scanning is increasing. Taking a three-dimensional model in the form of a mesh as an example, a three-dimensional model obtained after three-dimensional surveying is composed of a three-dimensional mesh and a texture picture. A three-dimensional mesh generally includes three or four spatial points, i.e., a triangular mesh or a quadrilateral mesh. The triangular mesh is more common, and the following is an example of a triangular mesh. Spatial points are discretely distributed in a three-dimensional space according to the surface shape of a scanned target, and each three vertices form a triangular mesh. A plurality of triangular meshes form a three-dimensional mesh model. A texture map is a two-dimensional picture. According to the texture coordinates of the mesh, the mesh vertices are one-to-one corresponding to the texture pixel coordinates, and are affinely transformed and attached together to form a three-dimensional mesh model with texture information.

[0003] In general, a mesh vertex is selected on a mesh model by selecting a point according to the characteristics of a color texture. This point can find a unique point according to the texture information, but it cannot directly find a unique mesh vertex. Because the triangular mesh model is originally a data method for approximating a real target object by using a discrete mesh model, the smaller each triangular mesh is, i.e., the higher the sampling rate is, the closer the approximation to the real target object is, and thus the higher the accuracy is. However, a super-high-precision model requires high scanning equipment and algorithms, and the data volume is also large, which brings great challenges to data processing, transmission, and storage. Therefore, in actual applications, the accuracy of the model and the mesh sampling size are a compromise, and each triangular mesh size is moderate, which does not significantly affect the overall model accuracy and does not cause excessive data volume.

[0004] Based on this, when data measurement is performed on a three-dimensional mesh model, the position of a mesh vertex is generally not considered, and a point or a line is directly selected on a triangular mesh. Taking distance calculation as an example, the currently common method is a data measurement method taking a triangular mesh as the smallest unit. When a user selects a starting point and an ending point, the nearest neighbor point of the starting point or the ending point is used to replace the point originally selected by the user, and then the distance between the points is calculated based on the replaced point. When a triangular mesh is selected, it is determined whether the entire triangular mesh is selected according to a specific rule, and then the distance is calculated according to the triangular mesh. According to this rule, the data measurement accuracy is affected by the density of the triangular mesh. The higher the density is, the higher the accuracy is, and the higher the cost and the measurement difficulty are. The lower the density is, the lower the accuracy is, and the lower the cost and the measurement difficulty are. SUMMARY

[0005] The technical problem solved by the present application is that the data measurement accuracy based on the grid model is low at low cost, and the present application provides a data measurement method based on a three-dimensional grid model and related equipment to solve the problems of the prior art.

[0006] To solve the above technical problems, the technical solutions adopted by the present application are as follows:

[0007] A data measurement method based on a three-dimensional grid model, the method comprising:

[0008] obtaining a measurement instruction;

[0009] parsing the measurement instruction to obtain a plurality of measurement points;

[0010] For each measurement point, a target ray corresponding to the measurement point is calculated according to the screen position coordinates corresponding to the measurement point.

[0011] Based on the grid sheet of the preset initial model, the target ray is intersected to determine the target space point corresponding to the screen position coordinates.

[0012] Based on the target space point, the measurement result corresponding to the measurement instruction is calculated.

[0013] The data measurement method based on a three-dimensional grid model, wherein when the measurement instruction is a surface distance measurement instruction, the measurement instruction includes a specified path or a path endpoint, wherein the path endpoint includes a path starting point and a path ending point; the parsing of the measurement instruction to obtain a plurality of measurement points comprises:

[0014] When the measurement instruction includes a specified endpoint, a path curve corresponding to the measurement instruction is generated according to the path starting point and the path ending point.

[0015] When the measurement instruction includes a specified path, the specified path is taken as a path curve.

[0016] According to a preset discretization rule, the path curve is discretized to obtain the measurement points.

[0017] The data measurement method based on a three-dimensional grid model, wherein the discretization of the path curve according to the preset discretization rule to obtain the measurement points comprises:

[0018] Performing plane mapping on the initial model to obtain a plane grid corresponding to each solid grid in the initial model.

[0019] According to the screen position coordinates of the planar grid, an intersection between the path curve and the planar grid is calculated to obtain a first discrete point;

[0020] According to the first discrete point, a direction inflection point in the path curve is calculated to obtain a second discrete point;

[0021] The first discrete point, the second discrete point, the path starting point and the path ending point are taken as measurement points.

[0022] The three-dimensional grid model-based data measurement method, wherein the measurement instruction is parsed to obtain a plurality of measurement points, and the method further comprises:

[0023] When the measurement instruction is a surface area measurement instruction, the measurement instruction comprises a first specified area, wherein the specified area comprises a plurality of first area edges;

[0024] The initial model is subjected to planar mapping to obtain a planar grid corresponding to each solid grid in the initial model;

[0025] According to the planar grid and the first area edge, a selected cross grid in the planar grid and a selected inner grid are determined;

[0026] The vertices of the selected cross grid and the intersection points between the selected cross grid and the area edge are taken as measurement points corresponding to the measurement instruction.

[0027] The three-dimensional grid model-based data measurement method, wherein before the measurement instruction is parsed to obtain a plurality of measurement points, the method further comprises:

[0028] According to the spatial order of the grid layers, a connection layer corresponding to each grid layer is determined;

[0029] For each grid layer, each solid grid in the grid layer is connected with a solid grid of the connection layer to obtain a pentahedron;

[0030] The pentahedron is split to obtain a target model corresponding to the initial model.

[0031] The three-dimensional grid model-based data measurement method, wherein the connection between each solid grid in the grid layer and a solid grid of the connection layer to obtain a pentahedron comprises:

[0032] According to the spatial relationship of each grid vertex in the grid layer, a first vertex array corresponding to the grid layer is generated, and according to the spatial relationship of each grid vertex in the connection layer corresponding to the grid layer, a second vertex array corresponding to the connection layer is generated, wherein the first vertex array includes the first vertex in the grid layer, and the second vertex array includes the second vertex in the connection layer;

[0033] For each first vertex in the first vertex array, the connection distance between the vertex and the non-connection point in the second vertex is calculated in turn, and the non-connection point with the smallest connection distance is taken as the connection point corresponding to the vertex, wherein when the first time is calculated, the number of non-connection points is zero;

[0034] Connecting each vertex in the first vertex data with the corresponding connection point obtains a pentahedron.

[0035] The data measurement method based on the three-dimensional grid model, wherein the analyzing the measurement instruction to obtain a plurality of measurement points comprises:

[0036] When the measurement instruction is a volume measurement instruction, the measurement instruction includes a specified second specified area, wherein the second specified area includes a plurality of second area edges;

[0037] Performing plane mapping on the target model obtains screen grid information corresponding to the target model, wherein the screen grid information includes screen grid coordinates and connection lines corresponding to each grid;

[0038] According to the screen grid information and the second area edge, the selected cross grid in the grid and the selected internal grid are determined;

[0039] The vertices in the selected cross grid and the selected internal grid located in the second specified area and the vertices intersected by the selected cross grid and the second area edge are taken as the measurement points corresponding to the measurement instruction.

[0040] A data measurement device based on a three-dimensional grid model, the device comprising:

[0041] An acquisition module is configured to acquire a measurement instruction;

[0042] An analysis module is configured to analyze the measurement instruction to obtain a plurality of measurement points;

[0043] A first calculation module is configured to calculate a target ray corresponding to each measurement point according to the screen position coordinates corresponding to the measurement point;

[0044] A determination module is configured to perform intersection detection on the target ray based on a preset grid of an initial model to determine a target space point corresponding to the screen position coordinate;

[0045] A second calculation module is configured to calculate a measurement result corresponding to the measurement instruction based on the target space point.

[0046] When the measurement instruction is a surface distance measurement instruction, the measurement instruction includes a specified path or a path endpoint, and the path endpoint includes a path starting point and a path ending point.

[0047] A generation unit is configured to generate a path curve corresponding to the measurement instruction according to the path starting point and the path ending point when the measurement instruction includes a specified endpoint.

[0048] A specified path unit is configured to take the specified path as a path curve when the measurement instruction includes a specified path.

[0049] A discretization unit is configured to discretize the path curve according to a preset discretization rule to obtain the measurement point.

[0050] The discretization unit is specifically configured to:

[0051] perform plane mapping on the initial model to obtain a plane grid corresponding to each solid grid in the initial model;

[0052] calculate an intersection point between the path curve and the plane grid according to a screen position coordinate of the plane grid to obtain a first discrete point;

[0053] calculate a directional inflection point in the path curve according to the first discrete point to obtain a second discrete point;

[0054] take the first discrete point, the second discrete point, the path starting point and the path ending point as the measurement point.

[0055] The analysis module is further configured to:

[0056] perform plane mapping on the initial model to obtain a plane grid corresponding to each solid grid in the initial model;

[0057] determine a selected intersection grid and a selected internal grid in the plane according to the plane grid and the first region edge;

[0058] take a vertex of the selected intersection grid and an intersection point between the selected intersection grid and the region edge as the measurement point corresponding to the measurement instruction.

[0059] The device further comprises a preprocessing module, and the preprocessing module comprises:

[0060] A determination unit is configured to determine a connection layer corresponding to each grid layer according to the spatial order of the grid layers.

[0061] A connection unit is configured to connect each solid grid in the grid layer with a solid grid in the connection layer to obtain a pentahedron for each grid layer.

[0062] A splitting unit is configured to split the pentahedron to obtain a target model corresponding to the initial model.

[0063] The connection unit is specifically configured to:

[0064] generate a first vertex array corresponding to the grid layer according to the spatial relationship of each grid vertex in the grid layer, and generate a second vertex array corresponding to the connection layer according to the spatial relationship of each grid vertex in the connection layer, wherein the first vertex array includes a first vertex in the grid layer, and the second vertex array includes a second vertex in the connection layer;

[0065] for each first vertex in the first vertex array, sequentially calculate a connection distance between the vertex and a non-connection point in the second vertex, and take the non-connection point with the smallest connection distance as a connection point corresponding to the vertex, wherein when the connection distance is calculated for the first time, the number of non-connection points is zero;

[0066] connect each vertex in the first vertex array with a corresponding connection point to obtain a pentahedron.

[0067] The analysis module is further configured to:

[0068] When the measurement instruction is a volume measurement instruction, the measurement instruction includes a specified second specified area, wherein the second specified area includes a plurality of second area edges.

[0069] perform plane mapping on the target model to obtain screen grid information corresponding to the target model, wherein the screen grid information includes a screen grid coordinate and a connection line corresponding to each grid.

[0070] determine a selected cross grid and a selected inner grid in the grid according to the screen grid information and the second area edge.

[0071] take a vertex in the selected cross grid and the selected inner grid located in the second specified area and a vertex intersecting the second area edge as a measurement point corresponding to the measurement instruction.

[0072] A computer-readable storage medium storing one or more programs, the one or more programs executable by one or more processors to implement the steps in any of the three-dimensional mesh model-based data measurement methods above.

[0073] A terminal device comprising: a processor, a memory and a communication bus; the memory storing a computer readable program executable by the processor;

[0074] The communication bus realizes the connection communication between the processor and the memory;

[0075] The processor implements the steps in any of the three-dimensional mesh model-based data measurement methods above when executing the computer readable program.

[0076] Beneficial effects: the present application provides a three-dimensional mesh model-based data measurement method, first, the user's measurement instruction is obtained, the content that the user wants to measure is determined, the measurement content is analyzed, and it is split into the measurement point on the screen, the content of the three-dimensional mesh model is all the grid, and the content that the user needs to measure does not all fall on the vertex of the grid, more is the point on the grid edge or inside, therefore, the measurement point also includes the point on the grid edge or inside. Then according to the measurement point, screen space-model space conversion is carried out, and the target ray is obtained. Then the grid sheet in the initial model is intersected with the target ray, and the intersection point, that is, the target space point, is obtained. The target space point is the point corresponding to the measurement point in the model space, which may be located on the edge or inside of the grid, therefore, based on the target space point, subsequent measurement can be carried out, and more accurate results can be obtained. BRIEF DESCRIPTION OF DRAWINGS

[0077] Figure 1 The flow chart of the three-dimensional mesh model-based data measurement method provided by the present application.

[0078] Figure 2 The schematic diagram of measuring surface distance in the three-dimensional mesh model-based data measurement method provided by the present application.

[0079] Figure 3 The schematic diagram of measuring surface area in the three-dimensional mesh model-based data measurement method provided by the present application.

[0080] Figure 4 The schematic diagram of measuring volume in the three-dimensional mesh model-based data measurement method provided by the present application, wherein the virtual frame is a second specified area.

[0081] Figure 5 The enlarged view of the virtual frame part in the three-dimensional mesh model-based data measurement method provided by the present application. Figure 4

[0082] ​Figure 6 A schematic diagram of a connected mesh sheet of a data measurement method based on a three-dimensional mesh model provided by the present application.

[0083] Figure 7 A structural schematic diagram of a data measurement device based on a three-dimensional mesh model provided by the present application.

[0084] Figure 8 A structural schematic diagram of a terminal device provided by the present application. DETAILED DESCRIPTION

[0085] The present application provides a data measurement method based on a three-dimensional mesh model, in order to make the purpose, technical scheme and effect of the present application more clear and explicit, the present application will be further described in detail below with reference to the accompanying drawings and examples. It should be understood that the specific examples described herein are only used to explain the present application and do not limit the present application.

[0086] Those skilled in the art can understand that, unless specifically stated, the singular forms "a", "an" and "the" used herein also include the plural forms. It should be further understood that the use of the word "include" in the specification of the present application means that the features, integers, steps, operations, elements and / or components exist, but do not exclude the presence or addition of one or more other features, integers, steps, operations, elements, components and / or groups thereof. It should be understood that when we say that an element is "connected" or "coupled" to another element, it can be directly connected or coupled to the other element, or there can be intermediate elements. In addition, "connected" or "coupled" used herein can include wireless connection or wireless coupling. The phrase "and / or" used herein includes all or any single unit and all combinations of the associated listed items.

[0087] Those skilled in the art can understand that, unless otherwise defined, all terms (including technical terms and scientific terms) used herein have the same meaning as that generally understood by those skilled in the art to which the present application belongs. It should also be understood that terms such as those defined in a general dictionary should be understood to have meanings consistent with those in the context of the prior art, and should not be interpreted in an idealized or overly formal sense unless specifically defined as such.

[0088] As Figure 1 shown, the present embodiment provides a data measurement method based on a three-dimensional mesh model, for convenience of description, a common data processing software is taken as an execution subject for description, the server herein can be replaced by a tablet, a computer and other devices with data processing function, the data measurement method based on a three-dimensional mesh model includes the following steps:

[0089] S10, obtaining a measurement instruction.

[0090] Specifically, when the user needs to measure some parameters, such as the distance between two points, the user needs to issue a measurement instruction. The measurement instruction includes the type of measurement to be measured and the measurement parameter. In this embodiment, the common measurement straight-line distance, surface distance, surface area and volume are taken as examples, and the measurement instruction can be divided into straight-line distance measurement instruction, surface distance measurement instruction, surface area measurement instruction and volume measurement instruction. According to the type of measurement instruction, the measurement parameter in the measurement instruction is different. When the measurement instruction is a straight-line distance measurement instruction, the measurement parameter includes a measurement starting point and a measurement ending point. When the measurement instruction is a surface distance measurement instruction, the measurement parameter includes a specified path or a path endpoint. When the measurement instruction is a surface area measurement instruction, the measurement instruction includes a first specified area. When the measurement instruction is a volume measurement instruction, the measurement instruction includes a second specified area.

[0091] S20, analyzing the measurement instruction to obtain a plurality of measurement points.

[0092] Specifically, the measurement point refers to a point on the screen and used to guide data measurement.

[0093] The measurement parameter in part of the measurement instruction directly includes the measurement point. For example, when the measurement instruction is a straight-line distance measurement instruction, the measurement points are the measurement starting point and the measurement ending point. For another example, when the measurement instruction is a surface distance measurement instruction, the measurement parameter includes a path endpoint, and the measurement point is the path endpoint. For other measurement instructions, for example, the measurement parameter is a specified path, the measurement point needs to be determined in combination with the two-dimensional image of the initial model displayed on the current screen. For example, if the specified path is a circle, then a plurality of clicks on the circle are measurement points.

[0094] When the measurement instruction is a straight-line distance measurement instruction, the measurement point includes a measurement starting point and a measurement ending point, so the measurement point is the measurement starting point and the measurement ending point.

[0095] When the measurement instruction is a surface distance measurement instruction, the measurement instruction includes a specified path or a path endpoint, wherein the path endpoint includes a path starting point and a path ending point. For the path endpoint type of measurement instruction, the path curve corresponding to the measurement instruction needs to be generated first. The most common type is that the user needs to know the shortest path between the path endpoints. In a two-dimensional plane, the straight line segment obtained by directly connecting the path endpoints is the path curve corresponding to the measurement instruction. For the specified path, the specified path is directly taken as the path curve.

[0096] Since the path between two points is not a straight line like in a straight-line distance measurement command, but involves arcs and angles, one way to determine the measurement points for surface distance measurement commands is to use a large number of points along the path curve. However, this approach involves a large number of measurement points and is computationally difficult. Therefore, another method for determining the measurement points involves pre-setting a discrete rule and extracting several points from the path curve based on this rule. This discretization of the path curve is then used as the measurement points.

[0097] One discrete rule predetermines the number of measurement points and then extracts the path curve points evenly based on that number. However, this approach suffers from low accuracy in subsequent calculations when the path curve is complex. A second discrete rule predetermines the distance between measurement points and extracts the path curve based on this distance, for example, extracting the path curve at 3-pixel intervals. For longer path curves, this approach also involves significant computation and is prone to missing key points.

[0098] In the third discretization rule, the initial model is first screen-mapped, that is, the mesh in the model space is mapped to the screen space, converting the 3D model into a 2D image on the screen. After screen mapping, the original 3D mesh is converted into a planar mesh. To distinguish between the two, the former is called a 3D mesh, while in this embodiment, the mapped mesh is called a planar mesh, and each planar mesh contains planar vertices. Based on the screen position coordinates of the planar mesh, the intersection point between the path curve and the planar mesh is calculated to obtain the first discrete point. At the same time, based on the first discrete point, the direction inflection point in the path curve is calculated to obtain the second discrete point.

[0099] like Figure 2 As shown, path curve m is the path curve between the measurement start point and the measurement end point, which is the path curve m required for surface distance measurement. It is worth noting that although the term "path curve" is used, a straight line can be considered a special type of curve. Since this path curve m passes through several grids and intersects with the edges of each grid, it can be discretized into several intersecting first discrete points. When the path curve m changes direction, it will have convex and concave points, for example, with... arrive The direction is taken as the first direction. arrive The direction of the first direction is taken as the second direction. The intersection of the first and second directions indicates a change in direction in the path curve m, i.e., the existence of a directional inflection point. Therefore, we need to find the convex or concave points in the process of transitioning from the first to the second direction as the second discrete points. Figure 2 Middle point Based on this rule, points were subsequently found. , and Finally, the first discrete point, the second discrete point, and the start and end points of the path are taken as the measurement points corresponding to this measurement command.

[0100] When the measurement command is a surface area measurement command, the measurement command includes a first specified region. The specified region includes several edges of the first region; for example, if the specified region is a circle, then the specified region is the surface enclosed by the circle; for example... Figure 3 As shown, the edges of the specified region are four line segments, and its shape is a rectangle. Therefore, the specified region is the face enclosed by the rectangle, and the edges of the first region are the four sides of the rectangle.

[0101] Similar to the surface distance measurement command, the initial model is first mapped to a plane to obtain the planar mesh corresponding to each solid mesh in the initial model. This step has been described in detail above and will not be repeated here. The planar mesh can be divided into in-selection mesh, out-of-selection mesh, and selection intersection mesh. Therefore, based on the coordinates of the planar mesh and the edge coordinates of the first region, the selection intersection mesh and the in-selection mesh in the plane can be determined. Figure 3 As shown, the vertex is , and The planar grid is a selected area intersection grid, with vertices being... , and The grid is the grid within the selected area. The vertices of the grid intersecting the selected area, and the intersections of the grid intersecting the selected area with the edges of the region, are taken as the measurement points corresponding to the measurement command, for example, points. and .

[0102] Furthermore, if the specified area is a surface enclosed by a circle, the measurement points include points uniformly located on the outer edge of the circle; if the specified area is an ellipse, the measurement points include the vertices of the ellipse.

[0103] When the measurement command is a volume measurement command, the measurement command includes specifying a second specified region. The second specified region consists of a plurality of second region edges. For example... Figure 4 As shown, the edges of the second region can be rectangles, circles, etc. Initial models include open models and closed models. An open model is a model that does not form a closed space, while a closed model is a model that forms a closed space. In a three-dimensional initial model, several mesh patches can form different layers; a layer composed of multiple three-dimensional meshes is called a mesh layer. An initial model containing multiple meshes can only be measured in volume if it forms a self-enclosed structure. Therefore, for volume measurement, if the initial model is an open model, it is difficult to calculate its corresponding volume.

[0104] Therefore, if the initial model is an open model, the open model needs to be closed before determining the measurement points. The embodiment provides a quick and convenient closing method, and the process is as follows:

[0105] A10, determining the connection layer corresponding to each grid layer according to the spatial order of the grid layers.

[0106] Specifically, since the initial model includes multiple grid layers, the connection layer for forming a closed space needs to be determined for each grid layer during closing. For example, Figure 4 , the initial model includes only two grid layers, which are and . If there are three grid layers in the space, the connection layer corresponding to the upper grid layer is the middle grid layer, the connection layer corresponding to the middle grid layer includes the upper grid layer and the lower grid layer, and the connection layer corresponding to the lower grid layer is the middle grid layer.

[0107] A20, for each grid layer, connecting each solid grid in the grid layer with the solid grid of the connection layer to obtain a pentahedron.

[0108] Specifically, each grid layer includes multiple solid grids, and each solid grid in the grid layer is connected with the solid grid of the connection layer. Since a single solid grid is a planar triangle, the connection obtains a pentahedron.

[0109] If a grid layer includes one solid grid, the solid grid can be directly connected. However, for the case where there are multiple solid grids as shown in Figure 4 , each solid grid needs to be determined multiple times to determine the most suitable connected solid grid. The embodiment provides a method for connecting the solid grids of the grid layer and the connection layer, which specifically includes:

[0110] A31, generating a first vertex array corresponding to the grid layer according to the spatial relationship of each grid vertex in the grid layer, and generating a second vertex array corresponding to the connection layer according to the spatial relationship of each grid vertex in the connection layer.

[0111] Specifically, taking the edge grid of the grid layer as an example, as shown in Figure 5 , the grid layer is taken as the grid layer to be connected, and the grid layer is taken as the connection layer to be connected. The vertices of the edge grid of the grid layer are , , , and , and the vertices of the edge grid of the connection layer are 、 、 and . It is worth noting that, for the convenience of description, the vertex far away from the camera in the stereoscopic grid is omitted.

[0112] According to the spatial relationship, the vertices of the grid layer can be arranged in order from left to right as 、 、 、 and to obtain a first layer vertex array, wherein the vertices are first vertices; and the connecting layer is arranged in the same order as 、 、 and to obtain a second layer vertex array, wherein the vertices are second vertices.

[0113] A32, for each first vertex in the first vertex array, the connecting distance between the vertex and the non-connecting point in the second vertex is calculated in turn, and the non-connecting point with the smallest connecting distance is taken as the connecting point corresponding to the vertex.

[0114] Specifically, for each first vertex in the first vertex array, the distance between the first vertex and the non-connecting point in the second vertex is calculated in turn to obtain a vertex distance. When calculating for the first time, the number of non-connecting points is 0. The vertex with the smallest vertex distance is selected as the connecting point corresponding to the vertex. For example, the connecting point corresponding to is determined as , then is excluded as a connecting point.

[0115] A33, connecting each vertex in the first vertex data with the corresponding connecting point to obtain a pentahedron.

[0116] Specifically, then the vertex and its corresponding connecting point are connected to obtain the connecting surface between the two grid pieces, forming a pentahedron.

[0117] When there are multiple grid pieces in a single-layer grid and the number is inconsistent, the above method of forming a pentahedron can be used to form pentahedrons from the outside to the inside. When the number is not enough, for example Figure 6 , the number of grid pieces of the grid layer A1 is 1, and the number of grid pieces of the connecting layer A2 is 2. An arbitrary grid in the grid layer with more grid pieces can be selected as an independent grid. For any one vertex in the stereoscopic grid, the sum of the distances between the vertex and each vertex in the independent grid is calculated, and the vertex with the smallest distance sum is taken as a multiple vertex. All vertices in the independent grid are taken as the connecting points corresponding to the multiple vertex.

[0118] A30, split the pentahedron to obtain a target model corresponding to the initial model.

[0119] Specifically, taking two vertices of any one edge in the triangular face of the pentahedron as the split starting point, and taking the vertex in the other triangular face farthest from the split starting point as the split end point, the pentahedron can be split into two tetrahedrons, thereby connecting the grid layer and the connection layer with triangular meshes to form a closed target model.

[0120] After obtaining the closed target model, the measurement points are determined according to the measurement instruction. When the measurement instruction is a volume measurement instruction, the measurement instruction includes a second specified area, and the second specified area includes a plurality of second area edges. The determination of the measurement points of the second type is similar to the determination of the measurement points of the first type. First, a plane mapping is performed on the target model to obtain a plane grid corresponding to each solid grid in the target model. Then, according to the screen grid information and the second area edges, the selected intersection grid and the selected internal grid in the grid are determined. Finally, the vertices in the selected intersection grid and the selected internal grid located in the second specified area, and the vertices in the selected intersection grid intersecting the second area edges, are taken as the measurement points corresponding to the measurement instruction.

[0121] S30, for each measurement point, a target ray corresponding to the measurement point is calculated according to the screen position coordinates corresponding to the measurement point.

[0122] Specifically, for each measurement point, the measurement point can be converted into a point in the model space according to its coordinates in the screen space, i.e. the screen position coordinates. Since the screen is a two-dimensional space, the measurement point does not have depth, and the result of the calculation is a ray with the measurement point as the starting point.

[0123] When the initial model of the model space is displayed in the screen space, the points in the initial model are converted to the clipping space in turn through the model matrix, the view matrix and the projection matrix. Then, the perspective division is adopted to convert the vertices in the clipping space to the NDC (Normalize Device Coordinates) space, which is a cube with a length, width and height range of [-1, 1]. After converting the vertex coordinates in the model to the coordinates in the NDC space and then mapping, the position coordinates of the vertex in the screen space can be obtained.

[0124] Since the screen is equivalent to a two-dimensional coordinate system, each point in the screen only has horizontal and vertical coordinates in the two-dimensional coordinate system. Therefore, assuming that there is a camera illuminating the model, the relative position relationship between the camera and the model, i.e., the projection direction, can be inferred according to the depth of each point in the model relative to the camera. The point corresponding to the screen position coordinate is located between the camera and the model, so the target ray corresponding to the screen position coordinate can be obtained by taking the screen position coordinate as the starting point and the projection direction as the ray direction.

[0125] The method of generating the target ray can adopt the inverse operation of projecting the initial model to the screen space. The screen position coordinate is first converted into an NDC coordinate. The screen position coordinate is a two-dimensional plane, while the NDC space is a three-dimensional space, so a depth value (i.e., z) is needed. The z value is randomly taken as one point in [-1, 1], i.e., the NDC space coordinate corresponding to the screen position coordinate in the NDC space is obtained. After obtaining the NDC space coordinate, the NDC space coordinate needs to be converted into a clipping space coordinate in the clipping space, at which time a w=1 is added as a homogeneous coordinate. Then, based on a preset MVP conversion matrix (Model Matrix, View Matrix, Projection Matrix), the clipping space coordinate is converted into a set of points located in the middle of the model, i.e., a target ray. Among them, the MVP matrix here is a matrix for converting points on the model into points in the screen space.

[0126] In addition to the above method of calculating the target ray, the screen position coordinate can also be inversely transformed based on a preset depth buffer to obtain a space position coordinate corresponding to the screen position coordinate in the model space. The depth buffer includes a rendering pipeline, which can convert points in the model space to obtain a viewport position coordinate corresponding to each point in the viewport space.

[0127] S40, based on the preset mesh sheet of the initial model, the target ray is intersected to determine the target space point corresponding to the screen position coordinate.

[0128] Specifically, when the user issues a measurement instruction, the data processing software is displaying an initial model, which is the model that the user wants to measure. The intersection detection is to calculate the intersection between the space coordinates (such as the coordinates of the mesh) of the objects in the initial model and the target ray to determine whether there is an intersection point. If there is an intersection point, the intersection point is the target space point corresponding to the screen position coordinate.

[0129] For the initial model composed of the mesh, according to the type of the mesh, the initial model can be divided into a triangular mesh model and a quadrilateral mesh model. The triangular mesh model is an initial model composed of a triangular mesh, and the quadrilateral mesh model is an initial model composed of a quadrilateral mesh. When the intersection detection is performed, the spatial stability of the quadrilateral mesh is poor, and therefore, the intersection detection calculation using the quadrilateral mesh is more complex. Therefore, in order to facilitate the calculation, when the initial model is a triangular mesh model, the intersection detection of the target ray is directly performed based on the initial model; when the initial model is a quadrilateral mesh model, each quadrilateral mesh in the quadrilateral mesh is first split to obtain an initial model composed of a triangular mesh. The split here can select to connect the opposite corners of the quadrilateral mesh to convert the quadrilateral mesh into two triangular meshes.

[0130] The triangular mesh can be taken as a triangle, and the three vertices of the triangle are denoted as A, B and C. The triangle can be represented by the formula wherein u and v are variation parameters, and satisfy And an arbitrary point on the triangle can be represented by point P. The parametric equation of the target ray L is wherein O is the starting point of the ray, i.e., the measurement point, D is the direction, i.e., the direction of the projection of the camera to the initial model, and t is a variation parameter for indicating the length of the ray. Therefore, when the triangle and the target ray L intersect, the following formula should be satisfied:

[0131] ;

[0132] Solving the equation can obtain

[0133]

[0134] wherein Therefore, the following formula can be obtained In the calculation process of the target ray, the coordinates and the direction of the measurement point are known, and therefore, the target space point corresponding to the target ray can be easily calculated. In the initial model, there are multiple meshes, and therefore, there can be multiple meshes intersecting with the target ray in the direction of the target ray. In this embodiment, only the earliest mesh intersecting with the target ray is taken as the mesh containing the target space point, i.e., the intersection point P with the minimum variable t is the target space point.

[0135] S50, based on the target space point, calculating the measurement result corresponding to the measurement instruction.

[0136] Specifically, after obtaining the target space point, the data processing software can determine the position coordinates of the point indicated by the user in the model space, so as to take the target space point as the calculation object and perform the measurement according to the measurement type in the measurement instruction.

[0137] The data processing software adopts different calculation methods for different measurement instructions of different measurement types.

[0138] When the measurement instruction is a straight-line distance measurement instruction, the target space point corresponding to the measurement starting point is taken as the space starting point, the target space point corresponding to the measurement ending point is taken as the space ending point, and the straight-line distance between the space starting point and the space ending point is calculated. Finally, the straight-line distance is taken as the measurement result corresponding to the measurement instruction. For example, the target starting point is , and the target ending point is , the straight-line distance between the two points is .

[0139] When the measurement instruction is a surface distance measurement instruction, the line segment distance between adjacent target space points is calculated according to the path curve, and finally the sum of all the line segment distances is calculated to obtain the measurement result corresponding to the measurement instruction. For example Figure 2 , according to the path curve, the measurement points corresponding to the target space points are , therefore, the distances between the target space points corresponding to and are calculated according to the path curve, the distances between the target space points corresponding to and are calculated, and finally the sum is obtained to obtain the measurement result.

[0140] When the measurement instruction is a surface area measurement instruction, for the selected region inner grid, the first surface area is calculated according to the solid grid corresponding to the selected region inner grid. For example Figure 3 , the solid grid corresponding to the planar grid ( , , ) can directly calculate the surface area according to the coordinates of the three vertices in the model space, and the first surface area corresponding to the planar grid is . For the selected region intersection grid, the second surface area is calculated according to the target space point corresponding to the selected region intersection grid. For example, the selected region intersection grid intersects with the first region edge to form a new triangle ( , , ) and a new quadrilateral ( , , , ). For the triangle, the second surface area is calculated according to the target space distance corresponding to the vertex of the triangle, and for the new quadrilateral, the quadrilateral is divided into two triangles, and then the sum of the areas of the two triangles is calculated to obtain the second surface area, that is, the second surface area of the quadrilateral . Finally, the first surface area and the second surface area are summed to obtain the measurement result.

[0141] When the measurement instruction is a volume measurement instruction, the target model is split into a plurality of polyhedrons according to the measurement points. The sum of the volumes of all the polyhedrons is calculated to obtain the measurement result corresponding to the measurement instruction. The calculation formula of the volume of a tetrahedron is as follows:

[0142] ;

[0143] wherein, the is a vertex of the tetrahedron, e is [1, 4], and i is the number of the tetrahedron.

[0144] The sum of the volumes of all the tetrahedrons is calculated, wherein, n is the total number of the tetrahedrons.

[0145] Based on the above-mentioned three-dimensional grid model-based data measurement method, as shown in Figure 7 the present application further provides a three-dimensional grid model-based data measurement device 100, which comprises:

[0146] An acquisition module 110 is configured to acquire a measurement instruction.

[0147] An analysis module 120 is configured to analyze the measurement instruction to obtain a plurality of measurement points.

[0148] A first calculation module 130 is configured to, for each measurement point, calculate a target ray corresponding to the measurement point according to the screen position coordinates corresponding to the measurement point.

[0149] A determination module 140 is configured to perform intersection detection on the target ray based on the grid sheet of the preset initial model to determine a target space point corresponding to the screen position coordinates.

[0150] A second calculation module 150 is configured to calculate a measurement result corresponding to the measurement instruction based on the target space point.

[0151] When the measurement instruction is a surface distance measurement instruction, the measurement instruction comprises a specified path or path end points, wherein the path end points comprise a path starting point and a path ending point. The analysis module 120 comprises:

[0152] A generation unit is configured to, when the measurement instruction comprises specified end points, generate a path curve corresponding to the measurement instruction according to the path starting point and the path ending point.

[0153] A specified path unit is configured to, when the measurement instruction comprises a specified path, take the specified path as a path curve.

[0154] A discretization unit is configured to discretize the path curve according to a preset discretization rule to obtain the measurement points.

[0155] The discrete units are specifically used for:

[0156] Performing plane mapping on the initial model to obtain a plane grid corresponding to each solid grid in the initial model;

[0157] According to the screen position coordinates of the plane grid, an intersection point between the path curve and the plane grid is calculated to obtain a first discrete point;

[0158] According to the first discrete point, a direction inflection point in the path curve is calculated to obtain a second discrete point;

[0159] The first discrete point, the second discrete point, the path starting point and the path ending point are taken as measurement points.

[0160] The analysis module 120 is further used for:

[0161] Performing plane mapping on the initial model to obtain a plane grid corresponding to each solid grid in the initial model;

[0162] According to the plane grid and the first area edge, a selected intersection grid and a selected internal grid in the plane are determined;

[0163] The vertices of the selected intersection grid and the intersection points between the selected intersection grid and the area edge are taken as measurement points corresponding to the measurement instruction.

[0164] The device further includes a preprocessing module, and the preprocessing module includes:

[0165] A determination unit is configured to determine a connection layer corresponding to each grid layer according to a spatial order of the grid layers;

[0166] A connection unit is configured to connect each solid grid in the grid layer with a solid grid in the connection layer to obtain a pentahedron for each grid layer.

[0167] A splitting unit is configured to split the pentahedron to obtain a target model corresponding to the initial model.

[0168] The connection unit is specifically used for:

[0169] According to a spatial relationship of each grid vertex in the grid layer, a first vertex array corresponding to the grid layer is generated, and according to a spatial relationship of each grid vertex in the connection layer corresponding to the grid layer, a second vertex array corresponding to the connection layer is generated, wherein the first vertex array includes a first vertex in the grid layer, and the second vertex array includes a second vertex in the connection layer;

[0170] For each first vertex in the first vertex array, the connection distance between the vertex and the non-connected points in the second vertex is calculated in turn, and the non-connected point with the smallest connection distance is taken as the connection point corresponding to the vertex, wherein when the first time is calculated, the number of non-connected points is zero;

[0171] Connecting each vertex in the first vertex data with the corresponding connection point obtains a pentahedron.

[0172] The analysis module 120 is further configured to:

[0173] When the measurement instruction is a volume measurement instruction, the measurement instruction includes a specified second specified area, wherein the second specified area includes a plurality of second area edges;

[0174] Performing plane mapping on the target model obtains screen grid information corresponding to the target model, wherein the screen grid information includes screen grid coordinates and connection lines corresponding to each grid;

[0175] According to the screen grid information and the second area edge, determine the selected cross grid and the selected internal grid in the grid;

[0176] The vertices in the selected cross grid and the selected internal grid located in the second specified area and the vertices intersected by the selected cross grid and the second area edge are taken as the measurement points corresponding to the measurement instruction.

[0177] Based on the above-mentioned three-dimensional grid model-based data measurement method, the application further provides a terminal device, as shown in the accompanying drawings, which comprises at least one processor 20, a display screen 21, and a memory 22, and can further comprise a communications interface 23 and a bus 24. Wherein, the processor 20, the display screen 21, the memory 22 and the communications interface 23 can complete the communication among each other through the bus 24. The display screen 21 is set to display the user guide interface preset in the initial setting mode. The communications interface 23 can transmit information. The processor 20 can call the logic command in the memory 22 to execute the method in the above-mentioned embodiments. Figure 8

[0178] In addition, the logic command in the above-mentioned memory 22 can be realized in the form of a software functional unit and sold or used as an independent product, which can be stored in a computer readable computer readable storage medium.

[0179] ​The memory 22, as a computer readable storage medium, can be configured to store software programs, computer executable programs, such as program commands or modules corresponding to the method in the embodiments of the present disclosure. The processor 20 executes the functions of the application and data processing by running the software programs, commands or modules stored in the memory 22, that is, implements the method in the above embodiments.

[0180] The memory 22 can include a program storage area and a data storage area, wherein the program storage area can store an operating system and at least one application required by a function; the data storage area can store data created according to the use of the terminal device, etc. In addition, the memory 22 can include a high-speed random access memory, and can also include a non-volatile memory. For example, a variety of media that can store program codes, such as a U disk, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk, etc. can also be a transitory computer readable storage medium.

[0181] In addition, the specific processes of the above computer readable storage medium and the plurality of command processors in the terminal device load and execute have been described in detail in the above method, and will not be repeated here.

[0182] Finally, it should be pointed out that: the above embodiments are only used to illustrate the technical solutions of the present application, and not to limit them; although the present application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that: it can still modify the technical solutions recorded in the foregoing embodiments, or make equivalent replacement for part of the technical features; and these modifications or replacements do not make the essence of the corresponding technical solutions deviate from the spirit and scope of the technical solutions of the embodiments of the present application.

Claims

1. A data measurement method based on a three-dimensional mesh model, characterized in that, The method includes: Obtain measurement instructions; The measurement command is parsed to obtain several measurement points; For each measurement point, the target ray corresponding to that measurement point is calculated based on the screen position coordinates of that measurement point. Based on the mesh of the preset initial model, the target ray is subjected to intersection detection to determine the target spatial point corresponding to the screen position coordinates; Based on the target spatial point, calculate the measurement result corresponding to the measurement command; When the measurement command is a surface distance measurement command, the measurement command includes a specified path or path endpoints, wherein the path endpoints include a path start point and a path end point; parsing the measurement command to obtain several measurement points includes: When the measurement command includes a specified endpoint, a path curve corresponding to the measurement command is generated based on the path start point and the path end point; When the measurement instruction includes a specified path, the specified path is used as a path curve; The path curve is discretized according to a preset discretization rule to obtain the measurement points; The step of discretizing the path curve according to a preset discretization rule to obtain the measurement points includes: Perform planar mapping on the initial model to obtain the planar mesh corresponding to each solid mesh in the initial model; Based on the screen position coordinates of the planar grid, the intersection point between the path curve and the planar grid is calculated to obtain the first discrete point; Based on the first discrete point, calculate the direction inflection point in the path curve to obtain the second discrete point; The first discrete point, the second discrete point, the starting point of the path, and the ending point of the path are used as measurement points.

2. The data measurement method based on a three-dimensional mesh model according to claim 1, characterized in that, When the measurement command is a surface area measurement command, the measurement command includes a first designated region, wherein the designated region includes a plurality of first region edges; parsing the measurement command to obtain a plurality of measurement points includes: Perform planar mapping on the initial model to obtain the planar mesh corresponding to each solid mesh in the initial model; Based on the planar grid and the edges of the first region, determine the selected area intersection grid and the grid within the selected area in the plane; The vertices of the selected area's intersecting grid and the intersection points of the selected area's intersecting grid and the edge of the region are used as the measurement points corresponding to the measurement command.

3. The data measurement method based on a three-dimensional mesh model according to claim 1, characterized in that, Before parsing the measurement command to obtain several measurement points, the process also includes: Based on the spatial order of the grid layers, determine the connection layer corresponding to each grid layer; For each of the aforementioned mesh layers, each 3D mesh in the mesh layer is connected to the 3D mesh in the connecting layer to obtain a pentahedron; The pentahedron is split to obtain the target model corresponding to the initial model.

4. The data measurement method based on a three-dimensional mesh model according to claim 3, characterized in that, For each of the aforementioned mesh layers, connecting each 3D mesh in the mesh layer to the 3D mesh in the connecting layer to obtain a pentahedron includes: Based on the spatial relationship of each grid vertex in the grid layer, a first vertex array corresponding to the grid layer is generated, and based on the spatial relationship of each grid vertex in the connection layer corresponding to the grid layer, a second vertex array corresponding to the connection layer is generated. The first vertex array includes the first vertices in the grid layer, and the second vertex array includes the second vertices in the connection layer. For each first vertex in the first vertex array, calculate the connection distance between the vertex and the non-connected points in the second vertex array in turn, and take the non-connected point with the smallest connection distance as the corresponding connected point of the vertex. In the first calculation, the number of non-connected points is zero. Connect each vertex in the first vertex data with its corresponding connection point to obtain a pentahedron.

5. The data measurement method based on a three-dimensional mesh model according to claim 3, characterized in that, The process of parsing the measurement command to obtain several measurement points includes: When the measurement command is a volume measurement command, the measurement command includes specifying a second specified region, wherein the second specified region includes a plurality of second region edges; The target model is mapped to a plane to obtain the screen mesh information corresponding to the target model, wherein the screen mesh information includes the screen mesh coordinates and connecting lines corresponding to each mesh; Based on the screen grid information and the edge of the second region, determine the selected area intersection grid and the grid within the selected area in the grid; The vertices in the selected area's intersecting grid and the grid within the selected area that are located in the second specified region, and the vertices where the selected area's intersecting grid intersects with the edge of the second region, are used as the measurement points corresponding to the measurement command.

6. A data measurement device based on a three-dimensional mesh model, characterized in that, The data measurement device based on the three-dimensional mesh model includes: The acquisition module is used to acquire measurement commands; The parsing module is used to parse the measurement command to obtain several measurement points; The first calculation module is used to calculate the target ray corresponding to each measurement point based on the screen position coordinates of that measurement point. The determination module is used to perform intersection detection on the target ray based on the mesh of the preset initial model, and determine the target spatial point corresponding to the screen position coordinates; The second calculation module is used to calculate the measurement result corresponding to the measurement command based on the target spatial point; When the measurement command is a surface distance measurement command, the measurement command includes a specified path or path endpoints, wherein the path endpoints include a path start point and a path end point; the parsing module parses the measurement command to obtain several measurement points, including: When the measurement command includes a specified endpoint, a path curve corresponding to the measurement command is generated based on the path start point and the path end point; When the measurement instruction includes a specified path, the specified path is used as a path curve; The path curve is discretized according to a preset discretization rule to obtain the measurement points; The step of discretizing the path curve according to a preset discretization rule to obtain the measurement points includes: Perform planar mapping on the initial model to obtain the planar mesh corresponding to each solid mesh in the initial model; Based on the screen position coordinates of the planar grid, the intersection point between the path curve and the planar grid is calculated to obtain the first discrete point; Based on the first discrete point, calculate the direction inflection point in the path curve to obtain the second discrete point; The first discrete point, the second discrete point, the starting point of the path, and the ending point of the path are used as measurement points.

7. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores one or more programs, which can be executed by one or more processors to implement the steps in the data measurement method based on a three-dimensional mesh model as described in any one of claims 1 to 5.

8. A terminal device, characterized in that, include: Processor, memory, and communication bus; The memory stores a computer-readable program that can be executed by the processor; The communication bus enables communication between the processor and the memory; When the processor executes the computer-readable program, it implements the steps in the data measurement method based on a three-dimensional mesh model as described in any one of claims 1 to 5.

Citation Information

Patent Citations

  • Parameter mapping-based measurement planning method for complex curved surface

    CN108682043A

  • Three-dimensional shape measurement method and device

    JP2000065548A