Method and apparatus for displaying shortest distance position between three-dimensional model objects

By generating the distance calculation range of the connecting line segments at the center of the bounding box, and filtering and selecting the vertex pairs with the shortest spatial distance, the problem of low efficiency in calculating the shortest distance between 3D model objects is solved, and efficient distance display is achieved.

CN120451255BActive Publication Date: 2026-07-21VKINGTELE INTELLIGENT TECHNOLOGY (SHANGHAI) CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
VKINGTELE INTELLIGENT TECHNOLOGY (SHANGHAI) CO LTD
Filing Date
2025-04-25
Publication Date
2026-07-21

AI Technical Summary

Technical Problem

Existing technologies are inefficient and computationally resource-intensive when calculating the shortest distance between objects in a 3D model, especially for non-convex geometry and detailed models.

Method used

Generate the bounding box of the object model, connect the center point of the bounding box to generate the model center connecting line segment, generate the distance calculation range based on the connecting line segment, filter out the overlapping vertex dataset, select the vertex pair with the shortest spatial distance as the target vertex, and display the shortest distance position.

Benefits of technology

This reduces the amount of spatial point location data required when calculating the shortest distance, thus improving the efficiency of calculating and displaying the shortest distance between objects in a 3D model.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120451255B_ABST
    Figure CN120451255B_ABST
Patent Text Reader

Abstract

The present application relates to the technical field of three-dimensional modeling, and discloses a method and device for calculating and displaying the shortest distance position between three-dimensional model objects, electronic equipment, a computer readable storage medium and a computer program product, which are used to solve the technical problem of low efficiency and large consumption of computing resources when calculating and displaying the shortest distance between three-dimensional model objects. The method comprises the following steps: generating a bounding box of a first object model and a bounding box of a second object model respectively, connecting the center points of the two bounding boxes to generate a model center connecting line segment and a distance calculation range; screening out the vertices coinciding with the distance calculation range in the first object model and the second object model respectively, and selecting the vertices to obtain a plurality of vertex pairs from different object models, selecting a pair of vertices with the shortest spatial distance in the vertex pairs as target vertices, and displaying the shortest distance position of the first object model and the second object model based on the target vertices.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of 3D modeling technology, and in particular to a method, apparatus, electronic device, computer storage medium, and computer program product for calculating and displaying the shortest distance between 3D model objects. Background Technology

[0002] A 3D mesh model is a mathematical model that represents the surface or solid of a 3D object using a set of vertices, edges, and faces. It discretizes objects in 3D space into a finite set of geometric elements composed of polygons such as triangles and quadrilaterals. By determining the coordinates of the polygon vertices and their connections, the shape and surface features of the object can be fully described. It has wide applications in computer graphics, computer-aided design, and vision.

[0003] For example, in the use of 3D mesh models in business scenarios such as industrial digital twins, it is often necessary to display the shortest path between two objects (e.g., two devices). Current technologies typically use common algorithms such as the GJK (Gilbert-Johnson-Keerthi) and SAT (Separating Axis Theorem) to calculate the distance between 3D polygonal objects, but these all require the objects involved in the calculation to be convex geometry. However, in many business scenarios, the objects (devices) are usually non-convex, so these objects need to be decomposed into convex models before calculation. Furthermore, detailed object (device) models often contain millions or even tens of millions of vertices, consuming significant computing resources and causing response delays. However, in business scenarios such as industrial digital twins where precise calculations are not required, such a solution leads to inefficient distance display and consumes a large amount of computational data.

[0004] Therefore, there is an urgent need for a method to calculate and display the shortest distance between 3D model objects, which can reduce the data consumption of calculating the shortest distance between 3D model objects while improving the display efficiency of the shortest distance between 3D model objects. Summary of the Invention

[0005] The main objective of this invention is to solve the technical problem of low efficiency and high computational resource consumption in the prior art when calculating and displaying the shortest distance between three-dimensional model objects.

[0006] The first aspect of this invention provides a method for calculating and displaying the shortest distance between objects in a three-dimensional model, comprising:

[0007] The bounding boxes of the first object model and the second object model are generated respectively. The center points of the two bounding boxes are connected to generate the model center connecting line segment, and the distance calculation range is generated based on the model center connecting line segment.

[0008] Vertices that overlap with the distance calculation range are selected from the first object model and the second object model respectively to obtain the first vertex dataset and the second vertex dataset;

[0009] Vertices are selected from the first vertex dataset and the second vertex dataset respectively to obtain multiple vertex pairs from different object models. The vertex pair with the shortest spatial distance is selected as the target vertex. The shortest distance position between the first object model and the second object model is displayed based on the target vertex.

[0010] Optionally, in a first implementation of the first aspect of the present invention, the step of generating a distance calculation range based on the connecting line segment at the center of the model includes:

[0011] Using the length of the connecting line segment at the center of the model as the diameter of the range sphere, and taking the midpoint of the connecting line segment at the center of the model as the center of the sphere, the range sphere is drawn to obtain the distance calculation range.

[0012] Optionally, in a second implementation of the first aspect of the present invention, the distance calculation range includes a first distance calculation range and a second distance calculation range, the range sphere includes a first range sphere and a second range sphere, and the diameter of the range sphere includes the diameter of the first range sphere and the diameter of the second range sphere;

[0013] The distance calculation range generated based on the connecting line segment at the center of the model includes:

[0014] Determine the proportions of the first and second enclosures;

[0015] Calculate the diameter of the first range sphere and the diameter of the second range sphere based on the length of the connecting line segment at the center of the model, the first enclosure ratio, and the second enclosure ratio, respectively.

