Geometric Boolean operation optimization system and method based on hierarchical spatial index
By optimizing geometric Boolean operations based on hierarchical spatial indexing, the performance bottleneck of geometric processing solutions on the web is solved, achieving efficient and reliable geometric Boolean operations, supporting real-time processing and smooth interaction of millions of vertex models, and improving the user design experience.
Patent Information
- Application Number
- CN202512048936.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-12-31
- Publication Date
- 2026-04-17
AI Technical Summary
Existing web-based geometry processing solutions suffer from performance bottlenecks when handling complex indoor scenes and large-scale models. The algorithms have high time complexity and large memory consumption, and cannot fully utilize the parallel computing capabilities of multi-core and GPUs, resulting in sluggish interaction and slow response, making it difficult to meet the requirements of real-time and smooth online design.
A geometric Boolean operation optimization system based on hierarchical spatial indexing is adopted, including an input processing module, a spatial indexing module, a Boolean operation module, a parallel processing scheduling module, and a post-processing module. The geometric Boolean operation process is optimized by constructing an adaptive hierarchical spatial indexing structure, relation point-relation line topology representation, dual-thread pool parallel scheduling, and fault-tolerant boundary reconstruction.
Significantly improves computational efficiency, reduces topology error rate, increases CPU multi-core utilization, reduces memory usage, ensures high reliability and smooth interaction of output results, enables real-time processing of millions of vertex models, and enhances the user design experience.
Smart Images

