Recursive calculation method for distance from spatial point to given point set

Through recursive calculation methods and balanced binary tree structures, quickly calculate the space point to a given point set distance, solve the problem of slow calculation speed in the existing technology, significantly reduce time costs, and improve the performance of calculating streaming software.

CN119358463AActive Publication Date: 2025-01-24CALCULATION AERODYNAMICS INST CHINA AERODYNAMICS RES & DEV CENT
View PDF 7 Cites 0 Cited by

Patent Information

Application Number
CN202411935665.1
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-26
Publication Date
2025-01-24
Estimated Expiration
2044-12-26

AI Technical Summary

Technical Problem

In the prior art, the calculation speed of the distance from the space point to a given point set is low, resulting in a sharp increase in the total amount of distance parameters in the flow field simulation of complex configurations, affecting the in-depth application of computational fluid mechanics software.

Method used

A recursive calculation method is used to initialize the geometric data of a given point set through a vector container, and generate a balanced binary tree retrieval structure in a recursive mode to quickly calculate the distance from a spatial point to a given point set and locate the nearest point.

Benefits of technology

This method has significantly reduced the calculation time cost of the distance parameter in the implicit assembly and non -fixed flow field simulation, and improved the performance of calculating stream mechanical software.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119358463A_ABST
    Figure CN119358463A_ABST
Patent Text Reader

Abstract

The invention relates to the technical field of computational fluid mechanics and computational geometry, and discloses a recursive calculation method for a distance from a spatial point to a given point set, which comprises the following steps of: 1, performing initialization storage on geometric data of the given point set by using a vector container; 2, generating a balanced binary tree retrieval structure in a recursive mode; step 3, recursively calculating the distance from the space point to the given point set and positioning the nearest point; and step 4, after the positioning is completed, releasing the dynamic memory developed by the internal members of the balanced binary tree. According to the invention, the problem of low calculation speed of distance parameters in the prior art is solved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The invention relates to the technical field of computational fluid dynamics and computational geometry, and in particular to a recursive calculation method for the distance from a space point to a given point set. Background Art

[0002] In the process of using computational fluid dynamics methods to perform numerical simulation of physical fields, it is often necessary to calculate the distance between each discrete point in the space region and the wall point set. For example, in the implicit assembly process of overlapping grids, the spatial grid points Distance to the surface point set of the component to which it belongs And the distance to other component surface points , which is the key geometric parameter for automatic mesh hole digging. In the numerical simulation of turbulent effects, most turbulence models need to calculate the minimum distance from the center of the unit body to the element set on the solid wall surface. From the perspective of computational geometry, they can all be summarized as the calculation of the distance from a spatial point to a given point set. At present, refined flow field simulations related to complex configurations often rely on large grids, resulting in a sharp increase in the total amount of distance parameter calculations. At the same time, for the case of relative motion of components, unsteady flow field simulations need to update these distance parameters at each physical time step. They have become common efficiency hotspots, restricting the in-depth application of computational fluid dynamics software. Therefore, it is particularly important to develop high-performance methods to improve the calculation speed of distance parameters. Summary of the invention

[0003] In order to overcome the deficiencies of the prior art, the present invention provides a recursive calculation method for the distance from a spatial point to a given point set, which solves the problem of low calculation speed of distance parameters in the prior art.

[0004] The technical solution adopted by the present invention to solve the above problems is: A recursive calculation method for the distance from a spatial point to a given point set comprises the following steps: Step 1: Use a vector container to initialize and store the geometric data of a given point set; Step 2: Generate a balanced binary tree retrieval structure in a recursive mode; Step 3: Recursively calculate the distance from the spatial point to the given point set and locate the nearest point; Step 4: When the positioning is completed, release the dynamic memory allocated for the internal members of the balanced binary tree.

[0005] As a preferred technical solution, in step 1, it is assumed that The given point set of point elements is , define a Vector container, sequential storage Points The address value is recorded as , where the class describing the point element information contains two basic data: ① The spatial coordinates of the point element, in the form of a double-precision floating-point array The logo, its length and spatial dimension Same;②Point elements in The initial sequence number in the signed integer variable Identification; at a given point set In the example, any two different point elements have different value.

