Method, device and equipment for detecting visibility between two points, medium and product

By constructing a hierarchical bounding volume structure and screening nodes with high intersection probability, the problem of low visibility detection efficiency between two points in the prior art is solved, achieving efficient and accurate visibility detection, which is applicable to multiple technical fields.

CN121544703APending Publication Date: 2026-02-17CHENGDU GONGDING TECHNOLOGY CO LTD +2
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202511698646.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-11-19
Publication Date
2026-02-17

AI Technical Summary

Technical Problem

Existing two-point visibility detection methods are inefficient when dealing with complex 3D models and cannot meet real-time requirements, especially in VR/AR and autonomous driving scenarios. This is mainly because ray casting requires intersecting with a large number of triangular facets one by one, resulting in serious redundant calculations.

Method used

A hierarchical bounding volume structure with triangular facets as leaf nodes is constructed. The spatial filtering characteristics of the bounding volume are used to exclude unrelated regions. The target nodes with high intersection probability are selected by combining the position information of the target line segments. Intersection detection is performed only on these nodes. After confirming the intersection, the child nodes are traversed recursively to avoid invalid detection of nodes with low intersection probability.

Benefits of technology

It significantly improves detection efficiency, reduces redundant calculations, and ensures the accuracy and real-time performance of detection, making it suitable for fields such as game development, VR/AR, autonomous driving, architectural design visualization, and robot obstacle avoidance.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121544703A_ABST
    Figure CN121544703A_ABST
Patent Text Reader

Abstract

The embodiment of the invention provides a method and device for detecting visibility between two points, equipment, a medium and a product. The method comprises the following steps: constructing a surrounding body structure corresponding to a three-dimensional model according to spatial position information of each triangular patch in the three-dimensional model; and for each current node in the bounding volume structure, judging whether the current node is a target node or not according to the position information of the target line segment and the position information of the current node. If the current node is the target node, judging whether the current node intersects with the target line segment or not; and if the current node intersects with the target line segment and the current node is not a leaf node, determining a child node of the current node as a new current node. And if the leaf node intersected with the target line segment exists, determining that the first point and the second point are invisible. Leaf nodes of the bounding volume structure are triangular patches, the intersection probability of a target node and a target line segment is greater than a preset probability, the target line segment is a line segment from a first point to a second point, and the method improves the detection efficiency.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of computer graphics technology, and in particular to a method, apparatus, device, medium and product for detecting visibility between two points. Background Technology

[0002] In the fields of 3D computer graphics, virtual reality (VR), augmented reality (AR), game development, architectural design visualization, autonomous driving path planning, and robot obstacle avoidance, two-point visibility detection is a core fundamental problem used to quickly and accurately determine whether the line connecting two points in space is occluded by geometric objects or obstacles in the scene.

[0003] Currently, the mainstream implementation scheme for visibility detection between two points is ray casting: a virtual ray is constructed from the viewpoint (such as the player's perspective or the sensor's position) to the target point. Whether the two points are occluded is determined by detecting whether this ray intersects with geometric primitives in the scene (mostly triangular faces, the basic building blocks of 3D models). If the ray does not intersect with any triangular face before reaching the target point, the two points are visible; otherwise, occlusion exists.

[0004] However, when the scene contains a large number of detailed models, the number of triangular faces may reach millions or even hundreds of millions. Rays need to be intersected with each face one by one, resulting in low processing efficiency and difficulty in meeting the real-time requirements of VR / AR, autonomous driving and other scenarios. Summary of the Invention

[0005] This application provides a method, apparatus, equipment, medium, and product for detecting visibility between two points, in order to achieve the technical effect of improving the efficiency of visibility detection between two points.

[0006] In a first aspect, embodiments of this application provide a method for detecting visibility between two points, including:

[0007] Based on the spatial position information of each triangular facet in the 3D model, a bounding volume structure corresponding to the 3D model is constructed, and the leaf nodes of the bounding volume structure are the triangular facets.

[0008] For each current node in the enclosing structure, based on the position information of the target line segment and the position information of the current node, it is determined whether the current node is a target node. The intersection probability of the target node and the target line segment is greater than a preset probability. The target line segment is the line segment from the first point to the second point.

[0009] If the current node is the target node, then determine whether the current node intersects with the target line segment;

[0010] If the current node intersects with the target line segment, then the child node of the current node is determined as the new current node;

[0011] If there is a leaf node that intersects with the target line segment, then it is determined that the first point and the second point are not visible to each other.

[0012] In one possible implementation, the location information includes direction and / or coordinates.

[0013] In one possible implementation, determining whether the current node is the target node based on the position information of the target line segment and the position information of the current node includes:

[0014] For any coordinate axis, if the target line segment and the current node have an overlapping coordinate range on the coordinate axis, then the current node is determined to be the target node.

[0015] In one possible implementation, when the current node is a leaf node, determining whether the current node is a target node based on the position information of the target line segment and the position information of the current node includes:

[0016] If the angle between the direction of the target line segment and the normal vector direction of the current node is less than a preset angle, then the current node is determined to be the target node; the direction of the target line segment is the direction from the first point to the second point.

