Detection method and system for single complex model coincidence point

By loading the model in a three-dimensional scene, obtaining the number of vertices, creating and distributing particles, and calculating the distance between particles, the overlapping point detection problem in complex models is solved, efficient model accuracy checking is achieved, and output quality is ensured.

CN118967987AInactive Publication Date: 2024-11-15山东捷瑞信息技术产业研究院有限公司
View PDF 5 Cites 0 Cited by

Patent Information

Application Number
CN202411433413.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-10-15
Publication Date
2024-11-15
Estimated Expiration
Not applicable · inactive patent

AI Technical Summary

Technical Problem

The prior art is difficult to effectively detect overlapping points in a single complex three-dimensional model, especially in the case of complex structures, which affects the accuracy of the final output.

Method used

By loading the model into a three-dimensional scene, obtaining its vertices, creating the same number of particles, and distributing them evenly to the vertices of the model, computing the distance between particles to determine whether there are overlapping points. The specific steps include using the cmds.ls and cmds.polyEvaluate functions of Maya software to obtain the number of vertices, create a particle emitter, set up a particle system, make the particles be distributed along the model surface, and calculate the distance between particles through the Euclidean distance formula to judge overlap. point.

Benefits of technology

This method is more efficient in complex models than directly calculating the distance between the vertices of the surface of the object, ensuring the accuracy of the final output model. Especially when the surface of the object is complex, it can effectively detect and avoid overlapping points and ensure the output effect.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118967987A_ABST
    Figure CN118967987A_ABST
Patent Text Reader

Abstract

The invention relates to a detection method and system for a single complex model coincidence point, and belongs to the technical field of three-dimensional models. The detection method comprises the following steps: loading a model into a three-dimensional scene; selecting a model and obtaining the number of vertexes of the model; creating the same number of particles according to the number of the vertexes; the particles are averagely distributed to model vertexes, so that the particles are in one-to-one correspondence with the model vertexes; and calculating the distance between two particles in all the particles, and judging whether the model has a coincidence point based on the distance. According to the method, the particles are Goal to the object, whether the vertexes of the model coincide or not is judged by comparing the distance between the particle pairs, the surface of the whole object does not need to be traversed, and the efficiency of judging the coincidence points of the single complex model is greatly improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The invention belongs to the technical field of three-dimensional models and is a detection method and system for coincidence points of a single complex model. Background Art

[0002] 3D models are the most basic elements of many current display and expression methods. The correctness and accuracy of 3D models are very necessary. Before the final output of the scene or product model, a standard model inspection process must be carried out first.

[0003] In many projects, it is often necessary to convert industrial digital models in different formats into a format that can be edited and operated by MAYA. Usually, such models have very complex structures, and the export processing conditions are different. They have internal structures, and they also need to be displayed internally according to different display schemes. This requires us to ensure the accuracy of such models in the final stage of outputting the models, and there must be no overlapping points or surfaces, otherwise it will affect the final output effect.

[0004] To address the above issues, the current method for handling simple models is to use smooth display (two levels of smooth, smooth is to insert a loop edge horizontally and vertically between two adjacent lines based on the existing model) or high-quality display in 3D software to determine whether there are overlapping points through visual observation, but this method is not suitable for checking overlapping points in a single complex structure model. Summary of the invention

[0005] In order to solve the above problems, the present invention provides a method and system for detecting coincidence points of a single complex model.

[0006] In a first aspect, the present invention provides a method for detecting coincidence points of a single complex model, comprising the following steps: Step 1: Load the model into the 3D scene; Step 2: Select the model and get the number of its vertices; Step 3: Create the same number of particles according to the number of vertices; Step 4: Evenly distribute the particles to the model vertices so that the particles correspond to the model vertices one by one; Step 5: Calculate the distance between two particles among all particles, and determine whether there are any overlapping points in the model based on the distance.