[0016] Using the midpoint of the line segment as the center of the sphere, and using the diameters of the first and second range spheres respectively, a first range sphere and a second range sphere are constructed to obtain the first distance calculation range and the second distance calculation range.

[0017] Optionally, in a third implementation of the first aspect of the present invention, the step of filtering out vertices that overlap with the distance calculation range in the first object model and the second object model respectively to obtain a first vertex dataset and a second vertex dataset includes:

[0018] In the first object model, vertices that overlap with the first distance calculation range are selected to obtain the first vertex dataset;

[0019] In the second object model, vertices that overlap with the second distance calculation range are selected to obtain the first vertex dataset.

[0020] Optionally, in a fourth implementation of the first aspect of the present invention, the step of selecting vertices from the first vertex dataset and the second vertex dataset respectively to obtain multiple vertex pairs from different object models, and selecting the vertex pair with the shortest spatial distance as the target vertex, includes:

[0021] According to the encoding and sorting rules, the vertices of the first vertex dataset and the second vertex dataset are sorted and numbered respectively;

[0022] Multiple first random numbers and multiple second random numbers are randomly generated using a pseudo-random algorithm to obtain multiple pairs of random numbers;

[0023] Based on the vertex number, obtain the vertex corresponding to the first random number in the first vertex dataset; based on the vertex number, obtain the vertex corresponding to the second random number in the second vertex dataset, thus obtaining multiple vertex pairs from different object models.

[0024] Obtain the coordinate information of multiple vertex pairs and calculate the distance between them, then select the vertex pair with the shortest distance as the target vertex.

[0025] Optionally, in a fifth implementation of the first aspect of the present invention, the bounding box is a minimum circumscribed rectangular bounding box.

[0026] A second aspect of the present invention provides a device for calculating and displaying the shortest distance between three-dimensional model objects, comprising:

[0027] The range acquisition module is used to generate bounding boxes for the first object model and the second object model respectively, connect the center points of the two bounding boxes to generate a model center connecting line segment, and generate a distance calculation range based on the model center connecting line segment.

[0028] The vertex filtering module is used to filter out vertices that overlap with the distance calculation range in the first object model and the second object model respectively, to obtain a first vertex dataset and a second vertex dataset.

[0029] The distance calculation module is used to select vertices in the first vertex dataset and the second vertex dataset respectively, to obtain multiple vertex pairs from different object models, select the vertex pair with the shortest spatial distance as the target vertex, and display the shortest distance position between the first object model and the second object model based on the target vertex.

[0030] A third aspect of the present invention provides a display device for calculating and displaying the shortest distance between three-dimensional model objects, comprising: a memory and at least one processor, wherein the memory stores instructions; the at least one processor invokes the instructions in the memory to cause the display device for calculating and displaying the shortest distance between three-dimensional model objects to perform the steps of the above-described method for calculating and displaying the shortest distance between three-dimensional model objects.

[0031] A fourth aspect of the present invention provides a computer-readable storage medium storing instructions that, when executed on a computer, cause the computer to perform the steps of the above-described method for calculating and displaying the shortest distance between three-dimensional model objects.

[0032] A fifth aspect of the present invention provides a computer program product, including a computer program / instructions, characterized in that, when the computer program / instructions are executed by a processor, the steps of the method for calculating and displaying the shortest distance position between three-dimensional model objects as described above are implemented.

[0033] The technical solution provided by this invention generates bounding boxes for a first object model and a second object model, connects the center points of the two bounding boxes to generate a model center connecting line segment, and generates a distance calculation range based on the model center connecting line segment. Vertices overlapping with the distance calculation range are selected from the first and second object models respectively, resulting in a first vertex dataset and a second vertex dataset. Vertices are selected from the first and second vertex datasets respectively to obtain multiple vertex pairs from different object models. The vertex pair with the shortest spatial distance is selected as the target vertex, and the shortest distance position between the first and second object models is displayed based on the target vertex. The technical solution provided by this invention can reduce the amount of spatial point position data needed to calculate the shortest distance, and can improve the efficiency of calculating and displaying the shortest distance between 3D model objects.

[0034] The device, electronic device, computer-readable storage medium, and computer program product provided by this invention also solve the corresponding technical problems. Attached Figure Description

[0035] The accompanying drawings, which are included to provide a further understanding of this application and form part of this application, illustrate exemplary embodiments and are used to explain this application, but do not constitute an undue limitation of this application. In the drawings:

[0036] Figure 1 This is a flowchart illustrating the first embodiment of the method for calculating and displaying the shortest distance between three-dimensional model objects in this invention.

[0037] Figure 2This is a schematic diagram of two three-dimensional model objects in the method for calculating and displaying the shortest distance between three-dimensional model objects in an embodiment of the present invention;

[0038] Figure 3 This is a first schematic diagram of the distance calculation range in the method for calculating and displaying the shortest distance between objects in a three-dimensional model according to an embodiment of the present invention;

[0039] Figure 4 This is a second schematic diagram of the distance calculation range in the method for calculating and displaying the shortest distance between objects in a three-dimensional model according to an embodiment of the present invention;

[0040] Figure 5 This is a third schematic diagram of the distance calculation range in the method for calculating and displaying the shortest distance between objects in a three-dimensional model according to an embodiment of the present invention;

[0041] Figure 6 This is a schematic diagram of the shortest distance calculated in the method for calculating and displaying the shortest distance between three-dimensional model objects in an embodiment of the present invention.

[0042] Figure 7 This is a flowchart illustrating a second embodiment of the method for calculating and displaying the shortest distance between three-dimensional model objects in this invention.

