WO2020062472A1 - Processing method for triangular mesh model, processing terminal, and storage medium - Google Patents

Processing method for triangular mesh model, processing terminal, and storage medium Download PDF

Info

Publication number
WO2020062472A1
WO2020062472A1 PCT/CN2018/115081 CN2018115081W WO2020062472A1 WO 2020062472 A1 WO2020062472 A1 WO 2020062472A1 CN 2018115081 W CN2018115081 W CN 2018115081W WO 2020062472 A1 WO2020062472 A1 WO 2020062472A1
Authority
WO
WIPO (PCT)
Prior art keywords
point
triangular
model
coordinate position
preset
Prior art date
Application number
PCT/CN2018/115081
Other languages
French (fr)
Chinese (zh)
Inventor
向志华
祁春超
黄雄伟
Original Assignee
深圳市华讯方舟太赫兹科技有限公司
华讯方舟科技有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 深圳市华讯方舟太赫兹科技有限公司, 华讯方舟科技有限公司 filed Critical 深圳市华讯方舟太赫兹科技有限公司
Publication of WO2020062472A1 publication Critical patent/WO2020062472A1/en

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T17/00Three dimensional [3D] modelling, e.g. data description of 3D objects
    • G06T17/30Polynomial surface description

Definitions

  • the present invention relates to the technical field of mesh models, and in particular, to a method, a processing terminal, and a storage medium for processing a triangular mesh model.
  • the three-dimensional geometric model is divided into three types: a wire frame model, a surface model, and a solid model.
  • the surface model is most widely used, and the triangular mesh data is a common form of the surface model.
  • Triangular mesh data belongs to a kind of three-dimensional numbers, and the corresponding processing includes three-dimensional sensing, mesh registration, mesh merging, and mesh optimization.
  • a three-dimensional sensor is used to obtain scanning grids on multiple sides of the object. These scanning grids include three-dimensional sampling points on the surface of the object and topological information about how this point is connected. Then, the grid is merged into a relatively single mesh model. To optimize the merged triangular mesh model.
  • Mesh simplification is a way to optimize the mesh.
  • Mesh simplification is to keep the features of the original model while reducing the number of points, edges and faces of the model as much as possible to make the model more concise. It can be roughly divided into four types: vertex deletion method, edge folding method, triangle folding method and wavelet decomposition method.
  • the present invention provides a method for processing a triangular mesh model, a processing terminal, and a storage medium.
  • the method for processing a triangular mesh model of the present invention can reduce the number of triangular faces included in the triangular mesh model.
  • the present invention provides a storage medium.
  • the storage medium stores program data, and the program data can be executed to implement the following operations:
  • calculating the point normals corresponding to all the points included in the model by using the surface normal includes: accumulating the surface normals of multiple surfaces sharing a same point, and calculating the multiple surfaces. Point normals that share the same point.
  • a processing terminal of a triangular mesh model provided by the present invention includes a processor and a memory connected to each other;
  • the memory stores instructions for execution by a processor
  • the processor executes the instructions in the memory, calculates surface normals corresponding to all triangular faces included in the model, and calculates point methods corresponding to all points included in the model through the surface normals. line;
  • a method for processing a triangular mesh model includes:
  • the processing method of the triangular mesh model of the present invention includes calculating surface normals corresponding to all triangular faces included in the model, and calculating all the normals included in the model through the surface normals. Point normals corresponding to the points respectively; obtaining surface information corresponding to all the triangular faces, and using the surface information and the point normals to determine whether there is a triangular face in all the triangular faces that meets a preset simplified condition; if yes , The triangles that meet the preset simplification conditions are simplified using a preset simplification rule to simplify the model.
  • the triangular mesh model can be simplified, and then the simplified triangular surface can be simplified, which can reduce the number of triangular surfaces included in the triangular mesh model and reduce the number of triangular mesh models.
  • the amount of data is convenient for the preservation and subsequent application of the triangular mesh model.
  • FIG. 1 is a schematic flowchart of a first embodiment of a method for processing a triangular mesh model according to the present invention
  • FIG. 2 is a schematic diagram of a model structure of a part of triangular faces of a triangular mesh model
  • FIG. 3 is a schematic flowchart of a second embodiment of a method for processing a triangular mesh model according to the present invention
  • step S205 in FIG. 3 is a schematic flowchart of an embodiment of step S205 in FIG. 3;
  • 5a is a schematic structural diagram of a triangle mesh model of the present invention before simplification
  • 5b is a simplified schematic diagram of the triangular mesh model of the present invention.
  • FIG. 6 is a schematic structural diagram of an embodiment of a processing terminal of a triangular mesh model according to the present invention.
  • FIG. 7 is a schematic structural diagram of an embodiment of a storage medium according to the present invention.
  • the directional indication is only used to explain in a specific posture (as shown in the drawings) (Shown) the relative positional relationship and movement of each component, etc., if the specific posture changes, the directional indicator will change accordingly.
  • FIG. 1 is a schematic flowchart of a first embodiment of a method for processing a triangular mesh model according to the present invention.
  • the method for processing the triangular mesh model in this embodiment may include at least the following steps:
  • step S101 the surface normals corresponding to all the triangular faces included in the model are calculated, and the point normals corresponding to all the points included in the model are respectively calculated through the surface normals.
  • the triangle mesh model that needs to be simplified is read out from the constructed multiple triangle mesh models.
  • the triangle mesh model includes a plurality of points, and a number of points are constructed into a plurality of triangular faces. Further, each point can be shared by multiple triangular faces, and the information of the triangular faces shared by the same point is used as the Polygon information for points.
  • the triangular mesh model is a three-dimensional model, and the format of the three-dimensional model may be a max format, an obj format, an FBX format, or an igs format, which is not specifically limited in the present invention.
  • Each triangular surface in the triangular mesh model has a corresponding normal, and the surface normal of each triangular surface can be calculated according to the triangular mesh model.
  • each point can be shared by multiple triangular surfaces.
  • the point normal of the point can be calculated by calculating the surface normal of the triangular surface sharing the point. .
  • the surface normals of each triangular surface are respectively added to the point normals of the three points constituting the triangular surface.
  • the point normals of each point have multiple triangular surfaces that share the point.
  • the surface normals are accumulated, and further, the point normals can be normalized so that the vector length of the point normals is 1.
  • the point normal of each point can be stored in the normal array of the triangular mesh model.
  • FIG. 2 shows a partial triangular surface of a triangular mesh model.
  • the illustrated triangular surface includes surfaces S1, S2, and S3 (the surface S3 is on the back side, and is indicated by an arrow in FIG. 2) ),
  • Points include points P1, P2, P3, and P4; where points P1, P2, and P3 constitute surface S1, points P1, P3, and P4 constitute surface S2, and points P1, P4, and P2 constitute surface S3; thus, point P1 Shared by planes S1, S2, and S3, that is, point P1 corresponds to planes S1, S2, and S3.
  • the respective surface normals of the surfaces S1, S2, and S3 can be calculated, and further, the respective surface normals of the surfaces S1, S2, and S3 are added to the point normals of the three points constituting the surface, respectively.
  • step S102 the surface information corresponding to all the triangular surfaces is obtained, and the surface information and the point normal are used to determine whether there is a triangular surface that meets the preset simplified condition in all the triangular surfaces.
  • the surface information of each triangular surface in the triangular mesh model is obtained, and then the obtained surface information of each triangular surface and the point normals of the three points corresponding to each triangular surface are used to further analyze each triangular surface.
  • the faces are judged to determine whether all the triangle faces of the triangle mesh model meet the preset simplified conditions. If at least one of all triangular faces meets the preset simplification conditions, all triangular faces of the triangular mesh model have triangular faces that meet the preset simplification conditions. If none of all triangular faces meet the preset simplification conditions, then There are no triangle faces in the triangle mesh model that meet the preset simplified conditions.
  • the number of triangular faces that meet the preset simplification conditions among all the triangular faces can be recorded to determine whether there are triangular faces that meet the preset simplification conditions in all the triangular faces. Specifically, if the number of triangular faces that meet the preset simplification condition among all triangular faces is not zero, there are triangular faces that meet the preset simplification condition among all triangular faces; if all triangular faces meet the preset simplification conditions, If the number is zero, it does not exist.
  • the surface information of the triangular surface may include at least point information of points constituting the triangular surface (at least including point coordinate positions and point numbers), and whether the triangular surface is valid or invalid.
  • the angle value of each corner of the triangular surface and the side length of each side can be calculated. Furthermore, it is determined whether the triangular surface meets a preset simplified condition by calculating the angle value of each corner and the side length of each side.
  • the triangular surface is a valid triangular surface or an invalid triangular surface by using the surface information of the triangular surface.
  • the surface information and the point normal are used to determine whether there is a triangular surface that meets the preset simplified conditions in all triangular surfaces. , Delete the invalid triangle.
  • the preset simplified conditions of this embodiment may include that among the three points constituting the triangular surface, the angle between the point normals of the two points is smaller than the first preset angle value, and the length of the side connecting the two points is smaller than The preset length and the angle value of the opposite corner of the side are smaller than the second preset angle value.
  • the angle between the point normals of two adjacent points can be obtained. It can be understood that the smaller the angle between the point normals of the two points, the closer the point normals of the two points are to become parallel; the smaller the side length of the sides of the two points, and the The smaller the angle value of the angle, the smaller the corresponding triangular face.
  • the first preset angle value and the second preset angle value may be the same or different.
  • the second preset angle value is greater than the first preset angle value.
  • the first preset angle value may be 1 °, 3 °, or 5 °
  • the second preset angle value may be 15 °, 30 °, or 45 °, which is not specifically limited in the present invention.
  • the determination of the angle value between the point normals of the two points and the diagonal angle of the sides can be set by setting the first preset cosine value and the second preset cosine value.
  • the preset simplification condition is that the cosine of the included angle between the two points' normals is greater than the first preset cosine of the three points forming the triangle, and the length of the side connecting the two points is shorter than the pre-set value. It is assumed that the cosine value of the length and the diagonal angle value of the side is greater than the second preset cosine value.
  • the first preset cosine value may be 0.996, 0.998, or 0.999
  • the second preset cosine value may be 0.965, 0.866, or 0.707, which is not specifically limited in the present invention.
  • step S103 the triangles that meet the preset simplification conditions are simplified using a preset simplification rule to simplify the model.
  • step S102 If the determination result in step S102 is that there is a triangular surface that meets the preset simplification condition among all the triangular surfaces, the triangular surface that meets the preset simplification condition is simplified according to the preset simplification rule.
  • the preset simplification rule used in this embodiment is edge folding and streamlining, that is, merging two points on one edge.
  • the two points merged in this embodiment are two points whose angle between the point normals described in step S102 satisfies a preset simplified condition. Specifically, one of the two points is used as the merge point and the other is used as the merged point. The surface information of the merged point is added to the surface information of the merged point, and then the two points are merged.
  • a third coordinate position can also be calculated by calculating the first coordinate position of the merged point and the second coordinate position of the merged point; moving the merged point from the first coordinate position to the third coordinate position Office.
  • the point after the two points are merged is at the third coordinate position.
  • the third coordinate position is an intermediate coordinate position between the first coordinate position and the second coordinate position.
  • the simplified triangular surface may be set as an invalid triangular surface, and the process returns to step S101, and steps S101 to S103 are executed cyclically, until the judgment result of step S102 is that all the triangular surfaces do not exist in accordance with the preset. Simplify the triangle to the condition.
  • step S104 the simplification of the model is stopped.
  • step S102 If the judgment result in step S102 is that no triangle faces that meet the preset simplified condition exist in all the triangle faces, it means that the triangle mesh model does not need to be simplified, and thus the simplification of the triangle mesh model is stopped.
  • step S101 to step S104 as a whole can be implemented through the following procedures:
  • whether the triangular surface can be simplified is determined based on the surface information of the triangular surface in the triangular mesh model and the point normals of the points constituting the triangular surface, and then the triangular surface that the triangular mesh model satisfies a preset simplified condition is simplified. , Thereby reducing the number of triangular faces in the triangular mesh model without affecting the three-dimensional shape of the triangular mesh model.
  • FIG. 3 is a schematic flowchart of a second embodiment of a method for processing a triangular mesh model according to the present invention.
  • the method for processing the triangular mesh model in this embodiment may include at least the following steps:
  • step S201 the point information corresponding to all the points included in the model is read, the point information creates a point structure for each point, and the point structure is stored in the point container of the model.
  • a container is also called a vector template. It is a data structure of the C ++ standard template library. It can be used to store multiple types of data.
  • the surface container is used to store the surface information of the triangular surface, and the surface container to which the point belongs stores the surface information of all the triangular surfaces corresponding to the point; the point container is used to store the point information of the point.
  • the point information may specifically include the coordinate position of each point (that is, the corresponding x, y, z value).
  • a corresponding point structure is created according to the coordinate position of each point read, and the point structure is stored in a point container of the triangular mesh model, that is, the point container of each model contains There is a point structure for all points in the model, that is, point information for all points.
  • the point structure also contains the serial number of the point, and the area container to which the point belongs (a point can be shared by multiple triangular faces, so it is easy for a point to belong to multiple triangular faces, and according to which point the point belongs to The surface container knows which triangles the point is in common with).
  • each point structure has its corresponding point structure pointer
  • the point structure pointer is a pointer declared by the point structure.
  • the variable does not change with its serial number.
  • step S202 the surface information corresponding to all triangular faces included in the model is read, a surface structure is created for each triangular face according to the surface information, and the surface structure is stored in a surface container of the model, and each The surface information of each triangular surface is recorded in the surface container to which the three points constituting the triangular surface belong.
  • every three points included in the triangular mesh model constitute a triangular surface, that is, each triangular mesh model is composed of multiple triangular surfaces, and the surface information of each triangular mesh model is its Contains a collection of face information for all triangular faces.
  • the surface information of all triangular faces included in each triangular mesh model is read (at least including the serial numbers of the three points constituting the triangular face and whether the triangular faces are valid).
  • create a separate surface structure for each triangular surface included in it that is, for each triangular surface included in each triangular mesh model, separately create surface information for storing the triangular surface. Data collection.
  • the surface structure of the triangular mesh model is stored in a surface container of the triangular mesh model.
  • the surface information included in the surface structure of each triangular surface is separately recorded in a surface container of three points constituting the triangular surface.
  • the points P1, P2, and P3 constitute the triangular surface S1.
  • a point structure is created for each point in the triangular mesh model through step S201.
  • point structures P1, P2, P3, and P4 are respectively created, and the created point structures are created.
  • the surface information of each triangular surface including the triangular surface S1 respectively create respective surface structures.
  • the surface information of the triangular surface S1 is recorded in each of the surface containers of the points P1, P2, and P3 constituting the triangular surface S1.
  • step S203 the surface normals corresponding to all the triangular faces included in the model are calculated, and the point normals corresponding to all the points included in the model are calculated through the surface normals.
  • step S204 the surface information corresponding to all the triangular surfaces is obtained, and the surface information and the point normal are used to determine whether there is a triangular surface that meets the preset simplified condition in all the triangular surfaces.
  • steps S203 and S204 are the same as steps S101 and S102 shown in FIG. 1, and details are not described herein again.
  • step S205 the triangles that meet the preset simplification conditions are simplified by using a preset simplification rule to simplify the model.
  • the preset simplification rule used in this embodiment is edge folding and streamlining, that is, merging two points on one edge.
  • the two points merged in this embodiment are two points where the angle between the point normals recorded in step S204 satisfies a preset simplified condition. Specifically, one of the two points is used as the merged point, and the other point is used as the merged point.
  • the surface to which the merged point belongs is determined.
  • the container is the first surface container
  • the surface container to which the merged point belongs is the second surface container. Therefore, as shown in FIG. 4, step S205 in this embodiment may include the following steps:
  • step S2051 the first surface container to which the merged point belongs and the second surface container to which the merged point belongs are obtained.
  • the surface container to which the point belongs in the triangular mesh model includes surface information of all the surfaces that share the point, thereby obtaining the first surface container to which the merged point belongs and the second surface container to which the merged point belongs, That is, it is equivalent to obtaining the surface information of all triangular faces that share a common merging point, and the surface information of all triangular faces that share a common merging point.
  • step S2052 the area information corresponding to the merged point included in the second area container is added to the first area container.
  • the third coordinate position may also be obtained by calculating according to the first coordinate position of the merged point and the second coordinate position of the merged point; The coordinate position is moved to the third coordinate position.
  • This moving step may be performed before step S2051 or before step S2052. In addition, it may be performed after step S2052.
  • the present invention is not specifically limited; therefore, two The merged point is at the third coordinate position.
  • the third coordinate position is an intermediate coordinate position between the first coordinate position and the second coordinate position.
  • the simplified triangular surface can be set as an invalid triangular surface, and the process returns to step S203, and steps S203 to S205 are executed cyclically, until the judgment result of step S204 is that none of the triangular surfaces meet the preset. Simplify the triangle to the condition.
  • step S206 the simplified triangular surface is set as an invalid triangular surface.
  • the triangular surface simplified after step S205 is set as an invalid triangular surface.
  • the triangle structure is provided with an indication of whether the triangle is valid or invalid. Generally, “true” indicates that the triangle is a valid triangle, and “false” indicates that the triangle is an invalid triangle.
  • the indication corresponding to the triangular surface is changed from “true” to "false", that is, an invalid triangular surface is set for the triangular surface.
  • step S207 the invalid triangle is deleted, and the process returns to step S203.
  • step S206 delete the invalid triangular faces set in step S206, and return to step S203, recalculate the corresponding surface normals of each of the remaining triangular faces included in the triangular mesh model, and calculate the triangular mesh model by the surface normals.
  • the simplification rule simplifies the triangular faces that meet the preset simplification conditions to simplify the model. This is performed cyclically, until after returning to step S203 again, it is determined that there is no triangle surface that meets the preset simplified condition among all the triangle surfaces.
  • step S208 the simplification of the model is stopped.
  • step S204 If the judgment result in step S204 is that no triangle faces that meet the preset simplified conditions exist in all the triangle faces, it means that the triangle mesh model does not need to be simplified, and thus the simplification of the triangle mesh model is stopped.
  • the triangular surfaces in the triangular mesh model that needs to be simplified can be simplified.
  • the number of triangular surfaces is reduced, that is, This is equivalent to reducing the amount of data of the triangular mesh model, reducing its memory consumption, and facilitating subsequent application of the triangular mesh model.
  • the triangle mesh model before simplification indicates its three-dimensional pattern by more triangular faces. It can be seen that there are more triangular faces in the model shown in FIG. 5a;
  • Method for processing a triangular mesh model The first embodiment to the second embodiment simplify the triangular mesh model shown in FIG. 5a to form a pattern shown in FIG. 5b, and the image shown in FIG. 5b is also maintained.
  • the three-dimensional shape shown in FIG. 5a, but the triangular surface included therein is significantly reduced, and the corresponding data amount is relatively small.
  • FIG. 6 is a schematic structural diagram of an embodiment of a processing terminal of a triangular mesh model of the present invention.
  • the processing terminal 100 in this embodiment includes a processor 10 and a memory 11 connected to each other.
  • the memory 11 stores a corresponding program instruction, and the processor executes the program instruction stored in the memory 11 to implement the diagram.
  • the processing methods of the triangular mesh model shown in FIGS. 1 to 4 are the first to second embodiments.
  • the processing terminal 100 may be different types of terminal devices with computing processing capabilities, such as a desktop computer, a tablet computer, a server, or a mobile phone.
  • processing terminals such as desktop computers, tablet computers, or mobile phones also include a display screen 12 that can display the triangular mesh model, so that users can view the simplified and simplified triangular mesh models, and for servers, etc.
  • the processing terminal may transmit corresponding data to a terminal having a display 12 or a display screen 12 so that the user can view the simplified triangular mesh model before and after the simplification.
  • the processing terminal 100 in this embodiment may further include a scanning device 13 such as a sensor, an infrared scanner, a terahertz scanner, and the scanning device 13 is configured to scan an object to be imaged to obtain a corresponding scan.
  • a scanning device 13 such as a sensor, an infrared scanner, a terahertz scanner, and the scanning device 13 is configured to scan an object to be imaged to obtain a corresponding scan.
  • Data the scan data is sent to the processor, and the processor processes the scan data to obtain a triangle mesh model corresponding to the object to be imaged.
  • FIG. 7 is a schematic structural diagram of an embodiment of a storage medium of the present invention.
  • the storage medium 200 in this embodiment stores program data 201 that can be executed. After the program data 201 is executed, the processing method of the triangular mesh model shown in FIGS. 1 to 4 can be implemented.
  • the storage medium 200 may be a storage module such as a storage module of a smart terminal, a mobile storage device (such as a mobile hard disk, a U disk, etc.), a network cloud disk, an application storage platform, or a server with a storage function.
  • the storage medium 200 may also be the memory 11 shown in FIG. 6 described above.