[0007] Furthermore, in step 2, the model is selected and the number of its vertices is obtained. The specific operation process includes: Step 21: Get the currently selected object model through cmds.ls (sl=True) and store it in the variable selection; Step 22: Evaluate the number of vertices of the selected object model through cmds.polyEvaluate(selection[0], vertex=True), and store the result in the variable numVerts; wherein, the cmds.polyEvaluate function is used to evaluate the number of vertices of the selected object model, selection[0] is used to identify the first object stored in the variable selection, and the filter parameter vertex=True is used to determine that the number of vertices to be obtained; Step 23: Output the number of vertices of the variable numVerts through the Print function, where the number of vertices is the total number of all vertices of the selected model.

[0008] Furthermore, in step 3, according to the number of model vertices, a particle emitter is created to emit particles having the same number as the number of model vertices, which specifically includes: Step 31: Create a particle emitter in the scene, set the emission mode, emission rate and emission time; Step 32: Set the life value of the particles so that the emitted particles always exist, ensuring that the scene particle count is accurate; Step 33: Set the maximum number of particles to the number of model vertices obtained in step 2; Step 34: Emit particles with the same number as the model vertices. The obtained particles and their corresponding set attributes constitute a particle system.

[0009] Furthermore, the step 4 evenly distributes the particles to the model vertex positions so that the distribution of the particles corresponds to the model vertices one by one; specifically includes: Step 41: Select the particles created in step 3 and the model imported in step 1, and let them participate in the subsequent operation steps; Step 42: Execute the Goal command in the particle system to make the particles created in step 3 fit and distribute along the vertices of the model surface in step 1; Step 43: Set the Goal Weight value to 1 so that the particles are accurately adsorbed and distributed to the vertex positions of the model in step 1 without floating.

[0010] Furthermore, the step 5 calculates the distance between two particles among all particles, and determines whether there are overlapping points in the model based on the distance. The specific method is as follows: Step 51: Set the particle system name to particleSystem; Step 52: Get the positions of all particles in the particleSystem in step 51 through the cmds.getParticleAttr function combined with the at='position' filter parameter; Step 53: Check whether the result obtained in step 52 is a list. If so, continue to execute the calculation method of step 54; if not, do not execute the calculation method of step 54; Step 54: Calculate the distance between the two particles using the Euclidean distance formula d = sqrt((x2 - x1)^2 + (y2 - y1)^2 + (z2 -z1)^2), the process includes: Step 54.1: Get the XYZ coordinates of particles P1 and P2; Step 54.2: Calculate the distance difference between the two particles P1 and P2 on the XYZ axis, namely (p1[0]-p2[0]), (p1[1]-p2[1]) and (p1[2]-p2[2]); Here, the expression p1[0] - p2[0] usually means to subtract the first element of one point p1 (usually the x coordinate) from the first element of another point p2. In Maya, the coordinates of points are usually represented in the form of lists, for example: p1 may be a three-element list representing the point position, such as [x1, y1, z1]. p2 is also a three-element list representing the point position, such as [x2, y2, z2]. Here, p1[0] is the x coordinate of point p1, and p2[0] is the x coordinate of point p2. Therefore, the expression p1[0] - p2[0] will calculate the distance difference between the two points in the x-axis direction; Step 54.3: Calculate the squares of the three distance differences respectively, and add the squares of the three distance differences to obtain the total square distance; Step 54.4: Take the square root of the total squared distance to obtain the Euclidean distance between the two particles.

[0011] Step 55: Through the for loop and range() function, in combination with variables P1 and P2, all particles in the particle system of step 51 are traversed, and the distance between two particles among all particles is calculated using the method of step 54.

[0012] Step 56: If the obtained distance is less than 0.01, it indicates that the particle distance is 0, which means that there are overlapping points in the model; if the obtained distance is greater than or equal to 0.01, it indicates that the particle distance is not 0, which means that there are no overlapping points in the model.

[0013] In a second aspect, the present invention provides a detection system for coincidence points of a single complex model, comprising: Model loading module, used to load the model into the three-dimensional scene; Vertex acquisition module, used to select a model and obtain the number of its vertices; A particle creation module, used for creating the same number of particles according to the number of vertices; The particle distribution module is used to evenly distribute particles to the model vertices so that particles correspond to model vertices one by one; The calculation and judgment module is used to calculate the distance between two particles among all particles, and judge whether there is an overlap point in the model based on the distance.