[0043] Figure 8 This is a schematic diagram of the range sphere for the method of calculating and displaying the shortest distance between objects in a three-dimensional model according to an embodiment of the present invention;

[0044] Figure 9 This is a flowchart illustrating the third embodiment of the method for calculating and displaying the shortest distance between objects in a 3D model according to the present invention.

[0045] Figure 10 This is another schematic diagram of the range sphere for the method of calculating and displaying the shortest distance between objects in a three-dimensional model according to an embodiment of the present invention;

[0046] Figure 11 This is a schematic diagram of an embodiment of the display device for calculating the shortest distance between three-dimensional model objects in this invention;

[0047] Figure 12 This is a schematic diagram of an embodiment of a display device for calculating the shortest distance between objects in a three-dimensional model according to an embodiment of the present invention;

[0048] Figure 13 This is a schematic diagram illustrating the principle of a computer-readable medium according to an embodiment of the present invention. Detailed Implementation

[0049] Exemplary embodiments of the invention will now be described more fully with reference to the accompanying drawings. However, these exemplary embodiments can be implemented in many forms and should not be construed as limiting the invention to the embodiments set forth herein. Rather, these exemplary embodiments are provided to make the invention more comprehensive and complete, and to facilitate a full communication of the inventive concept to those skilled in the art. The same reference numerals in the drawings denote the same or similar elements, components, or parts, and therefore repeated descriptions of them will be omitted.

[0050] Subject to the technical concept of this invention, the features, structures, characteristics or other details described in a particular embodiment may be combined in one or more other embodiments in a suitable manner.

[0051] In the description of specific embodiments, the features, structures, characteristics, or other details described in this invention are intended to enable those skilled in the art to fully understand the embodiments. However, it is not excluded that those skilled in the art can practice the technical solutions of this invention without one or more of the specific features, structures, characteristics, or other details.

[0052] The flowcharts shown in the accompanying drawings are merely illustrative and do not necessarily include all content and operations / steps, nor do they necessarily have to be performed in the described order. For example, some operations / steps can be broken down, while others can be combined or partially combined; therefore, the actual execution order may change depending on the specific circumstances.

[0053] The block diagrams shown in the accompanying drawings are merely functional entities and do not necessarily correspond to physically independent entities. That is, these functional entities can be implemented in software, in one or more hardware modules or integrated circuits, or in different network and / or processor devices and / or microcontroller devices.

[0054] The terms “and / or” or “and / or” include all combinations of any one or more of the listed items.

[0055] Please see Figures 1-6 The following is a first embodiment of the method for calculating and displaying the shortest distance between three-dimensional model objects in this invention.

[0056] S101. Generate bounding boxes for the first object model and the second object model respectively, connect the center points of the two bounding boxes to generate the model center connecting line segment, and generate the distance calculation range based on the model center connecting line segment.

[0057] It is understood that the execution subject of this invention can be a display device for calculating the shortest distance between three-dimensional model objects, or it can be a terminal or a server; the specific implementation is not limited here. This embodiment of the invention will be described using a server as an example.

[0058] After receiving the shortest distance calculation request, the server first determines the information of the two 3D model objects whose shortest distance needs to be calculated and displayed: the first object model and the second object model. After obtaining the information of the first and second object models, the server begins generating bounding boxes for both models; these bounding boxes can be AABB (Axis-aligned bounding box), spheres, OBB (Oriented bounding box), or other types of bounding boxes.

[0059] In one specific implementation, the bounding box is an OBB bounding box; please refer to [link / reference]. Figure 2 The bounding box of the generated first object model is as follows Figure 2 As shown in Figure A, the bounding box of the generated second object model Figure 2 As shown in B.

[0060] After generating the bounding boxes of the first object model and the second object model respectively, obtain the center points of the two bounding boxes and their coordinates in the same spatial coordinate system; connect the center points of the two bounding boxes with the model center connecting line segment, and then obtain the unique position information of the model center connecting line segment; and, the line segment length of the model center connecting line segment can be calculated based on the coordinates of the center points of the two bounding boxes in the same spatial coordinate system.

[0061] After obtaining the connecting line segment at the center of the model, a distance calculation range is generated based on the position of this connecting line segment. Specifically, the reason for generating the distance calculation range based on the connecting line segment is that it indicates the approximate direction of the closest point between two object models. Therefore, by generating an approximate distance calculation range based on this connecting line segment, only the shortest distance between points of the two object models contained within the distance calculation range is considered. Since the actual shortest distance is highly likely to fall within the distance calculation range, points not contained outside the range are discarded, which can reduce the computational load and improve the speed of finding the shortest distance to a certain extent.

[0062] For a specific implementation method, please refer to Figures 3-5 The shape of the distance calculation range is not specifically limited, and can be as follows: Figure 3As shown, the line segment connecting the center of the model is used as the line connecting the centers of a pair of parallel surfaces of the rectangular cube, and the area enclosed by the generated rectangular cube is used as the distance calculation range; alternatively, it can be as follows: Figure 4 As shown in the diagram, the line segment connecting the center of the model is used as the cross-sectional diameter of the cylinder's center, and the area enclosed by the generated cylinder is used as the distance calculation range; alternatively, it can be as follows: Figure 5 As shown, a sphere is constructed with the central connecting line segment of the model as its diameter and the center point of the connecting line segment as its center. The area enclosed by the generated sphere is used as the distance calculation range. The specific method of dividing the distance calculation range is not limited here.

[0063] S102. Select the vertices that overlap with the distance calculation range from the first object model and the second object model respectively to obtain the first vertex dataset and the second vertex dataset.