[0017] In one possible implementation, constructing the bounding volume structure corresponding to the three-dimensional model based on the spatial position information of each triangular facet in the three-dimensional model includes:

[0018] Based on the spatial location information of each triangular facet in the 3D model and the preset number of root nodes, determine the triangular facet contained in each root node.

[0019] For each node, based on the position of the triangular facets contained in the node and the preset number of child nodes corresponding to the node, the triangular facets contained in each child node are determined. The above steps are repeated until the child node contains a triangular facet, and the constructed bounding volume structure is obtained.

[0020] In one possible implementation, the enclosing structure is a binary tree structure.

[0021] Secondly, embodiments of this application provide a two-point visibility detection device, comprising:

[0022] The construction module is used to construct the bounding volume structure corresponding to the three-dimensional model based on the spatial position information of each triangular facet in the three-dimensional model, wherein the leaf nodes of the bounding volume structure are the triangular facets.

[0023] The judgment module is used to determine, for each current node in the enclosing structure, whether the current node is a target node based on the position information of the target line segment and the position information of the current node, wherein the intersection probability of the target node and the target line segment is greater than a preset probability, and the target line segment is the line segment from the first point to the second point;

[0024] The judgment module is further configured to determine whether the current node intersects with the target line segment if the current node is the target node;

[0025] The determination module is used to determine the child nodes of the current node as the new current node if the current node intersects with the target line segment and the current node is not a leaf node.

[0026] The determining module is further configured to determine that the first point and the second point are not visible to each other if there is a leaf node that intersects with the target line segment.

[0027] In one possible implementation, the location information includes direction and / or coordinates.

[0028] In one possible implementation, the determining module is specifically used for:

[0029] For any coordinate axis, if the target line segment and the current node have an overlapping coordinate range on the coordinate axis, then the current node is determined to be the target node.

[0030] In one possible implementation, when the current node is a leaf node, the determination module is specifically used for:

[0031] If the angle between the direction of the target line segment and the normal vector direction of the current node is less than a preset angle, then the current node is determined to be the target node; the direction of the target line segment is the direction from the first point to the second point.

[0032] In one possible implementation, the building module is specifically used for:

[0033] Based on the spatial location information of each triangular facet in the 3D model and the preset number of root nodes, determine the triangular facet contained in each root node.

[0034] For each node, based on the position of the triangular facets contained in the node and the preset number of child nodes corresponding to the node, the triangular facets contained in each child node are determined. The above steps are repeated until the child node contains a triangular facet, and the constructed bounding volume structure is obtained.

[0035] In one possible implementation, the enclosing structure is a binary tree structure.

[0036] Thirdly, embodiments of this application provide an electronic device, including: a memory and a processor;

[0037] The memory stores computer-executed instructions;

[0038] The processor executes computer execution instructions stored in the memory, causing the processor to perform the first aspect and / or various possible implementations of the first aspect as described above.

[0039] Fourthly, embodiments of this application provide a computer-readable storage medium storing computer-executable instructions, which, when executed by a processor, are used to implement the first aspect and / or various possible implementations of the first aspect.

[0040] Fifthly, embodiments of this application provide a computer program product, including a computer program that, when executed by a processor, implements the first aspect and / or various possible implementations of the first aspect.

[0041] The visibility detection method, apparatus, device, medium, and product between two points provided in this application construct a hierarchical bounding body structure with triangular facets as leaf nodes. This structure divides and aggregates the triangular facets of a 3D model according to their spatial location. Utilizing the spatial filtering characteristics of the upper bounding body, it first excludes areas completely unrelated to the target line segment, significantly reducing the initial detection range. Then, combining the position information of the target line segment with the position information of the current node, it filters out target nodes with an intersection probability greater than a preset probability with the target line segment. Intersection detection is performed only on these nodes, avoiding invalid detection of nodes with low intersection probabilities. Subsequent recursion towards the leaf nodes ensures no occlusion omissions while minimizing redundant calculations, improving detection efficiency and guaranteeing the reliability and real-time performance of subsequent functions. Attached Figure Description

[0042] The accompanying drawings, which are incorporated in and form part of this specification, illustrate embodiments consistent with this application and, together with the description, serve to explain the principles of this application.

[0043] Figure 1 Flowchart of the two-point visibility detection method provided in this application Figure 1 ;

[0044] Figure 2 Flowchart of the two-point visibility detection method provided in this application Figure 2 ;

[0045] Figure 3 Flowchart of the two-point visibility detection method provided in this application Figure 3 ;

[0046] Figure 4 Flowchart of the two-point visibility detection method provided in this application Figure 4 ;

[0047] Figure 5 A schematic diagram of the two-point visibility detection device provided in this application;

[0048] Figure 6 A schematic diagram of the structure of the electronic device provided in this application.

[0049] The accompanying drawings illustrate specific embodiments of this application, which will be described in more detail below. These drawings and descriptions are not intended to limit the scope of the concept in any way, but rather to illustrate the concept of this application to those skilled in the art through reference to particular embodiments. Detailed Implementation

