A selection interaction method, device, equipment, medium and product applicable to a three-dimensional CAD system
Patent Information
- Application Number
- CN202610856370.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2026-06-15
- Publication Date
- 2026-09-18
- Estimated Expiration
- 2046-06-15
AI Technical Summary
[0003]但是上述选取方式在简单场景下可实现基本点选操作,但面对大规模、高密度三维模型时,射线遍历与相交计算复杂度显著上升,运算耗时增加,导致选取响应延迟、系统运行卡顿;且受光标分辨率与屏幕投影比例限制,大规模、高密度三维模型中的微小对象、远距离对象常无法精准选中,需反复缩放视图操作,流程繁琐低效,难以满足工程BIM设计中高精度、高流畅度的选取交互要求
本申请提供了一种适用三维CAD系统的选取交互方法、装置、设备、介质及产品,通过在三维CAD系统启动时,完成空间索引结构初始化与空哈希表创建,加载场景内所有待处理3D模型后,对待处理3D模型的几何对象赋予唯一身份ID,同步建立身份ID与几何对象在自适应空间索引结构中存储位置的哈希关系映射表;当用户执行屏幕二维框选操作时,无需对全场景几何对象进行逐一遍历,而是通过哈希关系映射表快速查询与二维框选区域相关联的目标子空间节点,再从自适应空间索引结构中提取与目标子空间节点对应的节点内所有几何对象,形成候选几何对象集合;通过对候选几何对象集合进行筛选得到目标几何对象集合,在此过程中大幅减少了冗余计算量与无效检索操作,有效解决了传统选取方法在大规模、高密度三维模型场景下易出现的响应延迟、界面卡顿等问题,显著提升了物体选取的交互效率与流畅度,进而能够有效提升三维CAD软件的整体操作体验与工作效率。
Smart Images