[0064] After obtaining the distance calculation range, based on the spatial location information of the distance calculation range, the spatial points contained in the first object model and the second object model are obtained as spatial points contained in the distance calculation range, thus obtaining the first vertex dataset and the second vertex dataset respectively.

[0065] In one specific implementation, when acquiring the first vertex dataset and the second vertex dataset, the selected spatial points included in the distance calculation range only include spatial points on the surfaces of the first object model and the second object model.

[0066] S103. Select vertices from the first vertex dataset and the second vertex dataset respectively to obtain multiple vertex pairs from different object models. Select the vertex pair with the shortest spatial distance as the target vertex and display the shortest distance position between the first object model and the second object model based on the target vertex.

[0067] After obtaining the first and second vertex datasets, vertices are selected from both datasets. Vertex selection can be done through direct traversal or by using a random algorithm. The selected vertices are then grouped into vertex pairs from different object models, and the spatial distance between these pairs is calculated.

[0068] After obtaining the spatial distance between each pair of vertices, select the pair of vertices with the shortest spatial distance as the target vertices, and use the spatial distance between the target vertices as the shortest distance between the first object model and the second object model.

[0069] In one specific implementation, please refer to Figure 6 As shown in line segment D, a connection is generated based on the spatial position of the target vertex, displaying the shortest distance position of the first object model and the second object model, as well as the distance value of the shortest distance.

[0070] The method for calculating and displaying the shortest distance between three-dimensional model objects provided in this embodiment of the invention generates a distance calculation range based on the line connecting the centers of the bounding boxes of the first object model and the second object model. It only selects spatial points of the two object models within the distance calculation range to calculate the shortest distance, generate and display the shortest distance position, which can reduce the amount of spatial point position data that needs to be obtained when calculating the shortest distance and improve the efficiency of calculating and displaying the shortest distance between three-dimensional model objects.

[0071] Please refer to Figure 7 as well as Figure 8 The following is a second embodiment of the method for calculating and displaying the shortest distance between three-dimensional model objects in this invention.

[0072] S201. Generate bounding boxes for the first object model and the second object model respectively, and connect the center points of the two bounding boxes to generate the model center connecting line segment.

[0073] In this embodiment, the content of step S201 is basically the same as that of step S101 in the previous embodiment, which generates the bounding boxes of the first object model and the second object model and obtains the connecting line segments of the model center, so it will not be described again here.

[0074] Specifically, in this embodiment, the bounding box is the minimum outer rectangle bounding box of the OBB bounding box.

[0075] S202. Based on the length of the connecting line segment at the center of the model as the diameter of the range sphere, draw a range sphere with the midpoint of the connecting line segment at the center of the model as the center of the sphere to obtain the distance calculation range;

[0076] Please see Figure 8 In this embodiment, the distance calculation range is obtained by constructing a range sphere based on the connecting line segment at the center of the model. Specifically, the length of the connecting line segment at the center of the model is used as the diameter L1 of the range sphere, and the midpoint of the connecting line segment at the center of the model is used as the center O of the range sphere to construct the range sphere S1, thus obtaining the distance calculation range.

[0077] S203. Select the vertices that overlap with the distance calculation range from the first object model and the second object model respectively to obtain the first vertex dataset and the second vertex dataset.

[0078] The content of step S203 in this embodiment is basically the same as that of step S102 in the previous embodiment, so it will not be described again here.

[0079] S204. Select vertices from the first vertex dataset and the second vertex dataset respectively to obtain multiple vertex pairs from different object models. Select the vertex pair with the shortest spatial distance as the target vertex. Display the shortest distance position between the first object model and the second object model based on the target vertex.

[0080] After obtaining the first vertex dataset and the second vertex dataset, vertices are selected from the first vertex dataset and the second vertex dataset respectively, thereby obtaining multiple vertex pairs from different object models; in this embodiment, the vertex selection method can be to use a random algorithm.

[0081] In one specific implementation, encoding and sorting rules can be preset, and the vertices of the first vertex dataset and the second vertex dataset can be sorted and numbered according to the encoding and sorting rules; multiple first random numbers and multiple second random numbers can be randomly generated using a pseudo-random algorithm to obtain multiple random number pairs; the vertex corresponding to the first random number in the first vertex dataset can be obtained according to the vertex number, and the vertex corresponding to the second random number in the second vertex dataset can be obtained according to the vertex number to obtain multiple vertex pairs from different object models; the coordinate information of multiple vertex pairs can be obtained and the distance between the point pairs can be calculated, and the vertex pair with the shortest point pair distance can be selected as the target vertex pair.

[0082] Furthermore, in one specific implementation, the encoding sorting rule can be to arrange the x, y, z values ​​of each vertex's three-dimensional coordinates in ascending order. The purpose of doing so is to ensure that the vertices collected using the range sphere filtering are the same under the same equipment and equal distance conditions, and that the vertex sequence remains consistent each time.

[0083] When randomly selecting a vertex, the random algorithm seed is initialized, and two numbers are randomly generated each time using a pseudo-random algorithm. This pseudo-random algorithm ensures that the random numbers generated in the same number of iterations are identical. These numbers correspond to a vertex in objects A and B that is used in the calculation. Since the vertices selected for calculating the shortest distance between A and B are already sorted, each set of two random numbers can be mapped to an index in an array sequence. The index value of this array sequence can be calculated using a modulo operation.

[0084] In one specific implementation, when using a random algorithm to select vertices, each vertex of the object in the range sphere can be used as the point to participate in the nearest distance calculation. Each pair of vertices is sorted by Morton code according to the coordinates (x,y,z), and then selected from their respective sequences or blocks, and the distance between the pairs of vertices is calculated.