[0050] Exemplary embodiments will now be described in detail, examples of which are illustrated in the accompanying drawings. When the following description relates to the drawings, unless otherwise indicated, the same numbers in different drawings denote the same or similar elements. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with this application. Rather, they are merely examples of apparatuses and methods consistent with some aspects of this application as detailed in the appended claims.

[0051] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, data stored, data displayed, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties. Furthermore, the collection, use and processing of the relevant data must comply with relevant laws, regulations and standards, and corresponding operation entry points are provided for users to choose to authorize or refuse.

[0052] First, the application scenarios involved in this application will be explained:

[0053] In practical applications, visibility detection between two points is essential in various fields:

[0054] 1. In game development, whether it is the player's perspective on the enemy's field of vision or the core mechanisms of artificial intelligence (AI) characters such as patrol and vigilance, skill release range verification, and bullet trajectory penetration judgment, all rely on visibility detection to achieve a closed-loop logic.

[0055] 2. In VR / AR scenarios, the overlay rendering of virtual objects with the real environment and the eye focus feedback during user interaction require millisecond-level visibility judgment to ensure immersion and smooth interaction.

[0056] 3. In the field of autonomous driving, after the vehicle's LiDAR and vision sensors collect data, they need to filter out the effective obstacle information without obstruction through visibility detection, so as to provide a basis for safety decision-making for the path planning algorithm and avoid the risk of collision due to misjudgment caused by obstruction.

[0057] 4. In architectural design visualization, designers not only focus on spatial transparency, but also need to verify the compliance of indoor lighting standards and the unobstructed design of key areas (such as fire exits and viewing windows) through visibility analysis.

[0058] 5. In robot obstacle avoidance tasks, mobile robots need to detect the visibility relationship between themselves and target points and obstacles in real time, dynamically adjust their travel routes, and ensure smooth movement in complex environments.

[0059] However, existing ray casting methods require a significant amount of computation time, which severely impacts the reliability and real-time performance of the aforementioned functions, and also reduces the accuracy of subsequent decisions and the realism of the model.

[0060] Based on the aforementioned technical problems, the technical concept of this application is as follows: In researching visibility detection schemes between two points, the inventors discovered that existing technologies require performing intersection detection on a massive number of triangular faces of a 3D model one by one. Some of these triangular faces are far from the detection path, making intersection detection redundant. Reducing this redundancy would significantly improve detection efficiency. Therefore, the inventors conceived of using a bounding volume structure to represent the 3D model, utilizing the spatial aggregation characteristics of the upper bounding volume to exclude areas unrelated to the detection path, thus significantly reducing the initial detection range. Subsequently, considering the large number of low-intersection-probability nodes within the bounding volume structure, the inventors further combined the target line segment (i.e., the detection path) with the node position information to filter out target nodes with high intersection probabilities. Intersection detection is performed only on these nodes, and their child nodes are recursively traversed only after intersection is confirmed. This avoids invalid detection of low-intersection-probability nodes, ultimately significantly reducing redundant calculations and substantially improving detection efficiency while ensuring detection accuracy.

[0061] The technical solution of this application and how the technical solution of this application solves the above-mentioned technical problems are described in detail below with specific embodiments. These specific embodiments can be combined with each other, and the same or similar concepts or processes may not be described again in some embodiments. The embodiments of this application will now be described with reference to the accompanying drawings.

[0062] Figure 1 Flowchart of the two-point visibility detection method provided in this application Figure 1 ,like Figure 1 As shown, the method includes:

[0063] S11. Based on the spatial position information of each triangular facet in the 3D model, construct the bounding volume structure corresponding to the 3D model.

[0064] The execution subject of this application embodiment is an electronic device, which can be a terminal device, such as a laptop, desktop computer, or tablet computer, or a server. In practical applications, whether the electronic device is a terminal device or a server can be determined according to the actual situation, and no specific limitation is imposed on it.

[0065] In this step, considering that 3D models are typically composed of a massive number of triangular facets, directly performing intersection detection on each facet and the target line segment would incur enormous computational overhead, resulting in low detection efficiency. Therefore, it is necessary to construct a hierarchical bounding volume structure to spatially divide and aggregate the triangular facets, laying the foundation for subsequent efficient screening and detection.

[0066] Among them, a 3D model refers to a 3D digital representation obtained after digitally modeling a 3D scene (such as a building or urban scene).

[0067] For example, the three-dimensional model can be in formats such as OBJ or Stereolithography (STL), which can be determined according to the actual situation. This application does not impose specific restrictions on the format of the three-dimensional model.

[0068] Among them, the triangular facet is the basic building block of the three-dimensional model, which is determined by three non-collinear vertices.

[0069] The bounding volume structure is a hierarchical spatial partitioning structure. It uses bounding boxes to wrap triangular faces in a 3D model layer by layer, forming a hierarchical relationship from the root node to the leaf node. The leaf node is the lowest level node of the bounding volume structure and the end point of the hierarchical partitioning. Each leaf node uniquely corresponds to a triangular face in the 3D model. In other words, the leaf nodes of the bounding volume structure are triangular faces.

