Method and apparatus for processing virtual component, electronic device, computer-readable storage medium, and computer program product

Through the steps of preprocessing, triangulation, double-layer structure detection, vertex division and coplanar fitting in the virtual component processing method, the problem of inefficient coplanar fitting of virtual models in the prior art is solved, and efficient coplanar fitting of the two-layer structure model is achieved, and processing efficiency and accuracy are improved.

WO2025102852A1PCT designated stage expired Publication Date: 2025-05-22TENCENT TECHNOLOGY (SHENZHEN) CO LTD
View PDF 4 Cites 0 Cited by

Patent Information

Application Number
PCT/CN2024/111217
Authority / Receiving Office
WO · WO
Patent Type
Applications
Current Assignee / Owner
Priority Date
2023-11-14
Filing Date
2024-08-09
Publication Date
2025-05-22

AI Technical Summary

Technical Problem

In the prior art, when performing coplanar fitting of virtual models, especially for model components with a two-layer structure, the error is large and the processing efficiency is low. Especially when the model structure is complex, the workload of manual re-topology is huge.

Method used

Through a virtual component processing method, including preprocessing, triangulation, double-layer structure detection, vertex division and coplanar fitting, virtual components with a double-layer structure are automatically coplanarly fitted to obtain the target fitting results of a single-layer structure.

Benefits of technology

The processing efficiency and accuracy of coplanar fitting are improved, the processing complexity is reduced, the robustness of coplanar fitting is ensured, and the complexity of the three-dimensional model is simplified.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN2024111217_22052025_PF_FP_ABST
    Figure CN2024111217_22052025_PF_FP_ABST
Patent Text Reader

Abstract

The present application provides a method and apparatus for processing a virtual component, a device, and a computer-readable storage medium. The method comprises: obtaining a component to be processed, performing pre-processing on the component to be processed, and obtaining a first alpha package result of the component to be processed; performing triangulation on the first alpha package result, and obtaining a triangulation result; on the basis of the triangulation result and the first alpha package result, performing double-layer structure detection on the component to be processed, and obtaining a detection result; when the detection result indicates that the component to be processed comprises a first surface and a second surface that meet a parallel condition, grouping vertices included in the first alpha package result into a first vertex set located on the first surface and a second vertex set located on the second surface; and on the basis of the first vertex set and the second vertex set, performing coplanar fitting on the first surface and the second surface, and obtaining a target fitting result.
Need to check novelty before this filing date? Find Prior Art

Description

A virtual component processing method, device, electronic device, computer-readable storage medium, and computer program product

[0001] CROSS-REFERENCE TO RELATED APPLICATIONS

[0002] This application is based on the Chinese patent application with application number 202311510952.3 and application date of November 14, 2023, and claims the priority of the above Chinese patent application. The entire content of the above Chinese patent application is hereby introduced into this application as a reference. Technical Field

[0003] The present application relates to data processing technology, and in particular to a virtual component processing method, device, electronic device, computer-readable storage medium, and computer program product. Background Art

[0004] In gaming, virtual reality, or augmented reality scenarios, after generating a virtual model and obtaining its topological structure, retopology technology is required to reconstruct and represent the model in order to achieve a better topological structure and a more reasonable face distribution. Retopology can be divided into automatic retopology and manual retopology. In related technologies, automatic retopology suffers from large errors when performing coplanar fitting of model components with a two-layer structure, necessitating manual retopology. When the model structure is complex, manual retopology is extremely labor-intensive and inefficient.

[0005] Summary of the Invention

[0006] Embodiments of the present application provide a virtual component processing method, apparatus, electronic device, computer-readable storage medium, and computer program product, which can improve the processing efficiency of coplanar fitting of components with a double-layer structure.

[0007] The technical solution of the embodiment of the present application is implemented as follows:

[0008] An embodiment of the present application provides a virtual component processing method, which is applied to an electronic device, and the method includes:

[0009] Acquire a component to be processed, perform preprocessing on the component to be processed, and obtain a first alpha wrapping result of the component to be processed;

[0010] performing triangulation processing on the first alpha wrapping result to obtain a triangulated processing result;

[0011] Performing a double-layer structure inspection on the component to be processed based on the triangulation processing result and the first alpha wrapping result to obtain an inspection result;

[0012] When the detection result indicates that the component to be processed includes a first surface and a second surface that meet a parallel condition, dividing the vertices included in the first alpha wrapping result into a first vertex set located on the first surface and a second vertex set located on the second surface;

[0013] Based on the first vertex set and the second vertex set, the first surface and the second surface are coplanarly fitted to obtain a target fitting result.

[0014] An embodiment of the present application provides a virtual component processing device, including:

[0015] a preprocessing module configured to obtain a component to be processed, preprocess the component to be processed, and obtain a first alpha wrapping result of the component to be processed;

[0016] a triangulation processing module configured to perform triangulation processing on the first alpha wrapping result to obtain a triangulation processing result;

[0017] a double-layer structure detection module configured to perform a double-layer structure detection on the component to be processed based on the triangulation processing result and the first alpha wrapping result to obtain a detection result;

[0018] a vertex partitioning module configured to, when the detection result indicates that the component to be processed includes a first surface and a second surface that satisfy a parallel condition, partition the vertices included in the first alpha wrapping result into a first vertex set located on the first surface and a second vertex set located on the second surface;

[0019] The coplanar fitting module is configured to perform coplanar fitting on the first surface and the second surface based on the first vertex set and the second vertex set to obtain a target fitting result.

[0020] An embodiment of the present application provides an electronic device, comprising:

[0021] a memory for storing computer-executable instructions;

[0022] The processor is configured to implement the virtual component processing method provided in the embodiment of the present application when executing the computer executable instructions stored in the memory.

[0023] An embodiment of the present application provides a computer-readable storage medium storing a computer program or computer-executable instructions for implementing the virtual component processing method provided in the embodiment of the present application when executed by a processor.

[0024] An embodiment of the present application provides a computer program product, including a computer program or computer-executable instructions. When the computer program or computer-executable instructions are executed by a processor, the virtual component processing method provided in the embodiment of the present application is implemented.

[0025] The embodiments of the present application have the following beneficial effects:

[0026] After obtaining the component to be processed, the first alpha wrapping result of the component to be processed is determined first, so that a flat, orientable, two-manifold and non-self-intersecting watertight grid model can be obtained. The first alpha wrapping result is then triangulated to obtain a triangulated result. Then, a double-layer structure detection is performed on the component to be processed based on the triangulated result and the first alpha wrapping result. When the detection result indicates that the component to be processed includes a first face and a second face that meet the parallel condition, that is, when the detection result indicates that the component to be processed is a double-layer structure, the vertices included in the first alpha wrapping result are divided into a first vertex set located on the first face and a second vertex set located on the second face, so that the first face and the second face are parallelized based on the first vertex set and the second vertex set. Surface fitting is performed to obtain a target fitting result, wherein the target fitting result is a single-layer structure. That is to say, using the virtual component processing method provided in the embodiment of the present application, only when the component to be processed includes a first surface and a second surface that satisfy the parallel condition, the component to be processed with a double-layer structure will be automatically coplanar fitted. When the component to be processed does not have a parallel double-layer structure, that is, when the component to be processed does not include a first surface and a second surface that satisfy the parallel condition, the component to be processed will not be coplanar fitted, thereby ensuring the smooth execution of the coplanar fitting and improving the robustness of the coplanar fitting. Moreover, since the component to be processed that is coplanar fitted has a first surface and a second surface that satisfy the parallel condition, the processing complexity of the coplanar fitting can be reduced, thereby improving the processing efficiency of the coplanar fitting. BRIEF DESCRIPTION OF THE DRAWINGS

[0027] FIG1A is a schematic diagram of a portion of a virtual component having a double-layer structure on a game character model;

[0028] Figure 1B is a schematic diagram of the alpha wrapping results of the bicycle model under different parameters;

[0029] FIG1C is a schematic diagram of the 3D Delaunay triangulation results of a sphere and a cube;

[0030] FIG1D is a schematic diagram of the results of fitting the model in different dimensions using the PCA method;

[0031] FIG2 is a schematic diagram of the network architecture of the model processing system provided in an embodiment of the present application;

[0032] FIG3 is a schematic diagram of the structure of a server 400 provided in an embodiment of the present application;

[0033] FIG4A is a schematic diagram of an implementation flow of a virtual component processing method provided in an embodiment of the present application;

[0034] FIG4B is a schematic diagram of a process for implementing pre-processing of a component to be processed according to an embodiment of the present application;

[0035] FIG4C is a schematic diagram of the implementation process of double-layer detection provided in an embodiment of the present application;

[0036] FIG5A is a schematic diagram of an implementation flow of vertex partitioning provided in an embodiment of the present application;

[0037] FIG5B is a schematic diagram of an implementation flow of classifying the endpoints of the remaining first connection edges provided by an embodiment of the present application;

[0038] FIG5C is a schematic diagram of an implementation process for classifying other vertices in a target package result according to an embodiment of the present application;

[0039] FIG6 is a schematic diagram of a process for implementing coplanar fitting of a first surface and a second surface according to an embodiment of the present application;

[0040] FIG7 is a schematic diagram of an implementation process for determining an initial coplanar fitting result from the first surface after moving and the second surface after moving based on the minimum distance provided by an embodiment of the present application;

[0041] FIG8 is a schematic diagram of the original model and the generated flat alpha wrapping result provided in an embodiment of the present application;

[0042] FIG9 is a schematic diagram of a double-layer structure detection process provided in an embodiment of the present application;

[0043] FIG10 is a schematic diagram showing a comparison of an original component to be processed having a double-layer structure and its corresponding coplanar fitting result provided by an embodiment of the present application;

[0044] FIG11 is a schematic diagram showing a comparison of a panel structure and its corresponding coplanar fitting result provided in an embodiment of the present application;

[0045] FIG12 is a schematic diagram showing a comparison of a feather component with a double-layer structure and its corresponding coplanar fitting results provided in an embodiment of the present application. DETAILED DESCRIPTION

[0046] In order to make the purpose, technical solutions and advantages of this application clearer, the application will be further described in detail below with reference to the accompanying drawings. The described embodiments should not be regarded as limiting this application. All other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of this application.

[0047] In the following description, reference is made to “some embodiments”, which describes a subset of all possible embodiments, but it will be understood that “some embodiments” may be the same subset or different subsets of all possible embodiments and may be combined with each other without conflict.

[0048] In the following description, the terms "first\second" involved are merely used to distinguish similar objects and do not represent a specific ordering of the objects. It is understandable that "first\second" can be interchanged with a specific order or sequence where permitted, so that the embodiments of the present application described herein can be implemented in an order other than that illustrated or described herein.

[0049] In the embodiments of the present application, the term "module" or "unit" refers to a computer program or a part of a computer program that has a predetermined function and works together with other related parts to achieve a predetermined goal, and can be fully or partially implemented by using software, hardware (such as processing circuits or memories) or a combination thereof. Similarly, a processor (or multiple processors or memories) can be used to implement one or more modules or units. In addition, each module or unit can be part of an overall module or unit that includes the function of the module or unit.

[0050] Unless otherwise defined, all technical and scientific terms used in the embodiments of the present application have the same meanings as those commonly understood by those skilled in the art. The terms used in the embodiments of the present application are only for the purpose of describing the embodiments of the present application and are not intended to limit the present application.

[0051] Before further explaining the embodiments of the present application in detail, the nouns and terms involved in the embodiments of the present application are explained. The nouns and terms involved in the embodiments of the present application are subject to the following interpretations.

[0052] 1) Component. In the embodiment of the present application, a component refers to an independent connected mesh, which can usually represent an independent semantics (such as shoelaces, necklace straps, etc.), but does not share geometric elements (such as faces, edges, vertices, etc.) with other components.

[0053] 2) Model: A model is a collection of multi-connected meshes composed of one or more components that can express higher-level semantics. For example, a virtual character model in a game might include shoelaces, necklace straps, clothing laces, a top, pants, a nude model, and other components.