[0085] In one specific implementation, before randomly selecting and generating vertex pairs, a threshold for the number of vertex pairs is preset. Once the number of generated vertex pairs exceeds the threshold, the selection stops, and the shortest distance among the already selected vertex pairs is chosen as the target vertex pair.

[0086] The method for calculating and displaying the shortest distance between three-dimensional model objects provided in this embodiment of the invention generates a distance calculation range based on the line connecting the centers of the bounding boxes of the first object model and the second object model. It only selects spatial points of the two object models within the distance calculation range to calculate the shortest distance, generate and display the shortest distance position, which can reduce the amount of spatial point position data that needs to be obtained when calculating the shortest distance and improve the efficiency of calculating and displaying the shortest distance between three-dimensional model objects.

[0087] Please refer to Figure 9-10 The following is a third embodiment of the method for calculating and displaying the shortest distance between three-dimensional model objects in this invention.

[0088] S301. Generate bounding boxes for the first object model and the second object model respectively, and connect the center points of the two bounding boxes to generate the model center connecting line segment.

[0089] In this embodiment, the content of step S201 is basically the same as that of step S101 in the previous embodiment, which generates the bounding boxes of the first object model and the second object model and obtains the connecting line segments of the model center, so it will not be described again here.

[0090] Specifically, in this embodiment, the bounding box is the minimum outer rectangle bounding box of the OBB bounding box.

[0091] S302. Determine the first enclosure ratio and the second enclosure ratio;

[0092] In this embodiment, not just one distance calculation range is generated, but two distance calculation ranges are generated for each of the two object models. Taking the second embodiment of the aforementioned method as an example, if only one calculation range is used, when one object is larger and the other smaller, the larger object will have more vertices enclosed by the distance calculation range, while the smaller object will have fewer vertices enclosed; this will lead to inaccurate calculation results. Therefore, in this embodiment, the method of generating two distance calculation ranges by determining a first enclosure ratio and a second enclosure ratio is used to improve the accuracy of calculating and displaying the shortest distance between two object models with significantly different sizes.

[0093] In one specific implementation of this embodiment, the generated distance calculation range is similar to that in the second embodiment of the aforementioned method, both generating range spheres. However, a first enclosure ratio and a second enclosure ratio are first determined, and two range spheres of different sizes are generated based on the first and second enclosure ratios. Specifically, a smaller collision sphere is generated for a larger object model, and a larger collision sphere is generated for a smaller object model, based on the object's volume. In this case, the distance calculation range in this embodiment includes a first distance calculation range and a second distance calculation range, the range sphere includes a first range sphere and a second range sphere, and the diameter of the range sphere includes the diameter of the first range sphere and the diameter of the second range sphere.

[0094] In one specific implementation, the determination of the first bounding ratio and the second bounding ratio can be based on the ratio of the bounding box size of the first object model and the second object model, or based on the ratio of the actual volume of the first object model and the second object model, or based on the ratio of the actual number of vertices of the first object model and the second object model.

[0095] S303. Calculate the diameter of the first range sphere and the diameter of the second range sphere based on the length of the connecting line segment at the center of the model, the first enclosure ratio, and the second enclosure ratio, respectively.

[0096] Please see Figure 10 After obtaining the first and second enclosing ratios, the diameters of the first and second bounding spheres can be calculated based on these ratios and the length of the connecting line segment at the model center. In a specific example, the first and second enclosing ratios are represented by λ1 and λ2, respectively. L2 is obtained by multiplying the first enclosing ratio λ1 by the length of the connecting line segment at the model center; L3 is obtained by multiplying the first enclosing ratio λ2 by the length of the connecting line segment at the model center; where the effective range of λ1 and λ2 is (0,1). Subsequently, L2 is used as the diameter of the first bounding sphere, and L3 is used as the diameter of the second bounding sphere.

[0097] S304. Using the midpoint of the line segment as the center of the sphere, construct the first range sphere and the second range sphere with the diameters of the first range sphere and the second range sphere respectively, to obtain the first distance calculation range and the second distance calculation range.

[0098] With the midpoint O of the line segment as the center of the sphere, the first range sphere S2 and the second range sphere S3 are respectively defined by the diameter L2 of the first range sphere and the diameter L3 of the second range sphere. The range contained in the first range sphere S2 and the second range sphere S3 are used as the first distance calculation range and the second distance calculation range.

[0099] S305. Select the vertices that overlap with the first distance calculation range in the first object model to obtain the first vertex dataset;

[0100] S306. Select the vertices that overlap with the second distance calculation range in the second object model to obtain the first vertex dataset;

[0101] After obtaining the first and second distance calculation ranges, vertices that overlap with the first distance calculation range are selected from the first object model A, i.e., vertices that overlap with the first range sphere S2 are selected from the first object model A, resulting in the first vertex dataset. Similarly, vertices that overlap with the second distance calculation range are selected from the second object model B, i.e., vertices that overlap with the second range sphere S3 are selected from the second object model B, resulting in the second vertex dataset. In this way, a larger distance calculation range is used to select vertices in a smaller object model, and a smaller distance calculation range is used to select vertices in a larger object model, thus avoiding a situation where the number of vertices in the first and second vertex datasets differs too much.

[0102] S307. Select vertices from the first vertex dataset and the second vertex dataset respectively to obtain multiple vertex pairs from different object models. Select the vertex pair with the shortest spatial distance as the target vertex. Display the shortest distance position between the first object model and the second object model based on the target vertex.

[0103] The content of step S307 in this embodiment is basically the same as that of step S204 in the previous embodiment, so it will not be repeated here.