Abstract

Disclosed are a processing method for a triangular mesh model, a processing terminal, and a storage medium. The processing method for the triangular mesh model comprises: calculating surface normals respectively corresponding to all triangular faces contained in the model, and calculating point normals respectively corresponding to all points contained in the model by means of the surface normals; acquiring surface information respectively corresponding to all the triangular faces, and determining whether triangular faces conforming to preset simplification conditions exist in all the triangular faces by using the surface information and the point normals; and if so, using preset simplification rules to simplify the triangular faces conforming to the preset simplification conditions to simplify the model. According to the above-mentioned method, the number of triangular surfaces contained in the triangular mesh model can be reduced, and thus the data amount in the triangular mesh model can be reduced.

Description

一种三角网格模型的处理方法、处理终端及存储介质Processing method, processing terminal and storage medium of triangular mesh model 【技术领域】[Technical Field]
本发明涉及网格模型技术领域,具体而言涉及一种三角网格模型的处理方法、处理终端及存储介质。The present invention relates to the technical field of mesh models, and in particular, to a method, a processing terminal, and a storage medium for processing a triangular mesh model.
【背景技术】【Background technique】
三维几何模型分为线框模型、表面模型和实体模型三种,其中,表面模型运用最为广泛,三角网格数据为表面模型的一种常见形式。三角网格数据属于一种三维数字,其相应的处理包括三维传感、网格配准、网格合并和网格优化。首先,使用三维传感器得到物体多个侧面的扫描网格,这些扫描网格包括物体表面的三维采样点和这点如何连接的拓扑信息,然后再通过网格合并成相对单一的网格模型,进一步,在对合并后的三角网格模型进行优化。The three-dimensional geometric model is divided into three types: a wire frame model, a surface model, and a solid model. Among them, the surface model is most widely used, and the triangular mesh data is a common form of the surface model. Triangular mesh data belongs to a kind of three-dimensional numbers, and the corresponding processing includes three-dimensional sensing, mesh registration, mesh merging, and mesh optimization. First, a three-dimensional sensor is used to obtain scanning grids on multiple sides of the object. These scanning grids include three-dimensional sampling points on the surface of the object and topological information about how this point is connected. Then, the grid is merged into a relatively single mesh model. To optimize the merged triangular mesh model.
网格简化是网格优化的一种方式,网格简化就是保持原始模型特征的同时尽可能地减少模型的点、边和面的数量,使得模型更简洁。其大致可划分为顶点删除法、边折叠法三角形折叠法和小波分解法这四种。Mesh simplification is a way to optimize the mesh. Mesh simplification is to keep the features of the original model while reducing the number of points, edges and faces of the model as much as possible to make the model more concise. It can be roughly divided into four types: vertex deletion method, edge folding method, triangle folding method and wavelet decomposition method.
【发明内容】[Summary of the Invention]
有鉴于此,本发明提供了一种三角网格模型的处理方法、处理终端及存储介质,本发明的三角网格模型的处理方法能够减少三角网格模型包含的三角面的数量。In view of this, the present invention provides a method for processing a triangular mesh model, a processing terminal, and a storage medium. The method for processing a triangular mesh model of the present invention can reduce the number of triangular faces included in the triangular mesh model.
本发明提供一种存储介质,所述存储介质存储有程序数据,所述程序数据能够被执行以实现如下操作:The present invention provides a storage medium. The storage medium stores program data, and the program data can be executed to implement the following operations:
计算模型中包含的所有三角面分别对应的面法线,并通过所述面法线计算所述模型包含的所有的点分别对应的点法线;Calculate the surface normals corresponding to all the triangular faces included in the model, and calculate the point normals corresponding to all the points included in the model through the surface normals;
获取所述所有三角面分别对应的面信息,利用所述面信息和所述点法线判断所述所有三角面中是否存在符合预设简化条件的三角面;Obtaining surface information corresponding to all the triangular surfaces, and using the surface information and the point normal to determine whether there is a triangular surface in all the triangular surfaces that meets a preset simplified condition;
若是,则利用预设简化规则对符合预设简化条件的三角面进行简化,以对所述模型进行简化;If so, simplify the triangles that meet the preset simplification conditions by using a preset simplification rule to simplify the model;
其中,所述通过所述面法线计算所述模型包含的所有的点分别对应的点法线包括:将共用同一个点的多个面的面法线进行累加,计算得到所述多个面共 用的同一个点的点法线。Wherein, calculating the point normals corresponding to all the points included in the model by using the surface normal includes: accumulating the surface normals of multiple surfaces sharing a same point, and calculating the multiple surfaces. Point normals that share the same point.
另一方面,本发明提出的一种三角网格模型的处理终端,该处理终端包括相互连接的处理器和存储器;In another aspect, a processing terminal of a triangular mesh model provided by the present invention includes a processor and a memory connected to each other;
所述存储器存储有用于处理器执行的指令;The memory stores instructions for execution by a processor;
所述处理器执行所述存储器中的所述指令,计算模型中包含的所有三角面分别对应的面法线,并通过所述面法线计算所述模型包含的所有的点分别对应的点法线;The processor executes the instructions in the memory, calculates surface normals corresponding to all triangular faces included in the model, and calculates point methods corresponding to all points included in the model through the surface normals. line;
获取所述所有三角面分别对应的面信息,利用所述面信息和所述点法线判断所述所有三角面中是否存在符合预设简化条件的三角面;Obtaining surface information corresponding to all the triangular surfaces, and using the surface information and the point normal to determine whether there is a triangular surface in all the triangular surfaces that meets a preset simplified condition;
若是,则利用预设简化规则对符合预设简化条件的三角面进行简化,以对所述模型进行简化。If so, the triangles that meet the preset simplification conditions are simplified using a preset simplification rule to simplify the model.
另一方面,本发明提出的一种三角网格模型的处理方法,所述处理方法包括:In another aspect, a method for processing a triangular mesh model provided by the present invention includes:
计算模型中包含的所有三角面分别对应的面法线,并通过所述面法线计算所述模型包含的所有的点分别对应的点法线;Calculate the surface normals corresponding to all the triangular faces included in the model, and calculate the point normals corresponding to all the points included in the model through the surface normals;
获取所述所有三角面分别对应的面信息,利用所述面信息和所述点法线判断所述所有三角面中是否存在符合预设简化条件的三角面;Obtaining surface information corresponding to all the triangular surfaces, and using the surface information and the point normal to determine whether there is a triangular surface in all the triangular surfaces that meets a preset simplified condition;
若是,则利用预设简化规则对符合预设简化条件的三角面进行简化,以对所述模型进行简化。If so, the triangles that meet the preset simplification conditions are simplified using a preset simplification rule to simplify the model.
有益效果:区别于现有技术,本发明的三角网格模型的处理方法包括计算模型中包含的所有三角面分别对应的面法线,并通过所述面法线计算所述模型包含的所有的点分别对应的点法线;获取所述所有三角面分别对应的面信息,利用所述面信息和所述点法线判断所述所有三角面中是否存在符合预设简化条件的三角面;若是,则利用预设简化规则对符合预设简化条件的三角面进行简化,以对所述模型进行简化。通过上述方法有效判断出三角网格模型中可进行简化的三角面,进而对可简化的三角面进行简化,即可减少三角网格模型中包含的三角面的数量,减少了三角网格模型的数据量,便于三角网格模型的保存以及后续应用。Advantageous effect: Different from the prior art, the processing method of the triangular mesh model of the present invention includes calculating surface normals corresponding to all triangular faces included in the model, and calculating all the normals included in the model through the surface normals. Point normals corresponding to the points respectively; obtaining surface information corresponding to all the triangular faces, and using the surface information and the point normals to determine whether there is a triangular face in all the triangular faces that meets a preset simplified condition; if yes , The triangles that meet the preset simplification conditions are simplified using a preset simplification rule to simplify the model. Through the above method, it can be effectively judged that the triangular mesh model can be simplified, and then the simplified triangular surface can be simplified, which can reduce the number of triangular surfaces included in the triangular mesh model and reduce the number of triangular mesh models. The amount of data is convenient for the preservation and subsequent application of the triangular mesh model.
【附图说明】[Brief Description of the Drawings]
为了更清楚地说明发明实施例中的技术方案,下面将对实施例描述中所需 要使用的附图作简单地介绍,显而易见地,下面描述中的附图仅仅是发明的一些实施例,对于本领域普通技术人员来讲,在不付出创造性劳动的情况下,还可以根据这些附图获得其他的附图,其中:In order to more clearly illustrate the technical solutions in the embodiments of the invention, the drawings used in the description of the embodiments will be briefly introduced below. Obviously, the drawings in the following description are only some embodiments of the invention. Those of ordinary skill in the art can also obtain other drawings based on these drawings without paying creative labor, of which:
图1是本发明三角网格模型的处理方法第一实施例的流程示意图;1 is a schematic flowchart of a first embodiment of a method for processing a triangular mesh model according to the present invention;
图2是三角网格模型的部分三角面的模型结构示意图;2 is a schematic diagram of a model structure of a part of triangular faces of a triangular mesh model;
图3是本发明三角网格模型的处理方法第二实施例的流程示意图;3 is a schematic flowchart of a second embodiment of a method for processing a triangular mesh model according to the present invention;
图4是图3中步骤S205的一实施方式的流程示意图;4 is a schematic flowchart of an embodiment of step S205 in FIG. 3;
图5a是本发明三角网格模型简化前的结构示意图;5a is a schematic structural diagram of a triangle mesh model of the present invention before simplification;
图5b是本发明三角网格模型简化后的结构示意图;5b is a simplified schematic diagram of the triangular mesh model of the present invention;
图6是本发明三角网格模型的处理终端一实施例的结构示意图;6 is a schematic structural diagram of an embodiment of a processing terminal of a triangular mesh model according to the present invention;
图7是本发明存储介质一实施例的结构示意图。FIG. 7 is a schematic structural diagram of an embodiment of a storage medium according to the present invention.
【具体实施方式】【detailed description】
下面将结合本发明实施例中的附图,对本发明实施例中的技术方案进行清楚、完整地描述,显然,所描述的实施例仅仅是本发明一部分实施例,而不是全部的实施例。基于本发明中的实施例,本领域普通技术人员在没有做出创造性劳动情况下所获得的所有其他实施例,均属于本发明保护的范围。In the following, the technical solutions in the embodiments of the present invention will be clearly and completely described with reference to the drawings in the embodiments of the present invention. Obviously, the described embodiments are only a part of the embodiments of the present invention, but not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by a person of ordinary skill in the art without creative efforts shall fall within the protection scope of the present invention.
需要说明,若本发明实施例中有涉及方向性指示(诸如上、下、左、右、前、后……),则该方向性指示仅用于解释在某一特定姿态(如附图所示)下各部件之间的相对位置关系、运动情况等,如果该特定姿态发生改变时,则该方向性指示也相应地随之改变。It should be noted that if there is a directional indication (such as up, down, left, right, front, back, etc.) in the embodiment of the present invention, the directional indication is only used to explain in a specific posture (as shown in the drawings) (Shown) the relative positional relationship and movement of each component, etc., if the specific posture changes, the directional indicator will change accordingly.
另外,若本发明实施例中有涉及“第一”、“第二”等的描述,则该“第一”、“第二”等的描述仅用于描述目的,而不能理解为指示或暗示其相对重要性或者隐含指明所指示的技术特征的数量。由此,限定有“第一”、“第二”的特征可以明示或者隐含地包括至少一个该特征。另外,各个实施例之间的技术方案可以相互结合,但是必须是以本领域普通技术人员能够实现为基础,当技术方案的结合出现相互矛盾或无法实现时应当认为这种技术方案的结合不存在,也不在本发明要求的保护范围之内。In addition, if there are descriptions related to "first", "second", etc. in the embodiment of the present invention, the descriptions of "first", "second", etc. are only used for description purposes, and cannot be understood as instructions or hints Its relative importance or implicitly indicates the number of technical features indicated. Therefore, the features defined as "first" and "second" may explicitly or implicitly include at least one of the features. In addition, the technical solutions between the various embodiments can be combined with each other, but must be based on those that can be realized by a person of ordinary skill in the art. When the combination of technical solutions conflicts or cannot be realized, such a combination of technical solutions should be considered nonexistent It is also not within the protection scope claimed by the present invention.
请参阅图1,图1是本发明三角网格模型的处理方法第一实施例的流程示意图。如图1所示,本实施例的三角网格模型的处理方法至少可包括如下步骤:Please refer to FIG. 1, which is a schematic flowchart of a first embodiment of a method for processing a triangular mesh model according to the present invention. As shown in FIG. 1, the method for processing the triangular mesh model in this embodiment may include at least the following steps:
在步骤S101中,计算模型中包含的所有三角面分别对应的面法线,并通过 面法线计算模型包含的所有的点分别对应的点法线。In step S101, the surface normals corresponding to all the triangular faces included in the model are calculated, and the point normals corresponding to all the points included in the model are respectively calculated through the surface normals.
根据需求,从构建的多个三角网格模型中读取出需要进行简化的三角网格模型。其中,三角网格模型中包含有若干个点,由若干个点构建成若干个三角面,进一步,每个点可被多个三角面共用,将被同一个点共用的三角面的信息作为该点的面信息。本实施例中三角网格模型为三维模型,该三维模型的格式可以为max格式、obj格式、FBX格式或igs格式,本发明不做具体限制。According to the requirements, the triangle mesh model that needs to be simplified is read out from the constructed multiple triangle mesh models. Among them, the triangle mesh model includes a plurality of points, and a number of points are constructed into a plurality of triangular faces. Further, each point can be shared by multiple triangular faces, and the information of the triangular faces shared by the same point is used as the Polygon information for points. In this embodiment, the triangular mesh model is a three-dimensional model, and the format of the three-dimensional model may be a max format, an obj format, an FBX format, or an igs format, which is not specifically limited in the present invention.
三角网格模型中的每个三角面各自具有相应的法线,即可根据三角网格模型计算得到每个三角面的面法线。进一步,三角网格模型中,每个点可被多个三角面共用,对于被多个三角面共用点而言,可通过共用该点的三角面的面法线计算得到该点的点法线。本实施例中,将每个三角面的面法线分别累加到构成该三角面的三个点的点法线上,换言之,每个点的点法线有共用该点的多个三角面的面法线累加得到,进一步,可对点法线进行归一化处理,使点法线的向量长度为1。Each triangular surface in the triangular mesh model has a corresponding normal, and the surface normal of each triangular surface can be calculated according to the triangular mesh model. Further, in the triangular mesh model, each point can be shared by multiple triangular surfaces. For a point shared by multiple triangular surfaces, the point normal of the point can be calculated by calculating the surface normal of the triangular surface sharing the point. . In this embodiment, the surface normals of each triangular surface are respectively added to the point normals of the three points constituting the triangular surface. In other words, the point normals of each point have multiple triangular surfaces that share the point. The surface normals are accumulated, and further, the point normals can be normalized so that the vector length of the point normals is 1.
本实施例中记得到三角网格模型中的每个点的点法线之后,可将每个点的点法线存入三角网格模型的法线数组中。After remembering the point normal of each point in the triangular mesh model in this embodiment, the point normal of each point can be stored in the normal array of the triangular mesh model.
请参阅图2,图2示出了一个三角网格模型的局部三角面,如图2所示,示出的三角面包括面S1、S2和S3(面S3在背面,图2中用箭头指示),点包括点P1、P2、P3和P4;其中,点P1、P2和P3构成面S1,点P1、P3和P4构成面S2,点P1、P4和P2构成面S3;由此,点P1被面S1、S2和S3所共用,即点P1对应于面S1、S2和S3。进一步,可计算得到面S1、S2和S3各自的面法线,进一步,将面S1、S2和S3各自的面法线分别累加到构成该面的三个点的点法线上,即可得到每个点的点法线。以点P1为例,P1被面S1、S2和S3所共用,则面S1、S2和S3的面法线均会累加到点P1的点法线上,通过面S1、S2和S3的面法线的累加得到点P1的点法线,进一步,对点P1的点法线进行归一化处理,使点法线的向量长度为1。Please refer to FIG. 2. FIG. 2 shows a partial triangular surface of a triangular mesh model. As shown in FIG. 2, the illustrated triangular surface includes surfaces S1, S2, and S3 (the surface S3 is on the back side, and is indicated by an arrow in FIG. 2) ), Points include points P1, P2, P3, and P4; where points P1, P2, and P3 constitute surface S1, points P1, P3, and P4 constitute surface S2, and points P1, P4, and P2 constitute surface S3; thus, point P1 Shared by planes S1, S2, and S3, that is, point P1 corresponds to planes S1, S2, and S3. Further, the respective surface normals of the surfaces S1, S2, and S3 can be calculated, and further, the respective surface normals of the surfaces S1, S2, and S3 are added to the point normals of the three points constituting the surface, respectively. The point normal to each point. Taking point P1 as an example, P1 is shared by planes S1, S2, and S3. Then, the surface normals of planes S1, S2, and S3 are added to the point normal of point P1, and the plane method of planes S1, S2, and S3 The line normals are added to obtain the point normal of point P1. Further, the point normal of point P1 is normalized so that the vector length of the point normal is 1.
本实施例中上述计算点法线的步骤流程可通过如下程序实现:In this embodiment, the above steps of calculating the point normal can be implemented by the following program:
Figure PCTCN2018115081-appb-000001
Figure PCTCN2018115081-appb-000001
Figure PCTCN2018115081-appb-000002
Figure PCTCN2018115081-appb-000002
在步骤S102中,获取所有三角面分别对应的面信息,利用面信息和点法线判断所有三角面中是否存在符合预设简化条件的三角面。In step S102, the surface information corresponding to all the triangular surfaces is obtained, and the surface information and the point normal are used to determine whether there is a triangular surface that meets the preset simplified condition in all the triangular surfaces.
进一步,获取三角网格模型中的每个三角面的面信息,进而利用获取的每个三角面的面信息,以及每个三角面对应的三个点的点法线,进而对每个三角面进行判断,以确定三角网格模型的所有三角面中是否存在符合预设简化条件的三角面。若所有三角面中至少一个三角面符合预设简化条件,则三角网格模型的所有三角面中存在符合预设简化条件的三角面,若所有三角面没有一个三角面符合预设简化条件,则三角网格模型的所有三角面中不存在符合预设简化条件的三角面。Further, the surface information of each triangular surface in the triangular mesh model is obtained, and then the obtained surface information of each triangular surface and the point normals of the three points corresponding to each triangular surface are used to further analyze each triangular surface. The faces are judged to determine whether all the triangle faces of the triangle mesh model meet the preset simplified conditions. If at least one of all triangular faces meets the preset simplification conditions, all triangular faces of the triangular mesh model have triangular faces that meet the preset simplification conditions. If none of all triangular faces meet the preset simplification conditions, then There are no triangle faces in the triangle mesh model that meet the preset simplified conditions.
本实施例中,可通过记录所有三角面中符合预设简化条件的三角面的数量,进而判断所有三角面中是否存在符合预设简化条件的三角面。具体的,若所有三角面中符合预设简化条件的三角面的数量不为零,则所有三角面中存在符合预设简化条件的三角面;若所有三角面中符合预设简化条件的三角面的数量为零,则不存在。In this embodiment, the number of triangular faces that meet the preset simplification conditions among all the triangular faces can be recorded to determine whether there are triangular faces that meet the preset simplification conditions in all the triangular faces. Specifically, if the number of triangular faces that meet the preset simplification condition among all triangular faces is not zero, there are triangular faces that meet the preset simplification condition among all triangular faces; if all triangular faces meet the preset simplification conditions, If the number is zero, it does not exist.
本实施例中三角面的面信息至少可包括构成该三角面的点的点信息(至少包括点坐标位置和点的序号),以及该三角面是否有效或无效的信息。根据三角面的面信息即可计算得到该三角面的每个角的角度值,以及每个边的边长。进而通过计算得到的每个角的角度值以及每个边的边长对三角面是否符合预设简化条件进行判断。In this embodiment, the surface information of the triangular surface may include at least point information of points constituting the triangular surface (at least including point coordinate positions and point numbers), and whether the triangular surface is valid or invalid. According to the surface information of the triangular surface, the angle value of each corner of the triangular surface and the side length of each side can be calculated. Furthermore, it is determined whether the triangular surface meets a preset simplified condition by calculating the angle value of each corner and the side length of each side.
进一步,本实施例中可通过三角面的面信息知晓该三角面是否为有效三角面或无效三角面,在利用面信息和点法线判断所有三角面中是否存在符合预设简化条件的三角面时,将无效三角面进行删除。Further, in this embodiment, it is possible to know whether the triangular surface is a valid triangular surface or an invalid triangular surface by using the surface information of the triangular surface. The surface information and the point normal are used to determine whether there is a triangular surface that meets the preset simplified conditions in all triangular surfaces. , Delete the invalid triangle.
本实施例的预设简化条件可包括构成三角面的三个点中,两个点的点法线之间的夹角小于第一预设角度值,且连接两个点的边的边长小于预设长度,以及边的对角的角度值小于第二预设角度值。本实施例计算得到每个点的点法线 之后,即可得到相邻两个点的点法线之间的夹角。可以理解的是,两个点的点法线之间的夹角越小,则说明两个点的点法线越趋近于平行;两个点的边的边长越小,以及边的对角的角度值越小,则对应的三角面越小。进一步,本发明中第一预设角度值和第二预设角度值可以相同也可以不同,本实施例以第二预设角度值大于第一预设角度值为例;在一具体应用例,中第一预设角度值可为1°、3°或5°,第二预设角度值可为15°、30°或45°,本发明不做具体限制。The preset simplified conditions of this embodiment may include that among the three points constituting the triangular surface, the angle between the point normals of the two points is smaller than the first preset angle value, and the length of the side connecting the two points is smaller than The preset length and the angle value of the opposite corner of the side are smaller than the second preset angle value. In this embodiment, after calculating the point normal of each point, the angle between the point normals of two adjacent points can be obtained. It can be understood that the smaller the angle between the point normals of the two points, the closer the point normals of the two points are to become parallel; the smaller the side length of the sides of the two points, and the The smaller the angle value of the angle, the smaller the corresponding triangular face. Further, in the present invention, the first preset angle value and the second preset angle value may be the same or different. In this embodiment, the second preset angle value is greater than the first preset angle value. In a specific application example, The first preset angle value may be 1 °, 3 °, or 5 °, and the second preset angle value may be 15 °, 30 °, or 45 °, which is not specifically limited in the present invention.
在另一实施例中,可通过两个点的点法线之间的夹角以及边的对角的角度值的判断可通过设置第一预设余弦值和第二预设余弦值的方式设置预设简化条件,即构成三角面的三个点中,两个点的点法线之间的夹角的余弦值大于第一预设余弦值,且连接两个点的边的边长小于预设长度,以及边的对角的角度值的余弦值大于第二预设余弦值。本实施例中,第一预设余弦值可为0.996、0.998或0.999,第二预设余弦值可为0.965、0.866或0.707,本发明不做具体限制。In another embodiment, the determination of the angle value between the point normals of the two points and the diagonal angle of the sides can be set by setting the first preset cosine value and the second preset cosine value. The preset simplification condition is that the cosine of the included angle between the two points' normals is greater than the first preset cosine of the three points forming the triangle, and the length of the side connecting the two points is shorter than the pre-set value. It is assumed that the cosine value of the length and the diagonal angle value of the side is greater than the second preset cosine value. In this embodiment, the first preset cosine value may be 0.996, 0.998, or 0.999, and the second preset cosine value may be 0.965, 0.866, or 0.707, which is not specifically limited in the present invention.
本实施例中上述判断三角面是否符合预设简化条件的步骤流程可通过如下程序实现:In this embodiment, the above steps for judging whether the triangular surface meets the preset simplified conditions can be implemented by the following procedure:
Figure PCTCN2018115081-appb-000003
Figure PCTCN2018115081-appb-000003
Figure PCTCN2018115081-appb-000004
Figure PCTCN2018115081-appb-000004
在步骤S103中,利用预设简化规则对符合预设简化条件的三角面进行简化,以对模型进行简化。In step S103, the triangles that meet the preset simplification conditions are simplified using a preset simplification rule to simplify the model.
若步骤S102中的判断结果为所有三角面中存在符合预设简化条件的三角面,则对按照预设简化规则对符合预设简化条件的三角面进行简化。If the determination result in step S102 is that there is a triangular surface that meets the preset simplification condition among all the triangular surfaces, the triangular surface that meets the preset simplification condition is simplified according to the preset simplification rule.
本实施例中采用的预设简化规则为边折叠精简,即将一条边上的两个点进行合并。本实施例中合并的两个点为步骤S102中记载的点法线之间的夹角满足预设简化条件的两个点。具体的,将该两个点中,一个点作为合并点,另一个点作为被合并点,将被合并点的面信息添加至合并点的面信息中,进而实现该两个点的合并。The preset simplification rule used in this embodiment is edge folding and streamlining, that is, merging two points on one edge. The two points merged in this embodiment are two points whose angle between the point normals described in step S102 satisfies a preset simplified condition. Specifically, one of the two points is used as the merge point and the other is used as the merged point. The surface information of the merged point is added to the surface information of the merged point, and then the two points are merged.
进一步,在合并该两个点时还可以通过根据合并点的第一坐标位置和被合并点的第二坐标位置计算得到第三坐标位置;将合并点从第一坐标位置移动至第三坐标位置处。由此,两个点合并后的点在第三坐标位置处。进一步,第三坐标位置为第一坐标位置和第二坐标位置的中间坐标位置。Further, when merging the two points, a third coordinate position can also be calculated by calculating the first coordinate position of the merged point and the second coordinate position of the merged point; moving the merged point from the first coordinate position to the third coordinate position Office. Thus, the point after the two points are merged is at the third coordinate position. Further, the third coordinate position is an intermediate coordinate position between the first coordinate position and the second coordinate position.
在一实施方式中,可将经过简化的三角面设置为无效三角面,并在此返回步骤S101,循环执行步骤S101至步骤S103,直至步骤S102的判断结果为所有三角面中不存在符合预设简化条件的三角面为止。In one embodiment, the simplified triangular surface may be set as an invalid triangular surface, and the process returns to step S101, and steps S101 to S103 are executed cyclically, until the judgment result of step S102 is that all the triangular surfaces do not exist in accordance with the preset. Simplify the triangle to the condition.
在步骤S104中,停止对模型的简化。In step S104, the simplification of the model is stopped.
若步骤S102中的判断结果为所有三角面中不存在符合预设简化条件的三角面,则说明该三角网格模型不需要进行简化,由此停止对三角网格模型的简化。If the judgment result in step S102 is that no triangle faces that meet the preset simplified condition exist in all the triangle faces, it means that the triangle mesh model does not need to be simplified, and thus the simplification of the triangle mesh model is stopped.
本实施例中步骤S101至步骤S104整体循环执行的流程可通过如下程序实现:In this embodiment, the process of step S101 to step S104 as a whole can be implemented through the following procedures:
Figure PCTCN2018115081-appb-000005
Figure PCTCN2018115081-appb-000005
Figure PCTCN2018115081-appb-000006
Figure PCTCN2018115081-appb-000006
本实施例通过三角网格模型中三角面的面信息和构成三角面的点的点法线对该三角面是否能够简化进行判断,进而将三角网格模型满足预设简化条件的三角面进行简化,进而减少了三角网格模型中的三角面数量,同时不影响三角网格模型的三维形状。In this embodiment, whether the triangular surface can be simplified is determined based on the surface information of the triangular surface in the triangular mesh model and the point normals of the points constituting the triangular surface, and then the triangular surface that the triangular mesh model satisfies a preset simplified condition is simplified. , Thereby reducing the number of triangular faces in the triangular mesh model without affecting the three-dimensional shape of the triangular mesh model.
进一步,请参阅图3,图3是本发明三角网格模型的处理方法第二实施例的流程示意图。如图3所示,本实施例的三角网格模型的处理方法至少可包括如下步骤:Further, please refer to FIG. 3, which is a schematic flowchart of a second embodiment of a method for processing a triangular mesh model according to the present invention. As shown in FIG. 3, the method for processing the triangular mesh model in this embodiment may include at least the following steps:
在步骤S201中,读取模型中包含的所有的点分别对应的点信息,据点信息对每个点分别创建点结构体,并将点结构体存入模型的点容器中。In step S201, the point information corresponding to all the points included in the model is read, the point information creates a point structure for each point, and the point structure is stored in the point container of the model.
容器又称为vector模板,是C++标准模板库的一个数据结构,可以用来存储多个相应类型的数据。本实施例中,面容器即是用来存储三角面的面信息,点所属的面容器存储的即为该点对应的所有三角面的面信息;点容器即是用来存储点的点信息。A container is also called a vector template. It is a data structure of the C ++ standard template library. It can be used to store multiple types of data. In this embodiment, the surface container is used to store the surface information of the triangular surface, and the surface container to which the point belongs stores the surface information of all the triangular surfaces corresponding to the point; the point container is used to store the point information of the point.
读取需要进行处理的三角网格模型,进而获取该三角网格模型中包含的所有的点的点信息,其中,点信息具体可包括每个点的坐标位置(即对应的x、y、z值)。本实施例中,根据读取到的每个点的坐标位置创建相应的点结构体,并将该点结构体存入该三角网格模型的点容器中,即每个模型的点容器中包含有该模型中所有的点的点结构体,即所有的点的点信息。进一步,点结构体中还包含有该点的序号,以及该点所属的面容器(一个点可被多个三角面共有,因此,一个点可属于多个三角面容易,进而可根据点所属的面容器得知该点被哪些三角面共有)。Read the triangular mesh model that needs to be processed, and then obtain the point information of all the points contained in the triangular mesh model, where the point information may specifically include the coordinate position of each point (that is, the corresponding x, y, z value). In this embodiment, a corresponding point structure is created according to the coordinate position of each point read, and the point structure is stored in a point container of the triangular mesh model, that is, the point container of each model contains There is a point structure for all points in the model, that is, point information for all points. Further, the point structure also contains the serial number of the point, and the area container to which the point belongs (a point can be shared by multiple triangular faces, so it is easy for a point to belong to multiple triangular faces, and according to which point the point belongs to The surface container knows which triangles the point is in common with).
进一步,对每个点创建点结构体时,会对每个点结构体设置相应的序号,且每个点结构体具有其相应的点结构体指针,点结构体指针是点结构体申明的指针变量,不会随其序号的变化而变化。Further, when a point structure is created for each point, a corresponding sequence number is set for each point structure, and each point structure has its corresponding point structure pointer, and the point structure pointer is a pointer declared by the point structure. The variable does not change with its serial number.
在步骤S202中,读取模型中包含的所有三角面分别对应的面信息,根据面信息对每个三角面分别创建面结构体,并将面结构体存入模型的面容器中,以及将每个三角面的面信息分别记录至构成三角面的三个点所属的面容器中。In step S202, the surface information corresponding to all triangular faces included in the model is read, a surface structure is created for each triangular face according to the surface information, and the surface structure is stored in a surface container of the model, and each The surface information of each triangular surface is recorded in the surface container to which the three points constituting the triangular surface belong.
对于三角网格模型而言,其包含的多个点中每3个点构成一个三角面,即每个三角网格模型由多个三角面构成,每个三角网格模型的面信息即为其包含的所有三角面的面信息的集合。本实施例中,读取的每个三角网格模型所包含 的所有三角面的面信息(至少包括该构成该三角面的三个点的序号,以及该三角面的是否有效),进而对每个三角网格模型而言,对其包含的每个三角面分别创建各自的面结构体,即对每个三角网格模型所包含的每个三角面分别创建用于存储该三角面的面信息的数据集合。本实施例中,将三角网格模型的面结构体存入该三角网格模型的面容器中。此外,将每个三角面的面结构体所包含的面信息分别记录至构成该三角面的三个点的面容器中。For a triangular mesh model, every three points included in the triangular mesh model constitute a triangular surface, that is, each triangular mesh model is composed of multiple triangular surfaces, and the surface information of each triangular mesh model is its Contains a collection of face information for all triangular faces. In this embodiment, the surface information of all triangular faces included in each triangular mesh model is read (at least including the serial numbers of the three points constituting the triangular face and whether the triangular faces are valid). For each triangular mesh model, create a separate surface structure for each triangular surface included in it, that is, for each triangular surface included in each triangular mesh model, separately create surface information for storing the triangular surface. Data collection. In this embodiment, the surface structure of the triangular mesh model is stored in a surface container of the triangular mesh model. In addition, the surface information included in the surface structure of each triangular surface is separately recorded in a surface container of three points constituting the triangular surface.
以图2所示的三角网格模型的局部三角面为例,点P1、P2以及P3构成三角面S1。本实施例中,通过步骤S201,对三角网格模型中的每个点创建点结构体,例如,对点P1、P2、P3以及P4分别创建各自的点结构体,并将创建的点结构体存入三角网格模型的点容器中。进一步,通过步骤S202对包括三角面S1在内的每个三角面的面信息(至少包括该构成该三角面的三个点的序号,以及该三角面的是否有效)分别创建各自的面结构体,并将创建的每个面结构体存入三角网格模型的面容器中。进一步,将三角面S1的面信息记录到构成三角面S1的点P1、P2以及P3各自的面容器中。Taking the local triangular surface of the triangular mesh model shown in FIG. 2 as an example, the points P1, P2, and P3 constitute the triangular surface S1. In this embodiment, a point structure is created for each point in the triangular mesh model through step S201. For example, point structures P1, P2, P3, and P4 are respectively created, and the created point structures are created. Stored in the point container of the triangular mesh model. Further, in step S202, the surface information of each triangular surface including the triangular surface S1 (at least including the serial numbers of the three points constituting the triangular surface, and whether the triangular surface is valid) respectively create respective surface structures. And save each face structure created in the face container of the triangle mesh model. Further, the surface information of the triangular surface S1 is recorded in each of the surface containers of the points P1, P2, and P3 constituting the triangular surface S1.
本实施例中上述步骤流程可通过如下程序实现:The above steps and processes in this embodiment may be implemented by the following procedures:
Figure PCTCN2018115081-appb-000007
Figure PCTCN2018115081-appb-000007
在步骤S203中,计算模型中包含的所有三角面分别对应的面法线,并通过面法线计算模型包含的所有的点分别对应的点法线。In step S203, the surface normals corresponding to all the triangular faces included in the model are calculated, and the point normals corresponding to all the points included in the model are calculated through the surface normals.
在步骤S204中,获取所有三角面分别对应的面信息,利用面信息和点法线判断所有三角面中是否存在符合预设简化条件的三角面。In step S204, the surface information corresponding to all the triangular surfaces is obtained, and the surface information and the point normal are used to determine whether there is a triangular surface that meets the preset simplified condition in all the triangular surfaces.
本实施例中,步骤S203和步骤S204与图1所示的步骤S101和步骤S102相同,此处不再赘述。In this embodiment, steps S203 and S204 are the same as steps S101 and S102 shown in FIG. 1, and details are not described herein again.
进一步,由于本实施例中通过步骤S201和步骤S202创建了三角网格模型的点容器和面容器,由此,在本实施例步骤S203和步骤S204获取点的点信息和三角面的面信息时,可从创建的点容器和面容器中获取。Further, since the point container and the surface container of the triangular mesh model are created in steps S201 and S202 in this embodiment, when the point information of the points and the surface information of the triangle surface are obtained in steps S203 and S204 of this embodiment , Which can be obtained from the created point container and polygon container.
在步骤S205中,利用预设简化规则对符合预设简化条件的三角面进行简化,以对模型进行简化。In step S205, the triangles that meet the preset simplification conditions are simplified by using a preset simplification rule to simplify the model.
本实施例中采用的预设简化规则为边折叠精简,即将一条边上的两个点进行合并。本实施例中合并的两个点为步骤S204中记载的点法线之间的夹角满足预设简化条件的两个点。具体的,将该两个点中,一个点作为合并点,另一个点作为被合并点;根据步骤S201和步骤S202创建的面结构体、点结构体、以及面容器,将合并点所属的面容器作为第一面容器,被合并点所属的面容器为第二面容器,由此,如图4所示,本实施例中步骤S205可包括如下步骤:The preset simplification rule used in this embodiment is edge folding and streamlining, that is, merging two points on one edge. The two points merged in this embodiment are two points where the angle between the point normals recorded in step S204 satisfies a preset simplified condition. Specifically, one of the two points is used as the merged point, and the other point is used as the merged point. According to the surface structure, the point structure, and the surface container created in step S201 and step S202, the surface to which the merged point belongs is determined. The container is the first surface container, and the surface container to which the merged point belongs is the second surface container. Therefore, as shown in FIG. 4, step S205 in this embodiment may include the following steps:
在步骤S2051中,获取合并点所属的第一面容器以及被合并点所属的第二面容器。In step S2051, the first surface container to which the merged point belongs and the second surface container to which the merged point belongs are obtained.
根据步骤S201可知,三角网格模型中点所属的面容器包含有共有该点的所有面的面信息,由此,获取合并点所属的第一面容器以及被合并点所属的第二面容器,即相当于获取共有合并点的所有三角面的面信息,以及共有被合并点的所有三角面的面信息。According to step S201, it can be known that the surface container to which the point belongs in the triangular mesh model includes surface information of all the surfaces that share the point, thereby obtaining the first surface container to which the merged point belongs and the second surface container to which the merged point belongs, That is, it is equivalent to obtaining the surface information of all triangular faces that share a common merging point, and the surface information of all triangular faces that share a common merging point.
在步骤S2052中,将第二面容器中包含的被合并点对应的面信息添加至第一面容器中。In step S2052, the area information corresponding to the merged point included in the second area container is added to the first area container.
将共有被合并点的所有三角面的面信息添加至合并点的第一面容器中,将共有被合并点的所有三角面成为共有合并点的三角面,进而实现合并点和被合并点的合并。Add the surface information of all triangle faces that share the merged point to the first face container of the merge point, and change all triangle faces that share the merged point into triangle faces that share the merge point, and then merge the merged point and the merged point. .
进一步,本实施例在合并该上述合并点和被合并点时,还可以通过根据合并点的第一坐标位置和被合并点的第二坐标位置计算得到第三坐标位置;将合并点从第一坐标位置移动至第三坐标位置处,该移动步骤可在步骤S2051之前执行,也可在步骤S2052之前执行,此外,还可以在步骤S2052之后执行,本发明不做具体限制;由此,两个点合并后的点在第三坐标位置处。进一步,第三坐标位置为第一坐标位置和第二坐标位置的中间坐标位置。Further, in this embodiment, when the above-mentioned merged point and the merged point are merged, the third coordinate position may also be obtained by calculating according to the first coordinate position of the merged point and the second coordinate position of the merged point; The coordinate position is moved to the third coordinate position. This moving step may be performed before step S2051 or before step S2052. In addition, it may be performed after step S2052. The present invention is not specifically limited; therefore, two The merged point is at the third coordinate position. Further, the third coordinate position is an intermediate coordinate position between the first coordinate position and the second coordinate position.
在一实施方式中,可将经过简化的三角面设置为无效三角面,并在此返回步骤S203,循环执行步骤S203至步骤S205,直至步骤S204的判断结果为所有三角面中不存在符合预设简化条件的三角面为止。In an embodiment, the simplified triangular surface can be set as an invalid triangular surface, and the process returns to step S203, and steps S203 to S205 are executed cyclically, until the judgment result of step S204 is that none of the triangular surfaces meet the preset. Simplify the triangle to the condition.
本实施例中上述三角面简化流程可通过如下程序实现:The above-mentioned simplified process of the triangular surface in this embodiment can be implemented by the following procedure:
Figure PCTCN2018115081-appb-000008
Figure PCTCN2018115081-appb-000008
在步骤S206中,将经过简化的三角面设置为无效三角面。In step S206, the simplified triangular surface is set as an invalid triangular surface.
进一步,将经过步骤S205简化后的三角面设置为无效三角面。具体的,三角面的面结构体中设置有该三角面是否有效或无效的指示,一般用“true”表示三角面为有效三角面,“false”表示三角面为无效三角面,当三角面经过步骤S205简化后,则将该三角面对应的指示从“true”改为“false”,即将三角面设置无效三角面。Further, the triangular surface simplified after step S205 is set as an invalid triangular surface. Specifically, the triangle structure is provided with an indication of whether the triangle is valid or invalid. Generally, "true" indicates that the triangle is a valid triangle, and "false" indicates that the triangle is an invalid triangle. When the triangle passes After step S205 is simplified, the indication corresponding to the triangular surface is changed from "true" to "false", that is, an invalid triangular surface is set for the triangular surface.
在步骤S207中,删除无效三角面,并返回步骤S203。In step S207, the invalid triangle is deleted, and the process returns to step S203.
进一步,将步骤S206中设置的无效三角面进行删除,并返回步骤S203,重新计算三角网格模型中包含的剩余的所有三角面各自对应的面法线,并通过面法线计算三角网格模型包含的剩余的所有的点分别对应的点法线;获取所有三角面分别对应的面信息,利用面信息和点法线判断所有三角面中是否存在符合预设简化条件的三角面;利用预设简化规则对符合预设简化条件的三角面进行简化,以对模型进行简化。如此循环执行,直至在再次返回步骤S203后,判断所有三角面中不存在符合预设简化条件的三角面为止。Further, delete the invalid triangular faces set in step S206, and return to step S203, recalculate the corresponding surface normals of each of the remaining triangular faces included in the triangular mesh model, and calculate the triangular mesh model by the surface normals. Contains the point normals corresponding to all the remaining points, respectively; obtains the surface information corresponding to all the triangular surfaces, and uses the surface information and the point normals to determine whether there is a triangular surface that meets the preset simplified conditions in all triangular surfaces; using the preset The simplification rule simplifies the triangular faces that meet the preset simplification conditions to simplify the model. This is performed cyclically, until after returning to step S203 again, it is determined that there is no triangle surface that meets the preset simplified condition among all the triangle surfaces.
在步骤S208中,停止对模型的简化。In step S208, the simplification of the model is stopped.
若步骤S204中的判断结果为所有三角面中不存在符合预设简化条件的三角面,则说明该三角网格模型不需要进行简化,由此停止对三角网格模型的简化。If the judgment result in step S204 is that no triangle faces that meet the preset simplified conditions exist in all the triangle faces, it means that the triangle mesh model does not need to be simplified, and thus the simplification of the triangle mesh model is stopped.
通过上述的三角网格模型的处理方法,可对需要简化的三角网格模型中的三角面进行简化,在能够完整展示三角网格模型的必要信息的前提下,减少了三角面的数量,即相当于减少了三角网格模型的数据量,减少其占用内存,且便于后续对三角网格模型的应用。如图5a所示,简化前的三角网格模型通过较多的三角面表示了其三维图型,可以看出图5a所示的模型中三角面较多;通过图1至图4所示的三角网格模型的处理方法第一实施例至第二实施例,对图5a中所示的三角网格模型进行简化后,形成图5b所示的图型,图5b所示的图像同样保持了图5a所示的三维形状,但其包含的三角面明显减少,其对应的数据量也相对较少。Through the above-mentioned processing method of the triangular mesh model, the triangular surfaces in the triangular mesh model that needs to be simplified can be simplified. On the premise that the necessary information of the triangular mesh model can be completely displayed, the number of triangular surfaces is reduced, that is, This is equivalent to reducing the amount of data of the triangular mesh model, reducing its memory consumption, and facilitating subsequent application of the triangular mesh model. As shown in FIG. 5a, the triangle mesh model before simplification indicates its three-dimensional pattern by more triangular faces. It can be seen that there are more triangular faces in the model shown in FIG. 5a; Method for processing a triangular mesh model The first embodiment to the second embodiment simplify the triangular mesh model shown in FIG. 5a to form a pattern shown in FIG. 5b, and the image shown in FIG. 5b is also maintained. The three-dimensional shape shown in FIG. 5a, but the triangular surface included therein is significantly reduced, and the corresponding data amount is relatively small.
请参阅图6,图6是本发明三角网格模型的处理终端一实施例的结构示意图。如图6所示,本实施例的处理终端100包括相互连接的处理器10和存储器11;其中,存储器11存储有相应的程序指令,处理器执行存储器11中存储的该程序指令,以实现图1至图4所示的三角网格模型的处理方法第一实施例至第二实施例。Please refer to FIG. 6, which is a schematic structural diagram of an embodiment of a processing terminal of a triangular mesh model of the present invention. As shown in FIG. 6, the processing terminal 100 in this embodiment includes a processor 10 and a memory 11 connected to each other. The memory 11 stores a corresponding program instruction, and the processor executes the program instruction stored in the memory 11 to implement the diagram. The processing methods of the triangular mesh model shown in FIGS. 1 to 4 are the first to second embodiments.
本实施例中,处理终端100可为台式电脑、平板电脑、服务器、或手机等具有计算处理能力的不同类型的终端设备。此外,台式电脑、平板电脑或手机等处理终端还包括有显示屏12,可对三角网格模型进行显示,由此可令用户对简化前和简化后的三角网格模型进行查看,对于服务器等处理终端,可将相应数据传输至具有显示器12或具有显示屏12的终端上,以使用户对简化前和简化后的三角网格模型进行查看。In this embodiment, the processing terminal 100 may be different types of terminal devices with computing processing capabilities, such as a desktop computer, a tablet computer, a server, or a mobile phone. In addition, processing terminals such as desktop computers, tablet computers, or mobile phones also include a display screen 12 that can display the triangular mesh model, so that users can view the simplified and simplified triangular mesh models, and for servers, etc. The processing terminal may transmit corresponding data to a terminal having a display 12 or a display screen 12 so that the user can view the simplified triangular mesh model before and after the simplification.
进一步,如图6所示,本实施例的处理终端100还可包括传感器、红外扫描仪、太赫兹扫描仪等扫描设备13,扫描设备13用于对要成像的物体进行扫描,得到相应的扫描数据,将扫描数据发送至处理器,由处理器对扫描数据进行处理,进而得到与要成像的物体对应的三角网格模型。Further, as shown in FIG. 6, the processing terminal 100 in this embodiment may further include a scanning device 13 such as a sensor, an infrared scanner, a terahertz scanner, and the scanning device 13 is configured to scan an object to be imaged to obtain a corresponding scan. Data, the scan data is sent to the processor, and the processor processes the scan data to obtain a triangle mesh model corresponding to the object to be imaged.
请参阅图7,图7是本发明存储介质一实施例的结构示意图。如图7所示,本实施例中的存储介质200中存储有能够被执行的程序数据201,该程序数据201被执行后能够实现图1至图4所示的三角网格模型的处理方法第一实施例至第二实施例。Please refer to FIG. 7, which is a schematic structural diagram of an embodiment of a storage medium of the present invention. As shown in FIG. 7, the storage medium 200 in this embodiment stores program data 201 that can be executed. After the program data 201 is executed, the processing method of the triangular mesh model shown in FIGS. 1 to 4 can be implemented. An embodiment to a second embodiment.
本实施例中,该存储介质200可以是智能终端的存储模块、移动存储装置(如移动硬盘、U盘等)、网络云盘、应用存储平台或服务器等具备存储功能的介质。此外,该存储介质200还可以为上述图6中所示的存储器11。In this embodiment, the storage medium 200 may be a storage module such as a storage module of a smart terminal, a mobile storage device (such as a mobile hard disk, a U disk, etc.), a network cloud disk, an application storage platform, or a server with a storage function. In addition, the storage medium 200 may also be the memory 11 shown in FIG. 6 described above.
以上仅为本发明的实施方式,并非因此限制本发明的专利范围,凡是利用本发明说明书及附图内容所作的等效结构或等效流程变换,或直接或间接运用在其他相关的技术领域,均同理包括在本发明的专利保护范围。The above is only an embodiment of the present invention, and thus does not limit the patent scope of the present invention. Any equivalent structure or equivalent process transformation made by using the description and drawings of the present invention, or directly or indirectly used in other related technical fields, All the same are included in the patent protection scope of the present invention.