[0054] 3) Double-layer Structure: Some virtual components are primarily composed of two nearly parallel connected discrete surface sets, with the distance between these two connected discrete surface sets being relatively close. Such virtual components are said to have a double-layer structure. Figure 1A is a schematic diagram of some virtual components with double-layer structures on a game character model. In Figure 1A, 011 shows the double-layer structure of shoelaces, and 012 shows the double-layer structure of angel feathers.

[0055] 4) Single-layer structure, which is composed of a set of connected discrete surfaces and has open boundaries.

[0056] 5) Alpha Wrapping: Given a three-dimensional shape (such as a point cloud, triangle soup, a watertight mesh model, etc.), an alpha wrapping of the shape can be generated as a conservative approximation of the original three-dimensional shape. Alpha wrapping is a watertight mesh model that can strictly wrap the original shape and is guaranteed to be orientable, two-manifold, and non-self-intersecting. This method has been integrated into the CGAL library. Figure 1B is a schematic diagram of the alpha wrapping results of the bicycle model under different parameters. Among them, the two key parameters alpha and offset can be used to control the accuracy and size of the wrapping. In Figure 1B, 021 is the original bicycle model, and 022, 023, and 024 are the alpha wrapping results of the bicycle model under different parameters.

[0057] 6) 3D Delaunay Triangulation: 3D triangulation refers to the process of discretizing the convex hull of a point cloud distributed in a 3D space. Generally speaking, the discretized result can be a tetrahedron or a hexahedron. 3D Delaunay triangulation is a special type of triangulation method that generates tetrahedral elements and ensures that the circumscribed sphere of each tetrahedral unit does not include other vertices. Figure 1C is a schematic diagram of the 3D Delaunay triangulation results of a sphere and a cube, where 031 in Figure 1C is the 3D Delaunay triangulation result of a sphere, and 032 is the 3D Delaunay triangulation result of a cube.

[0058] 7) Bounding Box is an algorithm for finding the optimal bounding space for a discrete set of points. The basic idea is to use a slightly larger geometric body with simpler characteristics (called a bounding box) to approximate a complex geometric object.

[0059] 8) Axis-Aligned Bounding Box (AABB) (2D): A rectangle defined by the coordinate ranges of all elements in a geometric body. This bounding box is the smallest rectangle that can exactly enclose the entire body, among all rectangles that are parallel or perpendicular to the coordinate axes.

[0060] 9) AABB Tree: A spatial search tree based on the Kd-tree principle, where each node represents the bounding box of a 3D geometric primitive. This data structure can quickly report whether the query primitive intersects with primitives in the tree, as well as the specific intersection type and intersection location.

[0061] 10) Coplanar fitting is a modeling technique used to fit three-dimensional data points on a virtual model onto the same plane. This technique is commonly used to create virtual models in computer graphics or process data in medical imaging. Specifically, coplanar fitting of a virtual model involves combining multiple two-dimensional images or cross-sectional data into a continuous three-dimensional model. This is usually achieved by mapping a set of two-dimensional data points onto the same plane, so that these data points form a continuous model in three-dimensional space. This method can create realistic virtual models and use them in various applications such as computer games, medical visualization, virtual reality, etc.

[0062] 11) Smoothing refers to filtering or smoothing the model fitting results to remove noise and improve the model's visual quality. Smoothing can be achieved using algorithms such as moving average and Gaussian filtering. These algorithms can effectively remove noise while retaining useful signals, making the model smoother and more natural.

[0063] In order to better understand the virtual component processing method provided in the embodiment of the present application, the model fitting method in the related art and its shortcomings are first explained.

[0064] The main idea of ​​model fitting in related technologies is to find a low-dimensional shape to approximate a bounded three-dimensional shape (such as a point cloud, a two-dimensional plane figure, a three-dimensional mesh model, etc.) under a certain metric, so that the error is minimized under this metric. As shown in Figure 1D, for point cloud data on a two-dimensional plane, the principal component analysis (PCA) method can be used to find a straight line to fit it; for three-dimensional point cloud data, it can be fitted with a straight line or a plane; similarly, for a three-dimensional model, a plane can also be used to fit it. For some simple applications, the goal of simplification can be achieved through model fitting technology. For example, a surface close to a plane can be approximated by a plane.

[0065] The PCA-based method can achieve the best approximation of the original model through a plane, and the plane is indeed a single-layer structure. However, if the original model is more complex, the error of fitting with a plane will be relatively large.

[0066] Based on this, the embodiments of the present application provide a virtual component processing method, apparatus, device, computer-readable storage medium, and computer program product, which can improve the processing efficiency and accuracy of coplanar fitting. The following describes an exemplary application of the electronic device provided by the embodiments of the present application. The device provided by the embodiments of the present application can be implemented as various types of user terminals such as laptops, tablet computers, desktop computers, set-top boxes, mobile devices (e.g., mobile phones, portable music players, personal digital assistants, dedicated messaging devices, portable gaming devices), smart phones, smart speakers, smart watches, smart TVs, and vehicle-mounted terminals, and can also be implemented as servers. Below, an exemplary application when the device is implemented as a server will be described.

[0067] Referring to FIG. 2 , FIG. 2 is a schematic diagram of the architecture of a model processing system 100 provided in an embodiment of the present application. As shown in FIG. 2 , the model processing system 100 includes a terminal 200, a network 300, and a server 400. The terminal 200 is connected to the server 400 via the network 300. The network 300 may be a wide area network or a local area network, or a combination of the two. The model processing system 100 may also include a database 500 for storing data. The database 500 may be independent of the server 400 or may be integrated with the server 400. FIG. 2 illustrates an example in which the database 500 is independent of the server 400.

[0068] The terminal 200 is used to perform model design and model rendering. In response to the received model design operation, the terminal determines the three-dimensional model of the designed virtual object, and then the terminal 200 sends the three-dimensional model to the server. The server 400 obtains the model information and determines the various components included in the three-dimensional model, which may include clothing components, accessory components, model body components, etc. The server 400 determines each component included in the three-dimensional model as a component to be processed, and then uses the virtual component processing method provided by the embodiment of the present application to process each component to be processed. When it is determined that the component to be processed includes a first surface and a second surface that meet the parallel condition, the first surface and the second surface are coplanar fitted to obtain a target fitting result, which is a single-layer structure. In other words, the virtual component processing method provided by the embodiment of the present application can achieve coplanar fitting of a component to be processed with a double-layer structure and output a target fitting result of a single-layer structure. Compared with the solution in the related art that can only input a component to be processed with a single-layer structure and output a target fitting result of a single-layer structure, the robustness and processing efficiency of coplanar fitting of the component to be processed with a double-layer structure are improved. For components to be processed that do not have a first surface and a second surface that meet the parallel condition, the server 400 does not perform coplanar fitting processing and directly outputs the processed components. After the server 400 performs double-layer detection on each component to be processed and performs fitting processing on the components to be processed with a double-layer structure, it forms a processed three-dimensional model based on the target fitting result and other unprocessed components to be processed. The server 400 sends the processed model information to the terminal 200, and the terminal 200 performs UV unfolding processing based on the processed model information to obtain a two-dimensional unfolding result of the processed three-dimensional model, and then performs two-dimensional rendering based on the two-dimensional unfolding result. Since the double-layer structure components in the processed three-dimensional model have been coplanar fitted into a single-layer structure, this can greatly simplify the complexity of the three-dimensional model while ensuring the accuracy of the model structure, thereby improving the processing efficiency of UV unfolding and two-dimensional rendering.

[0069] In some embodiments, the server 400 can be an independent physical server, or a server cluster or distributed system composed of multiple physical servers, or a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, content delivery networks (CDNs), and big data and artificial intelligence platforms. The terminal 200 can be a smart phone, a tablet computer, a laptop computer, a desktop computer, a smart speaker, a smart watch, a car terminal, etc., but is not limited to this. The terminal and the server can be directly or indirectly connected via wired or wireless communication, which is not limited in the embodiments of the present application.

[0070] Referring to Figure 3, Figure 3 is a schematic diagram of the structure of a server 400 provided in an embodiment of the present application. The server 400 shown in Figure 3 includes: at least one processor 410, a memory 450, at least one network interface 420, and a user interface 430. The various components in the server 400 are coupled together via a bus system 440. It can be understood that the bus system 440 is used to achieve connection and communication between these components. In addition to including a data bus, the bus system 440 also includes a power bus, a control bus, and a status signal bus. However, for the sake of clarity, in Figure 2, all various buses are labeled as bus system 440.

[0071] The processor 410 can be an integrated circuit chip with signal processing capabilities, such as a general-purpose processor, a digital signal processor (DSP), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc., where the general-purpose processor can be a microprocessor or any conventional processor, etc.

[0072] The user interface 430 includes one or more output devices 431 that enable presentation of media content, including one or more speakers and / or one or more visual display screens. The user interface 430 also includes one or more input devices 432, including user interface components that facilitate user input, such as a keyboard, mouse, microphone, touch screen display, camera, other input buttons and controls.

[0073] The memory 450 may be removable, non-removable, or a combination thereof. Exemplary hardware devices include solid-state memory, hard drives, optical drives, etc. The memory 450 may optionally include one or more storage devices that are physically remote from the processor 410.

[0074] The memory 450 includes volatile memory or non-volatile memory, or may include both volatile and non-volatile memory. The non-volatile memory may be a read-only memory (ROM), and the volatile memory may be a random access memory (RAM). The memory 450 described in the embodiments of the present application is intended to include any suitable type of memory.

[0075] In some embodiments, the memory 450 can store data to support various operations, examples of which include programs, modules, and data structures, or a subset or superset thereof, as exemplified below.

[0076] Operating system 451, including system programs for processing various basic system services and performing hardware-related tasks, such as the framework layer, core library layer, and driver layer, which are used to implement various basic services and process hardware-based tasks;

[0077] A network communication module 452 for reaching other electronic devices via one or more (wired or wireless) network interfaces 420 , exemplary network interfaces 420 including Bluetooth, Wi-Fi, and Universal Serial Bus (USB);

[0078] a presentation module 453 for enabling presentation of information via one or more output devices 431 (e.g., a display screen, a speaker, etc.) associated with the user interface 430 (e.g., a user interface for operating peripheral devices and displaying content and information);

[0079] The input processing module 454 is configured to detect one or more user inputs or interactions from one of the one or more input devices 432 and to translate the detected inputs or interactions.

[0080] In some embodiments, the apparatus provided by the embodiments of the present application can be implemented using software. FIG3 shows a virtual component processing apparatus 455 stored in memory 450 . This apparatus can be software in the form of a program or plug-in, and includes the following software modules: a preprocessing module 4551 , a triangulation processing module 4552 , a two-layer structure detection module 4553 , a vertex partitioning module 4554 , and a coplanar fitting module 4555 . These modules are logical and can be arbitrarily combined or further separated according to the functions implemented. The functions of each module will be described below.

[0081] In other embodiments, the apparatus provided in the embodiments of the present application may be implemented in hardware. As an example, the apparatus provided in the embodiments of the present application may be a processor in the form of a hardware decoding processor, which is programmed to execute the virtual component processing method provided in the embodiments of the present application. For example, the processor in the form of a hardware decoding processor may be one or more application-specific integrated circuits (ASICs), digital signal processors (DSPs), programmable logic devices (PLDs), complex programmable logic devices (CPLDs), field-programmable gate arrays (FPGAs), or other electronic components.

[0082] The virtual component processing method provided in the embodiment of the present application will be explained in combination with the exemplary application and implementation of the server provided in the embodiment of the present application.

[0083] The following describes the virtual component processing method provided by the embodiment of the present application. As previously mentioned, the electronic device that implements the virtual component processing method of the embodiment of the present application can be a terminal, a server, or a combination of the two. Therefore, the execution entity of each step will not be repeated below.