[0006] As a preferred technical solution, in step 2, All elements in are divided into multiple finite point subsets for storage, and each finite point subset forms a one-to-one mapping relationship with the relevant nodes on the balanced binary tree; among them, the finite point subset contained in each non-terminal node is the union of the finite point subsets contained in its left child and right child nodes, and the finite point subsets contained in the same-level brother nodes do not intersect with each other.

[0007] As a preferred technical solution, in step 2, As a binary tree node type name, The internal member variables of include: ① The finite point subset elements contained in the current node are The starting subscript in ;②The finite point subset elements contained in the current node are The end subscript in ;③The finite point subset contained in the current node is The infimum array in the directions ; ④ The finite point subset contained in the current node is The supremum array in the directions ; ⑤The left child pointer of the current node , whose initialization value is a null pointer ;⑥The right child pointer of the current node , whose initialization value is a null pointer .

[0008] As a preferred technical solution, step 2 includes the following steps: Step 21: Set a finite point subset length threshold for a balanced binary tree and use a signed integer member variable Store; if the current node contains a finite number of point subset elements Satisfy the conditions , then the current node is identified as a non-terminal node and needs to continue recursive decomposition; otherwise, the current node is identified as a terminal node; Step 22: Declare a binary tree recursive generation function without a return type and its parameter list; Step 23: Global root node pointer for a balanced binary tree Constructing instantiated objects: In the binary tree constructor, the global root node pointer The initial value is the empty address , The first parameter passed by reference to the binary tree recursive generator function , at the same time, let and The values ​​are 0 and ;in, for The total length of

[0009] As a preferred technical solution, in step 22, the binary tree recursive generation function is named , its input parameters are: ① subtree root node pointer ;② The node contains the point subset elements in The starting subscript in ③ The node contains the point subset elements in The end subscript in ; Then the binary tree recursive generation function is in the form of .

[0010] As a preferred technical solution, step 23 includes the following steps: Step 231: Open up dynamic memory to implement the current Object instantiation, and through the node type The assignment operation inside the constructor uses Private member variables of an object , The values ​​are respectively related to the current Of , Stay consistent; Step 232: Along The current coordinate axis directions are calculated separately The point elements contained in the object The variance of the coordinate components of the Record the direction number corresponding to the maximum variance; among them, is an integer and ; Step 233: Along the direction of maximum variance, according to the coordinate components of the point elements The rules from small to large are currently The point element address value contained in the object Sort by Step 234: Calculate the root node of the current subtree The upper and lower bounds of the bounding box of the space to which it belongs, along coordinate axis directions, respectively calculate the current The point elements contained in the object The coordinate components The infimum of Supremum ;in, is an integer and ; Step 235: construct subtrees at all levels of the balanced binary tree; After executing the relevant steps 231 to 234, if the condition Established, then Return immediately, otherwise continue to execute step 235 and then return.

[0011] As a preferred technical solution, step 3 includes the following steps: Step 31: If Object and Both exist, then define and initialize two local node pointers as follows: ,

[0012] Calculate separately Point to the nearest node pointer Far node pointer The square value of the distance between the bounding boxes of the two subtrees of the root node and ; Step 32: If Object and All point to empty address values , then extract the current The object contains the starting and ending range parameters of the given point subset, and stores their values ​​in signed integer register variables and Then, traverse The fragments in the sequence are calculated one by one Point to point elements The square of the distance ,if , then The value of is updated to Simultaneously balance the nearest point pointer of a binary tree Point to the current point element The address of is an integer and ; Step 33: Return The square root of As a point To a given point set sequence The distance, at this time the nearest point pointer of the balanced binary tree Pointing Distance point in sequence The first address of the most recent element, which can be accessed through the interface function Points to more detailed data.