Claims (20)

  1. 一种存储介质,其中,存储有程序数据,所述程序数据能够被执行以实现如下操作:A storage medium in which program data is stored, and the program data can be executed to implement the following operations:
    计算模型中包含的所有三角面分别对应的面法线,并通过所述面法线计算所述模型包含的所有的点分别对应的点法线;Calculate the surface normals corresponding to all the triangular faces included in the model, and calculate the point normals corresponding to all the points included in the model through the surface normals;
    获取所述所有三角面分别对应的面信息,利用所述面信息和所述点法线判断所述所有三角面中是否存在符合预设简化条件的三角面;Obtaining surface information corresponding to all the triangular surfaces, and using the surface information and the point normal to determine whether there is a triangular surface in all the triangular surfaces that meets a preset simplified condition;
    若是,则利用预设简化规则对符合预设简化条件的三角面进行简化,以对所述模型进行简化;If so, simplify the triangles that meet the preset simplification conditions by using a preset simplification rule to simplify the model;
    其中,所述通过所述面法线计算所述模型包含的所有的点分别对应的点法线包括:将共用同一个点的多个面的面法线进行累加,计算得到所述多个面共用的同一个点的点法线。Wherein, calculating the point normals corresponding to all the points included in the model by using the surface normal includes: accumulating the surface normals of multiple surfaces sharing a same point, and calculating the multiple surfaces. Point normals that share the same point.
  2. 根据权利要求1所述的存储介质,其中,所述程序数据被执行以实现的所述预设简化条件包括:The storage medium according to claim 1, wherein the preset simplified conditions that the program data is executed to realize include:
    构成三角面的三个点中,两个点的点法线之间的夹角小于第一预设角度值,且连接所述两个点的边的边长小于预设长度,以及所述边的对角的角度值小于第二预设角度值;Of the three points constituting the triangular surface, the included angle between the point normals of the two points is less than the first preset angle value, and the length of the side connecting the two points is less than the preset length, and the side The angle value of the opposite corner is smaller than the second preset angle value;
    所述程序数据被执行以实现的所述预设简化规则包括:The preset simplified rules implemented by the program data to be implemented include:
    令所述两个点中的一个点作为合并点,另一个点作为被合并点;将所述被合并点的面信息添加至所述合并点的面信息中。Let one point of the two points be a merge point and the other point be a merged point; and add surface information of the merged point to the surface information of the merged point.
  3. 根据权利要求2所述的存储介质,其中,所述程序数据被执行以实现的所述预设简化规则还包括:The storage medium according to claim 2, wherein the preset simplification rule that the program data is executed to implement further comprises:
    根据所述合并点的第一坐标位置和所述被合并点的第二坐标位置计算得到第三坐标位置;Calculating a third coordinate position according to a first coordinate position of the merged point and a second coordinate position of the merged point;
    将所述合并点从所述第一坐标位置移动至所述第三坐标位置处。Moving the merge point from the first coordinate position to the third coordinate position.
  4. 根据权利要求3所述的存储介质,其中,所述程序数据被执行以实现的所述根据所述合并点的第一坐标位置和所述被合并点的第二坐标位置计算得到第三坐标位置,包括:The storage medium according to claim 3, wherein the program data is executed to realize a third coordinate position calculated from the first coordinate position of the merged point and the second coordinate position of the merged point. ,include:
    根据所述合并点的第一坐标位置和所述被合并点的第二坐标位置计算得到中间坐标位置;Calculate an intermediate coordinate position according to a first coordinate position of the merged point and a second coordinate position of the merged point;
    将所述中间坐标位置作为所述合并点坐标位置。And using the intermediate coordinate position as the merge point coordinate position.
  5. 根据权利要求1所述的存储介质,其中,所述程序数据被执行以实现的操作方法,还包括:The storage medium according to claim 1, wherein the operation method to be executed by the program data further comprises:
    读取所述模型中包含的所有的点分别对应的点信息,据所述点信息对每个点分别创建点结构体,并将所述点结构体存入所述模型的点容器中;Reading point information corresponding to all points included in the model, creating a point structure for each point according to the point information, and storing the point structure in a point container of the model;
    读取所述模型中包含的所有三角面分别对应的面信息,根据所述面信息对每个三角面分别创建面结构体,并将所述面结构体存入所述模型的面容器中,以及将每个所述三角面的面信息分别记录至构成所述三角面的三个点所属的面容器中。Reading surface information corresponding to all triangular faces included in the model, creating a surface structure for each triangular face according to the surface information, and storing the surface structure in a surface container of the model, And record the surface information of each of the triangular faces into the surface containers to which the three points constituting the triangular face belong.
  6. 根据权利要求1所述的存储介质,其中,所述程序数据被执行以实现的操作方法,还包括:The storage medium according to claim 1, wherein the operation method to be executed by the program data further comprises:
    将经过简化的三角面设置为无效三角面;Set simplified triangles as invalid triangles;
    所述程序数据被执行以实现的操作方法,还包括:The operation method by which the program data is executed to further include:
    删除所述无效三角面,并反馈所述计算模型中包含的所有三角面分别对应的面法线,并通过所述面法线计算所述模型包含的所有的点分别对应的点法线的步骤。A step of deleting the invalid triangular surface, and feeding back the surface normals corresponding to all the triangular surfaces included in the calculation model, and calculating the point normals corresponding to all the points included in the model through the surface normals .
  7. 一种三角网格模型的处理终端,其中,包括相互连接的处理器和存储器;A processing terminal of a triangular mesh model, which includes a processor and a memory connected to each other;
    所述存储器存储有用于处理器执行的指令;The memory stores instructions for execution by a processor;
    所述处理器执行所述存储器中的所述指令,计算模型中包含的所有三角面分别对应的面法线,并通过所述面法线计算所述模型包含的所有的点分别对应的点法线;The processor executes the instructions in the memory, calculates surface normals corresponding to all triangular faces included in the model, and calculates point methods corresponding to all points included in the model through the surface normals. line;
    获取所述所有三角面分别对应的面信息,利用所述面信息和所述点法线判断所述所有三角面中是否存在符合预设简化条件的三角面;Obtaining surface information corresponding to all the triangular surfaces, and using the surface information and the point normal to determine whether there is a triangular surface in all the triangular surfaces that meets a preset simplified condition;
    若是,则利用预设简化规则对符合预设简化条件的三角面进行简化,以对所述模型进行简化。If so, the triangles that meet the preset simplification conditions are simplified using a preset simplification rule to simplify the model.
  8. 根据权利要求7所述的处理终端,其中,所述预设简化条件包括:The processing terminal according to claim 7, wherein the preset simplified conditions include:
    构成三角面的三个点中,两个点的点法线之间的夹角小于第一预设角度值,且连接所述两个点的边的边长小于预设长度,以及所述边的对角的角度值小于第二预设角度值;Of the three points constituting the triangular surface, the included angle between the point normals of the two points is less than the first preset angle value, and the length of the side connecting the two points is less than the preset length, and the side The angle value of the opposite corner is smaller than the second preset angle value;
    所述预设简化规则,包括:The preset simplified rules include:
    令所述两个点中的一个点作为合并点,另一个点作为被合并点;将所述被 合并点的面信息添加至所述合并点的面信息中。Let one of the two points be the merged point and the other point be the merged point; add the surface information of the merged point to the surface information of the merged point.
  9. 根据权利要求8所述的处理终端,其中,所述预设简化规则,还包括:The processing terminal according to claim 8, wherein the preset simplified rule further comprises:
    根据所述合并点的第一坐标位置和所述被合并点的第二坐标位置计算得到第三坐标位置;将所述合并点从所述第一坐标位置移动至所述第三坐标位置处。A third coordinate position is calculated according to a first coordinate position of the merged point and a second coordinate position of the merged point; and the merged point is moved from the first coordinate position to the third coordinate position.
  10. 根据权利要求9所述的处理终端,其中,所述处理器执行的所述根据所述合并点的第一坐标位置和所述被合并点的第二坐标位置计算得到第三坐标位置,包括:The processing terminal according to claim 9, wherein the third coordinate position calculated by the processor according to the first coordinate position of the merged point and the second coordinate position of the merged point comprises:
    根据所述合并点的第一坐标位置和所述被合并点的第二坐标位置计算得到中间坐标位置;Calculate an intermediate coordinate position according to a first coordinate position of the merged point and a second coordinate position of the merged point;
    将所述中间坐标位置作为所述合并点坐标位置。And using the intermediate coordinate position as the merge point coordinate position.
  11. 根据权利要求7所述的处理终端,其中,所述处理器在执行所述计算模型中包含的所有三角面分别对应的面法线,并通过所述面法线计算所述模型包含的所有的点分别对应的点法线之前,还执行以下操作:The processing terminal according to claim 7, wherein the processor executes the surface normals corresponding to all the triangular faces included in the calculation model, and calculates all the normals included in the model through the surface normals. Before the corresponding normals of the points, the following operations are also performed:
    读取所述模型中包含的所有的点分别对应的点信息,根据所述点信息对每个点分别创建点结构体,并将所述点结构体存入所述模型的点容器中;Reading point information corresponding to all points included in the model, creating a point structure for each point according to the point information, and storing the point structure in a point container of the model;
    读取所述模型中包含的所有三角面分别对应的面信息,根据所述面信息对每个三角面分别创建面结构体,并将所述面结构体存入所述模型的面容器中,以及将每个所述三角面的面信息分别记录至构成所述三角面的三个点所属的面容器中。Reading surface information corresponding to all triangular faces included in the model, creating a surface structure for each triangular face according to the surface information, and storing the surface structure in a surface container of the model, And record the surface information of each of the triangular faces into the surface containers to which the three points constituting the triangular face belong.
  12. 根据权利要求7所述的处理终端,其中,所述处理器在执行在所述利用预设简化规则对符合预设简化条件的三角面进行简化之后,还执行以下操作:The processing terminal according to claim 7, wherein the processor further performs the following operations after the triangle surface that satisfies a preset simplification condition is simplified by using a preset simplification rule:
    将经过简化的三角面设置为无效三角面;Set simplified triangles as invalid triangles;
    所述处理器在执行所述将经过简化的三角面设置为无效三角面之后,还执行以下操作:After the processor executes the setting of the simplified triangular surface as an invalid triangular surface, the processor further performs the following operations:
    删除所述无效三角面,并反馈所述计算模型中包含的所有三角面分别对应的面法线,并通过所述面法线计算所述模型包含的所有的点分别对应的点法线的步骤。A step of deleting the invalid triangular surface, and feeding back the surface normals corresponding to all the triangular surfaces included in the calculation model, and calculating the point normals corresponding to all the points included in the model through the surface normals .
  13. 一种三角网格模型的处理方法,其中,包括:A method for processing a triangular mesh model, including:
    计算模型中包含的所有三角面分别对应的面法线,并通过所述面法线计算所述模型包含的所有的点分别对应的点法线;Calculate the surface normals corresponding to all the triangular faces included in the model, and calculate the point normals corresponding to all the points included in the model through the surface normals;
    获取所述所有三角面分别对应的面信息,利用所述面信息和所述点法线判 断所述所有三角面中是否存在符合预设简化条件的三角面;Acquiring surface information corresponding to all the triangular surfaces, and using the surface information and the point normal to determine whether there is a triangular surface in all the triangular surfaces that meets a preset simplified condition;
    若是,则利用预设简化规则对符合预设简化条件的三角面进行简化,以对所述模型进行简化。If so, the triangles that meet the preset simplification conditions are simplified using a preset simplification rule to simplify the model.
  14. 根据权利要求13所述的处理方法,其中,所述预设简化条件包括:The processing method according to claim 13, wherein the preset simplified conditions include:
    构成三角面的三个点中,两个点的点法线之间的夹角小于第一预设角度值,且连接所述两个点的边的边长小于预设长度,以及所述边的对角的角度值小于第二预设角度值。Of the three points constituting the triangular surface, the included angle between the point normals of the two points is less than the first preset angle value, and the length of the side connecting the two points is less than the preset length, and the side The angle of the diagonal angle is smaller than the second preset angle value.
  15. 根据权利要求14所述的处理方法,其中,所述预设简化规则,包括:The processing method according to claim 14, wherein the preset simplification rule comprises:
    令所述两个点中的一个点作为合并点,另一个点作为被合并点;将所述被合并点的面信息添加至所述合并点的面信息中。Let one point of the two points be a merge point and the other point be a merged point; and add surface information of the merged point to the surface information of the merged point.
  16. 根据权利要求15所述的处理方法,其中,所述预设简化规则,还包括:The processing method according to claim 15, wherein the preset simplification rule further comprises:
    根据所述合并点的第一坐标位置和所述被合并点的第二坐标位置计算得到第三坐标位置;Calculating a third coordinate position according to a first coordinate position of the merged point and a second coordinate position of the merged point;
    将所述合并点从所述第一坐标位置移动至所述第三坐标位置处。Moving the merge point from the first coordinate position to the third coordinate position.
  17. 根据权利要求16所述的处理方法,其中,所述根据所述合并点的第一坐标位置和所述被合并点的第二坐标位置计算得到第三坐标位置,包括:The processing method according to claim 16, wherein the calculating the third coordinate position according to the first coordinate position of the merged point and the second coordinate position of the merged point comprises:
    根据所述合并点的第一坐标位置和所述被合并点的第二坐标位置计算得到中间坐标位置;Calculate an intermediate coordinate position according to a first coordinate position of the merged point and a second coordinate position of the merged point;
    将所述中间坐标位置作为所述合并点坐标位置。And using the intermediate coordinate position as the merge point coordinate position.
  18. 根据权利要求13所述的处理方法,其中,在所述计算模型中包含的所有三角面分别对应的面法线,并通过所述面法线计算所述模型包含的所有的点分别对应的点法线之前,还包括:The processing method according to claim 13, wherein the surface normals corresponding to all the triangular faces included in the calculation model are respectively corresponding to points corresponding to all the points included in the model through the surface normals. Before normal, it also includes:
    读取所述模型中包含的所有的点分别对应的点信息,据所述点信息对每个点分别创建点结构体,并将所述点结构体存入所述模型的点容器中;Reading point information corresponding to all points included in the model, creating a point structure for each point according to the point information, and storing the point structure in a point container of the model;
    读取所述模型中包含的所有三角面分别对应的面信息,根据所述面信息对每个三角面分别创建面结构体,并将所述面结构体存入所述模型的面容器中,以及将每个所述三角面的面信息分别记录至构成所述三角面的三个点所属的面容器中。Reading surface information corresponding to all triangular faces included in the model, creating a surface structure for each triangular face according to the surface information, and storing the surface structure in a surface container of the model, And record the surface information of each of the triangular faces into the surface containers to which the three points constituting the triangular face belong.
  19. 根据权利要求13所述的处理方法,其中,在所述利用预设简化规则对符合预设简化条件的三角面进行简化之后,还包括:The processing method according to claim 13, wherein after the using the preset simplification rule to simplify a triangular surface that meets a preset simplification condition, further comprising:
    将经过简化的三角面设置为无效三角面。Set the simplified triangle to an invalid triangle.
  20. 根据权利要求19所述的处理方法,其中,在所述将经过简化的三角面设置为无效三角面之后,还包括:The processing method according to claim 19, wherein after the setting the simplified triangular surface as an invalid triangular surface, further comprising:
    删除所述无效三角面,并反馈所述计算模型中包含的所有三角面分别对应的面法线,并通过所述面法线计算所述模型包含的所有的点分别对应的点法线的步骤。A step of deleting the invalid triangular surface, and feeding back the surface normals corresponding to all the triangular surfaces included in the calculation model, and calculating the point normals corresponding to all the points included in the model through the surface normals .