[0084] Refer to Figure 4A, which is a schematic diagram of an implementation flow of the virtual component processing method provided in an embodiment of the present application. It will be explained in conjunction with the steps shown in Figure 4A. The main body of the steps in Figure 4A is the server.

[0085] In step 101, a component to be processed is obtained, and pre-processed to obtain a first alpha wrapping result of the component to be processed.

[0086] In some embodiments, a virtual model to be processed is first obtained. The virtual model to be processed may be a virtual character model, a virtual building model, a virtual prop model, etc. The virtual model to be processed is composed of multiple virtual components. For example, for a virtual character model, it includes virtual components such as virtual clothing, virtual accessories, and virtual characters. Each virtual component in the virtual model to be processed is determined as a component to be processed in turn, and is processed using the virtual component processing method provided in the embodiments of the present application.

[0087] In some embodiments, referring to FIG4B , “pre-processing the component to be processed to obtain the first alpha wrapping result of the component to be processed” in step 101 may be implemented by steps 1011 to 1013 , which will be described below in conjunction with FIG4B .

[0088] In step 1011, a first processing parameter value is obtained, and a second alpha wrapping result of the component to be processed is generated using the first processing parameter value.

[0089] In some embodiments, an axis-aligned bounding box (ABO) of the component to be processed is first obtained. The ABO of the component to be processed can be calculated using a library function provided by CGAL, and the diagonal length of the ABO is determined. Based on the diagonal length, a first processing parameter value is determined. The first processing parameter value includes a first size parameter value and a first offset parameter value. The first size parameter value controls the maximum size of the cavity that the shrink-wrap process can enter, and the first offset parameter value controls the degree of offset of the final surface mesh from the input. A smaller first offset parameter value results in a smaller offset of the final surface mesh from the input, indicating a tighter wrapping of the final surface mesh. The first size parameter value and the first offset parameter value can be used to balance the fidelity of the input and the complexity of the output. For example, the first size parameter value can be 1 / 50 of the diagonal length, and the first offset parameter value can be 1 / 100 of the diagonal length. After determining the first size parameter value and the first offset parameter value, the CGAL library function for generating an alpha wrap can be called to generate a second alpha wrap result for the component to be processed. The input of the library function for generating alpha wrapping includes the vertex data of the component to be processed, the first size parameter value and the first offset parameter value, and the output data is a valid (watertight, non-intersecting and combined 2-manifold) surface triangle mesh containing the component to be processed. Therefore, generating the second alpha wrapping result of the component to be processed can be understood as the first meshing processing of the component to be processed, or as the first triangulation processing of the component to be processed.

[0090] In step 1012 , a plurality of target points are determined based on the second alpha wrapping result.

[0091] Wherein, the target point is located inside the second alpha wrapping result. In some embodiments, step 1012 can be implemented by the following two methods:

[0092] The first method: meshing the second alpha wrapping result to obtain a meshed alpha wrapping result; determining the vertices, midpoints of the connecting edges and the center of gravity of the triangles of the meshed alpha wrapping result as first sampling points; determining the normal of each first sampling point toward the interior of the meshed alpha wrapping result, and determining the intersection of the normal and the meshed alpha wrapping result; determining the midpoint between each first sampling point and the corresponding intersection point, and determining the midpoint as the target point.

[0093] Since generating the second alpha wrapping result of the component to be processed can be understood as the first meshing process of the component to be processed, meshing the second alpha wrapping result is the second meshing process, and therefore, it can be understood as remeshing the second alpha result.

[0094] In some embodiments, the second alpha wrapping result can be meshed using library functions provided by CGAL to obtain a meshed alpha wrapping result. The meshed alpha wrapping result includes triangles that are all equilateral triangles, and the difference in area between any two triangles is less than a certain area threshold. After obtaining the meshed alpha wrapping result, the midpoints of each connecting edge in the meshed alpha wrapping result are determined based on the vertex coordinates of each connecting edge, and the centroid of each triangle is determined based on the vertex coordinates of each triangle. The vertices, midpoints of the connecting edges, and centroids of the triangles in the meshed alpha wrapping result are then determined as first sampling points. For each first sampling point, a normal pointing toward the interior of the meshed alpha wrapping result is calculated, and the intersection of the normal and the meshed alpha wrapping result is determined. The midpoint between the first sampling point and the intersection is determined as the target point. Since the normal is directed toward the interior of the alpha wrapping result, and the first sampling point and the intersection are both located on the meshed alpha wrapping result, the midpoint between the first sampling point and the intersection is guaranteed to be located within the alpha wrapping result.

[0095] In the first implementation method, by taking the midpoint of the intersection of the first sampling point and the normal as the target point, a target point set closer to the middle of the double-layer structure can be obtained, so that the alpha package generated again based on multiple target points in the target point set will be flatter, making the subsequent double-layer structure detection process more robust.

[0096] The second method: uniformly sample the internal space of the second alpha wrapping result to obtain multiple second sampling points; determine the first minimum distance from the second sampling point to the second alpha wrapping result; and determine the second sampling point whose first minimum distance is greater than or equal to the preset first distance threshold as the target point.

[0097] In some embodiments, uniform sampling can be performed at preset intervals within the interior space of the second alpha wrap result to obtain multiple second sampling points. Since the sampling is performed within the interior space of the second alpha wrap result, the second sampling points are necessarily located within the second alpha wrap result. Then, for each second sampling point, rays are emitted in multiple preset directions to determine the intersection points of each ray with the second alpha wrap result. The preset directions may include up, down, left, and right, as well as upper left, lower left, upper right, and lower right. The distances between the second sampling point and each intersection point are then determined to determine a first minimum distance from the second sampling point to the second alpha wrap result. If the first minimum distance corresponding to the second sampling point is less than a preset first distance threshold, it indicates that the second sampling point is close to the edge of the second alpha wrap, and the second sampling point is therefore not considered a target point. If the first minimum distance corresponding to the second sampling point is greater than or equal to the first distance threshold, it indicates that the second sampling point is not close to the edge of the second alpha wrap, and the second sampling point is therefore determined as a target point.

[0098] In step 1013, a second processing parameter value is obtained, and a first alpha wrapping result of the component to be processed is generated using the second processing parameter value and a plurality of target points.

[0099] In some embodiments, the second processing parameter value is similar to the first processing parameter value, including a second size parameter value and a second offset parameter value, and the second parameter value is smaller than the first parameter value, that is, the second size parameter value is smaller than the first size parameter value, and the second offset parameter value is smaller than the second offset parameter value. Continuing with the above example, the first size parameter value may be 1 / 50 of the diagonal length, and the first offset parameter value may be 1 / 100 of the diagonal length. Then, the second size parameter value may be 1 / 100 of the diagonal length, and the second offset parameter value may be 1 / 200 of the diagonal length. Since the size parameter value is used to control the maximum size of the cavity that can be entered during the shrink wrap process, and the offset parameter value is used to control the tightness of the final surface mesh to the input, and the second processing parameter value is smaller than the first processing parameter value, the first alpha wrap result generated using the second processing parameter value and the target point located within the second alpha wrap is more compact, accurate, and flatter than the second alpha wrap result, making the subsequent two-layer structure detection process more robust.

[0100] 4A , the description will continue with step 101 .

[0101] In step 102 , the first alpha wrapping result is triangulated to obtain a triangulated result.

[0102] Generating the second alpha wrapping result of the component to be processed can be understood as the first triangulation process, and the triangulation process of the first alpha wrapping result here can be understood as the second triangulation process, so it can also be regarded as re-triangulation process of the first alpha wrapping result.

[0103] In some embodiments, all vertices in the first alpha wrapping result are used as input, and the first alpha wrapping result is triangulated in three-dimensional space using a preset triangulation function provided by CGAL to obtain a triangulated result, which includes the vertices and connecting edges of each triangular facet. In some embodiments, the first alpha wrapping result can be subjected to Delaunay triangulation using a Delaunay triangulation function to discretize the convex hull of the vertices in the first alpha wrapping result. The convex hull of the vertices refers to a convex set including all vertices in the target wrapping result. In some embodiments, any other triangulation function can also be used to triangulate the first alpha wrapping result. For example, the CGAL library also implements an incremental regular triangulation method, which can be used to triangulate the first alpha wrapping result to obtain a triangulated result.

[0104] In step 103, a double-layer structure detection is performed on the component to be processed based on the triangulation processing result and the first alpha wrapping result to obtain a detection result.

[0105] In some embodiments, the triangulation result includes the vertices and connecting edges of each triangular facet. Referring to FIG. 4C , step 103 can be implemented through steps 1031 to 1037 , which are described in detail below.

[0106] In step 1031 , a plurality of first connected edges located inside the first alpha wrapping result in the triangulation processing result and the first edge number of the first connected edges are determined.

[0107] In some embodiments, the triangular facets obtained after triangulating the first alpha wrap may contain connected edges outside the first alpha wrap, connected edges inside the first alpha wrap, and connected edges on the surface of the first alpha wrap. In step 1031, the connected edges outside the first alpha wrap result and the connected edges on the surface of the first alpha wrap need to be deleted. For example, a spatial search tree (AABB Tree) of the first alpha wrap result is first constructed. In some embodiments, the library function for constructing spatial search trees in the CGAL library can be used to construct the spatial search tree of the first alpha wrap result. The midpoint of each connecting edge in the triangulated processing result is determined. Then, for each connecting edge in the triangulated processing result, the distance from the midpoint to the spatial search tree is calculated. If the distance is less than a given second distance threshold (the default value is 0.001), the connecting edge is considered to be on the surface of the first alpha wrap and is directly deleted. If the distance is greater than or equal to the second distance threshold, a ray method is used to determine whether the midpoint is located inside the first alpha wrap. For example, a ray is emitted in any direction with the midpoint as the starting point, and the number of intersections between the ray and the first alpha wrap result is determined. If the number of intersections is even, it means that the midpoint is located outside the first alpha wrap result, and the connecting edge is deleted. If the number of intersections is odd, it means that the midpoint is located inside the first alpha wrap result, and the connecting edge is located inside the first alpha wrap result, and the connecting edge is retained.

[0108] In step 1032, a first ratio of the geodesic distance to the Euclidean distance corresponding to each first connecting edge is determined.

[0109] In some embodiments, the vertex coordinates of the two vertices of each first connecting edge are first obtained, and then the Euclidean distance of the first connecting edge can be determined based on the vertex coordinates of the two vertices and the Euclidean distance calculation formula. Geodesic distance refers to the shortest distance from point A to point B on a surface (leaving the surface is not allowed). When determining the geodesic distance corresponding to the first connecting edge, it is necessary to use the geodesic distance calculation function provided by the CGAL library, and use the vertex coordinates of the two vertices of the first connecting edge and the first alpha wrapping result as inputs of the geodesic distance calculation function to obtain the geodesic distance of the first connecting edge. The geodesic distance corresponding to the first connecting edge is greater than or equal to the Euclidean distance corresponding to the first connecting edge, so the first ratio of the geodesic distance corresponding to the first connecting edge to the Euclidean distance is a real number greater than or equal to 1.

[0110] In step 1033 , first connection edges whose first ratio is less than a first ratio threshold are deleted from the plurality of first connection edges to obtain a plurality of remaining first connection edges.

[0111] Through step 1031, all first connecting edges wrapped in the first alpha wrap are obtained. However, the two endpoints of first connecting edges located at the boundary of the two-layer structure may not necessarily belong to different layers of the two-layer structure, which can significantly interfere with subsequent classification of the two-layer structure. Therefore, in step 1033, the first connecting edges are further screened using the first ratio of the geodesic distance to the Euclidean distance corresponding to the first connecting edges to ensure that the two endpoints of the remaining first connecting edges belong to different layers of the two-layer structure. The basic principle of this algorithm is that the Euclidean distance between the two endpoints of a first connecting edge located at the boundary of a two-layer structure is often not much different from the geodesic distance. However, for first connecting edges located in the center of a two-layer structure, the geodesic lines between the two endpoints need to pass through the entire edge of the two-layer structure and are therefore significantly longer than the Euclidean distance. Therefore, in step 1033, first connecting edges with a first ratio less than a first ratio threshold are deleted. The remaining first connecting edges are the first connecting edges located in the center of the two-layer structure. In some embodiments, the first ratio threshold can be 3, 3.5, 4, etc.