[0014] The present invention is a method and system for detecting coincidence points of a single complex model. By placing the particle Goal on the object, the distance calculation between particles can indeed be more efficient than calculating the distance between the vertices on the surface of the object, especially when the surface of the object is very complex. This is because the distance calculation between particles only needs to compare particle pairs, and does not need to traverse the entire surface of the object. In some projects with higher requirements, the accuracy of the final output model can be guaranteed, which has a very important positive role and practical significance. BRIEF DESCRIPTION OF THE DRAWINGS

[0015] Figure 1 This is a flow chart of the detection method of Example 1; Figure 2 This is a structural diagram of the detection system of Example 2. DETAILED DESCRIPTION

[0016] In order to clearly illustrate the technical features of the present invention, the present invention will be described in detail below through specific implementation methods and in conjunction with the accompanying drawings. The disclosure below provides many different embodiments for realizing different structures of the present invention. In order to simplify the disclosure of the present invention, the components and settings of specific examples are described below. In addition, the present invention may repeat reference numbers and / or letters in different examples. This repetition is for the purpose of simplicity and clarity, and does not itself indicate the relationship between the various embodiments and / or settings discussed. It should be noted that the components illustrated in the accompanying drawings are not necessarily drawn to scale. The present invention omits the description of known components and processing techniques and processes to avoid unnecessary limitations on the present invention.

[0017] Embodiment 1 A method for detecting coincidence points of a single complex model, the process is as follows Figure 1 As shown, the following steps are included: Step 1: Load the model Open or import a single complex model and load a single complex 3D model into a 3D scene for subsequent editing operations.

[0018] Step 2: Select the model and get its vertex count Select the model in the scene and define the variable numVerts to store the number of model vertices obtained. The specific code steps are as follows: Step 21: Execute the code selection = cmds.ls(sl=True), which is intended to list the object models selected in the scene through the cmds.ls(list) function, list only the currently selected object model through the sl=True filtering parameter, and store this model in the variable selection; Step 22: Evaluate the number of vertices of the selected object model through numVerts = cmds.polyEvaluate(selection[0], vertex=True) and store the result in the variable numVerts. In the above code, the cmds.polyEvaluate function is used to evaluate the number of vertices of the selected object model, selection[0] is used to identify the first object stored in the variable selection, and the filter parameter vertex=True is used to determine that the number of vertices to be obtained; Step 23: Use the Print function to output the number of vertices in the variable numVerts, and use the else statement to indicate that if the list is empty or no object is selected, the content in the else statement will be executed: 0000, indicating that a model needs to be selected.

[0019] Step 3: Create the same number of particles as vertices Based on the number of vertices, create a particle emitter that emits the same number of particles as the total number of vertices.

[0020] Step 31: Create a particle emitter in the scene, adjust the emission mode, emission rate, and emission time of the emitter, and enable the particle emitter to emit particles quickly; Step 32: Change the particle life value to Live forever, so that the emitted particles exist forever, ensuring the accurate particle count of the scene; Step 33: Set the maximum number of particles in the scene Max Count, where the maximum number of particles Max Count is equal to the number of vertices obtained in step 2; Step 34: Emit particles with the same number as the model vertices. The obtained particles and their corresponding set attributes constitute a particle system.

[0021] Step 4: Adsorb the particles one by one to the vertices of the model Distribute particles evenly to the model vertices so that the distribution of particles corresponds to the model vertices one by one; specifically, it includes: Step 41: Select the particles created in step 3 and the model imported in step 1, and let them participate in the subsequent operation steps; Step 42: Execute the Goal command in the MAYA system, so that the particles created in step 3 are distributed along the vertices of the model surface in step 1. Goal is a built-in function of the MAYA software particle system, and is very commonly used in particle systems and special effects. Here we only use the primary function of the particle and model Goal. Using Goal, particles with the same number of vertices are accurately distributed according to the model vertex positions. The weight value needs to be adjusted to 1, and the particles will be distributed according to the model vertices. After Goal is completed, the hidden model will get a model outline similar to a point cloud shape composed of points; Step 43: Adjust the Goal Weight value to 1, so that the particles can be accurately adsorbed and distributed to the model vertex positions in step 1 without floating.