[0070] In one possible implementation, the triangular facets contained in each root node can be determined based on the spatial position information of each triangular facet in the 3D model and the preset number of root nodes. Then, for each node, the triangular facets contained in each child node are determined based on the position of the triangular facets contained in the node and the preset number of child nodes corresponding to the node. The above steps are repeated until the child node contains a triangular facet, thus obtaining the constructed bounding volume structure.

[0071] This process involves statistically analyzing the spatial positions of all triangular faces in the 3D model. Combined with a preset number of root nodes, all triangular faces are assigned to the root nodes based on their spatial distribution characteristics, ensuring that each root node contains a certain number of spatially similar triangular faces. For each node with assigned triangular faces, the triangular faces within that node are further subdivided into child nodes based on the spatial distribution of the triangular faces within that node and a preset number of child nodes. This subdivision process is repeated until each child node contains only one triangular face. The resulting hierarchical structure is the desired bounding volume structure.

[0072] Specifically, based on the preset number of root nodes and the spatial location information of all triangular facets, all triangular facets can be clustered to obtain a preset number of triangular facet sets, with each set corresponding to a root node.

[0073] It should be understood that the method of further dividing the triangular facets within each node into their corresponding child nodes is the same as the method of assigning all triangular facets to each root node, and will not be elaborated here.

[0074] In another possible implementation, a Bounding Volume Hierarchy (BVH) algorithm can be used to traverse all triangular faces and construct a binary tree structure from the bottom up. This binary tree structure is the bounding volume structure described above. Each tree node stores an axis-aligned bounding box (AABB), which encloses the triangular faces contained in all its child nodes.

[0075] It should be understood that the preset number of root nodes and the preset number of child nodes can be preset according to the actual situation, and the embodiments of this application do not impose specific limitations on this.

[0076] It should be understood that the number of preset child nodes at different levels can be the same or different, and the embodiments of this application do not impose specific restrictions on this.

[0077] S12. For each current node in the bounding structure, determine whether the current node is the target node based on the position information of the target line segment and the position information of the current node.

[0078] In this step, since the bounding volume structure contains multiple levels, and each level contains multiple nodes, performing intersection detection on all nodes one by one would still result in a lot of redundant calculations. Therefore, it is necessary to select target nodes with a high probability of intersecting with the target line segment based on the spatial relationship between the target line segment and the nodes, and only perform subsequent detection on these nodes, thereby further improving detection efficiency.

[0079] The current node refers to the node that is currently being filtered and judged during the hierarchical traversal of the enclosing structure. It can be the root node, a non-leaf node in the middle level, or a leaf node at the bottom level.

[0080] The target line segment is the line segment from the first point to the second point, which is the detection path for visibility detection between the two points.

[0081] Optionally, the preset probability can be 0%, 2%, 3%, etc.

[0082] Among them, nodes whose intersection probability with the target line segment is greater than the preset probability are highly correlated with the target line segment in space and are the key targets for subsequent intersection detection.

[0083] The location information includes direction and / or coordinates.

[0084] Specifically, if the current node is a non-leaf node, it can be determined whether the current node is the target node in the following ways:

[0085] For any coordinate axis, if the target line segment and the current node have an overlapping coordinate range on that coordinate axis, then the current node is determined to be the target node.

[0086] The coordinate axes include the X-axis, Y-axis, and Z-axis, and the coordinate range refers to the maximum and minimum values ​​on each coordinate axis.

[0087] In this approach, if a coordinate axis exists where the coordinate range of the target line segment overlaps with that of the current node, it indicates that the current node and the target line segment may intersect in 3D space. Therefore, this node is identified as a target node, allowing for subsequent visibility detection between the two points. Conversely, if a coordinate axis exists where the coordinate range of the target line segment does not overlap with that of the current node, it indicates that the current node and the target line segment are necessarily separated in 3D space, with a zero probability of intersection. Therefore, this node is not identified as a target node, and redundant visibility detection between the two points is not performed, thus improving detection efficiency.

[0088] When the current node is a leaf node, it can be determined whether the current node is the target node in the following three ways:

[0089] 1. For any coordinate axis, if the target line segment and the current node have overlapping coordinate ranges on the coordinate axis, then the current node is determined to be the target node.

[0090] The implementation process of this method is the same as the method for determining whether the current node is the target node when the current node is a non-leaf node, and will not be described in detail here.

[0091] 2. If the angle between the direction of the target line segment and the direction of the normal vector of the current node is less than the preset angle, then the current node is determined as the target node.

[0092] The direction of the target line segment is the direction from the first point to the second point.

[0093] When the current node is a leaf node, its normal vector is the normal vector of the corresponding triangle, calculated from the coordinates of the triangle's three vertices. Specifically, let the three vertices of the triangle be... , , First find the edge vectors , Then, the normal vector N is obtained through the cross product: N = The direction of the normal vector N follows the right-hand rule (four fingers along the direction of ... arrive (The thumb is bent, pointing in the direction of the normal vector).

[0094] The smaller the angle between the direction of the target line segment and the normal vector direction of the current node, the higher the probability of the target line segment intersecting with the current node. Conversely, the larger the angle between the direction of the target line segment and the normal vector direction of the current node, the lower the probability of the target line segment intersecting with the current node.