[0112] In step 1034 , a second number of remaining first connected edges is determined, and a second ratio of the second number of edges to the first number of edges is determined.

[0113] In some embodiments, since the second number of remaining first connecting edges is less than or equal to the first number of edges, the second ratio of the second number of edges to the first number of edges is a real number between 0 and 1. For example, if the first number of edges is 100 and the second number of edges is 70, the second ratio is 70 / 100=0.7.

[0114] In step 1035 , it is determined whether the second ratio is less than a second ratio threshold.

[0115] When the second ratio is less than the second ratio threshold, the process proceeds to step 1036 ; and when the second ratio is greater than or equal to the second ratio threshold, the process proceeds to step 1037 .

[0116] In step 1036 , it is determined that the detection result is that the component to be processed does not include the first surface and the second surface that meet the parallel condition.

[0117] In some embodiments, if the second ratio is less than the second ratio threshold, it means that the proportion of the remaining first connecting edges to the first connecting edges is small, which means that the multiple first connecting edges include fewer first connecting edges located in the central part of the double-layer structure. Therefore, it is considered that the component to be processed does not include the first surface and the second surface that meet the parallel condition, that is, there is no double-layer structure in the component to be processed.

[0118] In step 1037 , it is determined that the detection result is that the component to be processed includes a first surface and a second surface that meet a parallel condition.

[0119] In some embodiments, if the second ratio is greater than or equal to the second ratio threshold, it means that the remaining first connecting edges account for a large proportion of the first connecting edges, which means that the multiple first connecting edges include more first connecting edges located in the central part of the double-layer structure, and thus it is considered that the component to be processed includes a first surface and a second surface that meet the parallel condition, that is, there is a double-layer structure in the component to be processed.

[0120] Since for components with a double-layer structure (i.e., a first surface and a second surface that satisfy the parallel condition), only a small number of internal connecting edges located at the boundary can be deleted in step 1033, while for components without a double-layer structure, a large number of internal connecting edges will be deleted because the first ratio of the geodesic distance to the Euclidean distance is lower than the first ratio threshold. Therefore, in the above steps 1034 to 1037, the ratio of deleted internal connecting edges is calculated to determine whether the original component to be processed has a double-layer structure. Only models with a double-layer structure will be used for subsequent classification and fitting. If it is determined based on the second ratio that the original component to be processed does not have a double-layer structure, that is, it is impossible to use a single-layer structure for coplanar fitting, the process ends at this time, thus ensuring that the subsequent coplanar fitting process can be accurately performed.

[0121] 4A , the description will proceed to step 103 .

[0122] In step 104, when the detection result indicates that the component to be processed includes a first surface and a second surface that meet the parallel condition, the vertices included in the first alpha wrapping result are divided into a first vertex set located on the first surface and a second vertex set located on the second surface.

[0123] In some embodiments, referring to FIG. 5A , “dividing the vertices included in the first alpha wrapping result into a first vertex set located on the first surface and a second vertex set located on the second surface” in step 104 can be implemented through steps 1041 to 1044 , which are described in detail below.

[0124] In step 1041 , the plurality of remaining first connected edges are sorted in descending order according to their corresponding geodesic distances to obtain a plurality of sorted remaining first connected edges.

[0125] In some embodiments, the plurality of remaining first connected edges are sorted in descending order according to their corresponding geodesic distances, that is, sorted in descending order of geodesic distance, to obtain a plurality of sorted remaining first connected edges. The first remaining first connected edge among the plurality of sorted remaining first connected edges has the largest geodesic distance.

[0126] In step 1042 , a first endpoint of a first remaining first connected edge among the plurality of sorted remaining first connected edges is added to the first vertex set, and a second endpoint of the first remaining first connected edge is added to the second vertex set.

[0127] In some embodiments, the first vertex set and the second vertex set are initially empty sets, and the first endpoint of the remaining first connecting edge can be either of the two endpoints of the remaining first connecting edge. Therefore, in step 1042, either of the two endpoints of the first remaining first connecting edge can be added to the first vertex set, and the other endpoint can be added to the second vertex set.

[0128] In step 1043 , two endpoints of the remaining first connection edges except the first remaining first connection edge among the sorted remaining first connection edges are classified into a first vertex set and a second vertex set respectively.

[0129] In some embodiments, the endpoints added to the first vertex set are determined as first vertices, and the endpoints added to the second vertex set are determined as second vertices. The two endpoints of each remaining first connecting edge can be classified into the first vertex set and the second vertex set, respectively, through steps 431 to 437 shown in FIG. 5B , as described in detail below.

[0130] In step 431 , a first minimum value of the distance between the first endpoints of the remaining first connecting edges and each first vertex in the first vertex set is determined.

[0131] In some embodiments, the Euclidean distance between the first endpoint and each first vertex can be determined based on the endpoint coordinates of the first endpoints of the other remaining first connecting edges and the vertex coordinates of each first vertex in the first vertex set, and the minimum Euclidean distance therebetween can be determined as the first minimum value.

[0132] In step 432 , the second minimum value of the distance between the second endpoints of the other remaining first connecting edges and each second vertex in the second vertex set is determined.

[0133] In some embodiments, similar to step 431, the Euclidean distance between the second endpoint and each second vertex can be determined based on the endpoint coordinates of the second endpoints of the other remaining first connecting edges and the vertex coordinates of each second vertex in the second vertex set, and the minimum Euclidean distance therebetween is determined as the second minimum value.

[0134] In step 433 , the sum of the first minimum value and the second minimum value is determined as a first cost value.

[0135] In some embodiments, the first cost value represents a cost of adding the first endpoint of the other remaining first connecting edge to the first vertex set and adding the second endpoint to the second vertex set.

[0136] In step 434 , a third minimum value of the distance between the first endpoints of the other remaining first connecting edges and each second vertex in the second vertex set is determined.

[0137] In some embodiments, the Euclidean distance between the first endpoint and each second vertex is determined based on the endpoint coordinates of the first endpoints of the other remaining first connecting edges and the vertex coordinates of each second vertex in the second vertex set, and the minimum Euclidean distance is determined as the third minimum value.

[0138] In step 435 , a fourth minimum value of the distance between the second endpoints of the other remaining first connecting edges and each first vertex in the first vertex set is determined.

[0139] In some embodiments, the Euclidean distance between the second endpoint and each first vertex is determined based on the endpoint coordinates of the second endpoints of the other remaining first connecting edges and the vertex coordinates of each first vertex in the first vertex set, and the minimum Euclidean distance is determined as the fourth minimum value.

[0140] In step 436 , the sum of the third minimum value and the fourth minimum value is determined as the second generation value.

[0141] The second cost value represents the cost of adding the first endpoint of the other remaining first connecting edge to the second vertex set and adding the second endpoint to the first vertex set.

[0142] In step 437 , based on the first generation value and the second generation value, the two endpoints of the other remaining first connecting edges are classified into the first vertex set and the second vertex set, respectively.

[0143] In some embodiments, when the first generation value is less than the second generation value, it indicates that the sum of the minimum distance between the first endpoint of the remaining first connecting edge and each first vertex in the first vertex set and the minimum distance between the second endpoint and each second vertex in the second vertex set is less than the sum of the minimum distance between the second endpoint of the remaining first connecting edge and each first vertex in the first vertex set and the minimum distance between the first endpoint and each second vertex in the second vertex set, so the first endpoint of the other remaining first connecting edge is added to the first vertex set, and the second endpoint of the other remaining first connecting edge is added to the second vertex set; when the first generation value is greater than or equal to the second generation value, the first endpoint of the other remaining first connecting edge is added to the second vertex set, and the second endpoint of the other remaining first connecting edge is added to the first vertex set.

[0144] 5A , the following description continues with step 1043 .

[0145] In step 1044 , other vertices in the first alpha wrapping result are classified into a first vertex set and a second vertex set.

[0146] In some embodiments, referring to FIG. 5C , step 1044 may be implemented through steps 441 to 4411 described below, which are described in detail below.

[0147] In step 441 , first distances between each other vertex and each first vertex in the first set of vertices and second distances between each other vertex and each second vertex in the second set of vertices are determined.

[0148] In some embodiments, based on the vertex coordinates of each other vertex and the vertex coordinates of each first vertex, each first distance between each other vertex and each first vertex is determined. Similarly, based on the vertex coordinates of each other vertex and the vertex coordinates of each second vertex, based on the Euclidean distance calculation formula, each second distance between each other vertex and each second vertex is determined.

[0149] For example, there are three other vertices, C1, C2, and C3, the first vertex set includes two first vertices, A1 and A2, and the second vertex set includes three second vertices, B1, B2, and B3. Then, two first distances and three second distances can be determined for each other vertex.

[0150] In step 442 , a fifth minimum value corresponding to each other vertex is determined based on each first distance and each second distance corresponding to each other vertex.

[0151] In some embodiments, a minimum distance is determined among the multiple first distances and the multiple second distances corresponding to each other vertex, and the minimum distance is determined as the fifth minimum value corresponding to the other vertices.

[0152] Continuing with the above example, one other vertex corresponds to two first distances and three second distances. Then, the minimum distance is determined from these five distance values, and the minimum distance is determined as the fifth minimum value corresponding to the other vertex.

[0153] In step 443 , the other vertices in the first alpha wrapping result are added to the dynamic queue in descending order of their corresponding fifth minimum values.

[0154] After determining the fifth minimum value corresponding to each other vertex, multiple other vertices are sorted from large to small according to the fifth minimum value, and added to the dynamic queue in sequence. That is, the other vertex with the largest fifth minimum value is at the head of the queue, and the other vertex with the smallest fifth minimum value is at the end of the queue.

[0155] For example, the other three vertices are C1, C2, and C3, and their corresponding fifth minimum values ​​are 3, 1, and 8, respectively. Then the order in the dynamic queue is C3, C1, and C2.

[0156] In step 444 , a sixth minimum value of the distance between the first other vertex in the dynamic queue and each first vertex in the first vertex set, and a seventh minimum value of the distance between the first other vertex and each second vertex in the second vertex set are determined.

[0157] In some embodiments, since the first distance between each other vertex and each first vertex, and the second distances between each other vertex and each second vertex have been determined when determining the fifth minimum value corresponding to each other vertex, then in this step, the minimum value of the first distances corresponding to the first other vertex can be determined as the sixth minimum value, and the minimum value of the second distances corresponding to the first other vertex can be determined as the seventh minimum value.

[0158] Continuing with the above example, let's say the first other vertex is C3. C3 has two first distances, let's say 8 and 13, and three second distances, let's say 9, 10, and 11. Then the sixth minimum value corresponding to the first other vertex is 8, and the seventh minimum value is 9.

[0159] In step 445 , it is determined whether the sixth minimum value is smaller than the seventh minimum value.

[0160] When the sixth minimum value is smaller than the seventh minimum value, the process proceeds to step 446 ; and when the sixth minimum value is greater than or equal to the seventh minimum value, the process proceeds to step 449 .

[0161] In step 446 , the first other vertex is added to the first vertex set to obtain an updated first vertex set.

[0162] Among them, when the sixth minimum value is less than the seventh minimum value, it means that the distance between the first other vertex and a first vertex in the first vertex set is the smallest, then the first other vertex is added to the first vertex set to obtain an updated first vertex set.

[0163] Continuing with the above example, since the sixth minimum value of the first other vertex is 8 and the seventh minimum value is 9, the sixth minimum value is smaller than the seventh minimum value. Therefore, the first other vertex is added to the first vertex set, and the updated first vertex set is {C3, A1, A2}.

[0164] In step 447 , based on the updated first vertex set and the second vertex set, the order of other vertices in the current dynamic queue is adjusted to obtain an adjusted dynamic queue.