[0104] The method for calculating and displaying the shortest distance between three-dimensional model objects provided in this embodiment of the invention generates a distance calculation range based on the line connecting the centers of the bounding boxes of the first and second object models. It only selects spatial points of the two object models within the distance calculation range to calculate the shortest distance, generate and display the shortest distance position, which can reduce the amount of spatial point position data that needs to be obtained when calculating the shortest distance. Furthermore, when generating the calculation range and obtaining the spatial points within the range, adjustments are made according to the size of the two objects, generating different acquisition ranges for each, which further improves the efficiency of calculating and displaying the shortest distance between three-dimensional model objects and, to a certain extent, prevents the situation of insufficient accuracy in the shortest distance calculation.

[0105] The above describes the method for calculating and displaying the shortest distance between three-dimensional model objects in the embodiments of the present invention. The following describes the device for calculating and displaying the shortest distance between three-dimensional model objects in the embodiments of the present invention. Please refer to [link / reference]. Figure 11 One embodiment of the shortest distance positioning device between three-dimensional model objects in this invention includes:

[0106] The range acquisition module 401 is used to generate bounding boxes for the first object model and the second object model respectively, connect the center points of the two bounding boxes to generate a model center connecting line segment, and generate a distance calculation range based on the model center connecting line segment.

[0107] Vertex filtering module 402 is used to filter out vertices that overlap with the distance calculation range in the first object model and the second object model respectively, to obtain a first vertex dataset and a second vertex dataset;

[0108] The distance calculation module 403 is used to select vertices in the first vertex dataset and the second vertex dataset respectively, to obtain multiple vertex pairs from different object models, select the vertex pair with the shortest spatial distance as the target vertex, and display the shortest distance position between the first object model and the second object model based on the target vertex.

[0109] The method for calculating and displaying the shortest distance between three-dimensional model objects provided in this embodiment of the invention generates a distance calculation range based on the line connecting the centers of the bounding boxes of the first object model and the second object model. It only selects spatial points of the two object models within the distance calculation range to calculate the shortest distance, generate and display the shortest distance position, which can reduce the amount of spatial point position data that needs to be obtained when calculating the shortest distance and improve the efficiency of calculating and displaying the shortest distance between three-dimensional model objects.

[0110] In another embodiment of this application, the range acquisition module 401 is specifically used for:

[0111] Using the length of the connecting line segment at the center of the model as the diameter of the range sphere, and taking the midpoint of the connecting line segment at the center of the model as the center of the sphere, the range sphere is drawn to obtain the distance calculation range.

[0112] In another embodiment of this application, the distance calculation range includes a first distance calculation range and a second distance calculation range, the range sphere includes a first range sphere and a second range sphere, and the diameter of the range sphere includes the diameter of the first range sphere and the diameter of the second range sphere;

[0113] The range acquisition module 401 is further used for:

[0114] Determine the proportions of the first and second enclosures;

[0115] Calculate the diameter of the first range sphere and the diameter of the second range sphere based on the length of the connecting line segment at the center of the model, the first enclosure ratio, and the second enclosure ratio, respectively.

[0116] Using the midpoint of the line segment as the center of the sphere, and using the diameters of the first and second range spheres respectively, a first range sphere and a second range sphere are constructed to obtain the first distance calculation range and the second distance calculation range.

[0117] In another embodiment of this application, the vertex filtering module 402 is further configured to:

[0118] In the first object model, vertices that overlap with the first distance calculation range are selected to obtain the first vertex dataset;

[0119] In the second object model, vertices that overlap with the second distance calculation range are selected to obtain the first vertex dataset.

[0120] In another embodiment of this application, the distance calculation module 403 is further configured to:

[0121] According to the encoding and sorting rules, the vertices of the first vertex dataset and the second vertex dataset are sorted and numbered respectively;

[0122] Multiple first random numbers and multiple second random numbers are randomly generated using a pseudo-random algorithm to obtain multiple pairs of random numbers;

[0123] Based on the vertex number, obtain the vertex corresponding to the first random number in the first vertex dataset; based on the vertex number, obtain the vertex corresponding to the second random number in the second vertex dataset, thus obtaining multiple vertex pairs from different object models.

[0124] Obtain the coordinate information of multiple vertex pairs and calculate the distance between them, then select the vertex pair with the shortest distance as the target vertex.

[0125] In another embodiment of this application, the bounding box is a minimum circumscribed rectangular bounding box.

[0126] Furthermore, the specific implementation method of the shortest distance position calculation and display device between three-dimensional model objects provided in this embodiment of the invention can be found in the specific content of the foregoing method embodiment, and will not be repeated here.

[0127] The shortest distance position calculation and display device between three-dimensional model objects provided in this embodiment of the invention generates a distance calculation range based on the line connecting the centers of the bounding boxes of the first object model and the second object model. It only selects spatial points of the two object models within the distance calculation range to calculate the shortest distance, generate and display the shortest distance position, which can reduce the amount of spatial point position data that needs to be obtained when calculating the shortest distance and improve the efficiency of calculating and displaying the shortest distance between three-dimensional model objects.

[0128] Based on the same inventive concept, this specification also provides an electronic device for calculating and displaying the shortest distance between three-dimensional model objects. The electronic device for calculating and displaying the shortest distance between three-dimensional model objects in this embodiment of the invention will be described in detail below from the perspective of hardware processing.

[0129] Figure 12 This is a schematic diagram of an electronic device provided as an embodiment of this specification. Refer to the following... Figure 12 To describe the electronic device 500 according to this embodiment of the invention. Figure 12 The electronic device 500 shown is merely an example and should not impose any limitations on the functionality and scope of use of the embodiments of the present invention.