Figure CN121879852A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of 3D image rendering technology, and more specifically, to a geometric Boolean operation optimization system and method based on hierarchical spatial indexing. Background Technology
[0002] With the popularization of Web3D technology, browser-based online 3D whole-house design software has become an important tool in the fields of home furnishing and architecture. Users on these platforms often need to drag and edit 3D models of furniture, walls, etc., in real time, frequently triggering geometric Boolean operations such as union, intersection, and difference to detect interference and adjust the layout. However, existing web-based geometric processing solutions, such as those based on the Three.js CSG library or traditional WebGL rendering methods, suffer from severe performance bottlenecks when handling complex interior scenes and large-scale models: their algorithms have high time complexity, large memory consumption, and cannot fully utilize the parallel computing capabilities of multi-core and GPUs, resulting in sluggish interaction and slow response, making it difficult to meet the needs of real-time, smooth online design. Summary of the Invention
[0003] The purpose of this invention is to provide a geometric Boolean operation optimization system and method based on hierarchical spatial indexing to solve the above-mentioned technical problems.
[0004] To achieve the above objectives, the embodiments of this application provide the following technical solutions: On one hand, this application provides a geometric Boolean operation optimization system based on hierarchical spatial indexing, including: an input processing module for parsing, normalizing, and redundancy merging preprocessing of user-input geometric object data, and converting it into a unified format; a spatial indexing module, connected to the input processing module, for constructing and maintaining a hierarchical spatial index structure, dynamically adjusting the spatial partitioning according to the object distribution density, and providing candidate object filtering services for the Boolean operation module; a Boolean operation module, connected to the spatial indexing module, for performing geometric Boolean operations based on the topological representation structure of relation points and relation lines, thereby realizing intersection detection and fault-tolerant boundary reconstruction; a parallel processing scheduling module, connected to the spatial indexing module and the Boolean operation module respectively, for managing the dual-thread pool of spatial indexing and Boolean operation, and achieving load balancing by adjusting the task queue; a post-processing module, connected to the Boolean operation module, for performing topological consistency checks and repairs on the geometric operation results; and an output module, connected to the post-processing module, for outputting the geometric operation results according to a preset format, and providing real-time rendering and visualization feedback, while generating performance logs and error reports.
[0005] Optionally, the spatial index module adopts a dynamic quadtree or octree structure, and its construction process includes: Calculate the global minimum bounding box of all geometric objects and use it as the root node's bounding box; Based on the preset load threshold and object distribution density, the space is recursively divided into four or eight sub-regions and corresponding child nodes are created until the number of objects in the child node is lower than the threshold or the maximum depth is reached, at which point the segmentation stops. By using a spatial hash table to establish a mapping between grid coordinates and object IDs, constant-time queries are achieved, while incremental updates are also supported. When the object's location changes, only the affected nodes and hash table entries are updated, thus avoiding full index reconstruction.
[0006] Optionally, in the topological representation structure adopted by the Boolean operation module, the relation point object includes topological information such as two-dimensional coordinates, a set of associated line segments, and record point types; The relationship line object contains a start point, an end point, a reference to the left polygon, and a reference to the right polygon; The intersection detection process includes: firstly, using the bounding box of line segments to roughly screen out obviously non-intersecting line segment pairs, then performing precise geometric intersection calculation on the candidate pairs, using the cross product of vectors and parametric equations to calculate the intersection point, and using numerical tolerance to handle floating-point precision. Boundary reconstruction includes automatically detecting and repairing cracks or overlaps by analyzing the topological connectivity at intersections.
[0007] Optionally, in the parallel processing scheduling module, the spatial index thread pool is used for index construction, updating and querying, and the Boolean operation thread pool is used for geometric calculations; Both the spatial index thread pool and the boolean operation thread pool use bounded task queues to manage tasks. When the task queue is full, a load balancing operation is triggered to transfer the task to a place with a lower load. Secondly, the parallel processing scheduling module also includes a GPU acceleration management unit, which is used to identify data-intensive tasks suitable for GPU parallel computing and transfer them to the GPU for execution through the WebGL computing shader; The parallel processing scheduling module monitors thread status and resource utilization in real time and dynamically adjusts task allocation to maximize system throughput.
[0008] Optionally, the topology consistency verification unit of the post-processing module traverses all edges and vertices generated by the operation and checks the consistency of polygon references on the left and right sides of the edges and the degree conformity of the vertices. At the same time, it automatically detects isolated vertices, duplicate edges or non-manifold structures. For variables or points that are detected incorrectly, an intelligent repair algorithm based on neighborhood information is used to correct them through local mesh reconstruction or vertex merging. Secondly, the adaptive polygon simplification unit in the post-processing module uses an edge folding algorithm to calculate a comprehensive error metric for each foldable edge based on curvature change, projected area and visual importance, and prioritizes folding the edges that have the least impact on shape features.
[0009] Secondly, embodiments of this application provide a geometric Boolean operation optimization method based on hierarchical spatial indexing, applicable to geometric Boolean operation optimization systems based on hierarchical spatial indexing, including: The input processing module receives geometric object data input by the user, performs format parsing, coordinate normalization and redundant vertex merging preprocessing on the input data, and converts the processed data into a unified internal representation format of the system, which is then recorded as preprocessed data. Based on the preprocessed data, a bounding box is built for each geometric object through the spatial indexing module, and an adaptive hierarchical spatial indexing structure is constructed accordingly. Then, spatial distribution density analysis is performed based on the bounding boxes of all objects in the preprocessed data. The spatial indexing module dynamically adjusts the granularity of spatial partitioning, thereby achieving load balancing of spatial partitioning. Based on the constructed spatial index, potential intersecting geometric objects are quickly filtered, and a set of candidate objects is output. Based on the candidate object set after output filtering and the computational requirements, the computational tasks are decomposed and allocated to multiple threads through the parallel processing scheduling module, and the task queues of the dual thread pools of spatial indexing and Boolean operation are managed synchronously to coordinate the parallel computing resources of CPU multi-threading and GPU. Based on allocated parallel computing resources, the Boolean operation module performs geometric Boolean operations in each thread based on the topological representation of relation points and relation lines. This completes accurate line segment intersection detection and fault-tolerant boundary reconstruction, implements specified union, intersection, or difference operations, generates initial results, and performs topological consistency checks and automatic repairs on the initial results through the post-processing module. It also performs polygon simplification, triangulation, and geometric optimization to generate optimized results with multi-level details. The optimized results are then converted into a specified format for output through the output module, while providing real-time rendering and interactive visualization feedback, and recording and generating performance logs and system error reports.
[0010] Optionally, the specific steps for constructing a hierarchical spatial index include: Traverse the input geometric objects in the preprocessed data and calculate the axially aligned bounding boxes of the input geometric objects. Obtain the global spatial extent by taking the union of the sets. The space is recursively divided with the global scope as the root node. The operation of dividing the space is as follows: evaluate the number and distribution of objects in the current node. If the number exceeds the threshold and the distribution is uneven, divide the space into two or four sub-regions along the selected axis and create child nodes. Distribute objects within the current node to one or more child nodes according to the intersection relationship between their bounding boxes and sub-regions; The operation of the partitioned space is recursively performed on each child node until the number of objects in the node is below the threshold or the maximum recursion depth is reached. While recursively partitioning, a spatial hash table is constructed to map regular grid cells to all leaf nodes that cover them, enabling fast reverse lookup from spatial location to the containing object.
[0011] Optionally, geometric Boolean operations are performed based on the topological representation of relation points and relation lines, including: The polygon shapes and boundaries in the candidate objects are decomposed into a set of directed line segments, where the set of directed line segments can be curve segments. A relation point object is created for each vertex generated after decomposition, and a relation line object is created for each directed line segment, thereby obtaining the initial basic topological relationship. Based on the constructed adaptive hierarchical spatial index structure, spatial queries are performed on all directed line segments to quickly retrieve all candidate line segment pairs whose bounding boxes intersect. For each pair of candidate line segments, perform precise geometric intersection detection; if an intersection is determined, calculate the coordinates of the intersection point, and at the intersection point, divide the original directed line segment into a new line segment, while updating the topological connection information of the relation point object and the relation line object; Traverse all relationship line objects to construct a complete topological relationship graph; in this topological relationship graph, each relationship point object maintains a reference to all relationship line objects connected to it, and each relationship line object clearly defines the polygon region to its left and the polygon region to its right. Based on the Boolean operation type requested by the user, the topological relationship graph is traversed, and line segments constituting the boundary of the final result are selected according to preset rules, wherein the preset rules are: When the operation type is union, select all boundary line segments located outside the first polygon or outside the second polygon; When the operation type is intersection, select all boundary line segments that are simultaneously located inside the first polygon and inside the second polygon; When the operation type is difference, select all boundary line segments that are inside the first polygon and outside the second polygon. The selected boundary segment sequences are sorted and their connectivity checked to form one or more closed boundary loops. Isolated vertices or overhanging edges discovered during the sorting process are removed. Thirdly, embodiments of this application provide a partial discharge type identification device for high-voltage electrical equipment, the device including a memory and a processor.
[0012] The memory is used to store the computer program; the processor is used to implement the steps of the above-described geometric Boolean operation optimization system based on hierarchical spatial index when executing the computer program.
[0013] Fourthly, embodiments of this application provide a medium on which a computer program is stored, which, when executed by a processor, implements the steps of the above-described geometric Boolean operation optimization system based on hierarchical spatial indexing.
[0014] The beneficial effects of this invention are as follows: The geometric Boolean operation optimization system based on hierarchical spatial indexing described in this invention significantly improves computational efficiency by introducing mechanisms such as hierarchical adaptive spatial indexing, relation point-relation line topological representation, dual-thread pool parallel scheduling, and fault-tolerant boundary reconstruction. Specifically, the input processing module and the spatial indexing module optimize the quadratic time complexity of traditional algorithms, which requires pairwise matching of all geometric objects, into a logarithmic linear time complexity based on hierarchical indexing through data normalization and the construction of adaptive hierarchical spatial indexing. At the same time, it supports direct operation on curves such as arcs and spline curves, effectively avoiding the shortcomings of traditional algorithms that require discretization of curves, which leads to a sharp increase in vertex cardinality. This significantly improves the speed of Boolean operations and supports real-time processing of models with millions of vertices.
[0015] Secondly, the Boolean operation module is based on the relation point-relation line topology representation and fault-tolerant boundary reconstruction mechanism, which reduces the topology error rate of geometric Boolean operations to below 0.05% and conforms to the IEEE 754 double precision standard, ensuring that the output results have high reliability at both the geometric and topological levels. The parallel processing scheduling module achieves CPU multi-core utilization of over 80% and memory usage reduction of over 40% through a dual-thread pool architecture and GPU acceleration management, significantly improving the browser's operational stability and processing capabilities for large-scale scenarios. The post-processing and output modules integrate adaptive simplification and real-time rendering feedback mechanisms, maintaining a smooth interaction of 60 FPS in complex 3D scenes with an operation response latency of less than 12 ms, significantly improving the user's design experience and operational intuitiveness.
[0016] The system as a whole has good cross-platform compatibility and scalability, and can be widely used in Web3D real-time design scenarios such as online home decoration design, customized furniture configuration, and commercial space layout. It effectively solves key problems such as low performance, high memory consumption, and lag in existing technologies.
[0017] Other features and advantages of the invention will be set forth in the following description, and will be apparent in part from the description, or may be learned by practicing embodiments of the invention. The objects and other advantages of the invention may be realized and obtained by means of the structures particularly pointed out in the written description and the accompanying drawings. Attached Figure Description
[0018] To more clearly illustrate the technical solutions of the embodiments of the present invention, the accompanying drawings used in the embodiments will be briefly introduced below. It should be understood that the following drawings only show some embodiments of the present invention and should not be regarded as a limitation on the scope. For those skilled in the art, other related drawings can be obtained based on these drawings without creative effort.
[0019] Figure 1 This is a schematic diagram of a geometric Boolean operation optimization system architecture based on hierarchical spatial indexing, as described in an embodiment of the present invention. Figure 2 This is a schematic diagram of a geometric Boolean operation optimization method based on hierarchical spatial indexing as described in an embodiment of the present invention; Figure 3 This is a schematic diagram of an electronic device structure optimized by geometric Boolean operations based on hierarchical spatial indexing, as described in an embodiment of the present invention. Detailed Implementation
[0020] To make the objectives, technical solutions, and advantages of the embodiments of the present invention clearer, the technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some, not all, of the embodiments of the present invention. The components of the embodiments of the present invention described and shown in the accompanying drawings can generally be arranged and designed in various different configurations. Therefore, the following detailed description of the embodiments of the present invention provided in the accompanying drawings is not intended to limit the scope of the claimed invention, but merely to illustrate selected embodiments of the invention. All other embodiments obtained by those skilled in the art based on the embodiments of the present invention without inventive effort are within the scope of protection of the present invention.
[0021] Example 1: like Figure 1 As shown, this embodiment provides a geometric Boolean operation optimization system based on hierarchical spatial indexing. The system includes: The input processing module is used to parse, normalize, and preprocess the geometric object data input by the user, and convert it into a unified format; The spatial index module, connected to the input processing module, is used to construct and maintain a hierarchical spatial index structure, dynamically adjust the spatial partitioning according to the object distribution density, and provide candidate object filtering services for the Boolean operation module. The spatial index module employs a dynamic quadtree or octree structure, and its construction process includes: Calculate the global minimum bounding box of all geometric objects and use it as the root node range; based on the preset load threshold and object distribution density, recursively divide the space into four or eight sub-regions and create corresponding child nodes until the number of objects in the child node is lower than the threshold or the maximum depth is reached, then stop the division; use a spatial hash table to establish a mapping between grid coordinates and object IDs to achieve constant-time queries, while also supporting incremental updates. When the object position changes, only the affected nodes and hash table entries are updated, thus avoiding full index reconstruction.
[0022] The Boolean operation module, connected to the spatial index module, performs geometric Boolean operations based on the topological representation of relation points and relation lines, thereby achieving intersection detection and fault-tolerant boundary reconstruction. In the topological representation used by the Boolean operation module, relation point objects contain two-dimensional coordinates, a set of associated line segments, and topological information about the record point type; relation line objects contain a start point, an end point, a left polygon reference, and a right polygon reference. Intersection detection includes: firstly, coarsely filtering out obviously non-intersecting line segment pairs based on bounding boxes; then, performing precise geometric intersection calculation on candidate pairs, using vector cross products and parametric equations to calculate the intersection point, and employing numerical tolerance to handle floating-point precision. Boundary reconstruction includes: automatically detecting and repairing cracks or overlaps by analyzing the topological connectivity at the intersection point. The parallel processing scheduling module is connected to both the spatial indexing module and the Boolean operation module. It manages the dual thread pools for spatial indexing and Boolean operations, achieving load balancing by adjusting the task queues. The spatial indexing thread pool is used for index building, updating, and querying, while the Boolean operation thread pool is used for geometric calculations. Both the spatial indexing and Boolean operation thread pools use bounded task queues to manage tasks. When the task queue is full, a load balancing operation is triggered, transferring tasks to areas with lower load. Furthermore, the parallel processing scheduling module also includes a GPU acceleration management unit, which identifies data-intensive tasks suitable for GPU parallel computing and transfers them to the GPU for execution via WebGL computation shaders. The parallel processing scheduling module monitors thread status and resource utilization in real time, dynamically adjusting task allocation to maximize system throughput. The post-processing module, connected to the Boolean operation module, is used to perform topological consistency checks and repairs on the geometric operation results. Specifically, the topological consistency verification unit of the post-processing module traverses all edges and vertices generated by the operation and checks the consistency of polygon references on the left and right sides of the edges and the degree conformity of the vertices. At the same time, it automatically detects isolated vertices, duplicate edges, or non-manifold structures. For edges or points with detection errors, an intelligent repair algorithm based on neighborhood information is used to correct them through local mesh reconstruction or vertex merging. Secondly, the adaptive polygon simplification unit in the post-processing module uses an edge folding algorithm to calculate a comprehensive error metric based on curvature change, projected area, and visual importance for each foldable edge, and prioritizes folding the edges that have the least impact on shape features. The output module, connected to the post-processing module, is used to output geometric calculation results according to a preset format, and to render and visualize the results in real time, while generating performance logs and error reports.
[0023] The geometric Boolean operation optimization system based on hierarchical spatial index described in this embodiment significantly improves computational efficiency by introducing mechanisms such as hierarchical adaptive spatial index, relation point-relation line topological representation, dual-thread pool parallel scheduling, and fault-tolerant boundary reconstruction. Specifically, the input processing module and the spatial index module optimize the quadratic time complexity of traditional algorithms, which requires pairwise matching of all geometric objects, into a logarithmic linear time complexity based on hierarchical index by normalizing data and constructing an adaptive hierarchical spatial index. This greatly improves the speed of Boolean operations and supports real-time processing of millions of vertex models.
[0024] Secondly, the Boolean operation module is based on the relation point-relation line topology representation and fault-tolerant boundary reconstruction mechanism, which reduces the topology error rate of geometric Boolean operations to below 0.05% and conforms to the IEEE 754 double precision standard, ensuring that the output results have high reliability at both the geometric and topological levels. The parallel processing scheduling module achieves CPU multi-core utilization of over 80% and memory usage reduction of over 40% through a dual-thread pool architecture and GPU acceleration management, significantly improving the browser's operational stability and processing capabilities for large-scale scenarios. The post-processing and output modules integrate adaptive simplification and real-time rendering feedback mechanisms, maintaining a smooth interaction of 60 FPS in complex 3D scenes with an operation response latency of less than 12 ms, significantly improving the user's design experience and operational intuitiveness.
[0025] The system as a whole has good cross-platform compatibility and scalability, and can be widely used in Web3D real-time design scenarios such as online home decoration design, customized furniture configuration, and commercial space layout. It effectively solves key problems such as low performance, high memory consumption, and lag in existing technologies.
[0026] Example 2: like Figure 2 As shown, this embodiment, based on Embodiment 1, provides a geometric Boolean operation optimization method based on hierarchical spatial indexing. The method includes: Step S100: The input processing module receives geometric object data input by the user, performs format parsing, coordinate normalization and redundant vertex merging preprocessing on the input data, and converts the processed data into a unified internal representation format of the system, which is then recorded as preprocessed data. Step S200: Based on the preprocessed data, a bounding box is established for each geometric object through the spatial index module, and an adaptive hierarchical spatial index structure is constructed accordingly. Then, spatial distribution density analysis is performed based on the bounding boxes of all objects in the preprocessed data. The spatial index module dynamically adjusts the granularity of spatial partitioning to achieve load balancing of spatial partitioning. Step S300: Based on the constructed spatial index, quickly filter potential intersecting geometric objects and output the filtered candidate object set; Step S400: Based on the candidate object set after output filtering and the computational requirements, the computational task is decomposed and allocated to multiple threads through the parallel processing scheduling module, the task queue of the dual thread pool of spatial index and Boolean operation is managed synchronously, and the parallel computing resources of CPU multi-thread and GPU are coordinated. Step S500: Based on the allocated parallel computing resources, the Boolean operation module performs geometric Boolean operations in each thread based on the topological representation structure of relation points and relation lines to complete accurate line segment intersection detection and fault-tolerant boundary reconstruction, implement the specified union, intersection or difference operations, generate initial results, and perform topological consistency checks and automatic repairs on the initial results through the post-processing module, and perform polygon simplification, triangulation and geometric optimization processing to generate optimized results with multi-level details. The optimized results are converted into a specified format for output through the output module, while providing real-time rendering and interactive visualization feedback, and recording and generating performance logs and system error reports.
[0027] Secondly, the specific steps for constructing the hierarchical spatial index described in step S200 include: Step S210: Traverse the input geometric objects in the preprocessed data and calculate the axially aligned bounding boxes of the input geometric objects. Obtain the global spatial extent by finding the union of the bounding boxes. Step S220: Recursively divide the space with the global scope as the root node. The operation of dividing the space is as follows: evaluate the number and distribution of objects in the current node. If the number exceeds the threshold and the distribution is uneven, divide the space into two or four sub-regions along the selected axis and create child nodes. Step S230: Assign objects within the current node to one or more child nodes according to the intersection relationship between their bounding boxes and sub-regions; Step S240: Recursively perform the operation of the partitioned space on each child node until the number of objects in the node is lower than the threshold or the maximum recursion depth is reached; Step S250: While recursively dividing, construct a spatial hash table to map the regular grid cell to all leaf nodes that cover it, thereby achieving a fast reverse lookup from spatial location to the containing object.
[0028] The specific implementation of geometric Boolean operations based on the topological representation structure of relation points and relation lines described in step S500 is as follows: Step S510: Decompose the polygon shape and boundary in the candidate object into a set of directed line segments, and create a relation point object for each vertex generated after decomposition, and a relation line object for each directed line segment, thereby obtaining the initial basic topological relationship; Step S520: Based on the constructed adaptive hierarchical spatial index structure, perform spatial queries on all directed line segments to quickly retrieve all candidate line segment pairs whose bounding boxes intersect. Step S530: Perform precise geometric intersection detection on each pair of candidate line segments; if an intersection is determined, calculate the coordinates of the intersection point, and divide the original directed line segment into a new line segment at the intersection point, while updating the topological connection information of the relation point object and the relation line object. Step S540: Traverse all relationship line objects and construct a complete topology graph. In this topology graph, each relationship point object maintains a reference to all relationship line objects connected to it, and each relationship line object clearly defines the polygon region to its left and the polygon region to its right. Step S550: Based on the Boolean operation type requested by the user, traverse the topology graph and select the line segments that constitute the boundary of the final result according to preset rules, wherein the preset rules are: Step S560: When the operation type is union, select all boundary line segments located outside the first polygon or outside the second polygon; When the operation type is intersection, select all boundary line segments that are simultaneously located inside the first polygon and inside the second polygon; When the operation type is difference, select all boundary line segments that are inside the first polygon and outside the second polygon. Step S570: Sort and check the connectivity of the selected boundary line segment sequence, organize it to form one or more closed boundary loops, and remove isolated vertices or overhanging edges found during the organization process.
[0029] Example 3: This embodiment is based on embodiment 2, taking the real-time layout and conflict detection of living room furniture in an online home decoration design platform as an example to illustrate the specific implementation process of the system and method of the present invention: When a user designs the living room layout on the Web, he / she needs to drag and adjust the sofa (approximately 15,000 vertices), coffee table (approximately 8,000 vertices), TV cabinet (approximately 12,000 vertices) and carpet (approximately 2,000 vertices), and detect the spatial interference between furniture and between furniture and walls in real time.
[0030] Data preprocessing: The input processing module parses the furniture models imported or dragged by the user, normalizes the coordinates, and merges redundant vertices, outputting preprocessed data in a unified format.
[0031] Spatial Index Construction and Candidate Filtering: The spatial index module creates a bounding box for each piece of furniture, constructs an adaptive three-level LOD octree index based on the spatial distribution density of all objects, and dynamically adjusts the partitioning granularity to achieve load balancing. Subsequently, this index is used to quickly retrieve a set of candidate objects (such as carpets and adjacent furniture) that may interfere with the currently moving furniture (such as coffee tables).
[0032] Parallel Scheduling and Precise Boolean Operations: The parallel processing scheduling module decomposes the interference detection task and allocates it to the spatial indexing thread pool and the Boolean operation thread pool. The GPU acceleration management unit transfers the intersection detection task of large-scale triangular meshes to the GPU for parallel processing through the WebGL computation shader. The Boolean operation module converts the boundaries of candidate object pairs into a set of directed line segments, which includes curve segments. Precise intersection detection is performed based on the relation point-relation line topology. When an intersection is detected, the intersection point is calculated, the line segments are divided, the topology graph is updated, and the interference region is extracted according to the "intersection" operation logic.
[0033] Results Optimization and Output: The post-processing module performs topological consistency checks and repairs on the extracted interference regions, and performs adaptive polygon simplification and triangulation. The output module converts the optimization results into JSON format, displays them in real-time on the front-end interface with highlighted prompts, and records performance logs and error reports.
[0034] In this embodiment, the traditional Three.js CSG solution takes approximately 8.5 seconds to process the same scene, consumes about 450MB of memory, and experiences noticeable lag in interaction. With this invention, the same Boolean operation takes only about 2.1 seconds, memory consumption is reduced to 180MB, and the interface maintains a smooth 60 FPS operation, significantly improving the user experience. This invention, through hierarchical indexing and parallel computing, reduces discrete and fault-tolerant processing, effectively solving the performance and stability problems of real-time geometric Boolean operations in complex 3D scenes on the web, making it suitable for various online 3D design applications with high interactivity and high precision requirements.
[0035] Example 4: Corresponding to the above method embodiments, this disclosure also provides a geometric Boolean operation optimization device based on hierarchical spatial indexing. The geometric Boolean operation optimization device based on hierarchical spatial indexing described below and the geometric Boolean operation optimization method based on hierarchical spatial indexing described above can be referred to in correspondence with each other.
[0036] Figure 3 This is a block diagram illustrating an electronic device optimized by geometric Boolean operations based on hierarchical spatial indexing, according to an exemplary embodiment. For example... Figure 3As shown, the electronic device 800 may include a processor 801 and a memory 802. The electronic device 800 may also include one or more of a multimedia component 803, an I / O interface 804, and a communication component 805.
[0037] The processor 801 controls the overall operation of the electronic device 800 to complete all or part of the steps in the aforementioned hierarchical spatial index-based geometric Boolean operation optimization method. The memory 802 stores various types of data to support the operation of the electronic device 800. This data may include, for example, instructions for any application or method operating on the electronic device 800, and application-related data such as contact data, sent and received messages, pictures, audio, video, etc. The memory 802 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. Multimedia component 803 may include a screen and an audio component. The screen may be, for example, a touchscreen, and the audio component is used to output and / or input audio signals. For example, the audio component may include a microphone for receiving external audio signals. The received audio signals may be further stored in memory 802 or transmitted via communication component 805. The audio component also includes at least one speaker for outputting audio signals. I / O interface 804 provides an interface between processor 801 and other interface modules, such as a keyboard, mouse, buttons, etc. These buttons may be virtual or physical buttons. Communication component 805 is used for wired or wireless communication between the electronic device 800 and other devices. Wireless communication may include Wi-Fi, Bluetooth, Near Field Communication (NFC), 2G, 3G, or 4G, or a combination of these. Therefore, the corresponding communication component 805 may include a Wi-Fi module, a Bluetooth module, or an NFC module.
[0038] In an exemplary embodiment, the electronic device 800 may be implemented by one or more application-specific integrated circuits (ASICs), digital signal processors (DSPs), digital signal processing devices (DSPDs), programmable logic devices (PLDs), field-programmable gate arrays (FPGAs), controllers, microcontrollers, microprocessors, or other electronic components to perform the above-described hierarchical spatial index-based geometric Boolean operation optimization method.
[0039] In another exemplary embodiment, a computer-readable storage medium including program instructions is also provided. When executed by a processor, these program instructions implement the steps of the geometric Boolean operation optimization method based on hierarchical spatial indexing described above. For example, the computer-readable storage medium may be the memory 802 including the program instructions described above, which may be executed by the processor 801 of the electronic device 800 to complete the geometric Boolean operation optimization method based on hierarchical spatial indexing described above.
[0040] Example 5: Corresponding to the above method embodiments, this disclosure also provides a readable storage medium. The readable storage medium described below corresponds to and can be referred to in relation to the geometric Boolean operation optimization method based on hierarchical spatial index described above.
[0041] A readable storage medium storing a computer program, which, when executed by a processor, implements the steps of the geometric Boolean operation optimization method based on hierarchical spatial indexing described in the above method embodiments.
[0042] Specifically, the readable storage medium can be a USB flash drive, a portable hard drive, a read-only memory (ROM), a random access memory (RAM), a magnetic disk, or an optical disk, or any other readable storage medium capable of storing program code.
[0043] The above description is merely a preferred embodiment of the present invention and is not intended to limit the invention. Various modifications and variations can be made to the present invention by those skilled in the art. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of the present invention should be included within the scope of protection of the present invention.
Claims
1. A geometric Boolean operation optimization system based on hierarchical spatial indexing, characterized in that, include: The input processing module is used to parse, normalize, and preprocess the geometric object data input by the user, and convert it into a unified format; The spatial index module, connected to the input processing module, is used to build and maintain a hierarchical spatial index structure, dynamically adjust the spatial partitioning according to the object distribution density, and provide candidate object filtering services for the Boolean operation module. The Boolean operation module, connected to the spatial index module, is used to perform geometric Boolean operations based on the topological representation of relation points and relation lines, thereby realizing intersection detection and fault-tolerant boundary reconstruction. The parallel processing scheduling module is connected to the spatial indexing module and the Boolean operation module respectively. It is used to manage the dual thread pools of spatial indexing and Boolean operation and achieve load balancing by adjusting the task queue. The post-processing module, connected to the Boolean operation module, is used to perform topological consistency checks and repairs on the geometric operation results. The output module, connected to the post-processing module, is used to output geometric calculation results according to a preset format, and to render and visualize the results in real time, while generating performance logs and error reports.
2. The geometric Boolean operation optimization system based on hierarchical spatial indexing according to claim 1, characterized in that, The spatial index module adopts a dynamic quadtree or octree structure, and its construction process includes: Calculate the global minimum bounding box of all geometric objects and use it as the root node's bounding box; Based on the preset load threshold and object distribution density, the space is recursively divided into four or eight sub-regions and corresponding child nodes are created until the number of objects in the child node is lower than the threshold or the maximum depth is reached, at which point the segmentation stops. By using a spatial hash table to establish a mapping between grid coordinates and object IDs, constant-time queries are achieved, while incremental updates are also supported. When the object's location changes, only the affected nodes and hash table entries are updated, thus avoiding full index reconstruction.
3. The geometric Boolean operation optimization system based on hierarchical spatial indexing according to claim 1, characterized in that, In the topological representation structure adopted by the Boolean operation module, the relation point object includes two-dimensional coordinates, a set of associated line segments, and topological information of the record point type, wherein the set of associated line segments includes curve segments; The relationship line object contains a start point, an end point, a reference to the left polygon, and a reference to the right polygon; The intersection detection process includes: firstly, using the bounding box of line segments to roughly screen out obviously non-intersecting line segment pairs, then performing precise geometric intersection calculation on the candidate pairs, using the cross product of vectors and parametric equations to calculate the intersection point, and using numerical tolerance to handle floating-point precision. Boundary reconstruction includes automatically detecting and repairing cracks or overlaps by analyzing the topological connectivity at intersections.
4. The geometric Boolean operation optimization system based on hierarchical spatial indexing according to claim 1, characterized in that, In the parallel processing scheduling module, the spatial index thread pool is used for index construction, updating and querying, and the Boolean operation thread pool is used for geometric calculations. Both the spatial index thread pool and the boolean operation thread pool use bounded task queues to manage tasks. When the task queue is full, a load balancing operation is triggered to transfer the task to a place with a lower load. Secondly, the parallel processing scheduling module also includes a GPU acceleration management unit, which is used to identify data-intensive tasks suitable for GPU parallel computing and transfer them to the GPU for execution through the WebGL computing shader; The parallel processing scheduling module monitors thread status and resource utilization in real time and dynamically adjusts task allocation to maximize system throughput.
5. The geometric Boolean operation optimization system based on hierarchical spatial indexing according to claim 1, characterized in that, The topology consistency verification unit of the post-processing module traverses all edges and vertices generated by the operation and checks the consistency of polygon references on the left and right sides of the edges and the degree conformity of the vertices. At the same time, it automatically detects isolated vertices, duplicate edges or non-manifold structures. For lines or points with detection errors, an intelligent repair algorithm based on neighborhood information is used to correct them through local mesh reconstruction or vertex merging. Secondly, the adaptive polygon simplification unit in the post-processing module uses an edge folding algorithm to calculate a comprehensive error metric for each foldable edge based on curvature change, projected area, and visual importance, and prioritizes folding the edges that have the least impact on shape features.
6. A geometric Boolean operation optimization method based on hierarchical spatial indexing, applicable to the geometric Boolean operation optimization system based on hierarchical spatial indexing as described in any one of claims 1-5, characterized in that, include: The input processing module receives geometric object data input by the user, performs format parsing, coordinate normalization and redundant vertex merging preprocessing on the input data, and converts the processed data into a unified internal representation format of the system, which is then recorded as preprocessed data. Based on the preprocessed data, a bounding box is built for each geometric object through the spatial indexing module, and an adaptive hierarchical spatial indexing structure is constructed accordingly. Then, spatial distribution density analysis is performed based on the bounding boxes of all objects in the preprocessed data. The spatial indexing module dynamically adjusts the granularity of spatial partitioning, thereby achieving load balancing of spatial partitioning. Based on the constructed spatial index, potential intersecting geometric objects are quickly filtered, and a set of candidate objects is output. Based on the candidate object set after output filtering and the computational requirements, the computational tasks are decomposed and allocated to multiple threads through the parallel processing scheduling module, and the task queues of the dual thread pools of spatial indexing and Boolean operation are managed synchronously to coordinate the parallel computing resources of CPU multi-threading and GPU. Based on allocated parallel computing resources, the Boolean operation module performs geometric Boolean operations in each thread based on the topological representation of relation points and relation lines. This completes accurate line segment intersection detection and fault-tolerant boundary reconstruction, implements specified union, intersection, or difference operations, generates initial results, and performs topological consistency checks and automatic repairs on the initial results through the post-processing module. It also performs polygon simplification, triangulation, and geometric optimization to generate optimized results with multi-level details. The optimized results are then converted into a specified format for output through the output module, while providing real-time rendering and interactive visualization feedback, and recording and generating performance logs and system error reports.
7. The geometric Boolean operation optimization method based on hierarchical spatial indexing according to claim 6, characterized in that, The specific steps for constructing a hierarchical spatial index include: Traverse the input geometric objects in the preprocessed data and calculate the axially aligned bounding boxes of the input geometric objects. Obtain the global spatial extent by taking the union of the sets. The space is recursively divided with the global scope as the root node. The operation of dividing the space is as follows: evaluate the number and distribution of objects in the current node. If the number exceeds the threshold and the distribution is uneven, divide the space into two or four sub-regions along the selected axis and create child nodes. Distribute objects within the current node to one or more child nodes according to the intersection relationship between their bounding boxes and sub-regions; The operation of the partitioned space is recursively performed on each child node until the number of objects in the node is below the threshold or the maximum recursion depth is reached. While recursively partitioning, a spatial hash table is constructed to map regular grid cells to all leaf nodes that cover them, enabling fast reverse lookup from spatial location to the containing object.
8. The geometric Boolean operation optimization method based on hierarchical spatial indexing according to claim 6, characterized in that, Geometric Boolean operations are performed based on the topological representation of relation points and relation lines, including: The polygon shapes and boundaries in the candidate objects are decomposed into a set of directed line segments, and a relation point object is created for each vertex generated after decomposition, and a relation line object is created for each directed line segment, thereby obtaining the initial basic topological relationship; Based on the constructed adaptive hierarchical spatial index structure, spatial queries are performed on all directed line segments to quickly retrieve all candidate line segment pairs whose bounding boxes intersect. For each pair of candidate line segments, perform precise geometric intersection detection; if an intersection is determined, calculate the coordinates of the intersection point, and at the intersection point, divide the original directed line segment into a new line segment, while updating the topological connection information of the relation point object and the relation line object; Traverse all relationship line objects to construct a complete topological relationship graph; in this topological relationship graph, each relationship point object maintains a reference to all relationship line objects connected to it, and each relationship line object clearly defines the polygon region to its left and the polygon region to its right. Based on the Boolean operation type requested by the user, the topological relationship graph is traversed, and line segments constituting the boundary of the final result are selected according to preset rules, wherein the preset rules are: When the operation type is union, select all boundary line segments located outside the first polygon or outside the second polygon; When the operation type is intersection, select all boundary line segments that are simultaneously located inside the first polygon and inside the second polygon; When the operation type is difference, select all boundary line segments that are inside the first polygon and outside the second polygon. The selected boundary line segment sequence is sorted and its connectivity is checked to form one or more closed boundary loops. Isolated vertices or overhanging edges found during the sorting process are removed.