PCT/CN2018/115081 2018-09-26 2018-11-12 Processing method for triangular mesh model, processing terminal, and storage medium WO2020062472A1 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201811125564.2 2018-09-26
CN201811125564.2A CN109448125A (en) 2018-09-26 2018-09-26 A kind of processing method of triangle grid model, processing terminal and storage medium

Publications (1)

Publication Number Publication Date
WO2020062472A1 true WO2020062472A1 (en) 2020-04-02

Family

ID=65544461

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2018/115081 WO2020062472A1 (en) 2018-09-26 2018-11-12 Processing method for triangular mesh model, processing terminal, and storage medium

Country Status (2)

Country Link
CN (1) CN109448125A (en)
WO (1) WO2020062472A1 (en)

Families Citing this family (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111523159B (en) * 2020-04-16 2023-04-28 深圳云甲科技有限公司 Shaping method, terminal and storage medium of grid model
CN111667581B (en) * 2020-06-15 2023-08-22 网易(杭州)网络有限公司 Processing method, device, equipment and storage medium of 3D model
CN112435330B (en) * 2020-12-04 2024-04-23 北京爱奇艺科技有限公司 3D model simplification method and device, electronic equipment and storage medium
CN112446940B (en) * 2020-12-04 2024-04-19 北京爱奇艺科技有限公司 Simplifying method and device for 3D model, electronic equipment and storage medium
CN112712587A (en) * 2020-12-23 2021-04-27 上海葛兰岱尔网络科技有限公司 Method for generating model wire frame based on triangular patch data
CN114004925B (en) * 2021-09-16 2022-11-22 北京城市网邻信息技术有限公司 WebGL-based model rendering method, electronic device and storage medium

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US5379371A (en) * 1987-10-09 1995-01-03 Hitachi, Ltd. Displaying method and apparatus for three-dimensional computer graphics
CN101377857A (en) * 2008-07-30 2009-03-04 电子科技大学 Method for simplifying three-dimensional model based on octree space division and culmination deletion
CN102324107A (en) * 2011-06-15 2012-01-18 中山大学 The continuous multiresolution coding method of a kind of three-dimensional grid model towards pervasive terminal
CN106780697A (en) * 2016-12-07 2017-05-31 珠海金山网络游戏科技有限公司 It is a kind of based on normal direction, geometry, uv factors lattice simplified method

Family Cites Families (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6362820B1 (en) * 1999-06-24 2002-03-26 Microsoft Corporation Quadric metric for simplifying meshes with appearance attributes
CN100545872C (en) * 2006-06-27 2009-09-30 北京航空航天大学 Three-dimensional model simplifying method based on visual feature measurement
CN103632394B (en) * 2013-12-02 2016-05-04 江苏科技大学 The Model Simplification Method that a kind of feature keeps
CN105469446A (en) * 2014-09-05 2016-04-06 富泰华工业(深圳)有限公司 Point cloud mesh simplification system and method
CN105006022A (en) * 2015-08-11 2015-10-28 中山大学 Simplified method and device for edge collapse of 3D geometry graphics

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US5379371A (en) * 1987-10-09 1995-01-03 Hitachi, Ltd. Displaying method and apparatus for three-dimensional computer graphics
CN101377857A (en) * 2008-07-30 2009-03-04 电子科技大学 Method for simplifying three-dimensional model based on octree space division and culmination deletion
CN102324107A (en) * 2011-06-15 2012-01-18 中山大学 The continuous multiresolution coding method of a kind of three-dimensional grid model towards pervasive terminal
CN106780697A (en) * 2016-12-07 2017-05-31 珠海金山网络游戏科技有限公司 It is a kind of based on normal direction, geometry, uv factors lattice simplified method

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
Title
TANG, HUI ET AL.: "A Mesh Simplification Method based on Curvature of Curves", JOURNAL OF IMAGE AND GRAPHICS, vol. 13, no. 11, 30 November 2008 (2008-11-30) *
ZHANG, SHIXUE ET AL.: "a Improving Algorithm for Generating Progressive Animation Mesh Model", SCIENCE CHINA, vol. 40, no. 8, 31 December 2010 (2010-12-31) *

Also Published As

Publication number Publication date
CN109448125A (en) 2019-03-08

Similar Documents

Publication Publication Date Title
WO2020062472A1 (en) Processing method for triangular mesh model, processing terminal, and storage medium
US10268917B2 (en) Pre-segment point cloud data to run real-time shape extraction faster
US8766979B2 (en) Three dimensional data compression
US9443353B2 (en) Methods and systems for capturing and moving 3D models and true-scale metadata of real world objects
CN112771573A (en) Depth estimation method and device based on speckle images and face recognition system
WO2020093307A1 (en) Method and device for simplifying three-dimensional mesh model
US10957062B2 (en) Structure depth-aware weighting in bundle adjustment
CN113706713A (en) Live-action three-dimensional model cutting method and device and computer equipment
JP2002288687A (en) Device and method for calculating feature amount
JP2022509329A (en) Point cloud fusion methods and devices, electronic devices, computer storage media and programs
GB2534903A (en) Method and apparatus for processing signal data
Yoshimura et al. Automatic registration of MLS point clouds and SfM meshes of urban area
JP2023172893A (en) Control method, control device, and recording medium for interactive three-dimensional representation of target object
CN116227209A (en) Multi-dimensional linear difference method for point cloud data, terminal equipment and storage medium
CN116596935B (en) Deformation detection method, deformation detection device, computer equipment and computer readable storage medium
CN112634366A (en) Position information generation method, related device and computer program product
US10861174B2 (en) Selective 3D registration
CN115861403A (en) Non-contact object volume measurement method and device, electronic equipment and medium
CN114522420A (en) Game data processing method and device, computer equipment and storage medium
CN113706543A (en) Three-dimensional pose construction method and equipment and storage medium
CN109448121B (en) Processing method, processing terminal and storage medium of triangular mesh model
CN111130569A (en) Spatial information data self-adaptive fault-tolerant processing method and system
CN111145081A (en) Three-dimensional model view projection method and system based on space volume characteristics
CN115861520B (en) Highlight detection method, highlight detection device, computer equipment and storage medium
CN112150527B (en) Measurement method and device, electronic equipment and storage medium

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 18934690

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 18934690

Country of ref document: EP

Kind code of ref document: A1