[0095] For example, the preset angles are 30°, 45°, 60°, etc. The larger the preset angle, the more current nodes will be identified as target nodes. In other words, the preset angle can be preset according to the accuracy requirements of visibility detection between two points, which will not be elaborated here.

[0096] 3. For any coordinate axis, determine whether the coordinate range of the target line segment overlaps with the coordinate range of the current node. If so, continue to determine whether the angle between the direction of the target line segment and the normal vector direction of the current node is less than a preset angle. If so, determine the current node as the target node.

[0097] S13. If the current node is the target node, determine whether the current node intersects with the target line segment.

[0098] In this step, when the current node is the target node, it can only be determined that the current node has a high probability of intersecting with the target line segment. Therefore, it is necessary to perform a further step to determine whether the current node intersects with the target line segment.

[0099] The process of determining whether the current node intersects with the target line segment mainly involves constructing a ray based on the set direction and the first point, and then determining whether the ray intersects with any surface of the current node. If it does, it means that the first point and the second point are visible; otherwise, if they do not, it means that the first point and the second point are visible.

[0100] In this case, the intersection point is not the first point itself, and the target line segment is the detection path of the constructed ray.

[0101] If the current node is a leaf node, it can be determined whether the current node intersects with the target line segment in the following way:

[0102] Rays can be represented by the following formula:

[0103]

[0104] in, For rays, For the first point, It is a direction vector. The parameter represents the relative distance between a point on the ray and the first point. .

[0105] It should be understood that the target line segment is the detection path of the ray.

[0106] Any point P in the triangular facet can be represented by its barycentric coordinates. express:

[0107]

[0108] in, , ,and .

[0109] Furthermore, the ray equation Substituting into the centroid coordinate formula above:

[0110]

[0111] The above formula can be rearranged as follows:

[0112]

[0113] make , , The equation above can be written in matrix form:

[0114]

[0115] According to Cramer's rule, the vector can be solved. .

[0116] Since the edge vectors of the triangular facet are represented as:

[0117]

[0118]

[0119] Therefore, we can first calculate an auxiliary vector. Then calculate the determinant. Geometrically speaking, It is the negative direction of the dot product of the normal vector, if the determinant The absolute value is close to 0 (i.e., less than a minimum value). This indicates that the ray is parallel to the triangular facet, which means that the two do not intersect (or can be considered as not intersecting).

[0120] Conversely, calculate the vector. : and the coordinates of the center of gravity : .if <0 or If the value is greater than 1, then the intersection point is located outside the triangular facet, and it can be determined that the two do not intersect (or are considered to be non-intersecting).

[0121] Conversely, calculate another auxiliary vector. and the coordinates of the center of gravity : .like <0 or If the intersection point is located outside the triangular facet, it can be determined that the two do not intersect (or are considered to be non-intersecting).

[0122] Conversely, calculate the ray parameters. : ,like >0 (or other pre-set minimum threshold t) min (to avoid self-intersection) and If the value is less than 1, then the ray intersects the triangular facet; otherwise, the ray does not intersect the triangular facet.

[0123] If the current node is a non-leaf node, it can be determined whether the current node intersects with the target line segment in the following way:

[0124] Taking the X-axis as an example, the interval of the current node on the X-axis is: By introducing the ray, we obtain: , Furthermore, the parameter values ​​for entering and leaving the current node (AABB) along the X-axis can be obtained:

[0125]

[0126]

[0127] Similarly, the parameter values ​​for the Y and Z axes can be calculated. , , , .

[0128] Furthermore, calculate the range of t:

[0129]

[0130]

[0131] like ≥ ,and, If the current node intersects the target line segment, then the current node is determined to intersect the target line segment; otherwise, the current node does not intersect the target line segment.

[0132] S14. If the current node intersects with the target line segment and the current node is not a leaf node, then the child node of the current node is determined as the new current node.

[0133] In this step, if the current node intersects with the target line segment, it means that the spatial region covered by its internal child bounding volume nodes contains triangular faces that intersect with the target line segment. It is necessary to further traverse the child nodes of the current node and gradually refine the detection range through hierarchical steps until the leaf node is reached.

[0134] It should be understood that a child node is the next level node of the current node, and is a further subdivision of the spatial region covered by the current node. Each child node contains some triangular facets that are spatially close to the current node.

[0135] Here, the new current node refers to the node selected for subsequent screening and detection, that is, the new current node will continue to execute S12-S13.

[0136] In one possible implementation, when determining whether the current node intersects with the target line segment, first determine whether the current node is a non-leaf node. If it is a leaf node, then directly execute S15; if it is a non-leaf node, obtain all child nodes corresponding to the current node, determine these child nodes one by one as the new current node, and then return to S12. For each new current node, re-execute S12-S14 until all leaf nodes have been traversed.

[0137] S15. If there is a leaf node that intersects with the target line segment, then the first point and the second point are not visible to each other.

