Model data conversion method, device and medium for mesh surface projection direction
By calculating the surface area and normal vector of the mesh surface, determining the target projection direction and rotating the data model, the complex mesh surface data processing problem in the prior art is solved, and data processing efficiency and precision of three-dimensional surface processing are improved.
Patent Information
- Application Number
- CN202311230665.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-09-21
- Publication Date
- 2024-12-31
- Estimated Expiration
- Not applicable · inactive patent
AI Technical Summary
In the prior art, the optimal projection direction of the mesh surface and the model data conversion operation are complex, the data processing efficiency is low, and it is difficult to meet the precision machining needs of complex surface parts.
By obtaining the three-dimensional data model of the mesh surface, calculate the area and normal vector of the face plate, perform the reverse calculation of the area-weighted method vector, determine the target projection direction, and rotate the data model to the target projection direction overlap, replacing the vertex coordinates and face plate The normal vector generates the best mesh surface model file.
The process of processing and conversion of mesh surface projection direction is simplified, data processing efficiency is improved, and more efficient data model conversion and three-dimensional surface processing is achieved.
Smart Images

Figure CN117409172B_ABST
Abstract
Description
Technical Field
[0001] The invention relates to the technical field of digital manufacturing, and in particular to a model data conversion method, equipment and medium in a mesh surface projection direction. Background Art
[0002] In the related technologies of digital manufacturing, complex curved surface parts often use the three-dimensional model data expression method of parametric surfaces, and any external dimension data is accurately recorded through the digital information of the digital surface. Mesh surface is another effective way to express three-dimensional surface data, which expresses the approximate surface contour data of complex surfaces through a number of connected triangular facets. In view of the precision machining and manufacturing needs of complex curved surface parts, multi-axis CNC machining is currently the most effective technical means. This machining method can control the movement and swing of the machining tool in three-dimensional space, and select the best moving position and swing angle direction to realize the cutting of physical parts. In the existing technology, the operations such as the best projection direction of the mesh surface and the model data conversion are relatively complicated to handle, and the data processing efficiency is low. Summary of the invention
[0003] The present invention aims to solve at least one of the technical problems existing in the prior art. To this end, the present invention proposes a model data conversion method in the mesh surface projection direction, which can simply and effectively process and convert the mesh surface projection and improve the efficiency of data processing.
[0004] In a first aspect, a model data conversion method for a mesh surface projection direction according to an embodiment of the present invention includes: obtaining a first three-dimensional data model of a mesh surface, wherein the first three-dimensional data model includes a plurality of first mesh surface patches, wherein the first mesh surface patches include a first patch normal vector and vertex coordinates of the first mesh surface patches;
[0005] Obtaining the area of the first mesh surface patch according to the first patch normal vector and the first vertex coordinates, obtaining a patch normal vector according to the area of the first mesh surface patch, obtaining an area-weighted normal vector according to the area of the first mesh surface patch and the patch normal vector, and negating the area-weighted normal vector to obtain a target projection direction of the mesh surface;
[0006] Convert the first three-dimensional data model according to the target projection direction, rotate the first three-dimensional data model to coincide with the target projection direction, and obtain a second three-dimensional data model;
[0007] Extracting data information of the second three-dimensional data model, where the data information of the second three-dimensional data model includes a plurality of second mesh surface patches, where the second mesh surface patches include second patch normal vectors and vertex coordinates of the second mesh surface patches;
[0008] The second patch normal vector and the vertex coordinates of the second mesh surface patch of the second three-dimensional data model replace the first patch normal vector and the vertex coordinates of the first mesh surface patch of the first three-dimensional data model to obtain a mesh surface model file with target projection direction coordinate conversion.
[0009] According to some embodiments of the present invention, obtaining a patch normal vector according to the area of the first mesh surface patch, and inverting the patch normal vector to obtain a target projection direction of the mesh surface projection includes:
[0010] Calculating the areas of a plurality of the first mesh surface patches in sequence;
[0011] Performing weighted calculation on the area of the first mesh surface patch and the patch normal vector to obtain a weighted normal vector value;
[0012] The weighted normal vector value is inverted to obtain an inverted value.
[0013] According to some embodiments of the present invention, the vertex coordinates of the first mesh surface patch include a first vertex coordinate value, a second vertex coordinate value, and a third vertex coordinate value, and sequentially calculating the areas of the plurality of first mesh surface patches includes:
[0014] Obtain a first side length value, a second side length value, and a third side length value of the first mesh surface patch according to the first vertex coordinate value, the second vertex coordinate value, and the third vertex coordinate value, wherein the first side length value is the sum of the differences between the first vertex coordinate and the second vertex coordinate, the second side length value is the sum of the differences between the second vertex coordinate and the third vertex coordinate, and the third side length value is the sum of the differences between the third vertex coordinate and the first vertex coordinate, and the sum of the differences is a positive value;
[0015] Acquire a half-perimeter value of the first mesh surface patch according to the first coordinate value, the second coordinate value, and the third coordinate value;
[0016] The area of the first mesh surface patch is obtained according to the first side length value, the second side length value, the third side length value and the semi-perimeter value.
[0017] According to some embodiments of the present invention, obtaining the area of the first mesh surface patch according to the first side length value, the second side length value, the third side length value and the semi-perimeter value includes:
[0018] Obtain the product of the semi-perimeter value and the difference between the first side length value, the second side length value and the third side length value;
[0019] Obtain the product of the semi-perimeter value and the product of the difference between the first side length value, the second side length value and the third side length value and the semi-perimeter value;
[0020] The arithmetic square root of the product of the semi-perimeter value and the difference between the first side length value, the second side length value and the third side length value and the product of the semi-perimeter value is calculated to obtain the area of the first mesh surface patch.
[0021] According to some embodiments of the present invention, performing conversion according to the target projection direction and rotating the first three-dimensional data model to coincide with the target projection direction to obtain a second three-dimensional data model includes:
[0022] Get the preset quaternary data matrix;
[0023] Calculating a three-dimensional coordinate rotation angle and a unit vector between the first mesh surface patch and the target projection direction;
[0024] Determining a value range of the three-dimensional coordinate rotation angle according to the three-dimensional coordinate rotation angle and the unit vector;
[0025] The first vertex coordinates, the second vertex coordinates, the third vertex coordinates, and the value range of the face normal vector are brought into the quaternary data matrix, the target file is output, and a second three-dimensional data model is obtained according to the target file.
[0026] According to some embodiments of the present invention, the outputting the target file and obtaining the second three-dimensional data model according to the target file includes:
[0027] Extracting the first three-dimensional data model from the target file in sequence, and rotating the first three-dimensional data model to the target projection direction according to the three-dimensional coordinates and the unit vector;
[0028] Replace the three-dimensional data in the first three-dimensional data model with the vertex coordinates of the first three-dimensional data model rotated to the target projection direction and the surface normal vector;
[0029] When all the vertex coordinates and the surface normal vectors have completed the replacement of the first three-dimensional data model, the second three-dimensional data model is obtained.
[0030] According to some embodiments of the present invention, replacing the vertex coordinates of the first patch normal vector and the second patch normal vector of the first three-dimensional data model with the vertex coordinates of the second patch normal vector and the second mesh surface patch of the second three-dimensional data model includes:
[0031] Determine the product of the first patch normal vector and the quaternion matrix as the patch normal vector of the second mesh surface patch;
[0032] Determine the product of the vertex coordinates of the first mesh surface patch and the quaternion matrix as the vertex coordinates of the second mesh surface patch;
[0033] The first patch normal vector and the vertex coordinates of the first mesh surface patch are replaced by the second patch normal vector and the vertex coordinates of the second mesh surface patch.
[0034] In a second aspect, an embodiment of the present invention also includes a data model conversion device for a mesh surface projection direction, comprising at least one control processor and a memory for communicating with the at least one control processor; the memory stores instructions executable by the at least one control processor, and the instructions are executed by the at least one control processor so that the at least one control processor can execute the data model conversion method for the mesh surface projection direction described in the first aspect.
[0035] In a third aspect, an embodiment of the present invention further includes an electronic device, including a code compiling device for register quantity control as in the embodiment of the second aspect.
[0036] In a fourth aspect, an embodiment of the present invention further includes a computer-readable medium, in which a computer program is stored. When the computer program is executed by a processor, the method of the first aspect and the second aspect is implemented.
[0037] The data model conversion method of the mesh surface projection direction according to the embodiment of the present invention has at least the following beneficial effects:
[0038] The patch normal of the first mesh surface patch is obtained through the first patch normal vector and vertex coordinates of the first three-dimensional data model of the mesh surface, the area weighted normal is obtained through the patch normal vector and the area of the first mesh surface patch, the target projection direction is obtained by inverting the area weighted normal vector, the first three-dimensional data model is rotated to coincide with the target projection direction to obtain a second three-dimensional data model, the vertex coordinates of the first mesh surface patch are replaced by the second patch normal vector of the second three-dimensional data model and the vertex coordinates of the second mesh surface patch to obtain an optimal mesh surface model file, the conversion operation process is simple, and the data processing efficiency is high.
[0039] Additional aspects and advantages of the present invention will be given in part in the following description and in part will be obvious from the following description, or will be learned through practice of the present invention. BRIEF DESCRIPTION OF THE DRAWINGS
[0040] The above and / or additional aspects and advantages of the present invention will become apparent and easily understood from the description of the embodiments in conjunction with the following drawings, in which:
[0041] Figure 1A flow chart of the steps of a method for converting model data of a mesh surface projection direction provided by an embodiment of the present invention;
[0042] Figure 2 A flowchart of the steps of obtaining a first three-dimensional data model of a mesh surface provided in an embodiment of the present invention;
[0043] Figure 3 A flowchart of steps for calculating the areas of a plurality of first mesh surface patches provided in an embodiment of the present invention;
[0044] Figure 4 A flowchart of steps for obtaining the area of a first mesh surface patch provided in an embodiment of the present invention;
[0045] Figure 5 A flowchart of steps for obtaining a second three-dimensional data model provided by an embodiment of the present invention;
[0046] Figure 6 A flowchart of the steps of obtaining a second three-dimensional data model according to a target file provided in an embodiment of the present invention;
[0047] Figure 7 A flowchart of the steps of obtaining a mesh surface model file for target projection direction coordinate conversion provided by an embodiment of the present invention;
[0048] Figure 8 A hardware schematic diagram of a model data conversion device for a mesh surface projection direction provided by an embodiment of the present invention. DETAILED DESCRIPTION
[0049] This section will describe in detail the specific embodiments of the present invention. The preferred embodiments of the present invention are shown in the accompanying drawings. The purpose of the accompanying drawings is to supplement the description of the text part of the specification with graphics, so that people can intuitively and vividly understand each technical feature and the overall technical solution of the present invention, but it cannot be understood as a limitation on the scope of protection of the present invention.
[0050] In the description of the present invention, "several" means one or more, "more" means more than two, "greater than", "less than", "exceed" etc. are understood as not including the number itself, and "above", "below", "within" etc. are understood as including the number itself. If there is a description of "first" or "second", it is only used for the purpose of distinguishing the technical features, and cannot be understood as indicating or implying the relative importance or implicitly indicating the number of the indicated technical features or implicitly indicating the order of the indicated technical features.
[0051] In the description of the present invention, unless otherwise clearly defined, terms such as setting, installing, connecting, etc. should be understood in a broad sense, and technicians in the relevant technical field can reasonably determine the specific meanings of the above terms in the present invention based on the specific content of the technical solution.
[0052] Reference Figure 1 The method of the embodiment of the present invention comprises the following steps:
[0053] S100. Acquire a first three-dimensional data model of a mesh surface, the first three-dimensional data model comprising a plurality of first mesh surface patches, the first mesh surface patches comprising first patch normal vectors and vertex coordinates of the first mesh surface patches;
[0054] S200. Obtaining the area of the first mesh surface patch according to the first patch normal vector and the first vertex coordinates, obtaining the patch normal vector according to the area of the first mesh surface patch, obtaining the area weighted normal vector according to the area of the first mesh surface patch and the patch normal vector, and negating the area weighted normal vector to obtain the target projection direction of the mesh surface;
[0055] S300. Convert the first three-dimensional data model according to the target projection direction, rotate the first three-dimensional data model to coincide with the target projection direction, and obtain a second three-dimensional data model;
[0056] S400. Extracting data information of a second three-dimensional data model, the data information of the second three-dimensional data model includes a plurality of second mesh surface patches, the second mesh surface patches include second patch normal vectors and vertex coordinates of the second mesh surface patches;
[0057] S500. Replace the first patch normal vector and the vertex coordinates of the first mesh surface patch of the first three-dimensional data model with the second patch normal vector and the vertex coordinates of the second mesh surface patch of the second three-dimensional data model to obtain a mesh surface model file with target projection direction coordinate conversion.
[0058] It is worth mentioning that the technical operation of the optimal projection direction and data model conversion of the mesh surface in the prior art, for the "3+2" directional price of the specified processing area of the complex surface parts, needs to obtain the surface outer normal vector and two-dimensional boundary contour data of the three-dimensional model, so as to realize the tool swing angle selection of the directional rotation axis and the tool path generation of the three-axis linkage processing, by storing the coordinates of each vertex and the normal vector of the face of the complex surface in the STL file format, but due to the special model data storage method of the STL file, the file data of the mesh surface cannot effectively improve the three-dimensional model surface outer normal vector and two-dimensional boundary contour data used for the 3+2 directional price. In the present embodiment, the patch normal of the first mesh surface patch is obtained through the first patch normal vector and vertex coordinates of the first three-dimensional data model of the mesh surface, the area-weighted normal is obtained through the patch normal vector and the area of the first mesh surface patch, the target projection direction is obtained by inverting the area-weighted normal vector, the first three-dimensional data model is rotated to coincide with the target projection direction to obtain a second three-dimensional data model, the vertex coordinates of the first mesh surface patch are replaced according to the second patch normal vector of the second three-dimensional data model and the vertex coordinates of the second mesh surface patch to obtain the optimal mesh surface model file, the conversion operation process is simple, and the data processing efficiency is high.
[0059] in, Figure 1 Specifically, step S100 is to extract the first normal vector of the first mesh surface patch and the three-dimensional coordinates of the three vertices of the first mesh surface patch from the STL file in sequence, until the three-dimensional data of all the first mesh surface patches in the first three-dimensional data model are extracted. Specifically, let the first mesh surface patch currently extracted be i, and the coordinates of the first normal vector can be expressed as The coordinates of the three vertices of the first mesh surface patch are v i1 (x i1 ,y i1 ,z i1 ),v i2 (x i2 ,y i2 ,z i2 ) and v i3 (x i3 ,y i3 ,z i3 ).
[0060] Reference Figure 2 , Figure 1 Step S100 includes but is not limited to the following steps:
[0061] S110. Calculate the areas of multiple first mesh surface patches in sequence;
[0062] S120. Perform weighted calculation on the area of the first mesh surface patch and the patch normal vector to obtain a weighted normal vector value;
[0063] S130. Negate the weighted normal vector value to obtain a negated value.
[0064] Reference Figure 3 , the vertex coordinates of the first mesh surface patch include a first vertex coordinate value, a second vertex coordinate value, and a third vertex coordinate value, and step S110 includes but is not limited to the following steps:
[0065] S111. Obtain a first side length value, a second side length value, and a third side length value of a first mesh surface patch according to the first vertex coordinate value, the second vertex coordinate value, and the third vertex coordinate value, wherein the first side length value is the sum of the differences between the first vertex coordinate and the second vertex coordinate, the second side length value is the sum of the differences between the second vertex coordinate and the third vertex coordinate, and the third side length value is the sum of the differences between the third vertex coordinate and the first vertex coordinate, and the sum of the differences is a positive value;
[0066] S112. Obtaining a half-perimeter value of the first mesh surface patch according to the first coordinate value, the second coordinate value, and the third coordinate value;
[0067] S113. Obtain the area of the first mesh surface patch according to the first side length value, the second side length value, the third side length value and the semi-perimeter value.
[0068] Reference Figure 4 Step S113 includes but is not limited to the following steps:
[0069] S601. Obtain the product of the semi-perimeter value and the difference between the first side length value, the second side length value and the third side length value;
[0070] S602. Obtain the product of the semi-perimeter value and the product of the difference between the first side length value, the second side length value and the third side length value and the semi-perimeter value;
[0071] S603. Calculate the arithmetic square root of the product of the semi-perimeter value and the difference between the first side length value, the second side length value and the third side length value and the product of the semi-perimeter value to obtain the area of the first mesh surface patch.
[0072] In which, let the first side length of the first mesh surface patch be a i , the second side length is b i , the third side length is c i , the process of calculating the side length can be expressed by the following formula:
[0073]
[0074]
[0075]
[0076] According to the first side length ai , the second side length is b i and the third side is c i The semi-perimeter q i It is obtained by the following formula:
[0077]
[0078] Therefore, the area S of the first mesh surface patch i is i It can be expressed as:
[0079]
[0080] Area-weighted normal vector values for mesh surfaces It can be expressed as:
[0081]
[0082] Best projection direction is the area-weighted normal vector The reverse direction can be expressed as:
[0083]
[0084] Reference Figure 5 Step S300 includes but is not limited to the following steps:
[0085] S310. Obtaining a preset four-dimensional data matrix;
[0086] S320. Calculate the three-dimensional coordinate rotation angle and unit vector between the first mesh surface patch and the target projection direction;
[0087] S330. Derive the range of the three-dimensional coordinate rotation angle according to the three-dimensional coordinate rotation angle and the unit vector;
[0088] S340. Substitute the first vertex coordinates, the second vertex coordinates, the third vertex coordinates, and the value range of the face normal vector into the quaternary data matrix, output the target file, and obtain the second three-dimensional data model based on the target file.
[0089] Reference Figure 6 Step S340 includes but is not limited to the following steps:
[0090] S341. Extracting the first three-dimensional data model from the target file in sequence, and rotating the first three-dimensional data model to the target projection direction according to the three-dimensional coordinates and the unit vector;
[0091] S342. Replace the three-dimensional data in the first three-dimensional data model with the vertex coordinates and the face normal vector of the first three-dimensional data model rotated to the target projection direction;
[0092] S343. When all vertex coordinates and face normal vectors have completed replacing the first three-dimensional data model, a second three-dimensional data model is obtained.
[0093] Reference Figure 7 Step S500 includes but is not limited to the following steps:
[0094] S510. Determine the product of the first patch normal vector and the quaternion matrix as the patch normal vector of the second mesh surface patch;
[0095] S520. Determine the product of the vertex coordinates of the first mesh surface patch and the quaternion matrix as the vertex coordinates of the second mesh surface patch;
[0096] S530. Replace the first patch normal vector and the vertex coordinates of the first mesh surface patch with the second patch normal vector and the vertex coordinates of the second mesh surface patch.
[0097] Specifically, the orientation processing of the mesh surface patch should orient the two rotation axes of the first mesh surface patch to the target projection direction, and use the target projection direction The opposite direction of As the +Z direction of three-axis linkage machining, the spatial rotation method of four elements is used to realize the spatial rotation of the first three-dimensional model data in the STL file.
[0098] Calculate the unit vector coordinate point of the first mesh surface patch in the positive direction of the Z axis To the first mesh surface area weighted normal vector value The three-dimensional coordinates are rotated by an angle θ.
[0099] set up The unit vector coordinate point in the positive direction of the Z axis To the mesh surface area weighted normal value The three-dimensional coordinate rotation axis unit vector, unit vector It can be expressed as the first formula:
[0100]
[0101] Among them, the unit vector of the three-dimensional coordinate rotation axis It can also be expressed as the second formula using three coordinate components and a coordinate basis:
[0102]
[0103] That is, the unit vector of the three-dimensional coordinate rotation axis The coordinates of (u x ,u y ,u z ), and can be solved by combining the first and second formulas to calculate:
[0104]
[0105] Since the value range of the three-dimensional coordinate rotation angle θ is [0,2π), we have:
[0106]
[0107] Extract the normal vector, first vertex coordinate, second vertex coordinate and third vertex coordinate of the first mesh surface patch from the STL file in sequence, so that the first three-dimensional model is spatially rotated according to the extracted data information until the three-dimensional data of all the first mesh surface patches are extracted. Here, let the first mesh surface patch currently extracted be i, and the normal vector of the second mesh surface patch obtained after the first mesh surface patch is converted be The coordinates of the three vertices of the second mesh surface patch are v i ′ j (x i ′ j ,y i ′ i ,z i ′ j ), j=1,2,3.
[0108]
[0109]
[0110] Among them, the preset quaternion matrix M is calculated by the following matrix:
[0111]
[0112] In summary, the vertex coordinates v′ of the transformed second mesh surface patch are ij and the second patch normal vector By importing the first 3D model data STL file and replacing the first 3D model data, a mesh surface model file with coordinate transformation along the best projection direction can be obtained. This model is directly used for the generation of NC code for three-axis linkage. The opposite direction of the area weighted normal vector It is used for the rotational orientation of two rotating axes, and can realize the "3+2" orientation processing along the best projection direction.
[0113] Reference Figure 8 , Figure 8It is a hardware structure diagram of a data model conversion device for a mesh surface projection direction provided by another embodiment of the present application, the data model conversion device includes at least one control processor and a memory for communicating with the at least one control processor; the memory stores instructions that can be executed by the at least one control processor, and the instructions are executed by the at least one control processor so that the at least one control processor can execute the data model conversion method for the mesh surface projection direction as described in the embodiment of the first aspect. An embodiment of the present application also provides an electronic device 700, which includes: a memory 710, a processor 720, and a computer program stored in the memory 710 and executable on the processor 720.
[0114] The processor 720 and the memory 710 may be connected via a bus or in other ways.
[0115] The non-transient software program and instructions required to implement the digital employee scheduling method based on particle swarm algorithm in the above embodiment are stored in the memory 710. When executed by the processor 720, the data model conversion method of the mesh surface projection direction in the above embodiment is executed, for example, the above described Figure 1 Steps S100 to S500 of the method, Figure 2 Steps S110 to S130 of the method, Figure 3 Steps S111 to S113 of the method, Figure 4 Steps S601 to S603 of the method, Figure 5 Steps S310 to S340 of the method, Figure 6 Steps S341 to S343 of the method and Figure 7 The method comprises steps S510 to S530.
[0116] In addition, an embodiment of the present application further provides a computer-readable storage medium, which stores computer-executable instructions. The computer-executable instructions are executed by a processor or a controller, for example, by a processor in the embodiment of the electronic device 700, so that the processor can execute the digital employee scheduling method based on the particle swarm algorithm in the above embodiment. For example, the non-transient software program and instructions required for the digital employee scheduling method based on the particle swarm algorithm in the above embodiment are stored in the memory 710. When executed by the processor 720, the digital employee scheduling method based on the particle swarm algorithm in the above embodiment is executed, for example, the above-described Figure 1 Steps S100 to S500 of the method, Figure 2 Steps S110 to S130 of the method, Figure 3 Steps S111 to S113 of the method, Figure 4Steps S601 to S603 of the method, Figure 5 Steps S310 to S340 of the method, Figure 6 Steps S341 to S343 of the method and Figure 7 Method steps S510 to step S530 in the method. It will be appreciated by those skilled in the art that all or some of the steps and systems in the method disclosed above may be implemented as software, firmware, hardware and appropriate combinations thereof. Some physical components or all physical components may be implemented as software executed by a processor, such as a central processing unit, a digital signal processor or a microprocessor, or implemented as hardware, or implemented as an integrated circuit, such as an application specific integrated circuit. Such software may be distributed on a computer-readable medium, which may include a computer storage medium (or a non-transitory medium) and a communication medium (or a temporary medium). As known to those skilled in the art, the term computer storage medium includes volatile and non-volatile, removable and non-removable media implemented in any method or technology for storing information (such as computer-readable instructions, data structures, program modules or other data). Computer storage media include, but are not limited to, RAM, ROM, EEPROM, flash memory or other memory technology, CD-ROM, digital versatile disk (DVD) or other optical disk storage, magnetic cassettes, magnetic tapes, disk storage or other magnetic storage devices, or any other medium that may be used to store desired information and may be accessed by a computer. Furthermore, it is well known to those skilled in the art that communication media typically embodies computer readable instructions, data structures, program modules, or other data in a modulated data signal such as a carrier wave or other transport mechanism, and may include any information delivery media.
[0117] In the description of this specification, the description with reference to the terms "one embodiment", "further embodiments", "some specific embodiments" or "some examples" etc. means that the specific features, structures or characteristics described in conjunction with the embodiment or example are included in at least one embodiment or example of the present invention. In this specification, the schematic representation of the above terms does not necessarily refer to the same embodiment or example. Moreover, the specific features, structures, materials or characteristics described may be combined in any one or more embodiments or examples in a suitable manner.
[0118] Although the embodiments of the present invention have been shown and described, it will be appreciated by those skilled in the art that various changes, modifications, substitutions and variations may be made to the embodiments without departing from the principles and spirit of the present invention, and that the scope of the present invention is defined by the claims and their equivalents.
Claims
1. A method for converting model data in a mesh surface projection direction, characterized in that: include: Acquire a first three-dimensional data model of a mesh surface, wherein the first three-dimensional data model includes a plurality of first mesh surface patches, wherein the first mesh surface patches include first patch normal vectors and vertex coordinates of the first mesh surface patches, wherein the vertex coordinates include first vertex coordinate values, second vertex coordinate values, and third vertex coordinate values of the first mesh surface patches; The area of the first mesh surface patch is obtained according to the first patch normal vector and the vertex coordinates, the patch normal vector is obtained according to the area of the first mesh surface patch, the area weighted normal vector is obtained according to the area of the first mesh surface patch and the patch normal vector, the target projection direction of the mesh surface is obtained by negating the area weighted normal vector, two rotation axes of the first mesh surface patch are oriented to the target projection direction, and the area weighted normal vector is used as the +Z axis direction of three-axis linkage machining to perform spatial rotation on the first three-dimensional data model; Convert the first three-dimensional data model according to the target projection direction, rotate the first three-dimensional data model to coincide with the target projection direction, and obtain a second three-dimensional data model; Extracting data information of the second three-dimensional data model, where the data information of the second three-dimensional data model includes a plurality of second mesh surface patches, where the second mesh surface patches include second patch normal vectors and vertex coordinates of the second mesh surface patches; Replacing the first patch normal vector and the vertex coordinates of the first mesh surface patch of the first three-dimensional data model with the second patch normal vector and the vertex coordinates of the second mesh surface patch of the second three-dimensional data model according to a preset quaternion matrix, to obtain a mesh surface model file with target projection direction coordinate conversion; Determine the product of the first patch normal vector and the quaternion matrix as the patch normal vector of the second mesh surface patch; Determine the product of the vertex coordinates of the first mesh surface patch and the quaternion matrix as the vertex coordinates of the second mesh surface patch; The first patch normal vector and the vertex coordinates of the first mesh surface patch are replaced by the second patch normal vector and the vertex coordinates of the second mesh surface patch.
2. The model data conversion method of the mesh surface projection direction according to claim 1 is characterized in that: The step of obtaining a patch normal vector according to the area of the first mesh surface patch and negating the patch normal vector to obtain a target projection direction of the mesh surface projection includes: Calculating the areas of a plurality of the first mesh surface patches in sequence; Performing weighted calculation on the area of the first mesh surface patch and the patch normal vector to obtain a weighted normal vector value; The weighted normal vector value is inverted to obtain an inverted value.
3. The model data conversion method of the mesh surface projection direction according to claim 1 is characterized in that: Obtaining the area of the first mesh surface patch according to the first patch normal vector and the vertex coordinates includes: Obtain a first side length value, a second side length value, and a third side length value of the first mesh surface patch according to the first vertex coordinate value, the second vertex coordinate value, and the third vertex coordinate value, wherein the first side length value is the sum of the differences between the first vertex coordinate and the second vertex coordinate, the second side length value is the sum of the differences between the second vertex coordinate and the third vertex coordinate, and the third side length value is the sum of the differences between the third vertex coordinate and the first vertex coordinate, and the sum of the differences is a positive value; Acquire a half-perimeter value of the first mesh surface patch according to the first vertex coordinate value, the second vertex coordinate value, and the third vertex coordinate value; The area of the first mesh surface patch is obtained according to the first side length value, the second side length value, the third side length value and the semi-perimeter value.
4. The method for converting model data of a mesh surface projection direction according to claim 3, characterized in that: Obtaining the area of the first mesh surface patch according to the first side length value, the second side length value, the third side length value, and the semi-perimeter value, includes: Obtain the product of the semi-perimeter value and the difference between the first side length value, the second side length value and the third side length value; Obtain the product of the semi-perimeter value and the product of the difference between the first side length value, the second side length value and the third side length value and the semi-perimeter value; The arithmetic square root of the product of the semi-perimeter value and the difference between the first side length value, the second side length value and the third side length value and the product of the semi-perimeter value is calculated to obtain the area of the first mesh surface patch.
5. The method for converting model data of a mesh surface projection direction according to claim 1, characterized in that: The converting according to the target projection direction, rotating the first three-dimensional data model to coincide with the target projection direction, and obtaining a second three-dimensional data model, comprises: Calculating a three-dimensional coordinate rotation angle and a unit vector between the first mesh surface patch and the target projection direction; Determining a value range of the three-dimensional coordinate rotation angle according to the three-dimensional coordinate rotation angle and the unit vector; The first vertex coordinate value, the second vertex coordinate value, the third vertex coordinate value, and the value range are brought into the quaternion matrix, and a target file is output, and a second three-dimensional data model is obtained according to the target file.
6. The model data conversion method of the mesh surface projection direction according to claim 5, characterized in that: The outputting of the target file, and obtaining a second three-dimensional data model according to the target file, comprises: Extracting the first three-dimensional data model from the target file in sequence, and rotating the first three-dimensional data model to the target projection direction according to the three-dimensional coordinates and the unit vector; Replace the three-dimensional data in the first three-dimensional data model with the vertex coordinates of the first three-dimensional data model rotated to the target projection direction and the surface normal vector; When all the vertex coordinates and the surface normal vectors have completed the replacement of the first three-dimensional data model, the second three-dimensional data model is obtained.
7. A model data conversion device for mesh surface projection direction, characterized in that: It includes at least one control processor and a memory for communicating with the at least one control processor; the memory stores instructions that can be executed by the at least one control processor, and the instructions are executed by the at least one control processor to enable the at least one control processor to execute the model data conversion method for the grid surface projection direction as described in any one of claims 1 to 6.
8. An electronic device, characterized in that: It includes the model data conversion device of the grid surface projection direction as described in claim 7.
9. A computer-readable medium, wherein a computer program is stored in the computer-readable medium, and when the computer program is executed by a processor, the method according to any one of claims 1 to 6 is implemented.