[0130] like Figure 12 As shown, the electronic device 500 is presented in the form of a general-purpose computing device. The components of the electronic device 500 may include, but are not limited to: at least one processing unit 510, at least one storage unit 520, a bus 530 connecting different system components (including storage unit 520 and processing unit 510), a display unit 540, etc.

[0131] The storage unit stores program code that can be executed by the processing unit 510, causing the processing unit 510 to perform the steps described in the processing method section of this specification according to various exemplary embodiments of the present invention. For example, the processing unit 510 can perform, for example... Figure 1 , Figure 7 or Figure 9 The steps are shown.

[0132] The storage unit 520 may include a readable medium in the form of a volatile storage unit, such as a random access memory unit (RAM) 5201 and / or a cache storage unit 5202, and may further include a read-only memory unit (ROM) 5203.

[0133] The storage unit 520 may also include a program / utility 5204 having a set (at least one) program module 5205, such program module 5205 including but not limited to: an operating system, one or more application programs, other program modules and program data, each or some combination of these examples may include an implementation of a network environment.

[0134] Bus 530 can represent one or more of several types of bus structures, including a memory cell bus or memory cell controller, a peripheral bus, a graphics acceleration port, a processing unit, or a local bus using any of the various bus structures.

[0135] Electronic device 500 can also communicate with one or more external devices 100 (e.g., keyboard, pointing device, Bluetooth device, etc.), and with one or more devices that enable a user to interact with electronic device 500, and / or with any device that enables electronic device 500 to communicate with one or more other computing devices (e.g., router, modem, etc.). This communication can be performed via input / output (I / O) interface 550. Furthermore, electronic device 500 can also communicate with one or more networks (e.g., local area network (LAN), wide area network (WAN), and / or public networks, such as the Internet) via network adapter 560. Network adapter 560 can communicate with other modules of electronic device 500 via bus 530. It should be understood that, although... Figure 12 As not shown, other hardware and / or software modules may be used in conjunction with the electronic device 500, including but not limited to: microcode, device drivers, redundant processing units, external disk drive arrays, RAID systems, tape drives, and data backup storage systems.

[0136] In addition, the present invention also provides a computer program product, including a computer program / instruction that, when executed by a processor, implements the method for calculating and displaying the shortest distance between three-dimensional model objects as described in any of the above embodiments.

[0137] Through the above description of the embodiments, those skilled in the art will readily understand that the exemplary embodiments described in this invention can be implemented by software or by combining software with necessary hardware. Therefore, the technical solutions according to the embodiments of this invention can be embodied in the form of a software product, which can be stored in a computer-readable storage medium (such as a CD-ROM, USB flash drive, external hard drive, etc.) or on a network, including several instructions to cause a computing device (such as a personal computer, server, or network device, etc.) to execute the method described above according to this invention. When the computer program is executed by a data processing device, the computer-readable medium can implement the method described above by executing the computer program / instructions, i.e.: as... Figure 1 , Figure 7 or Figure 9 The method shown.

[0138] Figure 13 This is a schematic diagram of a computer-readable medium provided for embodiments of this specification.

[0139] accomplish Figure 1 , Figure 7 or Figure 9The computer program of the method shown can be stored on one or more computer-readable media. A computer-readable medium can be a readable signal medium or a readable storage medium. A readable storage medium can be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination thereof. More specific examples of readable storage media (a non-exhaustive list) include: an electrical connection having one or more wires, a portable disk, a hard disk, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage device, magnetic storage device, or any suitable combination thereof.

[0140] The computer-readable storage medium may include data signals propagated in baseband or as part of a carrier wave, carrying readable program code. Such propagated data signals may take various forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination thereof. The readable storage medium may also be any readable medium other than a readable storage medium, capable of transmitting, propagating, or transmitting programs for use by or in connection with an instruction execution system, apparatus, or device. The program code contained on the readable storage medium may be transmitted using any suitable medium, including but not limited to wireless, wired, optical fiber, RF, etc., or any suitable combination thereof.

[0141] Program code for performing the operations of this invention can be written in any combination of one or more programming languages, including object-oriented programming languages ​​such as Java and C++, and conventional procedural programming languages ​​such as C or similar languages. The program code can execute entirely on the user's computing device, partially on the user's device, as a standalone software package, partially on the user's computing device and partially on a remote computing device, or entirely on a remote computing device or server. In cases involving remote computing devices, the remote computing device can be connected to the user's computing device via any type of network, including a local area network (LAN) or a wide area network (WAN), or it can be connected to an external computing device (e.g., via the Internet using an Internet service provider).

[0142] In summary, this invention can be implemented in hardware, or as software modules running on one or more processors, or a combination thereof. Those skilled in the art will understand that in practice, general-purpose data processing devices such as microprocessors or digital signal processors (DSPs) can be used to implement some or all of the functions of some or all of the components according to the embodiments of the invention. The invention can also be implemented as a device or apparatus program (e.g., a computer program and computer program product) for performing part or all of the methods described herein. Such programs implementing the invention can be stored on a computer-readable medium or can take the form of one or more signals. Such signals can be downloaded from an Internet website, provided on a carrier signal, or provided in any other form.

[0143] The specific embodiments described above further illustrate the purpose, technical solution, and beneficial effects of the present invention. It should be understood that the present invention is not inherently related to any specific computer, virtual device, or electronic device, and various general-purpose devices can also implement the present invention. The above descriptions are merely specific embodiments of the present invention and are not intended to limit the present invention. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of the present invention should be included within the protection scope of the present invention.