[0138] In this step, once it is determined that any leaf node intersects with the target line segment, it means that the line of sight between the two points is blocked by the triangular facet. Therefore, the above traversal process can be stopped, and it is determined that the first point and the second point are not visible to each other. This completes the visibility detection method between the first point and the second point.

[0139] The visibility detection method between two points provided in this application constructs a bounding volume structure corresponding to the 3D model based on the spatial position information of each triangular facet in the 3D model. For each current node in the bounding volume structure, it is determined whether the current node is a target node based on the position information of the target line segment and the position information of the current node. If the current node is a target node, it is determined whether the current node intersects with the target line segment. If the current node intersects with the target line segment and the current node is not a leaf node, the child node of the current node is determined as the new current node. If there is a leaf node that intersects with the target line segment, it is determined that the first point and the second point are not visible. Here, the leaf nodes of the bounding volume structure are triangular facets, the probability of the target node intersecting with the target line segment is greater than a preset probability, and the target line segment is the line segment from the first point to the second point. In this technical solution, by constructing a hierarchical bounding volume structure with triangular facets as leaf nodes, the triangular facets of the 3D model are divided and aggregated according to their spatial positions. By utilizing the spatial filtering characteristics of the upper bounding volume, areas completely unrelated to the target line segment are first excluded, significantly reducing the initial detection range. By combining the location information of the target line segment with the location information of the current node, target nodes with a probability of intersecting the target line segment greater than a preset probability are selected. Intersection detection is performed only on these nodes, avoiding invalid detection of nodes with low intersection probabilities. Subsequent steps recursively move towards leaf nodes, ensuring no occlusion is missed while minimizing redundant calculations, improving detection efficiency, and guaranteeing the reliability and real-time performance of subsequent functions.

[0140] Optionally, in some embodiments, if the current node is not the target node, no subsequent operations are performed.

[0141] Optionally, in some embodiments, if there is no leaf node intersecting the target line segment, then the first point and the second point are determined to be visible.

[0142] Next, we will explain the practical application of the visibility detection method between two points, starting from real-world scenarios.

[0143] Figure 2 Flowchart of the two-point visibility detection method provided in this application Figure 2 ,like Figure 2 As shown, the method includes:

[0144] S21. Import the 3D model from the Computer-Aided Engineering (CAE) file.

[0145] S22. Parse the CAE file.

[0146] S23. Determine the spatial position information of each triangular facet.

[0147] S24. Construct the bounding volume structure corresponding to the 3D model.

[0148] S25. Set the ray direction, starting point, and the range of parameter t.

[0149] The starting point is the first point, and the parameter t ranges from [0,1] and is used to determine the detection path of the ray.

[0150] S26, Construct a ray.

[0151] The target line segment is the detection path in the ray. The target line segment is the line segment from the first point to the second point, where t=0 corresponds to the first point and t=1 corresponds to the second point.

[0152] S27. Determine whether the current node is the target node.

[0153] If yes, then execute S28; otherwise, continue checking other sibling nodes.

[0154] S28. Determine whether the current node intersects with the target line segment.

[0155] If yes, proceed to step S29; otherwise, continue checking other sibling nodes.

[0156] S29. Determine if the current node has child nodes.

[0157] If yes, then the child node is determined as the new current node, and S27 is executed; otherwise, it is determined that the first point and the second point are not visible to each other.

[0158] Figure 3 Flowchart of the two-point visibility detection method provided in this application Figure 3 ,like Figure 3As shown, the process of determining whether a ray intersects with a triangular facet may include:

[0159] S31. Is the ray parallel to the triangular facet?

[0160] If yes, then determine that the ray does not intersect with the triangular facet; otherwise, execute S32.

[0161] S32. Calculate the intersection points of the planes.

[0162] S33. Calculate the center coordinates.

[0163] S34. Determine if u≥0, v≥0, and u+v≤1.

[0164] If yes, then the ray intersects the triangular facet; if no, then the ray does not intersect the triangular facet.

[0165] Figure 4 Flowchart of the two-point visibility detection method provided in this application Figure 4 ,like Figure 4 As shown, the method includes:

[0166] S41. Add the root node of the enclosing structure to the queue.

[0167] S42. Determine if the queue is empty.

[0168] If yes, then determine that the first point and the second point are visible; otherwise, execute S43.

[0169] S43. Remove the next node from the queue.

[0170] S44. Determine whether the node is a leaf node.

[0171] If yes, then execute S45; otherwise, execute S47.

[0172] S45. Determine whether the ray intersects with the triangular facet.

[0173] If yes, then execute S46; otherwise, execute S42.

[0174] S46. Determine that the first and second points are not visible, and update the shortest visible distance of the first point in the direction of the ray based on the intersection of the ray and the triangular facet.

[0175] S47. Determine whether the ray intersects with the bounding box aligned with the axis.

[0176] If yes, then execute S48; otherwise, execute S42.

[0177] S48. Arrange the child nodes of the node in order of distance from the first point from closest to farthest and add them to the queue. Then, execute S42.

[0178] In summary, the visibility detection method between two points provided in this application has the following technical advantages:

[0179] 1) Pure geometry calculation: It does not rely on the graphics rendering application programming interface (API) and GPU hardware, and can run in any computing environment. It is suitable for scenarios such as server backend and algorithm calculation.

[0180] 2) High efficiency: By using the bounding volume structure (BVH / BSP), the number of triangular faces that need to be involved in accurate calculations is greatly reduced, which can greatly improve its computational performance. The computational complexity is improved from the original O(N*M) to O(n*LgM) (N is the number of vertices and M is the number of triangular faces), and the computational efficiency is far higher than that of the traditional ray casting method.

[0181] 3) Accuracy: Based on rigorous mathematical and geometric calculations, the results are accurate and reliable, and are not affected by rendering settings such as resolution and depth buffer precision.

[0182] 4) Versatility: Applicable to any closed solid mesh model, it can be widely used in path planning, collision avoidance, 3D modeling and analysis, etc., no longer limited by computational efficiency and graphics hardware, and can achieve flexible migration.

[0183] Figure 5 A schematic diagram of the two-point visibility detection device provided in this application is shown below. Figure 5 As shown, the two-point visibility detection device 50 provided in this embodiment includes:

[0184] Module 501 is used to construct the bounding volume structure corresponding to the 3D model based on the spatial position information of each triangular facet in the 3D model. The leaf nodes of the bounding volume structure are triangular facets.

[0185] The judgment module 502 is used to determine whether the current node is a target node for each current node in the enclosing structure, based on the position information of the target line segment and the position information of the current node. The probability of the target node intersecting with the target line segment is greater than the preset probability. The target line segment is the line segment from the first point to the second point.

[0186] The judgment module 502 is also used to determine whether the current node intersects with the target line segment if the current node is the target node.

[0187] The determination module 503 is used to determine the child nodes of the current node as the new current node if the current node intersects with the target line segment and the current node is not a leaf node.

[0188] The determination module 503 is also used to determine that if there is a leaf node that intersects with the target line segment, the first point and the second point are not visible to each other.

[0189] In one possible implementation, the location information includes direction and / or coordinates.

[0190] In one possible implementation, the determination module 502 is specifically used for:

[0191] For any coordinate axis, if the target line segment and the current node have overlapping coordinate ranges on the coordinate axis, then the current node is determined to be the target node.

[0192] In one possible implementation, when the current node is a leaf node, the determination module 502 is specifically used for:

[0193] If the angle between the direction of the target line segment and the normal vector direction of the current node is less than a preset angle, then the current node is determined to be the target node. The direction of the target line segment is the direction from the first point to the second point.

[0194] In one possible implementation, the construction module 501 is specifically used for:

[0195] Based on the spatial location information of each triangular facet in the 3D model and the preset number of root nodes, determine the triangular facet contained in each root node.

[0196] For each node, based on the position of the triangular facets contained in the node and the preset number of child nodes corresponding to the node, determine the triangular facets contained in each child node. Repeat the above steps until the child node contains a triangular facet to obtain the constructed bounding volume structure.

[0197] In one possible implementation, the enclosing structure is a binary tree structure.

[0198] The visibility detection device between two points provided in this embodiment can execute the method provided in the above method embodiment. Its implementation principle and technical effect are similar, and will not be described in detail here.

[0199] Figure 6 A schematic diagram of the structure of the electronic device provided in this application. Figure 6 As shown, the electronic device 60 provided in this embodiment includes at least one processor 601 and a memory 602. Optionally, the electronic device 60 further includes a communication component 603. The processor 601, memory 602, and communication component 603 are connected via a bus 604.

[0200] In a specific implementation, at least one processor 601 executes computer execution instructions stored in memory 602, causing at least one processor 601 to perform the above-described method.

[0201] The specific implementation process of processor 601 can be found in the above method embodiments, and its implementation principle and technical effect are similar. It will not be repeated here.

[0202] In the above embodiments, it should be understood that the processor can be a Central Processing Unit (CPU), or other general-purpose processors, digital signal processors (DSPs), application-specific integrated circuits (ASICs), etc. The general-purpose processor can be a microprocessor or any conventional processor. The steps of the method disclosed in this invention can be directly implemented by a hardware processor, or implemented by a combination of hardware and software modules within the processor.

[0203] The memory may include random access memory (RAM) and may also include non-volatile memory (NVM), such as at least one disk storage device.

[0204] The bus can be an Industry Standard Architecture (ISA) bus, a Peripheral Component Interconnect (PCI) bus, or an Extended Industry Standard Architecture (EISA) bus, etc. Buses can be categorized as address buses, data buses, control buses, etc. For ease of illustration, the buses shown in the accompanying drawings are not limited to a single bus or a single type of bus.

[0205] This application also provides a computer program product, including a computer program that, when executed by a processor, implements the above-described method.

[0206] This application also provides a computer-readable storage medium storing computer-executable instructions, which, when executed by a processor, implement the above-described method.

[0207] The aforementioned readable storage medium can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as Static Random-Access Memory (SRAM), Electrically Erasable Programmable Read-Only Memory (EEPROM), Erasable Programmable Read-Only Memory (EPROM), Programmable Read-Only Memory (PROM), Read-Only Memory (ROM), magnetic storage, flash memory, magnetic disk, or optical disk. The readable storage medium can be any available medium accessible to a general-purpose or special-purpose computer.