[0022] Step 5: Determine whether there are overlapping points in the model by the distance between particles Calculate the distance between particles, and determine whether there are overlapping points in the model based on the distance between particles; if the distance between particles is zero, it means that there are overlapping points in the model; the specific method for calculating the distance between particles includes: Step 51: Set the particle system name to particleSystem; Step 52: Get the positions of all particles in the particleSystem in step 51 through the cmds.getParticleAttr function combined with the at='position' filter parameter; Step 53: Check whether the result obtained in step 52 is a list. If so, it indicates that it is a particle system and the subsequent calculation method can be executed; if not, it indicates an error and the subsequent calculation method does not need to be executed; Step 54: Calculate the distance between two particles using the calculate_distance function. The basic principle is the Euclidean distance formula: d = sqrt((x2 - x1)^2 + (y2 - y1)^2 + (z2 - z1)^2). The algorithm process includes: Step 54.1: Get the XYZ coordinates of the positions of particles P1 and P2; Step 54.2: Calculate the distance difference between particles P1 and P2 on the XYZ axis, namely (p1[0] -p2[0]), (p1[1] -p2[1]) and (p1[2] - p2[2]); Step 54.3: Calculate the squares of the three distance differences respectively, and add the squares of the three distance differences to obtain the total square distance; Step 54.4: Take the square root of the total square distance to get the Euclidean distance between the two particles; Step 55: Use the for loop and range() function to traverse all particles in the particle system in step 51, combined with variables P1 and P2, and use the method in step 54 to calculate the distance between two particles. The specific method is as follows: for i in range(0, len(particlePositions), 3) p1 = particlePositions[i:i+3] for j in range(i+3, len(particlePositions), 3): p2 = particlePositions[j:j+3] distance = calculate_distance(p1, p2) if distance<0.001: print("111") else: print("000") Step 56: Due to the precision of floating point numbers, this embodiment uses a threshold to determine the distance: if the distance is less than 0.01, 111 is output, indicating that the particle distance is 0, indicating that there are overlapping points or overlapping surfaces. If the distance is greater than or equal to 0.01, 000 is output, indicating that the particle distance is not 0, indicating that there are no overlapping points or overlapping surfaces.

[0023] This embodiment emits particles with the same number of vertices as the target three-dimensional model, targets the particles to the object, and makes the positions of the particles correspond one-to-one with the positions of the vertices of the three-dimensional model. By obtaining the spatial position coordinates of the particles in the particle system and calculating the distance between the particles, it is determined whether there are overlapping points through a fixed threshold.

[0024] Embodiment 2 This embodiment provides a detection system for coincidence points of a single complex model, including: Model loading module, used to load the model into the three-dimensional scene; Vertex acquisition module, used to select a model and obtain the number of its vertices; A particle creation module, used for creating the same number of particles according to the number of vertices; The particle distribution module is used to evenly distribute particles to the model vertices so that particles correspond to model vertices one by one; The calculation and judgment module is used to calculate the distance between two particles among all particles, and judge whether there is an overlap point in the model based on the distance.

[0025] The above embodiments are only technical solutions of the present invention rather than limitations thereof. It should be pointed out that, for those skilled in the art, the specific implementation modes of the present invention may be modified or replaced by equivalents without departing from the technical principles of the present invention. Any modification or equivalent replacement without departing from the spirit and scope of the present invention shall be included in the protection scope of the present invention.

Claims

1. A method for detecting coincidence points of a single complex model, characterized in that: The following steps are involved: Step 1: Load the model into the 3D scene; Step 2: Select the model and get the number of its vertices; Step 3: Create the same number of particles according to the number of vertices; Step 4: Evenly distribute the particles to the model vertices so that the particles correspond to the model vertices one by one; Step 5: Calculate the distance between two particles among all particles, and determine whether there are any overlapping points in the model based on the distance.