[0144] The various embodiments in this specification are described in a progressive manner. The same or similar parts between the various embodiments can be referred to each other. Each embodiment focuses on describing the differences from other embodiments.

[0145] If the technical solution of this application involves personal information, the product using this technical solution has clearly informed the user of the personal information processing rules and obtained the user's voluntary consent before processing the personal information. If the technical solution of this application involves sensitive personal information, the product using this technical solution has obtained the user's separate consent before processing the sensitive personal information, and also meets the requirement of "express consent". For example, at personal information collection devices such as cameras, clear and prominent signs are set up to inform users that they have entered the scope of personal information collection and that personal information will be collected. If an individual voluntarily enters the collection scope, it is deemed that they have agreed to the collection of their personal information; or on the personal information processing device, with clear signs / information informing users of the personal information processing rules, authorization is obtained from the individual through pop-up information or by asking the individual to upload their personal information; wherein, the personal information processing rules may include information such as the personal information processor, the purpose of personal information processing, the processing method, and the types of personal information processed.

[0146] The above description is merely an embodiment of this application and is not intended to limit the scope of this application. Various modifications and variations can be made to this application by those skilled in the art. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of this application should be included within the scope of the claims of this application.

Claims

1. A method for calculating and displaying the shortest distance between objects in a three-dimensional model, characterized in that, include: Bounding boxes for the first and second object models are generated respectively. The center points of the two bounding boxes are connected to generate a model center connecting line segment. The first and second bounding ratios are determined. The diameters of the first and second range spheres are calculated based on the length of the model center connecting line segment, the first bounding ratio, and the second bounding ratio. The first and second range spheres are constructed with the midpoint of the line segment as the center of the sphere and the diameters of the first and second range spheres respectively, to obtain the first and second distance calculation ranges. Vertices that overlap with the first distance calculation range are selected from the first object model to obtain the first vertex dataset. Vertices that overlap with the second distance calculation range are selected from the second object model to obtain the second vertex dataset. This allows vertices to be selected from a smaller object model using a larger distance calculation range, and vertices to be selected from a larger object model using a smaller distance calculation range. Vertices are selected from the first vertex dataset and the second vertex dataset respectively to obtain multiple vertex pairs from different object models. The vertex pair with the shortest spatial distance is selected as the target vertex. The shortest distance position between the first object model and the second object model is displayed based on the target vertex.

2. The method for calculating and displaying the shortest distance between three-dimensional model objects according to claim 1, characterized in that, The step of selecting vertices from the first vertex dataset and the second vertex dataset respectively to obtain multiple vertex pairs from different object models, and selecting the vertex pair with the shortest spatial distance as the target vertex includes: According to the encoding and sorting rules, the vertices of the first vertex dataset and the second vertex dataset are sorted and numbered respectively; Multiple first random numbers and multiple second random numbers are randomly generated using a pseudo-random algorithm to obtain multiple pairs of random numbers; Based on the vertex number, obtain the vertex corresponding to the first random number in the first vertex dataset; based on the vertex number, obtain the vertex corresponding to the second random number in the second vertex dataset, thus obtaining multiple vertex pairs from different object models. Obtain the coordinate information of multiple vertex pairs and calculate the distance between them, then select the vertex pair with the shortest distance as the target vertex.

3. The method for calculating and displaying the shortest distance between three-dimensional model objects according to claim 2, characterized in that, The bounding box is the minimum circumscribed rectangle bounding box.

4. A device for calculating and displaying the shortest distance between three-dimensional model objects, characterized in that, include: The range acquisition module is used to generate bounding boxes for a first object model and a second object model, connect the center points of the two bounding boxes to generate a model center connecting line segment, and determine a first bounding ratio and a second bounding ratio. Based on the length of the model center connecting line segment, the first bounding ratio, and the second bounding ratio, the diameter of a first range sphere and the diameter of a second range sphere are calculated respectively. With the midpoint of the line segment as the center of the sphere, a first range sphere and a second range sphere are constructed with the diameters of the first range sphere and the second range sphere respectively, to obtain a first distance calculation range and a second distance calculation range. The vertex filtering module is used to filter out vertices that overlap with the first distance calculation range in the first object model to obtain a first vertex dataset, and to filter out vertices that overlap with the second distance calculation range in the second object model to obtain a second vertex dataset, so that vertices are filtered in a smaller object model with a larger distance calculation range, and vertices are filtered in a larger object model with a smaller distance calculation range. The distance calculation module is used to select vertices in the first vertex dataset and the second vertex dataset respectively, to obtain multiple vertex pairs from different object models, select the vertex pair with the shortest spatial distance as the target vertex, and display the shortest distance position between the first object model and the second object model based on the target vertex.

5. A device for calculating and displaying the shortest distance between three-dimensional model objects, characterized in that, The shortest distance position calculation and display device between the three-dimensional model objects includes: a memory and at least one processor, wherein the memory stores instructions; The at least one processor invokes the instructions in the memory to cause the shortest distance position calculation and display device between the three-dimensional model objects to perform the steps of the shortest distance position calculation and display method between the three-dimensional model objects as described in any one of claims 1-3.

6. A computer-readable storage medium storing a computer program / instructions thereon, characterized in that, When the program / instruction is executed by the processor, it implements the steps of the method for calculating and displaying the shortest distance between three-dimensional model objects as described in any one of claims 1-3.

7. A computer program product comprising a computer program / instructions, characterized in that, When the computer program / instruction is executed by the processor, it implements the steps of the method for calculating and displaying the shortest distance between three-dimensional model objects as described in any one of claims 1-3.