[0165] In some embodiments, the first other vertex is added to the first vertex set, and the other vertices in the current dynamic queue are reduced by one. Continuing with the above example, the current dynamic queues are C1 and C2 at this time. At this time, each third distance between the other vertices in the current dynamic queue and each first vertex in the updated first vertex set, as well as each fourth distance between the other vertices in the current dynamic queue and each second vertex in the second vertex set are determined respectively. Continuing with the above example, since the updated first vertex set includes 3 first vertices and the second vertex set still has 3 second vertices, for each other vertex in the current dynamic queue, 3 third distances and 3 fourth distances can be determined, and then based on each third distance and each fourth distance corresponding to the other vertices in the current dynamic queue, the eighth minimum value corresponding to the other vertices in the current dynamic queue is determined; the other vertices in the current dynamic queue are re-sorted in descending order of their respective eighth minimum values ​​to obtain an adjusted dynamic queue.

[0166] In some embodiments, in order to avoid repeated calculation of vertex distances, in step 441, after determining the distance between two vertices, the distance between the two vertices is stored in a cache space. When the distance between the two vertices needs to be determined again in a subsequent step, it can be first determined whether the distance between the two vertices is stored in the cache space. If it is stored, it is directly obtained from the cache space. If it is not stored, the distance between the two vertices is calculated and stored in the cache space. This can effectively reduce the amount of data calculation and improve processing efficiency.

[0167] In step 448 , the remaining vertices in the adjusted dynamic queue are classified into the first vertex set and the second vertex set.

[0168] In some embodiments, step 448 is implemented based on a process similar to steps 444 and 446. That is, after obtaining the adjusted dynamic queue, the first other vertex is taken from the adjusted dynamic queue, and then the minimum distance between the first other vertex and each first vertex in the updated first vertex set and the minimum distance between the first other vertex and each second vertex in the second vertex set are obtained. The first other vertex is then added to the vertex set corresponding to the smaller of the two minimum distances. This iterative process is repeated until all other vertices in the adjusted dynamic queue are classified into the first vertex set and the second vertex set.

[0169] In step 449 , the first other vertex is added to the second vertex set to obtain an updated second vertex set.

[0170] In step 4410, based on the first vertex set and the updated second vertex set, the order of other vertices in the current dynamic queue is adjusted to obtain an adjusted dynamic queue.

[0171] In step 4411 , the other vertices in the adjusted dynamic queue are classified into a first vertex set and a second vertex set.

[0172] In some embodiments, the implementation process of step 449 to step 4411 is similar to the implementation process of step 446 to step 448. For example, the implementation process of step 446 to step 448 can be referred to.

[0173] Through the above steps 1041 to 1044, when the component to be processed includes a first face and a second face that meet the parallel condition, that is, when the component to be processed has a double-layer structure, the vertices of the remaining first connecting edges located inside the first alpha wrapping result are first classified into the first vertex set and the second vertex set, and then the other vertices on the first alpha wrapping result are assigned to the first vertex set and the second vertex set, so as to subsequently construct the first face and the second face, and provide the necessary data basis for subsequent coplanar fitting.

[0174] 4A , the description will proceed to step 104 .

[0175] In step 105 , based on the first vertex set and the second vertex set, the first surface and the second surface are coplanarly fitted to obtain a target fitting result.

[0176] In some embodiments, referring to FIG. 6 , step 105 may be implemented through steps 1051 to 1056 , which are described in detail below.

[0177] In step 1051 , a first face is constructed using each first vertex in the first vertex set, and a second face is constructed using each second vertex in the second vertex set.

[0178] In some embodiments, first, a first facet set corresponding to the first vertex set and a second facet set corresponding to the second vertex set are obtained from the first alpha wrapping result. Each first facet in the first facet set includes at least one first vertex, and similarly, each second facet in the second facet set includes at least one second vertex. Then, a first facet is constructed based on each first facet in the first facet set, and a second facet is constructed based on each second facet in the second facet set. When constructing the first facet based on each first facet in the first facet set, first faces with the same connecting edges are spliced ​​to obtain the first facet, and similarly, second faces with the same connecting edges are spliced ​​to obtain the second facet.

[0179] In step 1052 , a first movement vector corresponding to the first surface and a second movement vector corresponding to the second surface are determined.

[0180] In some embodiments, a first weighted centroid of the first surface and a second weighted centroid of the second surface are determined, and a midpoint between the first weighted centroid and the second weighted centroid is determined; a first movement vector of the first surface is determined based on the midpoint and the first weighted centroid; and a second movement vector of the second surface is determined based on the midpoint and the second weighted centroid.

[0181] In some embodiments, when determining the first weighted centroid of a first surface, the first barycentric coordinates and the first areas of each first surface patch that constitutes the first surface are first determined, and the first areas of each first surface patch are accumulated to obtain the total area of ​​the first surface. The first area is then determined as the first weight value of the first barycentric coordinate, and the first barycentric coordinates and the first weight value of each first surface patch are weighted and summed to obtain the first total barycentric coordinate. Finally, the first weighted centroid is determined based on the first total barycentric coordinate and the total area of ​​the first surface. In some embodiments, the first total barycentric coordinate can be divided by the total area of ​​the first surface to obtain the first weighted centroid coordinate of the first weighted centroid, thus determining the first weighted centroid. Because the first weighted centroid is determined based on the barycentric coordinates of each first surface patch and the first area of ​​the first surface patch, and the centroid of the first surface patch with a larger area has a greater influence on the weighted centroid of the first surface, the first weighted centroid coordinate of the first weighted centroid of the first surface can be determined more accurately.

[0182] In some embodiments, the second weighted centroid of the second face is determined in a manner similar to the first weighted centroid. Once the first weighted centroid coordinates of the first weighted centroid and the second weighted centroid coordinates of the second weighted centroid are known, the first weighted centroid coordinates and the second weighted centroid coordinates can be averaged to obtain the midpoint coordinates of the midpoint between the first weighted centroid and the second weighted centroid.

[0183] Subtract the first weighted centroid coordinates from the midpoint coordinates of the midpoint to obtain the first movement vector of the first surface. Similarly, subtract the second weighted centroid coordinates from the midpoint coordinates of the midpoint to obtain the second movement vector of the second surface.

[0184] In step 1053 , the first surface is moved according to the first movement vector to obtain the moved first surface, and the second surface is moved according to the second movement vector to obtain the moved second surface.

[0185] In some embodiments, the vertex coordinates of each first vertex in the first face can be added to the first movement vector to obtain each moved first vertex, and the moved first face can be constructed based on each moved first vertex. Similarly, the vertex coordinates of each second vertex in the second face can be added to the second movement vector to obtain each moved second vertex, and the moved second face can be constructed based on each moved second vertex.

[0186] In step 1054, the second minimum distances from each first vertex on the moved first surface to the component to be processed are determined, and the third minimum distances from each second vertex on the moved second surface to the component to be processed are determined.

[0187] In some embodiments, the library functions provided by CGAL can be used to determine the second minimum distances from each first vertex on the moved first face to the component to be processed, and the third minimum distances from each second vertex on the moved second face to the component to be processed.

[0188] In step 1055 , an initial coplanar fitting result is determined from the moved first surface and the moved second surface based on the respective second minimum distances and the respective third minimum distances.

[0189] In some embodiments, referring to FIG. 7 , step 1055 may be implemented through steps 551 to 554 , which are described in detail below.

[0190] In step 551 , a first distance median is determined from each second minimum distance, and a second distance median is determined from each third minimum distance.

[0191] In some embodiments, the second minimum distances are sorted in ascending order to obtain a plurality of sorted second minimum distances, and then the second minimum distance located in the middle of the sorted plurality of second minimum distances is determined as the median of the first distance. Assuming there are N second minimum distances in total, when N is an odd number, the median of the first distance is the (N+1) / 2th second minimum distance among the sorted plurality of second minimum distances; when N is an even number, the median of the first distance is the N / 2th second minimum distance among the sorted plurality of second minimum distances.

[0192] Similarly, the third minimum distances are sorted in ascending order to obtain a plurality of sorted third minimum distances, and the third minimum distance located in the middle of the sorted plurality of third minimum distances is then determined as the median of the second distances. Assuming there are N third minimum distances in total, when N is an odd number, the median of the second distance is the (N+1) / 2th third minimum distance among the sorted plurality of third minimum distances; when N is an even number, the median of the second distance is the N / 2th third minimum distance among the sorted plurality of third minimum distances.

[0193] In step 552, it is determined whether the first distance median is smaller than the second distance median.

[0194] When the first distance median is smaller than the second distance median, proceed to step 553 ; when the first distance median is greater than or equal to the second distance median, proceed to step 554 .

[0195] In step 553 , the first surface after the movement is determined as the initial coplanar fitting result.

[0196] In step 554 , the moved second surface is determined as the initial coplanar fitting result.

[0197] In the above steps 551 to 554, the first distance median corresponding to the first surface and the second distance median corresponding to the second surface are determined, and the smaller distance median is used as the basis for screening the initial coplanar fitting results, so as to eliminate the influence of individual singular points on the coplanar fitting results.

[0198] In step 1056 , the initial coplanar fitting result is smoothed to obtain a target coplanar fitting result.

[0199] In some embodiments, the initial coplanar fit result can be smoothed using library functions provided by CGAL to obtain a target coplanar fit result. Further smoothing the initial coplanar fit result can eliminate the impact of unevenness on the first alpha-wrapped surface on the final target fit result, thereby ensuring a smooth target coplanar fit result. Furthermore, the target coplanar fit result can better reflect the actual situation and improve the visual effect of the model, making the 3D model determined by the target coplanar fit result smoother and more natural.

[0200] After obtaining the component to be processed, the first alpha wrapping result of the component to be processed is first determined, so that a flat, orientable, two-manifold, and self-intersection-free watertight grid model can be obtained. The first alpha wrapping result is then triangulated to obtain a triangulated processing result. Then, a double-layer structure detection is performed on the component to be processed based on the triangulated processing result and the first alpha wrapping result. When the detection result indicates that the component to be processed includes a first face and a second face that meet the parallel condition, that is, when the detection result indicates that the component to be processed is a double-layer structure, the vertices included in the first alpha wrapping result are divided into a first vertex set located on the first face and a second vertex set located on the second face. Then, based on the first vertex set and the second vertex set, the first face and the second face are coplanar fitted to obtain a target fitting result, wherein the target fitting result is a single-layer structure. That is, using the virtual component processing method provided in the embodiment of the present application, the component to be processed with a double-layer structure can be automatically coplanar fitted to obtain a target fitting result of a single-layer structure, which can improve the robustness and processing efficiency of the coplanar fitting of the component to be processed with a double-layer structure.

[0201] The following describes an exemplary application of the embodiments of the present application in a practical application scenario.

[0202] The virtual component processing method provided in the embodiment of the present application can also be applied to the rendering scene of the virtual model. After the terminal obtains the three-dimensional model of the virtual object, the three-dimensional model is sent to the server. The server obtains the model information and determines the various components included in the three-dimensional model, which may include clothing components, accessory components, model main body components, etc. The server determines the various components included in the three-dimensional model as components to be processed, and then uses the virtual component processing method provided in the embodiment of the present application to process each component to be processed. When it is determined that the component to be processed includes a first surface and a second surface that meet the parallel condition, the first surface and the second surface are coplanar fitted to obtain the target fitting result; for the component to be processed that does not have a first surface and a second surface that meet the parallel condition, the coplanar fitting process is not performed, and the processed component is directly output. After the server performs double-layer detection on each component to be processed and fits the components to be processed with a double-layer structure, it constructs a processed three-dimensional model based on the target fitting result and other unprocessed components to be processed. The server sends the processed model information to the terminal, and the terminal performs UV unfolding processing based on the processed model information to obtain a two-dimensional unfolding result of the processed three-dimensional model, and then performs two-dimensional rendering based on the two-dimensional unfolding result. Since the double-layer structure components in the processed three-dimensional model have been coplanarly fitted into a single-layer structure, this can greatly simplify the complexity of the three-dimensional model while ensuring the accuracy of the model structure, thereby improving the processing efficiency of UV unfolding and two-dimensional rendering.