[0208] An exemplary readable storage medium is coupled to a processor, enabling the processor to read information from and write information to the readable storage medium. Of course, the readable storage medium can also be a component of the processor. The processor and the readable storage medium can reside in an application-specific integrated circuit (ASIC). Alternatively, the processor and the readable storage medium can exist as discrete components in the device.

[0209] The division of units is merely a logical functional division; in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be indirect coupling or communication connection through some interfaces, devices, or units, and may be electrical, mechanical, or other forms.

[0210] The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.

[0211] In addition, the functional units in the various embodiments of the present invention can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit.

[0212] If a function is implemented as a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this invention, or the part that contributes to the prior art, or a part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods of the various embodiments of this invention. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, ROM, RAM, magnetic disks, or optical disks.

[0213] Those skilled in the art will understand that all or part of the steps of the above-described method embodiments can be implemented by hardware related to program instructions. The aforementioned program can be stored in a computer-readable storage medium. When executed, the program performs the steps of the above-described method embodiments; and the aforementioned storage medium includes various media capable of storing program code, such as ROM, RAM, magnetic disks, or optical disks.

[0214] Finally, it should be noted that other embodiments of the invention will readily occur to those skilled in the art upon consideration of the specification and practice of the invention disclosed herein. This invention is intended to cover any variations, uses, or adaptations of the invention that follow the general principles of the invention and include common knowledge or customary techniques in the art not disclosed herein, and is not limited to the precise structures described above and shown in the accompanying drawings, and various modifications and changes can be made without departing from its scope. The scope of the invention is limited only by the appended claims.

Claims

1. A method for detecting visibility between two points, characterized in that, include: Based on the spatial position information of each triangular facet in the 3D model, a bounding volume structure corresponding to the 3D model is constructed, and the leaf nodes of the bounding volume structure are the triangular facets. For each current node in the enclosing structure, based on the position information of the target line segment and the position information of the current node, it is determined whether the current node is a target node. The intersection probability of the target node and the target line segment is greater than a preset probability. The target line segment is the line segment from the first point to the second point. If the current node is the target node, then determine whether the current node intersects with the target line segment; If the current node intersects with the target line segment, and the current node is not a leaf node, then the child node of the current node is determined as the new current node; If there is a leaf node that intersects with the target line segment, then it is determined that the first point and the second point are not visible to each other.

2. The method according to claim 1, characterized in that, The location information includes direction and / or coordinates.

3. The method according to claim 2, characterized in that, The step of determining whether the current node is the target node based on the position information of the target line segment and the position information of the current node includes: For any coordinate axis, if the target line segment and the current node have an overlapping coordinate range on the coordinate axis, then the current node is determined to be the target node.

4. The method according to claim 2, characterized in that, When the current node is a leaf node, determining whether the current node is a target node based on the position information of the target line segment and the position information of the current node includes: If the angle between the direction of the target line segment and the normal vector direction of the current node is less than a preset angle, then the current node is determined to be the target node; the direction of the target line segment is the direction from the first point to the second point.

5. The method according to any one of claims 1-4, characterized in that, The step of constructing the bounding volume structure corresponding to the three-dimensional model based on the spatial position information of each triangular facet in the three-dimensional model includes: Based on the spatial location information of each triangular facet in the 3D model and the preset number of root nodes, determine the triangular facet contained in each root node. For each node, based on the position of the triangular facets contained in the node and the preset number of child nodes corresponding to the node, the triangular facets contained in each child node are determined. The above steps are repeated until the child node contains a triangular facet, and the constructed bounding volume structure is obtained.

6. The method according to claim 5, characterized in that, The enclosing structure is a binary tree structure.

7. A two-point visibility detection device, characterized in that, include: The construction module is used to construct the bounding volume structure corresponding to the three-dimensional model based on the spatial position information of each triangular facet in the three-dimensional model, wherein the leaf nodes of the bounding volume structure are the triangular facets. The judgment module is used to determine, for each current node in the enclosing structure, whether the current node is a target node based on the position information of the target line segment and the position information of the current node, wherein the intersection probability of the target node and the target line segment is greater than a preset probability, and the target line segment is the line segment from the first point to the second point; The judgment module is further configured to determine whether the current node intersects with the target line segment if the current node is the target node; The determination module is used to determine the child nodes of the current node as the new current node if the current node intersects with the target line segment and the current node is not a leaf node. The determining module is further configured to determine that the first point and the second point are not visible to each other if there is a leaf node that intersects with the target line segment.

8. An electronic device, characterized in that, include: Memory, processor; The memory stores computer-executed instructions; The processor executes computer execution instructions stored in the memory, causing the processor to perform the method as described in any one of claims 1-6.

9. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores computer-executable instructions, which, when executed by a processor, are used to implement the method as described in any one of claims 1-6.

10. A computer program product, characterized in that, Includes a computer program that, when executed by a processor, implements the method described in any one of claims 1-6.