Figure CN122391515B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of 3D CAD modeling technology, and in particular to a selection interaction method, device, equipment, medium and product applicable to 3D CAD systems. Background Technology
[0002] Object selection is a core function of 3D CAD software, directly determining modeling efficiency and user experience. Currently, most mainstream 3D CAD software uses the ray intersection method for object selection, which involves emitting rays from the mouse position along the camera's viewpoint and determining the selected object based on geometric intersections.
[0003] However, while the above selection methods can achieve basic point selection operations in simple scenarios, the computational complexity of ray traversal and intersection increases significantly when dealing with large-scale, high-density 3D models, leading to increased computation time, selection response delays, and system lag. Furthermore, due to limitations in cursor resolution and screen projection ratio, small or distant objects in large-scale, high-density 3D models often cannot be accurately selected, requiring repeated zooming of the view, resulting in a cumbersome and inefficient process that fails to meet the high-precision and high-smoothness selection interaction requirements of engineering BIM design. Therefore, there is an urgent need to provide a selection interaction method for 3D CAD systems that can improve object selection accuracy and smoothness. Summary of the Invention
[0004] In view of the above-mentioned defects or deficiencies in the related technologies, the purpose of this application is to provide a selection interaction method, device, equipment, medium and product applicable to 3D CAD systems, which can effectively improve the object selection accuracy and selection smoothness of 3D CAD systems and is suitable for large-scale, high-density 3D model construction scenarios.
[0005] To achieve the above objectives, this application provides the following solution: Firstly, this application provides a selection interaction method applicable to a 3D CAD system, comprising: during the startup process of the 3D CAD system, initializing a spatial index structure and creating an empty hash table; loading all 3D models to be processed in the current scene, and uniquely encoding the geometric objects of all 3D models to be processed to generate several geometric objects to be processed with unique identity IDs; inserting all geometric objects to be processed into the spatial index structure to generate an adaptive spatial index structure; adding the identity IDs of all geometric objects to be processed and their storage locations in the adaptive spatial index structure to the empty hash table to generate a hash relationship mapping table between identity IDs and storage locations; responding to the user's target selection operation, querying all subspace nodes associated with the two-dimensional selection area in the hash relationship mapping table to obtain the target subspace node; obtaining all geometric objects corresponding to the target subspace node in the adaptive spatial index structure to obtain a candidate geometric object set; sampling the hardware device equipped with the 3D CAD system, and filtering the candidate geometric object set based on the sampling results to obtain the target geometric object set.
[0006] Optionally, the step of inserting all the geometric objects to be processed into the spatial index structure to generate an adaptive spatial index structure includes: calculating the bounding box of each geometric object to be processed to obtain several object bounding boxes; traversing the several object bounding boxes and performing spatial verification on each object bounding box in turn; if the current object bounding box exceeds the current spatial index structure, then adaptively expanding the current spatial index structure to obtain a current expanded spatial index structure; inserting the geometric object corresponding to the current object bounding box into the extended subspace node of the current expanded spatial index structure; if the current object bounding box does not exceed the current spatial index structure, directly inserting the geometric object corresponding to the current object bounding box into the corresponding subspace node of the current spatial index structure; traversing and looping all object bounding boxes until all the geometric objects to be processed have been inserted to obtain the adaptive spatial index structure.
[0007] Optionally, the step of responding to the user's target selection operation by querying all subspace nodes associated with the two-dimensional bounding box in the hash relation mapping table to obtain the target subspace node includes: responding to the user's target selection operation to obtain the two-dimensional bounding box; converting all geometric objects to be selected within the two-dimensional bounding box into a three-dimensional query bounding box; and querying all subspace nodes associated with the three-dimensional query bounding box in the hash relation mapping table to obtain the target subspace node.
[0008] Optionally, obtaining all geometric objects corresponding to the target subspace node in the adaptive spatial index structure to obtain a candidate geometric object set includes: locating all nodes corresponding to the target subspace node in the adaptive spatial index structure and extracting the geometric objects stored in all nodes; sequentially performing intersection checks on all extracted geometric objects; if the bounding box of the current geometric object has spatial intersection with the corresponding 3D query bounding box, then retaining the current geometric object; if the bounding box of the current geometric object does not have spatial intersection with the corresponding 3D query bounding box, then discarding it; wherein, all retained geometric objects form the candidate geometric object set.
[0009] Optionally, the step of sampling the hardware device equipped with the 3D CAD system and filtering the candidate geometric object set based on the sampling results to obtain the target geometric object set includes: performing hardware rendering sampling twice on each candidate geometric object in the candidate geometric object set within a two-dimensional bounding area; during the first rendering sampling, counting the number of visible pixel samples of the current candidate geometric object within the two-dimensional bounding area; during the second rendering sampling, counting the number of complete pixel samples of the current candidate geometric object during normal rendering; if the number of visible pixel samples is equal to the number of complete pixel samples, then the current candidate geometric object is unobstructed and completely located within the two-dimensional bounding area, and the current candidate geometric object is retained; if the number of visible pixel samples is not equal to the number of complete pixel samples, then the current candidate geometric object is obstructed or not completely located within the two-dimensional bounding area, and the current candidate geometric object is discarded; wherein, all retained current candidate geometric objects form the target geometric object set.
[0010] Optionally, after obtaining the target geometric object set, the method further includes: highlighting all target geometric objects in the target geometric object set to provide clear visual feedback to the user to complete the selection interaction.
[0011] Secondly, this application provides a selection interaction device applicable to a 3D CAD system, comprising: The initialization module is used to initialize the spatial index structure and create an empty hash table during the startup process of the 3D CAD system. The loading and encoding module is used to load all 3D models to be processed in the current scene, and to uniquely encode the geometric objects of all 3D models to be processed, generating several geometric objects to be processed with unique IDs. An extended insertion module is used to insert all geometric objects to be processed into the spatial index structure, generating an adaptive spatial index structure. The generation module is used to add the identity ID of all geometric objects to be processed and their storage location in the adaptive spatial index structure to the empty hash table, and generate a hash mapping table between identity ID and storage location; The response query module is used to respond to the user's target selection operation, query all subspace nodes associated with the two-dimensional box selection area in the hash relationship mapping table, and obtain the target subspace node; The acquisition module is used to acquire all geometric objects corresponding to the target subspace node in the adaptive spatial index structure, and obtain a candidate geometric object set; The sampling and filtering module is used to perform hardware sampling through rendering pipeline template testing, and to filter the candidate geometric object set based on the sampling results to obtain the target geometric object set.
[0012] Thirdly, this application provides a computer device, including: a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to implement the steps of the selection interaction method applicable to any of the above-described three-dimensional CAD systems.
[0013] Fourthly, this application provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the steps of the selection interaction method applicable to a three-dimensional CAD system described above.
[0014] Fifthly, this application provides a computer program product, including a computer program that, when executed by a processor, implements the steps of the selection interaction method applicable to a three-dimensional CAD system as described above.
[0015] According to the specific embodiments provided in this application, the following technical effects are disclosed: This application provides a selection interaction method, device, equipment, medium, and product applicable to 3D CAD systems. By initializing the spatial index structure and creating an empty hash table upon system startup, and loading all 3D models to be processed within the scene, a unique ID is assigned to each geometric object of the 3D model to be processed. Simultaneously, a hash mapping table is established, mapping the ID to the storage location of the geometric object in the adaptive spatial index structure. When the user performs a two-dimensional selection operation on the screen, it is not necessary to traverse all geometric objects in the scene one by one. Instead, the target subspace node associated with the two-dimensional selection area is quickly queried through the hash mapping table. Then, all geometric objects within the node corresponding to the target subspace node are extracted from the adaptive spatial index structure, forming a candidate geometric object set. The target geometric object set is obtained by filtering the candidate geometric object set. This process significantly reduces redundant computation and invalid retrieval operations, effectively solving the problems of response delay and interface lag that traditional selection methods easily encounter in large-scale, high-density 3D model scenes. This significantly improves the interactive efficiency and smoothness of object selection, thereby effectively enhancing the overall operating experience and work efficiency of 3D CAD software. Attached Figure Description
[0016] To more clearly illustrate the technical solutions in the embodiments of this application or the prior art, the drawings used in the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0017] Figure 1 A flowchart illustrating a selection interaction method applicable to a 3D CAD system, provided as an embodiment of this application; Figure 2 A schematic diagram of an initialization space index structure provided in an embodiment of this application; Figure 3 An embodiment of this application provides an object bounding box for several geometric objects to be processed; Figure 4 This application provides a schematic diagram of a two-dimensional selection area chosen by a user in screen space according to an embodiment; Figure 5 A schematic diagram of a target geometric object highlighted in an embodiment of this application; Figure 6 A schematic diagram of the functional modules of a selection interaction device applicable to a 3D CAD system provided in an embodiment of this application; Figure 7 This is a schematic diagram of the structure of a computer device provided in an embodiment of this application. Detailed Implementation
[0018] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.
[0019] To make the above-mentioned objectives, features and advantages of this application more apparent and understandable, the application will be further described in detail below with reference to the accompanying drawings and specific embodiments.
[0020] In one exemplary embodiment, such as Figure 1 As shown, a selection interaction method applicable to a 3D CAD system is provided. This method is executed by a computer device, specifically by a terminal or server, etc. In this embodiment, the method includes the following steps S101 to S207. Wherein: Step S101: During the startup process of the 3D CAD system, the spatial index structure is initialized and an empty hash table is created.
[0021] In the example implementation, the spatial index structure is an octree structure. An octree is a tree-like data structure used to describe and partition three-dimensional space, where each internal node has exactly eight child nodes. The octree structure organizes data by recursively dividing a cubic space into eight smaller sub-cubes, thus achieving efficient spatial management. Figure 2 The diagram shows the initial state of the octree structure, with a root node centered at (0, 0, 0). S An octree structure with 0=10 (i.e., coordinates in the range of [-5, 5]).
[0022] Step S102: Load all 3D models to be processed in the current scene, and uniquely encode the geometric objects of all 3D models to be processed to generate several geometric objects to be processed with unique identity IDs.
[0023] Step S103: Insert all the geometric objects to be processed into the spatial index structure to generate an adaptive spatial index structure.
[0024] In the example embodiment, the cube of all the geometric objects to be processed is calculated. AABBThe bounding box is used to traverse the AABB bounding boxes of all geometric objects to be processed and automatically perform spatial topology deployment. For geometric objects to be processed that exceed the preset range of the current spatial index structure, adaptive expansion logic is executed; for example, in this embodiment, 1000 standard cubes with a side length of 1.0 are preset, numbered from Cube001 to Cube1000. Taking Cube001 as an example: the boundary overflow judgment and adaptive expansion are as follows: by comparison, it is found that the X-axis component 6.0 of the vertex coordinates (6.0, 0.5, 0.0) of a bounding box of Cube001 is greater than the half length of the current root node 5.0, which is judged as a spatial overflow. The spatial expansion algorithm is called to expand the initial space of the octree. The range is increased from 10 to 20 (updated to [-10, 10]). After expansion, the root node range is recalculated, and existing space partitions are automatically migrated to the newly generated parent node according to topological relationships. If subsequent object insertions still trigger overflow checks, the above expansion logic will be executed repeatedly until the root node completely contains the target object. After ensuring that the root node contains the geometry to be processed, the index of the next-level subspace is automatically calculated based on the center position of Cube001.
[0025] The partitioning logic is then executed: If the partitioning condition is met—that is, the object count within the current node exceeds a preset threshold and the current tree depth has not reached its upper limit—the next-level subspace node is automatically created under the current node, and Cube001 is pushed down to the corresponding next-level subspace. If the partitioning condition is not met—that is, the current node is determined to be the finest-grained leaf node—the recursion stops.
[0026] Object mounting and hash mapping storage: After determining the final subspace node to which Cube001 belongs, the insertion operation is performed. Upon completion of the insertion, the memory handle (0x0045AF20) of the subspace node is automatically extracted, and a key-value pair record {"Cube001": 0x0045AF20} is written to the global hash mapping table.
[0027] Specifically, after Cube001 is inserted, the process automatically switches to the next object to be operated on, Cube002, and repeatedly executes the adaptive expansion, recursive partitioning, and hash mapping logic in the above steps. After all 1000 cube objects have completed spatial index deployment, a global octree index structure covering all discretely distributed objects is finally constructed. In this embodiment, after multiple adaptive expansions, the octree space is finally expanded to... Size. At this point, all geometric entities and their subspace nodes have established hash mapping relationships. The complete scene diagram after insertion is as follows: Figure 3 As shown.
[0028] Step S104: Add the identity ID of all geometric objects to be processed and their storage location in the adaptive spatial index structure to an empty hash table to generate a hash mapping table between identity ID and storage location.
[0029] Step S105: In response to the user's target selection operation, query all subspace nodes associated with the two-dimensional box selection area in the hash relationship mapping table to obtain the target subspace node.
[0030] Step S106: Obtain all geometric objects corresponding to the target subspace node in the adaptive spatial index structure to obtain a set of candidate geometric objects.
[0031] Step S107: Sample the hardware device equipped with the 3D CAD system, and filter the candidate geometric object set based on the sampling results to obtain the target geometric object set.
[0032] As can be understood from the above embodiments, firstly, the current camera's frustum parameters are retrieved, and the camera orientation vector is extracted. Near cutting plane And far-reaching cutting plane When input is detected in the Mask area (i.e., the two-dimensional selection area) of the screen space, such as... Figure 4 As shown, the system automatically traverses the vertices of the region and calculates its 2D AABB bounding box to obtain the minimum corner point in the screen coordinate system. With the largest corner point Then, the raycasting logic is executed, which involves raycasting from the two corner points along the camera direction vector. Two rays are emitted, which successively intersect the near-cutting plane. And far-reaching cutting plane The two points intersect, thus determining two corner points on the near plane and two corner points on the far plane in three-dimensional space.
[0033] Based on the coordinates of the four corner points mentioned above, calculate the minimum value of the three-dimensional AABB query space of the selected region. With the maximum value Satisfy the following formula: in, It is the set of three-dimensional coordinates of all corner points on the near plane and the far plane.
[0034] The three-dimensional coordinate set is used as input to perform an intersection test in the octree, recursively searching for nodes that intersect with the space, and using a hash table for fast retrieval, directly outputting 9 preliminary intersecting candidate objects, numbered Cube231, Cube305, Cube413, Cube289, Cube536, Cube088, Cube507, Cube659 and Cube663 respectively.
[0035] Then, the rendering pipeline is automatically switched to occlusion query mode, and precise filtering is performed through hardware-level pixel sampling. The specific execution logic is as follows: First, a state protection instruction is executed to disable depth testing and write permissions to the depth and color buffers. Then, stencil testing is enabled, and the acquired screen space mask area is written to the stencil buffer, constructing a pixel-level selection mask. Under the effect of this selection mask, all subsequent drawing operations are only valid within the pixel area covered by the mask.
[0036] Initial Object Rendering and Preliminary Visibility Query: For each object in the candidate set, a hardware counter is initiated to perform the initial rendering query. The number of successful samples received from the hardware is then recorded. G 1. If G A value of 1=0 indicates that the object is completely invisible within the current Mask area; skip this object, close the template test, and proceed to process the next object. If... G If 1 > 0, the object is determined to have preliminary visibility, and the second comparison stage begins.
[0037] Second Object Drawing and Double Sample Statistical Comparison: For objects that are initially visible, a second drawing query is performed to obtain the actual number of samples passed by the hardware. G 2. Comparison based on sample size G 1 and the actual number of samples passed G 2 values, if G 1= G 2. Determine that the object is not occluded by other geometry within the Mask area, and that its outer geometric outline completely covers the projection area of the proxy bounding box within the Mask, satisfying the "positive selection mode" requirement, and record it as the selected object. If G 1≠ G 2. If it is determined that the object is occluded in the line of sight and its geometry does not completely fill the projection space corresponding to the Mask, it will be automatically removed from the selection cache.
[0038] Taking Cube231 as an example, the number of samples that passed the depth test is based on hardware feedback. G 1=150 G 2 = 150; Taking Cube305 as an example, the number of samples that passed the depth test according to hardware feedback. G 1=60、G 2=180, the latter does not meet the non-occlusion requirement in the positive selection mode, and is automatically removed from the selection cache. Similarly, Cube413, Cube536 and Cube507 with unequal sample numbers are removed.
[0039] Rendering state restoration: After completing the traversal and comparison of all objects in the collection, the template test is automatically closed, and the depth test and depth and color write permissions are reopened, restoring the scene to its normal rendering state.
[0040] By implementing steps S101 to S107 above, the spatial index structure is initialized and an empty hash table is created when the 3D CAD system starts. After loading all 3D models to be processed in the scene, a unique identity ID is assigned to the geometric objects of the 3D models to be processed, and a hash relationship mapping table between the identity ID and the storage location of the geometric objects in the adaptive spatial index structure is established simultaneously. When the user performs a two-dimensional selection operation on the screen, it is not necessary to traverse all geometric objects in the scene one by one. Instead, the target subspace node associated with the two-dimensional selection area is quickly queried through the hash relationship mapping table. Then, all geometric objects in the node corresponding to the target subspace node are extracted from the adaptive spatial index structure to form a candidate geometric object set. The target geometric object set is obtained by filtering the candidate geometric object set. In this process, redundant calculation and invalid retrieval operations are greatly reduced, which effectively solves the problems of response delay and interface lag that are prone to occur in large-scale, high-density 3D model scenes by traditional selection methods. It significantly improves the interactive efficiency and smoothness of object selection, and thus effectively improves the overall operation experience and work efficiency of 3D CAD software.
[0041] In another exemplary embodiment of this application, step S103 is replaced by steps S1031 to S1034, that is: Step S1031: Calculate the bounding box of each geometric object to be processed to obtain several object bounding boxes; Step S1032: Traverse several object bounding boxes and perform spatial verification on each object bounding box in turn. Step S1033: If the current object bounding box exceeds the current spatial index structure, then the current spatial index structure is adaptively expanded to obtain the current expanded spatial index structure; the geometric object corresponding to the current object bounding box is inserted into the expanded subspace node of the current expanded spatial index structure; if the current object bounding box does not exceed the current spatial index structure, the geometric object corresponding to the current object bounding box is directly inserted into the corresponding subspace node of the current spatial index structure. Step S1034: Traverse all bounding boxes of objects until all geometric objects to be processed have been inserted to obtain an adaptive spatial index structure.
[0042] The adaptive spatial index structure automatically adjusts and adapts to the actual spatial distribution and size range of the 3D model to be processed within the scene. This eliminates the need for manual pre-setting of index parameters and the need to rebuild the spatial index for 3D model scenes of different specifications and layouts, thus lowering the barrier to entry for users. Furthermore, the adaptive spatial index structure is compatible with various complex shapes and sizes of 3D geometric objects, broadly adapting to the selection needs of 3D CAD models in fields such as architecture, machinery, and electrical engineering.
[0043] In another exemplary embodiment of this application, step S105 is replaced by steps S1051 to S1053, that is: Step S1051: Respond to the user's target selection operation and obtain the two-dimensional selection area.
[0044] In the example embodiment, the user's target selection operation is an interactive action in which the user selects a target area on the computer screen by using a keyboard, mouse or touch screen. The target area can be determined by a closed two-dimensional shape such as a rectangle or ellipse. In this embodiment, it is preferred that the user selects the target area by using a rectangle, which is a two-dimensional selection area.
[0045] Optionally, in response to the user's selection interaction on the display screen, the rectangular area of the screen drawn by the user by dragging the mouse is captured to form a two-dimensional selection area; this two-dimensional selection area is a mask, which only has width and height, but no depth. It is a two-dimensional planar area that only represents the selection range of the user from the screen perspective and is used to convert it into a three-dimensional spatial query range later.
[0046] Step S1052: Convert all geometric objects to be selected within the two-dimensional bounding box into a three-dimensional query bounding box.
[0047] In the example embodiment, based on the camera frustum parameters of the current 3D CAD system, the two-dimensional bounding box area defined by the user on the screen plane is spatially extended along the camera's line of sight to construct an axis-aligned query bounding box in 3D space. This 3D query bounding box corresponds to the actual spatial range of the two-dimensional bounding box area in the 3D scene, providing support for subsequent intersection detection with the AABB bounding boxes of geometric objects and realizing object filtering in 3D space.
[0048] Step S1053: Query all subspace nodes associated with the 3D query bounding box in the hash relation mapping table to obtain the target subspace node.
[0049] In the example implementation, based on the spatial range of the 3D query bounding box, and by quickly matching and retrieving octree subspace nodes with overlapping spatial relationships through a hash relation mapping table, the target subspace node corresponding to the selected range is filtered out, thereby achieving rapid spatial positioning of the selected range and avoiding full-scene traversal retrieval.
[0050] By responding to user actions to obtain a two-dimensional selection area, mapping the two-dimensional selection area to a three-dimensional query bounding box, and then using a hash relationship mapping table to quickly retrieve associated target subspace nodes, a rapid conversion from two-dimensional screen interaction to precise three-dimensional spatial positioning is achieved. It is not necessary to traverse all geometric objects in the entire three-dimensional scene, but only to lock local subspace nodes that overlap with the selection area, which greatly reduces the subsequent search range, reduces invalid traversal and redundant calculations, and significantly improves the retrieval efficiency and response speed of object selection in large-scale three-dimensional model scenes, ensuring the smoothness of selection interaction.
[0051] In another exemplary embodiment of this application, step S106 is replaced by steps S1061 to S1062, that is: Step S1061: Locate all nodes in the adaptive spatial index structure that correspond to the target subspace node, and extract the geometric objects stored in all nodes.
[0052] Step S1062: Perform intersection checks on all extracted geometric objects sequentially; if the bounding box of the current geometric object intersects with the corresponding 3D query bounding box, the current geometric object is retained. If the bounding box of the current geometric object does not intersect with the corresponding 3D query bounding box, it is discarded; all retained geometric objects form a candidate geometric object set.
[0053] By extracting geometric objects within the target subspace nodes and performing spatial intersection checks with the 3D query bounding boxes one by one, a preliminary coarse screening of geometric objects is completed. Only geometric objects whose bounding boxes overlap with the 3D query bounding boxes of the selected area are retained, while spatially irrelevant objects are eliminated. This further narrows the processing range of subsequent hardware fine screening, reduces invalid rendering sampling operations, and effectively reduces computational overhead while ensuring the accuracy of the selection range, thereby improving the overall selection processing efficiency.
[0054] In another exemplary embodiment of this application, step S107 may include steps S1071 and S1072, wherein: Step S1071: Perform hardware rendering sampling twice for each candidate geometric object in the candidate geometric object set within the two-dimensional selection area; during the first rendering sampling, count the number of visible pixel samples of the current candidate geometric object within the two-dimensional selection area; during the second rendering sampling, count the number of complete pixel samples of the current candidate geometric object during normal rendering. In step S1072, if the number of visible pixel samples is equal to the number of complete pixel samples, the current candidate geometric object is unobstructed and completely located within the two-dimensional bounding box area, and the current candidate geometric object is retained; if the number of visible pixel samples is not equal to the number of complete pixel samples, the current candidate geometric object is obstructed or not completely located within the two-dimensional bounding box area, and the current candidate geometric object is removed; wherein, all retained current candidate geometric objects form the target geometric object set.
[0055] As can be understood from the above embodiments, the two queries in this application are one within the Mask scope and one normal query without a Mask. Comparing these two queries yields occluded or incomplete candidate geometric objects. Occluded or incomplete candidate geometric objects are removed, and unoccluded candidate geometric objects are retained to form the target geometric object set. Specifically, First, a coarse screening of the candidate geometric object set is completed through a hash relationship mapping table and an adaptive spatial index structure, quickly eliminating geometric objects that are irrelevant to the two-dimensional selection area. Then, hardware-level pixel sampling is performed through rendering pipeline template testing. Within the two-dimensional selection area formed by the user's selection, the number of visible pixels and complete pixels is compared by the two sampling results to determine whether the current candidate geometric object is unobstructed and completely located within the two-dimensional selection area. This effectively eliminates invalid candidate geometric objects that are obstructed or partially outside the selection range, resulting in the target geometric object set. This completely solves the defects of traditional selection methods, such as susceptibility to occlusion interference, high misselection rate, and serious omissions, ensuring accurate and reliable selection results and meeting the core needs of refined modeling and editing in 3D CAD software.
[0056] The hash mapping table enables rapid binding and querying of the identity ID and spatial storage location of the geometric objects to be processed, resulting in low data retrieval complexity and low computational overhead. The fine screening of the candidate geometric object set relies on hardware acceleration through native template testing in the rendering pipeline, without the need for additional complex algorithm calculations. This improves selection efficiency and accuracy while effectively reducing the resource consumption of system memory and graphics processor, thus balancing operational efficiency and system stability.
[0057] In another exemplary embodiment of this application, in order to provide clear visual feedback to the user, after obtaining the target geometric object set, the method may further include: highlighting all target geometric objects in the target geometric object set to provide clear visual feedback to the user to complete the selection interaction.
[0058] In the example embodiment, after fine filtering is completed, the final list of valid object IDs residing in the selection cache (such as Cube231, Cube088, etc.) is output; then, the rendering state of these objects is automatically modified, a preset highlight shader is applied, and feedback is sent to the display as follows: Figure 5The highlighted magnified view shown.
[0059] Highlighting the entire set of target geometric objects obtained through filtering provides users with intuitive and eye-catching visual feedback, enabling them to quickly and accurately identify the final selected geometric objects and avoid repeated selection and verification operations caused by ambiguous selection results. At the same time, the complete closed-loop interactive process from the two-dimensional selection area to the presentation of the selection results provides clear and intuitive operation feedback, effectively improving the interactive experience and ease of operation of object selection in 3D CAD scenes.
[0060] Based on the same inventive concept, this application also provides a selection interaction device for a three-dimensional CAD system to implement the selection interaction method for a three-dimensional CAD system described above. The solution provided by this device is similar to the solution described in the above method. Therefore, the specific limitations of one or more selection interaction device embodiments for a three-dimensional CAD system provided below can be found in the limitations of the selection interaction method for a three-dimensional CAD system described above, and will not be repeated here.
[0061] In one exemplary embodiment, such as Figure 6 As shown, a selection interaction device suitable for a 3D CAD system is provided. The selection interaction device 600 suitable for a 3D CAD system includes: an initialization module 601, a loading encoding module 602, an extension insertion module 603, a generation module 604, a response query module 605, an acquisition module 606, and a sampling and filtering module 607. The initialization module 601 is used to initialize the spatial index structure and create an empty hash table during the startup process of the 3D CAD system; The loading and encoding module 602 is used to load all the 3D models to be processed in the current scene, and to uniquely encode the geometric objects of all the 3D models to be processed, generating several geometric objects to be processed with unique IDs. The extended insertion module 603 is used to insert all geometric objects to be processed into the spatial index structure and generate an adaptive spatial index structure. The generation module 604 is used to add the identity ID of all geometric objects to be processed and their storage location in the adaptive spatial index structure to an empty hash table, and generate a hash mapping table between identity ID and storage location. The response query module 605 is used to respond to the user's target selection operation, query all subspace nodes associated with the two-dimensional box selection area in the hash relationship mapping table, and obtain the target subspace node; The acquisition module 606 is used to acquire all geometric objects corresponding to the target subspace node in the adaptive spatial index structure, and obtain a candidate geometric object set. The sampling and filtering module 607 is used to sample the hardware device equipped with the 3D CAD system and filter the candidate geometric object set based on the sampling results to obtain the target geometric object set.
[0062] As an optional implementation, the aforementioned extended insertion module 603 is specifically used to: calculate the bounding box of each geometric object to be processed, obtaining several object bounding boxes; traverse several object bounding boxes and perform spatial verification on each object bounding box in turn; if the current object bounding box exceeds the current spatial index structure, then adaptively expand the current spatial index structure to obtain the current expanded spatial index structure; insert the geometric object corresponding to the current object bounding box into the expanded subspace node of the current expanded spatial index structure; if the current object bounding box does not exceed the current spatial index structure, directly insert the geometric object corresponding to the current object bounding box into the corresponding subspace node of the current spatial index structure; traverse and loop through all object bounding boxes until all geometric objects to be processed are inserted, obtaining the adaptive spatial index structure.
[0063] As an optional implementation, the above-mentioned response query module 605 is specifically used to respond to the user's target selection operation to obtain a two-dimensional bounding box area; convert all geometric objects to be selected within the two-dimensional bounding box area into a three-dimensional query bounding box; and query all subspace nodes associated with the three-dimensional query bounding box in the hash relation mapping table to obtain the target subspace node.
[0064] As an optional implementation, the acquisition module 606 is specifically used to: locate all nodes in the adaptive spatial index structure corresponding to the target subspace node, and extract the geometric objects stored in all nodes; sequentially perform intersection checks on all extracted geometric objects; if the object bounding box of the current geometric object has spatial intersection with the corresponding 3D query bounding box, then the current geometric object is retained; if the object bounding box of the current geometric object does not have spatial intersection with the corresponding 3D query bounding box, then it is discarded; wherein, all retained geometric objects form a candidate geometric object set.
[0065] As an optional implementation, the sampling and filtering module 607 is specifically used to perform two hardware rendering samples on each candidate geometric object in the candidate geometric object set within the two-dimensional selection area; during the first rendering sample, the number of visible pixel samples of the current candidate geometric object within the two-dimensional selection area is counted; during the second rendering sample, the number of complete pixel samples of the current candidate geometric object during normal rendering is counted; if the number of visible pixel samples is equal to the number of complete pixel samples, the current candidate geometric object is unobstructed and completely located within the two-dimensional selection area, and the current candidate geometric object is retained; if the number of visible pixel samples is not equal to the number of complete pixel samples, the current candidate geometric object is obstructed or not completely located within the two-dimensional selection area, and the current candidate geometric object is discarded; wherein, all retained current candidate geometric objects form the target geometric object set.
[0066] As an optional implementation, the selection interaction device 600 applicable to the above-mentioned 3D CAD system further includes a highlighting module, which is used to highlight all target geometric objects in the target geometric object set to provide clear visual feedback to the user to complete the selection interaction.
[0067] This implementation method involves initializing the spatial index structure and creating an empty hash table upon system startup. After loading all 3D models to be processed within the scene, a unique ID is assigned to each geometric object in the 3D model. Simultaneously, a hash mapping table is established, mapping the IDs to the storage locations of the geometric objects within the adaptive spatial index structure. When a user performs a 2D selection operation on the screen, it is not necessary to traverse all geometric objects in the scene one by one. Instead, the target subspace node associated with the 2D selection area is quickly queried through the hash mapping table. Then, all geometric objects within the corresponding nodes of the target subspace nodes are extracted from the adaptive spatial index structure, forming a candidate set of geometric objects. The target set of geometric objects is obtained by filtering the candidate set. This process significantly reduces redundant computation and invalid retrieval operations, effectively solving the problems of response delay and interface lag that traditional selection methods often encounter in large-scale, high-density 3D model scenes. This significantly improves the interactive efficiency and smoothness of object selection, thereby effectively enhancing the overall user experience and work efficiency of the 3D CAD software.
[0068] The adaptive spatial index structure automatically adjusts and adapts to the actual spatial distribution and size range of the 3D model to be processed within the scene. This eliminates the need for manual pre-setting of index parameters and the need to rebuild the spatial index for 3D model scenes of different specifications and layouts, thus lowering the barrier to entry for users. Furthermore, the adaptive spatial index structure is compatible with various complex shapes and sizes of 3D geometric objects, broadly adapting to the selection needs of 3D CAD models in fields such as architecture, machinery, and electrical engineering.
[0069] First, a coarse screening of the candidate geometric object set is completed through a hash relationship mapping table and an adaptive spatial index structure, quickly eliminating geometric objects that are irrelevant to the two-dimensional selection area. Then, hardware-level pixel sampling is performed through rendering pipeline template testing. Within the two-dimensional selection area formed by the user's selection, the number of visible pixels and complete pixels is compared by the two sampling results to determine whether the current candidate geometric object is unobstructed and completely located within the two-dimensional selection area. This effectively eliminates invalid objects that are obstructed or partially outside the selection range, resulting in the target geometric object set. This completely solves the defects of traditional selection methods, such as susceptibility to occlusion interference, high misselection rate, and serious omissions, ensuring accurate and reliable selection results and meeting the core needs of refined modeling and editing in 3D CAD software.
[0070] The hash mapping table enables rapid binding and querying of the identity ID and spatial storage location of the geometric objects to be processed, resulting in low data retrieval complexity and low computational overhead. The fine screening of the candidate geometric object set relies on hardware acceleration through native template testing in the rendering pipeline, without the need for additional complex algorithm calculations. This improves selection efficiency and accuracy while effectively reducing the resource consumption of system memory and graphics processor, thus balancing operational efficiency and system stability.
[0071] In one exemplary embodiment, a computer device is provided, which may be a server or a terminal, and its internal structure diagram may be as follows. Figure 7As shown, this computer device includes a processor, memory, input / output (I / O) interfaces, and a communication interface. The processor, memory, and I / O interfaces are connected via a system bus, and the communication interface is also connected to the system bus via the I / O interfaces. The processor provides computational and control capabilities. The memory includes non-volatile storage media and internal memory. The non-volatile storage media stores the operating system, computer programs, and a database. The internal memory provides the environment for the operation of the operating system and computer programs stored in the non-volatile storage media. The database stores selection and interaction data applicable to a 3D CAD system. The I / O interfaces are used for information exchange between the processor and external devices. The communication interface is used for communication with external terminals via a network connection. When executed by the processor, the computer program implements a selection and interaction method applicable to a 3D CAD system.
[0072] Those skilled in the art will understand that Figure 7 The structure shown is merely a block diagram of a portion of the structure related to the present application and does not constitute a limitation on the computer device to which the present application is applied. Specific computer devices may include more or fewer components than those shown in the figure, or combine certain components, or have different component arrangements.
[0073] In one exemplary embodiment, a computer device is also provided, including a memory and a processor, wherein the memory stores a computer program, and the processor executes the computer program to implement the steps in the above-described method embodiments.
[0074] In one exemplary embodiment, a computer-readable storage medium is provided storing a computer program that, when executed by a processor, implements the steps in the above-described method embodiments.
[0075] In one exemplary embodiment, a computer program product is provided, including a computer program that, when executed by a processor, implements the steps in the above-described method embodiments.
[0076] 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, and the collection, use and processing of the relevant data must comply with relevant regulations.
[0077] Those skilled in the art will understand that all or part of the processes in the above embodiments can be implemented by a computer program instructing related hardware. The computer program can be stored in a non-volatile computer-readable storage medium. When executed, the computer program can include the processes of the embodiments described above. Any references to memory, databases, or other media used in the embodiments provided in this application can include at least one of non-volatile and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetic random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. By way of illustration and not limitation, RAM can take many forms, such as Static Random Access Memory (SRAM) or Dynamic Random Access Memory (DRAM).
[0078] The databases involved in the embodiments provided in this application may include at least one type of relational database and non-relational database. Non-relational databases may include, but are not limited to, blockchain-based distributed databases. The processors involved in the embodiments provided in this application may be general-purpose processors, central processing units, graphics processing units, digital signal processors, programmable logic devices, quantum computing-based data processing logic devices, etc., and are not limited to these.
[0079] The technical features of the above embodiments can be combined in any way. For the sake of brevity, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0080] This document uses specific examples to illustrate the principles and implementation methods of this application. The descriptions of the above embodiments are only for the purpose of helping to understand the methods and core ideas of this application. Furthermore, those skilled in the art will recognize that, based on the ideas of this application, there will be changes in the specific implementation methods and application scope. Therefore, the content of this specification should not be construed as a limitation of this application.
Claims
1. A selection interaction method applicable to a 3D CAD system, characterized in that, The selection and interaction method for the applicable 3D CAD system includes: During the startup process of the 3D CAD system, the spatial index structure is initialized and an empty hash table is created; the spatial index structure is an octree structure. Load all 3D models to be processed in the current scene, and uniquely encode the geometric objects of all 3D models to be processed, generating several geometric objects to be processed with unique IDs; Calculate the bounding box of each of the geometric objects to be processed to obtain a number of object bounding boxes; Traverse several of the object bounding boxes and perform spatial verification on each object bounding box in turn; If the current object's bounding box exceeds the initial space of the current spatial index structure, then the current spatial index structure is expanded according to the half-length of the root node of the initial space to obtain the current expanded spatial index structure; the geometric object corresponding to the current object's bounding box is inserted into the expanded subspace node of the current expanded spatial index structure. If the current object's bounding box does not exceed the current spatial index structure, directly insert the geometric object corresponding to the current object's bounding box into the corresponding subspace node of the current spatial index structure; Iterate through all bounding boxes of objects until all geometric objects to be processed have been inserted, and obtain an adaptive spatial index structure. Add the identity ID of all geometric objects to be processed and their storage location in the adaptive spatial index structure to the empty hash table to generate a hash mapping table between identity ID and storage location; In response to the user's target selection operation, a two-dimensional selection area is obtained; Convert all geometric objects to be selected within the two-dimensional bounding box into a three-dimensional query bounding box; Based on the spatial range of the three-dimensional query bounding box, and by matching and retrieving octree subspace nodes with overlapping spatial relationships through a hash relation mapping table, target subspace nodes corresponding to the selected range are obtained. In the adaptive spatial index structure, all geometric objects corresponding to the target subspace node are obtained to obtain a candidate geometric object set. Within the two-dimensional selection area, each candidate geometric object in the candidate geometric object set is subjected to two hardware rendering samples. During the first rendering sample, the number of visible pixel samples of the current candidate geometric object within the two-dimensional selection area is counted. During the second rendering sample, the number of complete pixel samples of the current candidate geometric object during normal rendering is counted. If the number of visible pixel samples is equal to the number of complete pixel samples, then the current candidate geometric object is unobstructed and completely located within the two-dimensional bounding box area, and the current candidate geometric object is retained. If the number of visible pixel samples is not equal to the number of complete pixel samples, then the current candidate geometric object is occluded or not completely located within the two-dimensional bounding box area, and the current candidate geometric object is removed; wherein, all the retained current candidate geometric objects form the target geometric object set.
2. The selection and interaction method applicable to a 3D CAD system according to claim 1, characterized in that, The step involves retrieving all geometric objects corresponding to the target subspace node from the adaptive spatial index structure to obtain a candidate geometric object set, including: Locate all nodes in the adaptive spatial index structure that correspond to the target subspace node, and extract the geometric objects stored in all nodes; Perform intersection checks on all extracted geometric objects in sequence; If the bounding box of the current geometric object intersects with the corresponding 3D query bounding box, then the current geometric object is retained. If the bounding box of the current geometric object does not intersect with the corresponding 3D query bounding box, it is discarded; wherein, all the retained geometric objects form the candidate geometric object set.
3. The selection and interaction method applicable to a 3D CAD system according to claim 1, characterized in that, After obtaining the target geometric object set, the method further includes: All target geometric objects within the target geometric object set are highlighted to provide users with clear visual feedback to complete the selection interaction.
4. A selection interaction device applicable to a 3D CAD system, characterized in that, The selection and interaction device for the applicable 3D CAD system includes: An initialization module is used to initialize the spatial index structure and create an empty hash table during the startup process of the 3D CAD system; the spatial index structure is an octree structure. The loading and encoding module is used to load all 3D models to be processed in the current scene, and to uniquely encode the geometric objects of all 3D models to be processed, generating several geometric objects to be processed with unique IDs. An extended insertion module is used to calculate the bounding box of each geometric object to be processed, resulting in several object bounding boxes; it traverses these object bounding boxes and performs spatial verification on each of them sequentially; if the current object bounding box exceeds the initial space of the current spatial index structure, the current spatial index structure is expanded according to the half-length of the root node of the initial space, resulting in a current expanded spatial index structure; the geometric object corresponding to the current object bounding box is inserted into the expanded subspace node of the current expanded spatial index structure; if the current object bounding box does not exceed the current spatial index structure, the geometric object corresponding to the current object bounding box is directly inserted into the corresponding subspace node of the current spatial index structure; the process continues until all object bounding boxes are traversed and inserted, resulting in an adaptive spatial index structure. The generation module is used to add the identity ID of all geometric objects to be processed and their storage location in the adaptive spatial index structure to the empty hash table, and generate a hash mapping table between identity ID and storage location; The query response module is used to respond to the user's target selection operation and obtain a two-dimensional bounding box area; convert all geometric objects to be selected within the two-dimensional bounding box area into a three-dimensional query bounding box; and based on the spatial range of the three-dimensional query bounding box, match and retrieve octree subspace nodes with overlapping spatial relationships through a hash relationship mapping table to filter out the target subspace nodes corresponding to the selection range. The acquisition module is used to acquire all geometric objects corresponding to the target subspace node in the adaptive spatial index structure, and obtain a candidate geometric object set; The sampling and filtering module is used to perform two hardware rendering samples on each candidate geometric object in the candidate geometric object set within a two-dimensional selection area. During the first rendering sample, the number of visible pixel samples of the current candidate geometric object within the two-dimensional selection area is counted. During the second rendering sample, the number of complete pixel samples of the current candidate geometric object during normal rendering is counted. If the number of visible pixel samples is equal to the number of complete pixel samples, the current candidate geometric object is unobstructed and completely located within the two-dimensional selection area, and is retained. If the number of visible pixel samples is not equal to the number of complete pixel samples, the current candidate geometric object is occluded or not completely located within the two-dimensional selection area, and is discarded. All retained current candidate geometric objects form the target geometric object set.
5. A computer device, comprising: A memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that the processor executes the computer program to implement the steps of the selection interaction method applicable to any three-dimensional CAD system according to any one of claims 1-3.
6. A computer-readable storage medium having a computer program stored thereon, characterized in that, When executed by a processor, the computer program implements the steps of the selection interaction method applicable to any three-dimensional CAD system as described in any one of claims 1-3.
7. A computer program product, comprising a computer program, characterized in that, When executed by a processor, the computer program implements the steps of the selection interaction method applicable to any three-dimensional CAD system as described in any one of claims 1-3.
Citation Information
Patent Citations
Ground feature recognition method based on inclined three-dimensional model, terminal equipment and storage medium
CN118053072A
Selection interaction method and device suitable for three-dimensional CAD system and medium
CN118097011A