[0203] The virtual component processing method provided in the embodiment of the present application can also be applied to automatic retopology projects. Even as long as the goal is to use a single-layer structure for coplanar fitting, the model processing method provided in the embodiment of the present application is also applicable and can be promoted.

[0204] In the embodiment of the present application, a model processing method capable of achieving robust coplanar fitting is proposed from the perspective of double-layer structure detection and separation. The implementation steps of the model processing method are described below.

[0205] Step 1: Generate a flat alpha package.

[0206] The original model to be fitted may have many problems such as non-connectivity, self-intersection, non-orientability, and non-two-manifold, which will pose a great challenge to the robustness of subsequent processing steps. In addition, assuming that the original model itself has a two-layer structure, if the distance between its two layers is large, there will also be robustness issues in the subsequent processing process. To solve this problem, the original model is first preprocessed, that is, a flat alpha package is generated. Generating a flat alpha package can be achieved by the following steps:

[0207] Step 11), for the original model M, generate an initial alpha package using the first parameter value.

[0208] The initial alpha wrapping corresponds to the second alpha wrapping result in other embodiments. In some embodiments, the alpha wrapping can be calculated using the method provided in CGAL. ​​The first parameter value includes a first value of the alpha parameter and a first value of the offset parameter. The first value of the alpha parameter can be 1 / 50 of the diagonal length of the axis-aligned bounding box, and the first value of the offset parameter can be 1 / 100 of the diagonal length of the axis-aligned bounding box.

[0209] Step 12), remeshing the initial alpha package, and then sampling at its vertices, edge midpoints, and surface centroids to obtain a set of sampling points;

[0210] Step 13), for each sample point, calculate its inward normal, and generate a ray based on it, calculate its intersection with the initial alpha package, then calculate the midpoint between the sample point and the intersection, and store all these midpoints;

[0211] In step 14), the midpoint set obtained in step 13) is used as input, and a second parameter value is used to generate a flat alpha package.

[0212] The second parameter value includes the second value of the alpha parameter and the second value of the offset parameter. The second value of the alpha parameter can be 1 / 100 of the diagonal length of the axis-aligned bounding box, and the second value of the offset parameter can be 1 / 200 of the diagonal length of the axis-aligned bounding box. In other words, the second parameter value used to generate the flattened alpha wrap in step 14) is more accurate than the first parameter value used to generate the initial alpha wrap in step 11).

[0213] FIG8 is a schematic diagram of the original model and the generated flat alpha package result provided in an embodiment of the present application, wherein 801 in FIG8 is the original component, 802 is a side view of the flat alpha package, and 803 is the corresponding midpoint set.

[0214] In steps 12) and 13), by calculating the midpoint of the sampling ray, a set of sampling points closer to the center of the double-layer structure is obtained. This will result in a flatter alpha package, making the subsequent double-layer structure detection process more robust.

[0215] In some embodiments, after generating the initial alpha wrap, uniform sampling can be performed within the initial alpha wrap. For each sample point, rays are emitted in different directions, and the intersection of each ray with the original alpha wrap is calculated. The minimum distance between the sample point and each intersection is then calculated. If this minimum value is less than a preset distance threshold, the sample point is considered close to the boundary of the initial alpha wrap and is discarded; otherwise, the sample point is retained. After all sample points have been screened in this manner, the remaining sample points can be used to construct the flattened alpha wrap.

[0216] Step 2: Detection of double-layer structure.

[0217] After obtaining the flat alpha package, a robust algorithm needs to be designed to detect the double-layer structure, because only a model with a double-layer structure can be coplanarly fitted using a single-layer structure. This embodiment of the application proposes a double-layer structure detection algorithm based on three-dimensional Delaunay triangulation, and its execution process is as follows:

[0218] Step 21) All vertices wrapped in the flat alpha are taken as input and Delaunay triangulated in three-dimensional space. In the embodiment of the present application, the triangulation result is denoted as T.

[0219] In step 22), edges on T that are outside or on the surface of the flat alpha package are removed, and only edges that are inside the flat alpha package are retained.

[0220] Since T obtained in step 21) is the triangulation of the convex hull of the original vertices, there must be edges outside the flat alpha package and edges on the surface of the flat alpha package. Therefore, these two types of edges need to be deleted in step 22). For example, a spatial query tree (AABB Tree) of the flat alpha package is constructed. For the midpoint of each edge in T, the distance from the midpoint to the spatial query tree is calculated. If the distance is less than a given threshold (the default value is 0.001), then the edge is considered to be on the surface of the flat alpha package and is directly deleted; otherwise, the ray method is used to determine whether the midpoint is located inside the flat alpha package. If not, it means that the edge is an external edge and is directly deleted; if the midpoint is located inside the flat alpha package, it means that the edge is an internal edge and is retained.

[0221] Figure 9 is a schematic diagram of the double-layer structure detection process provided in an embodiment of the present application, wherein 901 in Figure 9 is a flat alpha package, 902 is the three-dimensional Delaunay triangulation result; 903 is the result after deleting the external edges and surface edges using step 22) (i.e., only retaining the internal edges).

[0222] In step 23), the internal edge is further deleted by calculating a first ratio of the geodesic distance to the Euclidean distance between the two endpoints of the internal edge. If the first ratio is lower than a set threshold, the internal edge is deleted.

[0223] Although step 22) can obtain all alpha-wrapped internal edges, the two endpoints of an internal edge located at the boundary of a two-layer structure may not necessarily belong to different layers of the two-layer structure, which can significantly interfere with subsequent classification of the two-layer structure. Therefore, in step 23), further screening is performed using the ratio of the geodesic distance to the Euclidean distance of the internal edge endpoints to ensure that the two endpoints of the remaining internal edges belong to different layers of the two-layer structure. The basic idea of ​​this algorithm is that the Euclidean distance and geodesic distance of the endpoints of an internal edge located at the boundary of a two-layer structure are often similar in magnitude. However, the geodesic line of the endpoint of an internal edge located in the center of a two-layer structure needs to pass through the entire edge of the two-layer structure, so it will be significantly longer than the Euclidean distance. Therefore, in this embodiment of the present application, a first ratio of the geodesic distance to the Euclidean distance between the two endpoints of an internal edge is determined, and a determination is made as to whether this first ratio is below a set threshold. If the first ratio is below the set threshold, the internal edge is deleted. The default threshold for this first ratio can be 3, 4, 4.5, etc.

[0224] In step 24), a second ratio of the number of internal edges obtained in step 23) to the number of internal edges obtained in step 22) is calculated. If the second ratio is lower than a given threshold (for example, 0.4), it is considered that the original model does not have a double-layer structure, that is, a single-layer structure cannot be used for coplanar fitting, and false is returned; otherwise, the final remaining internal edges are recorded and true is returned.

[0225] Through observation and experimental verification, we found that for models with a double-layer structure, only a small number of internal edges located at the boundary were deleted in step 23. However, for models without a double-layer structure, a large number of internal edges were deleted because the distance ratio was below the threshold. Therefore, in step 24), the proportion of deleted internal edges was calculated to determine whether the original model had a double-layer structure. Only models with a double-layer structure were classified and fitted.

[0226] Step three, classification of double-layer structures.

[0227] After processing and filtering in step 2, it is ensured that the data entering the current step has the following characteristics: 1) the current flat alpha package must have a two-layer structure; 2) the endpoints of the remaining internal edges must belong to different layers of the two-layer structure. Based on this characteristic, the embodiment of the present application proposes a two-layer structure classification method based on vertex partitioning, and the implementation process includes the following steps:

[0228] Step 31), for the internal edges remaining in the previous step, sort them in descending order according to the geodesic distance of their endpoints;

[0229] Step 32), for the first edge, classify its starting point as {A} and its end point as {B};

[0230] In step 33), the remaining internal edges are processed in turn, and their endpoints are classified into set {A} and set {B} respectively.

[0231] Step 33) For example, first assume that the endpoints of the current internal edge are S and T. Then there are only two alternatives: one is to place S in set {A} and T in set {B}; the other is to place S in set {B} and T in set {A}. Then, the minimum distance from S to all elements in set {A} and the minimum distance from T to all elements in set {B} are calculated, and the sum of the two is used as the cost of alternative case one. Using a similar method, the cost of alternative case two can be calculated, and then the alternative with the smaller cost is selected as the final classification for S and T. In other words, if the cost of case one is less than the cost of case two, then the classification is performed according to case one, that is, S is placed in set {A} and T is placed in set {B}. Similarly, if the cost of case two is less than or equal to the cost of case one, then the classification is performed according to case two, that is, S is placed in set {B} and T is placed in set {A}.

[0232] In step 34 , the remaining vertices in the flattened alpha package are processed in turn, and classified into set {A} or set {B}.

[0233] In step 33, the endpoints of the remaining internal edges are classified, but some vertices on the flat alpha parcel remain unclassified. Therefore, in step 34, these vertices are further classified. The specific method is: first, according to the minimum distance from the elements in the vertex sets {A} and {B}, these remaining vertices are placed in a dynamic priority queue in descending order (i.e., the vertex with the largest minimum distance is placed first). These vertices are then processed in sequence. In practice, the minimum distance from each vertex to all elements in {A} and {B} is calculated. If the vertex is closer to {A}, it is classified into set {A}, and the current dynamic priority queue is adjusted based on the updated {A}. If the vertex is closer to {B}, it is classified into set {B}, and the current dynamic priority queue is adjusted based on the updated {B}. This process continues until all vertices on the flat alpha parcel are classified into either {A} or {B}.

[0234] Step 4: Single-layer structure generation and optimization.

[0235] After robust binary classification of vertices on the flattened alpha wrap, a single-layer structure can be generated and optimized. The implementation process of step 4 includes:

[0236] Step 41) construct the facet sets {F A}, and the face set {F B};

[0237] Step 42), using {F A} and {F B} to construct single-layer structure M A and M B ;

[0238] Step 43, calculate M respectively A and M B The weighted center C A and C B ; and calculate the midpoint C between them;

[0239] Step 44), M A Movement vector V A =CC A , M B Movement vector V B =CC B ;

[0240] Step 45), calculate M respectively A and M B The shortest distance from the vertex on the original model to the original model, and take the median of the distance; if M A The median of the shortest distances from the endpoints to the original model is less than M B The median of the shortest distances from the endpoints to the original model, then choose M A As the initial fitting result of the single layer structure, otherwise select M B As the initial fitting result of the single-layer structure;

[0241] In step 45), the median of the shortest distances of all vertices is used as a basis for screening the initial results of the single-layer optimization, thereby eliminating the influence of individual singular points on the final results.

[0242] Step 46 ) The boundaries of the initial fitting result of the single-layer optimization are marked, and then an internal smoothing operation is performed to preserve the boundaries, thereby obtaining the final coplanar fitting result.

[0243] In step 46 ), the initial result of the single layer result is further optimized to eliminate the influence of the unevenness of the flat alpha wrapped surface on the final fitting result.

[0244] FIG10 is a schematic diagram comparing an original component to be processed having a double-layer structure and its corresponding coplanar fitting results provided by an embodiment of the present application, wherein 1001, 1003, and 1005 are the original components to be processed, 1002 is the coplanar fitting result corresponding to the original component to be processed shown in 1001, 1004 is the coplanar fitting result of the original component to be processed shown in 1003, and 1006 is the coplanar fitting result of the original component to be processed shown in 1005. As shown in FIG10 , regardless of whether the component to be processed having a double-layer structure is curved, the virtual component processing method provided by an embodiment of the present application can determine the best fit of the single-layer structure.