2. A method for detecting coincidence points of a single complex model as claimed in claim 1, characterized in that: In step 2, the model is selected and the number of its vertices is obtained. The specific operation process includes: Step 21: Get the currently selected object model through cmds.ls (sl=True) and store it in the variable selection; Step 22: Evaluate the number of vertices of the selected object model through cmds.polyEvaluate(selection[0], vertex=True), and store the result in the variable numVerts; wherein, the cmds.polyEvaluate function is used to evaluate the number of vertices of the selected object model, selection[0] is used to identify the first object stored in the variable selection, and the filter parameter vertex=True is used to determine that the number of vertices to be obtained; Step 23: Output the number of vertices of the variable numVerts through the Print function, where the number of vertices is the total number of all vertices of the selected model.

3. A method for detecting coincidence points of a single complex model as claimed in claim 1, characterized in that: In step 3, according to the number of model vertices, a particle emitter is created to emit particles having the same number of model vertices, which specifically includes: Step 31: Create a particle emitter in the scene, set the emission mode, emission rate and emission time; Step 32: Set the life value of the particles so that the emitted particles always exist, ensuring that the scene particle count is accurate; Step 33: Set the maximum number of particles to the number of vertices obtained in step 2; Step 34: Emit particles with the same number as the model vertices. The obtained particles and their corresponding set attributes constitute a particle system.

4. A method for detecting coincidence points of a single complex model as claimed in claim 1, characterized in that: The step 4 evenly distributes the particles to the model vertex positions so that the distribution of the particles corresponds to the model vertices one by one; specifically includes: Step 41: Select the particles created in step 3 and the model imported in step 1, and let them participate in the subsequent operation steps; Step 42: Execute the Goal command in the particle system to make the particles created in step 3 fit and distribute along the vertices of the model surface in step 1; Step 43: Set the Goal Weight value to 1 so that the particles are accurately adsorbed and distributed to the vertex positions of the model in step 1 without floating.

5. A method for detecting coincidence points of a single complex model as claimed in claim 1, characterized in that: The step 5 calculates the distance between two particles among all particles, and determines whether there is an overlap point in the model based on the distance. The specific method is as follows: Step 51: Set the particle system name to particleSystem; Step 52: Get the positions of all particles in the particleSystem in step 51 through the cmds.getParticleAttr function combined with the at='position' filter parameter; Step 53: Check whether the result obtained in step 52 is a list. If so, continue to execute the calculation method of step 54; if not, do not execute the calculation method of step 54; Step 54: Calculate the distance between the two particles using the Euclidean distance formula d = sqrt((x2 - x1)^2 + (y2 - y1)^2 + (z2 - z1)^2), the process includes: Step 54.1: Get the XYZ coordinates of particles P1 and P2; Step 54.2: Calculate the distance difference between the two particles P1 and P2 on the XYZ axis, namely (p1[0]-p2[0]), (p1[1]-p2[1]) and (p1[2]-p2[2]); Step 54.3: Calculate the squares of the three distance differences respectively, and add the squares of the three distance differences to obtain the total square distance; Step 54.4: Take the square root of the total square distance to get the Euclidean distance between the two particles; Step 55: Use the for loop and range() function to traverse all particles in the particle system in step 51 in combination with variables P1 and P2, and use the method in step 54 to calculate the distance between two particles in all particles; Step 56: If the obtained distance is less than 0.01, it indicates that the particle distance is 0, which means that there are overlapping points in the model; if the obtained distance is greater than or equal to 0.01, it indicates that the particle distance is not 0, which means that there are no overlapping points in the model.

6. A detection system for coincidence points of a single complex model, used to implement the detection method according to any one of claims 1 to 5, characterized in that: include: Model loading module, used to load the model into the three-dimensional scene; Vertex acquisition module, used to select the model and obtain the number of its vertices; A particle creation module, used for creating the same number of particles according to the number of vertices; The particle distribution module is used to evenly distribute particles to the model vertices so that particles correspond to model vertices one by one; The calculation and judgment module is used to calculate the distance between two particles among all particles, and judge whether there is an overlap point in the model based on the distance.

Citation Information

Patent Citations

  • Boolean calculation method for triangular grid data and system thereof

    CN102682476A

  • Model particle generation method and device, equipment and storage medium

    CN115659769A

  • Complex geometric model particle discretization method and system and electronic equipment

    CN117763931A

  • Object recognition method

    JP2009128075A

  • Projection-based model surface spline generation method

    WO2024169159A1