[0013] As a preferred technical solution, in step 31, set the near node pointer The corresponding bounding box infra and supremum parameters are and ,at the same time Point at The projection component on Defined as: If ,So ;if ,So ;if ,So , ; Get the far node pointer The corresponding bounding box infra and supremum parameters are obtained The value of , then exchange and Values ​​and swap and direction; if , then call the recursive function , its three parameters are The first address of the point coordinate array , near node pointer With reference variables ;if , then call the recursive function , its three parameters are Point coordinates first address , far node pointer With reference variables ;in, is an integer and .

[0014] As a preferred technical solution, in step 4, for a given point set sequence The heap space occupied by each element is released according to the sequential traversal process of the vector; the heap space occupied by each layer of nodes in the balanced binary tree is released according to the pre-order traversal process of the fork tree structure.

[0015] Compared with the prior art, the present invention has the following beneficial effects: (1) In the implicit assembly process of overlapping grids of millions to tens of millions, the recursive calculation model of the distance from a spatial point to a given point set can quickly obtain the distance parameters from the spatial grid point to the grid point set on the solid wall surface, thereby greatly reducing the time cost of automatic hole digging of overlapping grids; (2) In the unsteady simulation process of the flow field based on a moving grid of millions to tens of millions in size, the recursive calculation model of the distance from a spatial point to a given point set can quickly update the distance parameter from the center of each volume unit to the center of the surface element of the solid wall, thereby reducing the time cost of turbulence simulation at each physical time step. BRIEF DESCRIPTION OF THE DRAWINGS

[0016] Figure 1 It is a flow chart of the recursive algorithm for the distance from a spatial point to a given point set of the present invention; Figure 2 It is a given point set element data structure and its vector mapping relationship diagram of the present invention; Figure 3 It is a mapping diagram of the internal members of the binary tree node of the present invention and its corresponding given point subset; Figure 4 It is a schematic diagram of the recursive construction process of nodes at each layer of the binary tree of the present invention; Figure 5 This is a diagram showing the effect of the overlapping grids digging holes in the three-body delivery model of the present invention (section x=5.2). DETAILED DESCRIPTION

[0017] The present invention will be further described in detail below in conjunction with embodiments and drawings, but the embodiments of the present invention are not limited thereto.

[0018] Example 1 like Figures 1 to 5 As shown, in view of the problems of the prior art, the present invention provides a recursive calculation method for the distance from a spatial point to a given point set. In a standard C++ programming environment, Figure 1 As shown in the figure, its implementation process includes the following 4 basic steps.

[0019] Step 1: Use a vector container to initialize and store the geometric data of a given point set. In the initial stage, assume that The given point set of point elements is , the present invention allows There are point elements with the same spatial coordinates in . Figure 2As shown, calling the C++ standard template library, the present invention defines a A vector container ( ), sequential storage Points The address value is recorded as , where the description point element ( ) The class composed of information contains two basic data: ① The spatial coordinates of the point element, in the form of a double-precision floating-point array The logo, its length and spatial dimension The same. ② The point element is The initial sequence number in the signed integer variable Identification. In a given point set In the example, any two different point elements have different value.

[0020] Step 2: Generate a balanced binary tree retrieval structure in recursive mode. In the current step, you need to All elements in are divided into multiple finite point subsets for storage, and each finite point subset forms a one-to-one mapping relationship with the relevant nodes on the balanced binary tree. Among them, the finite point subset contained in each non-terminal node is the union of the finite point subsets contained in its left and right child nodes, and the finite point subsets contained in the same-level brother nodes do not intersect with each other. In the present invention, is the name of the binary tree node type, such as Figure 3 As shown, its internal member variables are: ① The finite point subset elements contained in the current node are in The starting subscript in ;②The finite point subset elements contained in the current node are The end subscript in ;③The finite point subset contained in the current node is The infimum array in the directions ; ④ The finite point subset contained in the current node is The supremum array in the directions ; ⑤The left child pointer of the current node , whose initialization value is a null pointer ;⑥The right child pointer of the current node , whose initialization value is a null pointer . Figure 4 The figure shows the recursive construction process of nodes at each level of a binary tree, where each ellipse corresponds to a node in the binary tree, and the two solid arrows extending to the lower left and lower right point to the left child and right child of the current node respectively; the numbers in the ellipse indicate the recursive construction of the binary tree node (i.e. The order of calculation of the internal member variables No. ① to ⑥).