[0245] Figure 11 is a schematic diagram comparing the cut-out structure provided by an embodiment of the present application and its corresponding coplanar fitting results, wherein 1101 shows the original cut-out structure and 1102 shows the coplanar fitting results of the original cut-out structure. Figure 12 is a schematic diagram comparing the feather component with a double-layer structure provided by an embodiment of the present application and its corresponding coplanar fitting results, wherein 1201 is the original feather component and 1202 is the coplanar fitting results corresponding to the feather component. It can be concluded from Figures 11 and 12 that the method provided by the present invention can achieve coplanar fitting for specific types of models, and the fitting results not only meet the requirements of a single-layer structure, but can also be non-planar, even with arbitrary curvature. With the coplanar fitting results of the single-layer structure, the retopology tool only needs to retopology these fitting results in subsequent processing, thus achieving fully automated retopology of components with a double-layer structure.

[0246] The following further describes an exemplary structure of the virtual component processing device 455 provided in an embodiment of the present application implemented as a software module. In some embodiments, as shown in FIG2 , the software modules stored in the virtual component processing device 455 of the memory 450 may include: a pre-processing module 4551 configured to obtain a component to be processed, pre-process the component to be processed, and obtain a first alpha wrapping result of the component to be processed; a triangulation processing module 4552 configured to triangulate the first alpha wrapping result to obtain a triangulation processing result; a double-layer structure detection module 4553 configured to perform double-layer structure detection on the component to be processed based on the triangulation processing result and the first alpha wrapping result to obtain a detection result; a vertex partitioning module 4554 configured to, when the detection result indicates that the component to be processed includes a first face and a second face that meet a parallel condition, partition the vertices included in the first alpha wrapping result into a first vertex set located on the first face and a second vertex set located on the second face; and a coplanar fitting module 4555 configured to perform coplanar fitting on the first face and the second face based on the first vertex set and the second vertex set to obtain a target fitting result.

[0247] In some embodiments, the preprocessing module 4551 is further configured to: obtain a first processing parameter value, and use the first processing parameter value to generate an initial alpha wrapping result of the component to be processed; based on the initial alpha wrapping result, determine multiple target points, and the target points are located inside the initial alpha wrapping result; obtain a second processing parameter value, and use the second processing parameter value and the multiple target points to generate a first alpha wrapping result of the component to be processed, and the second parameter value is less than the first parameter value.

[0248] In some embodiments, the preprocessing module 4551 is further configured to: perform meshing processing on the initial alpha wrapping result to obtain a meshed alpha wrapping result; determine the vertices, midpoints of the connecting edges and the center of gravity of the triangles of the meshed alpha wrapping result as first sampling points; determine the normal of each first sampling point toward the interior of the meshed alpha wrapping result, and determine the intersection of the normal and the meshed alpha wrapping result; determine the midpoint between each first sampling point and the corresponding intersection point, and determine the midpoint as the target point.

[0249] In some embodiments, the preprocessing module 4551 is further configured to: perform uniform sampling in the internal space of the initial alpha wrapping result to obtain multiple second sampling points; determine a first minimum distance from the second sampling point to the initial alpha wrapping result; and determine a second sampling point whose first minimum distance is greater than or equal to a preset first distance threshold as a target point.

[0250] In some embodiments, the triangulation processing result includes the vertices and connecting edges of each triangular facet, and the double-layer structure detection module 4553 is further configured to: determine multiple first connecting edges located inside the first alpha wrapping result in the triangulation processing result and the first number of the first connecting edges; determine the first ratio of the geodesic distance and the Euclidean distance corresponding to each first connecting edge; delete the first connecting edges whose first ratio is less than the first ratio threshold from the multiple first connecting edges to obtain multiple remaining first connecting edges; determine the second number of the remaining first connecting edges, and determine the second ratio of the second number of edges to the first number of edges; when the second ratio is greater than or equal to the second ratio threshold, determine the detection result as the component to be processed includes the first face and the second face that meet the parallel condition; when the second ratio is less than the second ratio threshold, determine the detection result as the component to be processed does not include the first face and the second face that meet the parallel condition.

[0251] In some embodiments, the vertex partitioning module 4554 is further configured to: sort the multiple remaining first connected edges in descending order according to their respective corresponding geodesic distances to obtain multiple sorted remaining first connected edges; add the first endpoint of the first remaining first connected edge among the multiple sorted remaining first connected edges to the first vertex set, and add the second endpoint of the first remaining first connected edge to the second vertex set; classify the two endpoints of the remaining first connected edges other than the first remaining first connected edge among the sorted remaining first connected edges into the first vertex set and the second vertex set respectively; classify the other vertices in the first alpha wrapping result into the first vertex set and the second vertex set.

[0252] In some embodiments, the vertex partitioning module 4554 is also configured to: determine the first minimum value of the distance between the first endpoint of the other remaining first connecting edge and each first vertex in the first vertex set; determine the second minimum value of the distance between the second endpoint of the other remaining first connecting edge and each second vertex in the second vertex set; determine the sum of the first minimum value and the second minimum value as the first generation value; determine the third minimum value of the distance between the first endpoint of the other remaining first connecting edge and each second vertex in the second vertex set; determine the fourth minimum value of the distance between the second endpoint of the other remaining first connecting edge and each first vertex in the first vertex set; determine the sum of the third minimum value and the fourth minimum value as the second generation value; based on the first generation value and the second generation value, classify the two endpoints of the other remaining first connecting edge into the first vertex set and the second vertex set respectively.

[0253] In some embodiments, the vertex partitioning module 4554 is further configured to: when the first generation value is less than the second generation value, add the first endpoint of the other remaining first connecting edges to the first vertex set, and add the second endpoint of the other remaining first connecting edges to the second vertex set; when the first generation value is greater than or equal to the second generation value, add the first endpoint of the other remaining first connecting edges to the second vertex set, and add the second endpoint of the other remaining first connecting edges to the first vertex set.

[0254] In some embodiments, the vertex partitioning module 4554 is further configured to: determine each first distance between each of the other vertices and each first vertex in the first vertex set, and each second distance between each of the other vertices and each second vertex in the second vertex set; determine a fifth minimum value corresponding to each of the other vertices based on each first distance and each second distance corresponding to each of the other vertices; add the other vertices in the first alpha wrapping result to the dynamic queue in descending order of their respective fifth minimum values; determine a sixth minimum value of the distance between the first other vertex in the dynamic queue and each first vertex in the first vertex set, and a seventh minimum value between the first other vertex and each second vertex in the second vertex set; when the sixth minimum value is less than the seventh minimum value, add the first other vertex to the first vertex set to obtain an updated first vertex set; adjust the order of the other vertices in the current dynamic queue based on the updated first vertex set and the second vertex set to obtain an adjusted dynamic queue; and classify the other vertices in the adjusted dynamic queue into the first vertex set and the second vertex set.

[0255] In some embodiments, the vertex partitioning module 4554 is further configured to: when the sixth minimum value is greater than or equal to the seventh minimum value, add the first other vertex to the second vertex set to obtain an updated second vertex set; based on the first vertex set and the updated second vertex set, adjust the order of other vertices in the current dynamic queue to obtain an adjusted dynamic queue; classify the other vertices in the adjusted dynamic queue into the first vertex set and the second vertex set.

[0256] In some embodiments, the vertex partitioning module 4554 is also configured to: determine the third distances between other vertices in the current dynamic queue and each first vertex in the updated first vertex set, and the fourth distances between other vertices in the current dynamic queue and each second vertex in the second vertex set; determine the fifth minimum values ​​corresponding to other vertices in the current dynamic queue based on the first distances and second distances corresponding to other vertices in the current dynamic queue; re-sort the other vertices in the current dynamic queue in descending order of their corresponding fifth minimum values ​​to obtain an adjusted dynamic queue.

[0257] In some embodiments, the coplanar fitting module 4555 is further configured to: construct a first face using each first vertex in the first vertex set, and construct a second face using each second vertex in the second vertex set; determine a first movement vector corresponding to the first face and a second movement vector corresponding to the second face; move the first face according to the first movement vector to obtain the moved first face, and move the second face according to the second movement vector to obtain the moved second face; determine each second minimum distance from each first vertex on the moved first face to the component to be processed, and determine each third minimum distance from each second vertex on the moved second face to the component to be processed; based on each second minimum distance and each third minimum distance, determine an initial coplanar fitting result from the moved first face and the moved second face; smooth the initial coplanar fitting result to obtain a target coplanar fitting result.

[0258] In some embodiments, the coplanar fitting module 4555 is further configured to: obtain a first facet set adjacent to each first vertex in the first vertex set, and a second facet set adjacent to each second vertex in the second vertex set from the first alpha wrapping result; construct a first face based on each first facet in the first facet set, and construct a second face based on each second facet in the second facet set.

[0259] In some embodiments, the coplanar fitting module 4555 is further configured to: determine a first weighted centroid of the first surface and a second weighted centroid of the second surface, and determine a midpoint between the first weighted centroid and the second weighted centroid; determine a first movement vector of the first surface based on the midpoint and the first weighted centroid; and determine a second movement vector of the second surface based on the midpoint and the second weighted centroid.

[0260] In some embodiments, the coplanar fitting module 4555 is further configured to: determine the first centroid coordinates of each first facet constituting the first facet, the first area of ​​each first facet and the total area of ​​the first facet; determine the first area as the first weight value of the first centroid coordinate; determine the first total centroid coordinate based on the first centroid coordinates of each first facet and the first weight value; determine the first weighted centroid based on the first total centroid coordinate and the total area of ​​the first face.

[0261] In some embodiments, the coplanar fitting module 4555 is further configured to: determine the first distance median from the respective second minimum distances, and determine the second distance median from the respective third minimum distances; when the first distance median is less than the second distance median, determine the first surface after the move as the initial coplanar fitting result; when the first distance median is greater than or equal to the second distance median, determine the second surface after the move as the initial coplanar fitting result.

[0262] In some embodiments, the triangulation processing module 4552 is further configured to: call a preset triangulation function to perform triangulation processing on the first alpha wrapping result to obtain a triangulation processing result.

[0263] An embodiment of the present application provides a computer program product, which includes a computer program or computer-executable instructions stored in a computer-readable storage medium. A processor of an electronic device reads the computer-executable instructions from the computer-readable storage medium and executes the computer-executable instructions, causing the electronic device to perform the virtual component processing method described in the embodiment of the present application.

[0264] An embodiment of the present application provides a computer-readable storage medium storing computer-executable instructions, wherein computer-executable instructions or a computer program are stored. When the computer-executable instructions or the computer program are executed by a processor, the processor will execute the virtual component processing method provided in an embodiment of the present application, for example, the virtual component processing method shown in FIG. 4A .

[0265] In some embodiments, the computer-readable storage medium may be a memory such as RAM, ROM, flash memory, magnetic surface memory, optical disk, or CD-ROM; or may be various devices including one or any combination of the above memories.

[0266] In some embodiments, computer-executable instructions may be in the form of a program, software, software module, script, or code, written in any form of programming language (including compiled or interpreted languages, or declarative or procedural languages), and may be deployed in any form, including as a stand-alone program or as a module, component, subroutine, or other unit suitable for use in a computing environment.

[0267] As an example, computer-executable instructions may, but need not, correspond to a file in a file system, may be stored as part of a file that stores other programs or data, e.g., in one or more scripts in a HyperText Markup Language (HTML) document, in a single file dedicated to the program in question, or in multiple coordinating files (e.g., files storing one or more modules, subroutines, or code portions).

[0268] By way of example, computer-executable instructions may be deployed to be executed on one electronic device, or on multiple electronic devices located at one site, or on multiple electronic devices distributed across multiple sites and interconnected by a communication network.

[0269] The above description is merely an embodiment of the present application and is not intended to limit the scope of protection of the present application. Any modifications, equivalent replacements, and improvements made within the spirit and scope of the present application are included in the scope of protection of the present application.

Claims

1. A virtual component processing method, applied to an electronic device, the method comprising: Acquire a component to be processed, pre-process the component to be processed, and obtain a first alpha wrapping result of the component to be processed; Performing triangulation processing on the first alpha wrapping result to obtain a triangulation processing result; Performing a double-layer structure inspection on the component to be processed based on the triangulation processing result and the first alpha wrapping result to obtain an inspection result; When the detection result indicates that the component to be processed includes a first surface and a second surface that meet a parallel condition, dividing the vertices included in the first alpha wrapping result into a first vertex set located on the first surface and a second vertex set located on the second surface; Based on the first vertex set and the second vertex set, the first surface and the second surface are coplanarly fitted to obtain a target fitting result of the component to be processed.

2. The method according to claim 1, wherein: The preprocessing of the component to be processed to obtain a first alpha wrapping result of the component to be processed includes: Obtaining a first processing parameter value, and generating a second alpha wrapping result of the component to be processed by using the first processing parameter value; Based on the second alpha wrapping result, determining a plurality of target points, wherein the target points are located inside the second alpha wrapping result; A second processing parameter value is obtained, and a first alpha wrapping result of the component to be processed is generated using the second processing parameter value and the multiple target points, wherein the second processing parameter value is smaller than the first processing parameter value.

3. The method according to claim 2, wherein: The determining of a plurality of target points based on the second alpha wrapping result comprises: Performing gridding processing on the second alpha wrapping result to obtain a gridded alpha wrapping result; Determine the vertices of the meshed alpha wrapping result, the midpoints of the connecting edges and the centroid of the triangular facet as the first sampling point; Determine a normal line of each first sampling point toward the inside of the gridded alpha wrap result, and determine an intersection point between the normal line and the gridded alpha wrap result; A midpoint between each of the first sampling points and the corresponding intersection point is determined, and the midpoint is determined as a target point.

4. The method according to claim 2, wherein: The determining of a plurality of target points based on the second alpha wrapping result comprises: Perform uniform sampling in the inner space of the second alpha wrapping result to obtain a plurality of second sampling points; determining a first minimum distance from the second sampling point to the second alpha wrapping result; A second sampling point whose first minimum distance is greater than or equal to a preset first distance threshold is determined as a target point.

5. The method according to claim 1, wherein: The triangulation processing result includes vertices and connecting edges of each triangular facet, and the double-layer structure detection is performed on the to-be-processed component based on the triangulation processing result and the first alpha wrapping result to obtain the detection result, including: Determine a plurality of first connected edges located inside the first alpha wrapping result and a first edge number of the first connected edges in the triangulation processing result; Determine a first ratio of the geodesic distance and the Euclidean distance corresponding to each first connecting edge; Deleting first connecting edges whose first ratio is less than a first ratio threshold from the plurality of first connecting edges to obtain a plurality of remaining first connecting edges; Determine a second number of the remaining first connected edges, and determine a second ratio of the second number of edges to the first number of edges; When the second ratio is greater than or equal to a second ratio threshold, determining that the detection result is that the component to be processed includes a first surface and a second surface that meet a parallel condition; When the second ratio is less than the second ratio threshold, it is determined that the detection result is that the component to be processed does not include the first surface and the second surface that meet the parallel condition.

6. The method according to claim 5, wherein: The step of dividing the vertices included in the first alpha wrapping result into a first vertex set located on the first surface and a second vertex set located on the second surface comprises: Sorting the plurality of remaining first connected edges in descending order according to their corresponding geodesic distances to obtain a plurality of sorted remaining first connected edges; Adding a first endpoint of a first remaining first connected edge among the plurality of sorted remaining first connected edges to the first vertex set, and adding a second endpoint of the first remaining first connected edge to the second vertex set; Classify two endpoints of the remaining first connection edges except the first remaining first connection edge among the sorted remaining first connection edges into the first vertex set and the second vertex set respectively; Other vertices in the first alpha wrap result are classified into the first set of vertices and the second set of vertices.

7. The method according to claim 6, wherein: The step of classifying two endpoints of the remaining first connection edges except the first remaining first connection edge among the sorted remaining first connection edges into the first vertex set and the second vertex set, respectively, includes: Determine a first minimum value of the distance between the first endpoints of the other remaining first connecting edges and each first vertex in the first vertex set; Determine a second minimum value of the distance between the second endpoints of the other remaining first connecting edges and each second vertex in the second vertex set; determining a sum of the first minimum value and the second minimum value as a first generation value; Determine a third minimum value of the distance between the first endpoints of the other remaining first connecting edges and each second vertex in the second vertex set; Determine a fourth minimum value of the distance between the second endpoints of the other remaining first connecting edges and each first vertex in the first vertex set; determining a sum of the third minimum value and the fourth minimum value as a second generation value; Based on the first generation value and the second generation value, two endpoints of the other remaining first connecting edges are classified into the first vertex set and the second vertex set, respectively.

8. The method according to claim 7, wherein: The step of classifying the two endpoints of the other remaining first connecting edges into the first vertex set and the second vertex set respectively based on the first generation value and the second generation value includes: When the first generation value is less than the second generation value, adding the first endpoints of the other remaining first connecting edges to the first vertex set, and adding the second endpoints of the other remaining first connecting edges to the second vertex set; When the first generation value is greater than or equal to the second generation value, the first endpoints of the other remaining first connecting edges are added to the second vertex set, and the second endpoints of the other remaining first connecting edges are added to the first vertex set.

9. The method according to claim 6, wherein: The classifying other vertices in the first alpha wrapping result into the first vertex set and the second vertex set comprises: Determine each first distance between each of the other vertices and each first vertex in the first set of vertices, and each second distance between each of the other vertices and each second vertex in the second set of vertices; Determine a fifth minimum value corresponding to each of the other vertices based on each of the first distances and each of the second distances corresponding to each of the other vertices; Arrange the other vertices in the first alpha wrapping result in descending order of their corresponding fifth minimum values, Add to the dynamic queue; Determine a sixth minimum value of distances between a first other vertex in the dynamic queue and each first vertex in the first vertex set, and a seventh minimum value of distances between the first other vertex and each second vertex in the second vertex set; When the sixth minimum value is less than the seventh minimum value, adding the first other vertex to the first vertex set to obtain an updated first vertex set; Based on the updated first vertex set and the second vertex set, adjusting the order of other vertices in the current dynamic queue to obtain an adjusted dynamic queue; The other vertices in the adjusted dynamic queue are classified into a first vertex set and a second vertex set.

10. The method according to claim 9, wherein: The classifying other vertices in the first alpha wrapping result into the first vertex set and the second vertex set comprises: When the sixth minimum value is greater than or equal to the seventh minimum value, adding the first other vertex to the second vertex set to obtain an updated second vertex set; Based on the first vertex set and the updated second vertex set, adjusting the order of other vertices in the current dynamic queue to obtain an adjusted dynamic queue; The other vertices in the adjusted dynamic queue are classified into a first vertex set and a second vertex set.

11. The method according to claim 9, wherein: The step of adjusting the order of other vertices in the current dynamic queue based on the updated first vertex set and the second vertex set to obtain an adjusted dynamic queue includes: Determine respective third distances between other vertices in the current dynamic queue and respective first vertices in the updated first vertex set, and respective fourth distances between other vertices in the current dynamic queue and respective second vertices in the second vertex set; Determine fifth minimum values ​​corresponding to other vertices in the current dynamic queue based on the first distances and the second distances corresponding to other vertices in the current dynamic queue; The other vertices in the current dynamic queue are sorted in descending order of their corresponding fifth minimum values ​​to obtain an adjusted dynamic queue.

12. The method according to any one of claims 1 to 11, wherein: The coplanar fitting of the first surface and the second surface based on the first vertex set and the second vertex set to obtain the target fitting result of the component to be processed includes: Constructing a first face using each first vertex in the first vertex set, and constructing a second face using each second vertex in the second vertex set; Determine a first movement vector corresponding to the first surface and a second movement vector corresponding to the second surface; Moving the first surface according to a first moving vector to obtain a moved first surface, and moving the second surface according to a second moving vector to obtain a moved second surface; Determine each second minimum distance from each first vertex on the first face after the move to the component to be processed, and determine each third minimum distance from each second vertex on the second face after the move to the component to be processed; Determining an initial coplanar fitting result from the moved first surface and the moved second surface based on the respective second minimum distances and the respective third minimum distances; The initial coplanar fitting result is smoothed to obtain a target coplanar fitting result of the component to be processed.

13. The method according to claim 12, wherein: The step of constructing a first face using each first vertex in the first vertex set, and constructing a second face using each second vertex in the second vertex set, comprises: Obtaining a first patch set corresponding to the first vertex set and a second patch set corresponding to the second vertex set from the first alpha wrapping result, wherein each first patch in the first patch set includes at least one first vertex, and each second patch in the second patch set includes at least one second vertex; A first surface is constructed based on each first surface patch in the first surface patch set, and a second surface is constructed based on each second surface patch in the second surface patch set.

14. The method according to claim 12, wherein: The determining a first movement vector corresponding to the first surface and a second movement vector corresponding to the second surface includes: Determine a first weighted centroid of the first surface and a second weighted centroid of the second surface, and determine a midpoint between the first weighted centroid and the second weighted centroid; determining a first movement vector of the first surface based on the midpoint and the first weighted centroid; A second movement vector of the second surface is determined based on the midpoint and the second weighted centroid.

15. The method according to claim 14, wherein: Determining a first weighted center of the first surface includes: Determine first centroid coordinates of each first face piece constituting the first face, first areas of each first face piece, and a total area of ​​the first face; Determining the first area as a first weight value of the first barycentric coordinate; Determining a first total barycentric coordinate based on the first barycentric coordinates of the first face pieces and the first weight value; A first weighted centroid is determined based on the first total centroid coordinates and the total area of ​​the first surface.

16. The method according to claim 12, wherein: The determining of an initial coplanar fitting result from the moved first surface and the moved second surface based on the respective second minimum distances and the respective third minimum distances comprises: Determine a first distance median from each of the second minimum distances, and determine a second distance median from each of the third minimum distances; When the first distance median is smaller than the second distance median, determining the moved first surface as an initial coplanar fitting result; When the first distance median is greater than or equal to the second distance median, the moved second surface is determined as an initial coplanar fitting result.

17. The method according to any one of claims 1 to 16, wherein the triangulating the first alpha wrapping result to obtain a triangulated result comprises: A preset triangulation function is called to perform triangulation processing on the first alpha wrapping result to obtain a triangulation processing result.

18. A virtual component processing device, the device comprising: A preprocessing module is configured to obtain a component to be processed, preprocess the component to be processed, and obtain a first alpha wrapping result of the component to be processed; A triangulation processing module, configured to perform triangulation processing on the first alpha wrapping result to obtain a triangulation processing result; a double-layer structure detection module, configured to perform a double-layer structure detection on the component to be processed based on the triangulation processing result and the first alpha wrapping result to obtain a detection result; a vertex division module configured to divide the vertices included in the first alpha wrapping result into a first vertex set located on the first surface and a second vertex set located on the second surface when the detection result indicates that the component to be processed includes a first surface and a second surface that meet a parallel condition; The coplanar fitting module is configured to perform coplanar fitting on the first surface and the second surface based on the first vertex set and the second vertex set to obtain a target fitting result of the component to be processed.

19. An electronic device, comprising: A memory for storing computer executable instructions; A processor, configured to implement the virtual component processing method according to any one of claims 1 to 17 when executing the computer executable instructions stored in the memory.

20. A computer-readable storage medium storing computer-executable instructions or a computer program, wherein the computer-executable instructions or the computer program, when executed by a processor, implements the virtual component processing method according to any one of claims 1 to 21.

21. A computer program product, comprising computer executable instructions or a computer program, wherein the computer executable instructions or the computer program, when executed by a processor, implements the virtual component processing method according to any one of claims 1 to 17.

Citation Information

Patent Citations

  • Coplanar fitting method, device and equipment and computer readable storage medium

    CN117235824A

  • Scattered point cloud triangularization method based on support vector machine

    CN112767552A

  • Image rendering method and device, electronic equipment, storage medium and program product

    CN116740256A

  • Method for watermarking a three dimensional object and method for obtaining a payload from a three dimensional object

    US20160063661A1