[0021] Furthermore, step 2 can be divided into the following three steps: Step 21: Set a finite point subset length threshold for a balanced binary tree and use a signed integer member variable If the current node contains a finite number of point subset elements Satisfy the conditions , then the current node is identified as a non-terminal node and needs to continue to perform recursive decomposition; otherwise, the current node is identified as a terminal node. In the embodiment of the present invention, based on the comprehensive consideration of the binary tree height control factor and the local nearest point fast search factor, the setting The value of is 24.

[0022] Step 22: Declare a binary tree recursive generator function without a return type and its parameter list. The binary tree recursive generator function is named , its input parameters are: ① subtree root node pointer (reference pointer transfer);② The node contains the point subset elements in The starting subscript in (Signed integer value transfer); ③ The node contains the point subset elements in The end subscript in (Signed integer value is passed). Therefore, the form of the binary tree recursive generation function is .

[0023] Step 23: Global root node pointer for balanced binary tree Construct an instantiated object. In the binary tree constructor, the global root node pointer The initial value is the empty address . In the current step, Passed by reference to The first parameter of , at the same time, let and The values ​​are 0 and ( for After executing the relevant steps 231 to 234, if the condition Established, then Return immediately, otherwise continue to execute step 235 and then return.

[0024] Step 231: Open up dynamic memory to implement the current Object instantiation, and through the node type The assignment operation inside the constructor uses Private member variables of an object , The values ​​of the current binary tree recursive generation function Of , Be consistent.

[0025] Step 232: Along The current coordinate axis directions are calculated separately The point elements contained in the object (Continuous subscript The range is ) and use signed integer register variables Record the direction number corresponding to the maximum variance.

[0026] Step 233: Along the direction of maximum variance, according to the coordinate components of the point elements The rules from small to large are currently The point element address value contained in the object (Continuous subscript The range is ) to sort. The present invention directly calls the C++ standard template library The generic algorithm completes this sorting process to achieve the optimal combination of quick sort, heap sort and insertion sort, thereby reducing the time cost of recursive construction of a balanced binary tree.

[0027] Step 234: Calculate the root node of the current subtree The upper and lower bounds of the bounding box of the space. coordinate axis directions, respectively calculate the current The point elements contained in the object (Continuous subscript The range is ) The infimum of Supremum , (subscript The range is ). The present invention directly calls the C++ standard template library and The generic algorithm completes this calculation process.

[0028] Step 235: construct subtrees at all levels of the balanced binary tree. In steps 231 to 234, and Identifies the current subtree at a given point sequence The starting and ending range of the point subset involved in . Since in step 233, along the sequence number The maximum variance direction of the subscript The range is The point elements are reordered, so the signed integer register variable is defined For use in sequence Mark the median element on the graph. According to step 23, if the condition Established, then call Complete the generation of the next level left subtree and right subtree in sequence, otherwise jump out of the current one directly For the generation of the left subtree, the binary tree recursive generation function The first parameter value is set to the current root node The left child pointer , the second parameter is set to , the third parameter is set to For the generation of the right subtree, the binary tree recursive generation function The first parameter value is set to the current root node The right child pointer , the second parameter is set to , the third parameter is set to .

[0029] Step 3: Recursively calculate the distance from the spatial point to the given point set and locate the nearest point. Any point in dimensional space The coordinates of , To a given set of points The square value of the distance uses a double-precision floating-point register variable Storage, whose initial value is a sufficiently large floating-point constant (In the embodiment of the present invention, ). Declare a recursive search function with no return type and its parameter list as , where the double-precision floating-point parameter for The first address of the point coordinate array (constant pointer transfer), The root node address of the current subtree (pointer transfer), double-precision floating-point parameter That is To a given set of points The square value of the distance (reference transfer). In particular, at the initial moment, the global root node pointer of the balanced binary tree is used initialization The second parameter of the function When the parameter transfer is completed, the distance from the spatial point to the given point set can be calculated according to steps 31 to 33 and the nearest point can be located.

[0030] Step 31: If the root node of the current subtree is a non-terminal node, that is The left child pointer of the object and the right child pointer Both exist, then define and initialize two local node pointers as follows ,

[0031] Calculate separately Point to the nearest node pointer (To a known point The node pointer variable to which the nearer subtree bounding box belongs) and the far node pointer (To a known point The node pointer variable to which the bounding box of the farther subtree belongs) is the square value of the distance between the bounding boxes of the two subtrees of the root node and . Set the near node pointer The corresponding bounding box infra and supremum parameters are and ,at the same time Point at dimension( ) on the projection component Defined as: If ,So ;if ,So ;if ,So . Further, . Similarly, get the far node pointer The corresponding bounding box lower and upper bound parameters, by analogy The calculation process can be obtained If , then exchange and Values ​​and swap and If , then call the recursive function , its three parameters are The first address of the point coordinate array , near node pointer With reference variables .if , then call the recursive function , its three parameters are The first address of the point coordinate array , far node pointer With reference variables .

[0032] Step 32: If the root node of the current subtree is a terminal node, that is The left child pointer of the object and the right child pointer All point to empty address values , then extract the current The object contains the starting and ending range parameters of the given point subset, and stores their values ​​in signed integer register variables and Next, traverse A fragment of a sequence, where the subscript The range is , calculate successively Point to point elements The square of the distance ,if , then The value of is updated to Simultaneously balance the nearest point pointer of a binary tree Point to the current point element The address of.

[0033] Step 33: Return The square root of As a point To a given point set sequence The distance, at this time the nearest point pointer of the balanced binary tree Pointing Distance point in sequence The first address of the most recent element, which can be accessed through the interface function It is pointed to more detailed data. It is explained that, from step 31 to step 32 of the present invention, only the square value of the relevant distance parameter is stored to avoid the influence of frequent square root operations on the computing performance.

[0034] Step 4: When the positioning is completed, release the dynamic memory opened by the internal members of the balanced binary tree, which are: ① Given point set sequence ② The heap space occupied by each element of the tree is released according to the sequential traversal process of the vector. ② The heap space occupied by each layer of the nodes in the balanced binary tree is released according to the pre-order traversal process of the fork tree structure.

[0035] Example 2 like Figures 1 to 5 As shown, as a further optimization of Example 1, based on Example 1, this embodiment also includes the following technical features: In order to enable ordinary technicians in this field to better understand the technical solution of the present invention, the following takes the high-speed flow CFD simulation software HyFLOW in the national numerical wind tunnel project as an example to further describe the technical solution of the present invention. The original HyFLOW software relies on the implicit assembly module of the structural overlapping grid and combines the turbulence model to have the unsteady heat flow simulation function based on the moving grid. Among them, in the implicit assembly module of the overlapping grid, the wall distance parameter of the spatial grid point is obtained by the classic cyclic box algorithm; in the unsteady heat flow simulation process, the wall distance parameter of the volume unit cell center in the turbulence model is obtained by the classic multidimensional digital tree algorithm. With the increase of the grid scale, the time consumption generated by the above two algorithms in the calculation of the wall distance parameter increases rapidly. In order to improve the computing performance of the HyFLOW software as a whole, the technical solution of the present invention is applied to the new version of the HyFLOW software, and the cyclic box algorithm and the multidimensional digital tree algorithm are replaced in the implicit assembly module of the overlapping grid and the unsteady heat flow simulation module, respectively, and the time cost is compared.

[0036] like Figure 4 As shown, each node of the balanced binary tree is constructed in sequence in the order of pre-order traversal. Figure 4 In the figure, the ellipse represents a node, and the number inside the ellipse represents the pre-order traversal number of the current node (that is, the construction order number of the current node). For example, the number 0 represents the pre-order traversal number of the current node is 0, the number 6 represents the pre-order traversal number of the current node is 6, and the number 14 represents the pre-order traversal number of the current node is 14.

[0037] Figure 5 The embodiment model selected by the present invention is shown, which is a wing with three missile bodies mounted under it. Independent structural grids are generated around these four components, so that the total number of spatial grid points reaches 80396220 and the total number of body units reaches 76975618. On a domestic high-performance cluster, 240 core computing resources are called. At the initial moment, the wall distance parameters of the spatial grid points are calculated using the cyclic box algorithm and the algorithm of the present invention, respectively. The corresponding wall time consumption is 13.22s and 2.74s, respectively. It can be seen that the algorithm of the present invention reduces the time cost by 79.3%; similarly, at the initial moment, the multidimensional digital tree method and the algorithm of the present invention are used to calculate the wall distance parameters of the body unit center in the turbulence model, respectively. The corresponding wall time is 3.36s and 1.32s, respectively. It can be seen that the algorithm of the present invention reduces the time cost by 60.7%. The embodiment shows that the application of the present invention greatly reduces the time consumed in the motion overlapping grid assembly and the wall distance parameter update during the unsteady heat flow simulation, and improves the computing performance of the simulation software.

[0038] As described above, the present invention can be preferably implemented.

[0039] All features disclosed in all embodiments in this specification, or steps in all methods or processes implicitly disclosed, except for mutually exclusive features and / or steps, can be combined and / or expanded or replaced in any manner.

[0040] The above description is only a preferred embodiment of the present invention and does not limit the present invention in any form. According to the technical essence of the present invention, within the spirit and principles of the present invention, any simple modification, equivalent replacement and improvement made to the above embodiment still falls within the protection scope of the technical solution of the present invention.

Claims

1. A recursive calculation method for the distance from a spatial point to a given point set, characterized in that: The following steps are involved: Step 1: Use a vector container to initialize and store the geometric data of a given point set; Step 2: Generate a balanced binary tree retrieval structure in a recursive mode; Step 3: Recursively calculate the distance from the spatial point to the given point set and locate the nearest point; Step 4: When the positioning is completed, release the dynamic memory allocated for the internal members of the balanced binary tree.

2. A recursive calculation method for the distance from a spatial point to a given point set according to claim 1, characterized in that: In step 1, let The given point set of point elements is , define a Vector container, sequential storage Points The address value is recorded as , where the class describing the point element information contains two basic data: ① The spatial coordinates of the point element, in the form of a double-precision floating-point array The logo, its length and spatial dimension Same;②Point elements in The initial sequence number in the signed integer variable Identification; at a given point set In the example, any two different point elements have different value.

3. A recursive calculation method for the distance from a spatial point to a given point set according to claim 2, characterized in that: In step 2, All elements in are divided into multiple finite point subsets for storage, and each finite point subset forms a one-to-one mapping relationship with the relevant nodes on the balanced binary tree; among them, the finite point subset contained in each non-terminal node is the union of the finite point subsets contained in its left child and right child nodes, and the finite point subsets contained in the same-level brother nodes do not intersect with each other.

4. A recursive calculation method for the distance from a spatial point to a given point set according to claim 3, characterized in that: In step 2, As a binary tree node type name, The internal member variables of include: ① The finite point subset elements contained in the current node are The starting subscript in ;②The finite point subset elements contained in the current node are The end subscript in ;③The finite point subset contained in the current node is The infimum array in the directions ; ④ The finite point subset contained in the current node is The supremum array in the directions ; ⑤The left child pointer of the current node , whose initialization value is a null pointer ;⑥The right child pointer of the current node , whose initialization value is a null pointer .

5. A recursive calculation method for the distance from a spatial point to a given point set according to claim 4, characterized in that: Step 2 includes the following steps: Step 21: Set a finite point subset length threshold for a balanced binary tree and use a signed integer member variable Store; if the current node contains a finite number of point subset elements Satisfy the conditions , then the current node is identified as a non-terminal node and needs to continue recursive decomposition; otherwise, the current node is identified as a terminal node; Step 22: Declare a binary tree recursive generation function without a return type and its parameter list; Step 23: Global root node pointer for balanced binary tree Constructing instantiated objects: In the binary tree constructor, the global root node pointer The initial value is the empty address , The first parameter passed by reference to the binary tree recursive generator function , at the same time, let and The values ​​are 0 and ;in, for The total length of 6. A recursive calculation method for the distance from a spatial point to a given point set according to claim 5, characterized in that: In step 22, the binary tree recursive generation function is named , its input parameters are: ① subtree root node pointer ;② The node contains the point subset elements in The starting subscript in ③ The node contains the point subset elements in The end subscript in ; Then the binary tree recursive generation function is in the form of .

7. A recursive calculation method for the distance from a spatial point to a given point set according to claim 6, characterized in that: Step 23 includes the following steps: Step 231: Open up dynamic memory to implement the current Object instantiation, and through the node type The assignment operation inside the constructor uses Private member variables of an object , The values ​​are respectively related to the current Of , Stay consistent; Step 232: Along The current coordinate axis directions are calculated separately The point elements contained in the object The variance of the coordinate components of the Record the direction number corresponding to the maximum variance; among them, is an integer and ; Step 233: Along the direction of maximum variance, according to the coordinate components of the point elements The rules from small to large are currently The point element address value contained in the object Sort by Step 234: Calculate the root node of the current subtree The upper and lower bounds of the bounding box of the space to which it belongs, along coordinate axis directions, respectively calculate the current The point elements contained in the object The coordinate components The infimum of Supremum ;in, is an integer and ; Step 235: construct subtrees at all levels of the balanced binary tree; After executing the relevant steps 231 to 234, if the condition Established, then Return immediately, otherwise continue to execute step 235 and then return.

8. A recursive calculation method for the distance from a spatial point to a given point set according to claim 7, characterized in that: Step 3 includes the following steps: Step 31: If Object and Both exist, then define and initialize two local node pointers as follows: , Calculate separately Point to the nearest node pointer Far node pointer The square value of the distance between the bounding boxes of the two subtrees of the root node and ; Step 32: If Object and All point to empty address values , then extract the current The object contains the starting and ending range parameters of the given point subset, and stores their values ​​in signed integer register variables and Then, traverse The fragments in the sequence are calculated one by one Point to point elements The square of the distance ,if , then The value of is updated to Simultaneously balance the nearest point pointer of a binary tree Point to the current point element The address of is an integer and ; Step 33: Return The square root of As a point To a given point set sequence The distance, at this time the nearest point pointer of the balanced binary tree Pointing Distance point in sequence The first address of the most recent element, which can be accessed through the interface function Points to more detailed data.

9. A recursive calculation method for the distance from a spatial point to a given point set according to claim 8, characterized in that: In step 31, set the near node pointer The corresponding bounding box infra and supremum parameters are and ,at the same time Point at The projection component on Defined as: If ,So ;if ,So ;if ,So , ; Get the far node pointer The corresponding bounding box infra and supremum parameters are obtained The value of , then exchange and Values ​​and swap and Direction of if , then call the recursive function , its three parameters are The first address of the point coordinate array , near node pointer With reference variables ;if , then call the recursive function , its three parameters are Point coordinates first address , far node pointer With reference variables ;in, is an integer and .

10. A recursive calculation method for the distance from a spatial point to a given point set according to any one of claims 1 to 9, characterized in that: In step 4, for a given point set sequence The heap space occupied by each element is released according to the sequential traversal process of the vector; the heap space occupied by each layer of nodes in the balanced binary tree is released according to the pre-order traversal process of the fork tree structure.

Citation Information

Patent Citations

  • Software FMEA (failure mode and effects analysis) method based on level dependency modeling

    CN103473400A

  • A massive point cloud spatial management method based on octree-like encoding

    CN109345619A

  • Power transmission line distance measurement method, device and system based on ground fixed-point laser radar scanning and electronic equipment

    CN112305559A

  • Webpage partitioning method based on non-modeled Web data model

    CN113806665A

  • Hierarchical control point editing of adaptively sampled distance fields

    US20020130877A1