A three-dimensional pipeline modeling method and related device
By constructing the half-side structure and polyhedral of the three-dimensional pipeline, the problem that three-dimensional pipeline modeling in the prior art is difficult to accurately reflect cross-sections, and higher modeling accuracy is achieved.
Patent Information
- Application Number
- CN202411831835.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-12
- Publication Date
- 2025-04-04
AI Technical Summary
The existing three-dimensional pipeline modeling method is difficult to accurately reflect the cross-section at the pipe point and the pipeline connection.
By constructing a half-edge structure of a three-dimensional pipeline, the edge direction vector of each branch of a node is obtained, and based on the dual polyhedron of the convex hull and the convex hull, a polyhedron is constructed to represent the three-dimensional shape at the connection between the pipeline and the pipe point.
The accuracy of the three-dimensional pipeline modeling results is improved, especially when there are cross-sections at the pipe point and pipeline connection.
Smart Images

Figure CN119762675A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of computer graphics technology, and in particular to a three-dimensional pipeline modeling method and related devices. Background Art
[0002] With the development of urban construction, the scale of 3D pipelines is getting larger and larger, and the types are becoming more and more diverse. The modeling of 3D pipelines is crucial for design and maintenance. The accuracy of the modeling results obtained by the current modeling method needs to be improved, especially for the situation where there are non-planar intersections at the connection between the pipe points and the pipelines on the 3D pipelines. The modeling results of 3D pipelines often cannot accurately reflect the non-planar intersections. Summary of the invention
[0003] In view of the above problems, the present application provides a three-dimensional pipeline modeling method and related devices to achieve the purpose of improving the accuracy of the three-dimensional pipeline modeling results. The specific scheme is as follows:
[0004] A three-dimensional pipeline modeling method, wherein the three-dimensional pipeline includes a pipe point and a pipeline, a node is abstractly obtained based on the pipe point, and a branch of the node is abstractly obtained based on the pipeline connected to the pipe point, the method comprising:
[0005] Based on the position information of the three-dimensional pipeline, construct a half-edge structure of the three-dimensional pipeline;
[0006] Based on the half-edge structure, obtaining an edge direction vector of each branch of the node;
[0007] If the node connects more than two branches, and the two branches are not coplanar, a direction polyhedron is constructed based on the convex hull and the dual polyhedron of the convex hull, wherein the direction polyhedron represents the three-dimensional shape of the connection between the pipeline and the pipe point, and the convex hull is obtained based on the coordinates of the node and the starting and ending points of the edge direction vector;
[0008] Based on the half-edge structure of the three-dimensional pipe, in the orientation polyhedron, obtaining a starting face of each of the branches, wherein the starting face of the first branch includes the node and is associated with the first branch, and the first branch is any one of the branches;
[0009] Based on the half-edge structure of the three-dimensional pipeline, construct a first plane of each branch, wherein the first plane of the first branch takes the node as an origin and takes the direction of the edge direction vector of the first branch as a normal;
[0010] The first plane is translated by a first distance along the direction of the side direction vector of the branch to obtain a first plane after translation, wherein the first distance of translation of the first plane of the first branch is determined based on the distance between the first plane of the first branch and the starting surface of the first branch;
[0011] The cross section corresponding to the branch is rotated and translated to the corresponding first plane after the movement to obtain a pipe point model, wherein the cross section corresponding to the first branch is a cross section of the pipeline corresponding to the first branch.
[0012] Optionally, constructing the oriented polyhedron based on the convex hull and the dual polyhedron of the convex hull includes:
[0013] Expanding the dual polyhedron by expanding each vertex of the dual polyhedron;
[0014] Using the midpoint of a half edge in the expanded dual polyhedron, split the half edge to obtain a new dual polyhedron;
[0015] Delete the boundaries between the new dual polyhedrons that meet the conditions to obtain the oriented polyhedron, the conditions of the first boundary include: the length is less than a preset threshold, and the number of faces connected by the first half edge is equal to a first value, the number of faces connected by the second half edge is not equal to the first value, the first half edge and the second half edge are adjacent half edges and represent the first boundary, and the first boundary is any boundary.
[0016] Optionally, expanding the dual polyhedron by expanding each vertex of the dual polyhedron includes:
[0017] Obtain the corresponding vertex P of the first face of the convex hull in the dual polyhedron;
[0018] Subtract the coordinates of the node from the coordinates of P, and normalize the result to obtain a unit vector Nd;
[0019] Subtract the coordinates of the node from the coordinates of the 0th vertex of the first face of the convex hull to obtain a unit vector Nc;
[0020] Calculate the cosecant value w of the angle between Nc and Nd;
[0021] The coordinates of the vertex P1 of the expanded P are calculated as the sum of the node coordinates and the product, where the product is the product of Nd and w.
[0022] Optionally, the process of obtaining the midpoint includes:
[0023] Based on the half-edge structure, obtain the midpoint Pm of the edge represented by the first half-edge and the adjacent half-edge;
[0024] Subtract the coordinates of the node from Pm and normalize to obtain Nm;
[0025] Obtain the vertices of the convex hull corresponding to the adjacent face of the first half edge;
[0026] Calculate the difference between the coordinates of the vertex and the node to obtain a vector P;
[0027] Calculate the cosecant value w of the angle between Nm and vector P;
[0028] The sum of the coordinates of the node and the product is used as the coordinates of the new midpoint of the first half edge, where the product is the product of Nm and w.
[0029] Optionally, also include:
[0030] If the node connects more than two branches, and the two branches are coplanar, three non-colinear points are selected in the node and the branches of the node to calculate the plane normal vector, and the plane is constructed with the node as the origin;
[0031] Taking the node as the origin and the normal vectors calculated from three non-collinear points selected in the node and the branches of the node as the Z axis, a local coordinate system is constructed, wherein the coordinate axes of the local coordinate system are orthogonal to each other;
[0032] Calculate the angle arrAngle of each branch with the X-axis of the local coordinate system in the plane, and the sum of the angles dTotalAngle with the Z-axis;
[0033] Divide dTotalAngle by the number of branches to obtain a division result, and calculate a cosecant value of the division result;
[0034] Constructing the 0th point p0 and the 1st point p1 of the polyhedron based on the coordinates of the node, the cosecant value of the division result, and the Z axis;
[0035] Arrange the edge direction vectors of the branches in ascending order of arrAngle to obtain an edge direction vector sequence;
[0036] Based on the sequence of edge direction vectors, additional points are added to the polyhedron.
[0037] Optionally, also include:
[0038] If the node connects two of the branches, the angle bisector plane of the two branches is calculated, the circumscribed rectangle of the unit circle is projected onto the angle bisector plane along the side direction vector of the branch to obtain a projected rectangle, and a polyhedron is constructed based on the projected rectangle to obtain a polyhedron;
[0039] If the node is connected to one of the branches, a reference plane perpendicular to the edge direction vector is constructed according to the node and the edge direction vector of the branch, and the cross section of the branch is transformed by referring to the reference plane to obtain an oriented polyhedron.
[0040] Optionally, before obtaining the starting surface of each branch, the method further includes:
[0041] Based on the coordinates of the node and the maximum radius, the positions of the vertices of the facing polyhedron are corrected to obtain a corrected facing polyhedron, wherein the maximum radius is the maximum value of a plurality of lengths, the plurality of lengths are the lengths of the diagonals of a plurality of circumscribed rectangles, and the plurality of circumscribed rectangles are the circumscribed rectangles of the cross sections of the pipelines represented by the branches of the node.
[0042] Optionally, the first distance moved by the first plane of the first branch is determined based on a distance between the first plane of the first branch and a starting surface of the first branch, including:
[0043] Calculating a maximum distance between a first plane of the first branch and a starting plane of the first branch;
[0044] The maximum distance is added to a preset offset to obtain a first distance of first plane movement of the first branch.
[0045] An electronic device comprises at least one processor and a memory connected to the processor, wherein:
[0046] The memory is used to store computer programs;
[0047] The processor is used to execute the computer program so that the electronic device can implement the above-mentioned three-dimensional pipeline modeling method.
[0048] A computer storage medium carries one or more computer programs. When the one or more computer programs are executed by an electronic device, the electronic device can implement the above-mentioned three-dimensional pipeline modeling method.
[0049] A computer program product includes computer-readable instructions. When the computer-readable instructions are executed on an electronic device, the electronic device implements the above-mentioned three-dimensional pipeline modeling method.
[0050] By means of the above technical solution, if the node connects more than two branches, and the two branches are not coplanar, an orientation polyhedron is constructed based on the convex hull and the dual polyhedron of the convex hull, and the modeling of the pipe point model is completed based on the starting face and the first plane of each branch. For the case where the connection between the pipe point and the pipeline has a non-planar intersection, the modeling can be performed more accurately. BRIEF DESCRIPTION OF THE DRAWINGS
[0051] The above and other features, advantages and aspects of the embodiments of the present disclosure will become more apparent with reference to the following detailed description in conjunction with the accompanying drawings. Throughout the accompanying drawings, the same or similar reference numerals represent the same or similar elements. It should be understood that the drawings are schematic and the originals and elements are not necessarily drawn to scale.
[0052] Figure 1A flow chart of a pipeline and pipe point modeling method provided in the present application;
[0053] Figure 2 An example diagram of a half-edge structure provided in this application;
[0054] Figure 3 is a flow chart of constructing a polyhedron with branch orientations provided by an embodiment of the present application;
[0055] Figure 4 is an example diagram of a polyhedron with branch orientations constructed by the method provided in the embodiments of the present application;
[0056] Figure 5 is an example diagram of constructing a management point model provided by an embodiment of the present application;
[0057] Figure 6 The embodiment of the present application provides a process for constructing a polyhedron when the number of branches of the node is greater than 3.
[0058] Figure 7 is an example diagram of a three-dimensional convex hull and a dual polyhedron of the three-dimensional convex hull constructed by the method provided in the embodiments of the present application;
[0059] Figure 8 This is an example diagram of a model of pipe points and pipelines constructed by the three-dimensional pipeline modeling method provided in an embodiment of the present application. DETAILED DESCRIPTION
[0060] The following describes the embodiments of the present application in conjunction with the drawings in the embodiments of the present application. The terms used in the implementation method section of the present application are only used to explain the specific embodiments of the present application, and are not intended to limit the present application.
[0061] The embodiments of the present application are described below in conjunction with the accompanying drawings. Those skilled in the art will appreciate that, with the development of technology and the emergence of new scenarios, the technical solutions provided in the embodiments of the present application are also applicable to similar technical problems.
[0062] The terms "first", "second", etc. in the specification and claims of the present application and the above-mentioned drawings are used to distinguish similar objects, and need not be used to describe a specific order or sequential order. It should be understood that the terms used in this way can be interchangeable under appropriate circumstances, which is only to describe the distinction mode adopted by the objects of the same attributes when describing in the embodiments of the present application. In addition, the terms "including" and "having" and any of their variations are intended to cover non-exclusive inclusions, so that the process, method, system, product or equipment comprising a series of units need not be limited to those units, but may include other units that are not clearly listed or inherent to these processes, methods, products or equipment.
[0063] In order to obtain more accurate three-dimensional pipeline modeling results, the embodiment of the present application constructs a half-edge structure from the three-dimensional pipeline, and then constructs a pipeline branch direction polyhedron from the half-edge structure, thereby constructing a pipe-point pipeline model with connected areas.
[0064] Figure 1 The process of the pipeline and pipe point modeling method provided in the embodiment of the present application includes the following steps:
[0065] S101. Construct a half-edge structure based on three-dimensional pipeline data, and record the half-edge structure data.
[0066] The pipeline data includes the position coordinates of the starting point and the end point of the pipeline. It can be understood that the pipe point is an entity set on the pipeline, such as an exhaust (drainage, sewage) device and a valve. Because the pipe point is set on the pipeline, the half-edge structure constructed based on the pipeline data can include the pipe point data.
[0067] In computers, models are often represented by polyhedra, which are three-dimensional geometric bodies surrounded by multiple planes (called faces). Each face is a polygon, and multiple faces intersect to form the edges and vertices of the polyhedron.
[0068] The half-edge structure splits each edge of a polyhedron into two half-edges. The half-edge structure data of each half-edge contains information about its adjacent faces, adjacent half-edges, and vertices. The data structures of each half-edge constitute the half-edge data structure. For ease of explanation, the half-edge data structure is referred to as the half-edge structure in the following steps.
[0069] An example of a half-edge structure is Figure 2 As shown, Figure 2 In the figure, the arrowed line represents a half edge, the dot represents a vertex, the red line represents an edge, and the area surrounded by the red line represents a face. It can be seen that an edge is divided into two half edges with different directions, such as he1 and he2. The two half edges are occupied by two faces respectively. It is also possible that only one half of the two half edges is occupied by one face, while the other half is not occupied ( Figure 2 For any half-edge such as he2, the vertex to which the half-edge points, such as 01, is called the vertex of the half-edge, and the face on which the half-edge is located is called the adjacent face of the half-edge, such as f is the adjacent face of he1. The two half-edges of an edge are adjacent half-edges, such as he1 and he2 are adjacent half-edges.
[0070] The specific process of constructing the half-edge structure of pipelines and pipe points based on pipeline data can be found in the existing technology and will not be repeated here.
[0071] S102. Calculate the maximum radius of the node based on the half-edge structure.
[0072] A node is an abstract pipe point. Since the half-edge structure can represent pipe points and pipelines, the vertices in the half-edge structure can represent nodes. For any node, there may be at least one branch at the node in the half-edge structure. A branch refers to the edge where the node is located. Figure 2 For example, node 01 has 5 branches. The branch cross section refers to the cross section of the pipeline represented by the branch, and it can be understood that the cross section may have any shape.
[0073] In some implementations, for any branch, the length of the diagonal of the circumscribed rectangle of the branch cross section is calculated, and the maximum length is selected from the diagonal lengths of the branch cross sections of the node, and the maximum radius of the node is obtained based on the maximum length. For example, half of the maximum length is used as the maximum radius of the node.
[0074] S103. Based on the half-edge structure, obtain the edge direction vector of each branch of the node.
[0075] A node is an abstract pipe point. Since the half-edge structure can represent pipe points and pipelines, the vertices in the half-edge structure can represent nodes. Combined with the half-edge structure, for any branch, the direction of the edge direction vector is the direction from the starting point to the end point of the pipeline represented by the branch, and the length is the unit vector length.
[0076] S104. Based on the nodes and the branches of the nodes, a polyhedron with branch orientations (referred to as orientation polyhedron or polyhedron for short) is constructed.
[0077] The branch of a node can be understood as an abstraction of a pipeline starting from a node. In the embodiments of the present application, an arbitrary node is taken as an example. Based on the half-edge structure, the branch of a node is the half-edge in the half-edge structure starting from the vertex representing the node. Figure 2 For example, the branches of vertex 01 are 5 half edges starting from vertex 01. In the following steps, the node represented by vertex 01 is taken as an example.
[0078] Because the branch represents a pipeline, the branch has a cross section, and the cross section of the branch of the node is referred to as the cross section of the branch. It can be understood that the cross section has any shape.
[0079] The specific implementation of S104 will be combined with Figure 3 Provide detailed explanation.
[0080] It can be understood that the polyhedron with branch orientation constructed in this step can represent the three-dimensional shape of the connection between the pipeline and the pipe point. Figure 4 For example, green is the orientation polyhedron and black lines represent pipelines.
[0081] S105 , based on the coordinates of the nodes and the maximum radius, correct the positions of the vertices of the facing polyhedron to obtain a corrected facing polyhedron.
[0082] The coordinates of the nodes are obtained from the half-edge structure data, and the corrected vertex coordinates = (vertex coordinates before correction - node coordinates) × maximum radius + node coordinates. The purpose of the correction is to improve the fit between the polyhedron and the actual shape of the connection between the pipeline and the pipe point.
[0083] It can be understood that S105 is an optional step. When S105 is not performed, the corrected orientation polyhedron in the following steps is replaced by the orientation polyhedron.
[0084] S106 , obtaining a starting face of each branch in the corrected orientation polyhedron according to the half-edge structure.
[0085] The half-edge structure is the half-edge structure before the vertex is corrected, and the starting face is represented as startFace.
[0086] For any branch, the starting face is the intersecting face or adjacent face of the branch in the oriented polyhedron, and the starting face of the branch is found according to the half-edge structure.
[0087] S107, constructing a pipe-point model based on the half-edge structure, the edge direction vector, the starting face, and the facing polyhedron.
[0088] Specifically, at any node of the half-edge structure, the coordinates of the node are taken as the origin, the edge direction of a branch is taken as the normal, and a plane (i.e., the first plane) is constructed. Figure 2 Taking the node 01 shown as an example, the node 01 is used as the origin, and five planes can be constructed based on the edge vectors of the five branches. A plane is constructed for each node in the half-edge structure.
[0089] For each constructed plane, find the starting face startFace corresponding to the plane. It can be understood that the corresponding plane has the same nodes and branches as startFace. Calculate the maximum distance dDisMax between the plane and the corresponding starting face startFace.
[0090] Add the maximum distance dDisMax to the preset offset to get the new maximum distance dNewDis, and translate the plane plane by dNewDis units along the edge direction. It can be understood that dNewDis is larger than dDisMax, so enough space can be reserved for the connection between the pipe point model and the pipeline model, thereby improving the accuracy of the model. Figure 5 For example, A represents the connection between the pipe point and the pipeline determined by dDisMax, and B represents the connection between the pipe point and the pipeline determined by dNewDis.
[0091] The cross section corresponding to the branch is rotated and translated to the plane (i.e. the plane after the movement), and the starting surface and the rotated cross section are connected as a branch of the pipe point model.
[0092] S108. Construct a pipeline model based on the half-edge structure, the starting face, and the facing polyhedron.
[0093] For any pipeline, the half-edge starting face of the pipeline is found based on the half-edge model, and the half-edge starting face is moved by a preset offset to obtain the half-edge offset starting face of the pipeline. The half-edge offset starting face of the pipeline is connected with the half-edge offset starting face of the adjacent edge of the half-edge corresponding to the pipeline to obtain the pipeline model of the pipeline.
[0094] In this embodiment, a half-edge structure of a three-dimensional pipeline is constructed, and a direction polyhedron of the connection between the pipe point and the pipeline is constructed based on the half-edge structure. On the basis of the direction polyhedron, a pipe point model is constructed. Figure 5 For example, the sum of the maximum distance between the first plane and the starting plane and the offset is used as the translation distance to build enough space for the pipe points and pipeline connections to improve the accuracy of the model.
[0095] Figure 3 It is a process of constructing a polyhedron with branch orientation based on nodes and branches of nodes, including the following steps:
[0096] S201: Determine the type of branch.
[0097] The types of branches include single branch, double branch and branches greater than 3. In this embodiment, different processes of constructing polyhedrons are performed for different types.
[0098] If it is a single branch, execute S202-S203; if it is a double branch, execute S204-S206; if the number of branches is greater than 3, execute Figure 6 The process shown.
[0099] S202. Construct a plane (ie, a reference plane) perpendicular to the edge direction vectors of the nodes and branches according to the edge direction vectors of the nodes and branches.
[0100] The plane perpendicular to the edge direction vector includes the node.
[0101] S203. By taking the plane as a reference, transforming the cross section of the branch, a polyhedron facing the branch is obtained.
[0102] Specifically, the cross section of the branch is rotated and translated to the plane obtained in S202 to obtain a polyhedron facing the branch.
[0103] S204, calculating the angle bisector planes of the two branches.
[0104] S205 , projecting the circumscribed rectangle of the unit circle onto the angle bisector plane along the side direction vector of the branch to obtain a projected rectangle.
[0105] S206: construct a polyhedron based on the projected rectangle to obtain a polyhedron facing the branch.
[0106] Specifically, a rectangle formed by the edges of the projected rectangle traversed in a clockwise direction is used as the first face of the polyhedron, and a rectangle formed by the edges of the projected rectangle traversed in a counterclockwise direction is used as the second face of the polyhedron.
[0107] Figure 6 The process of constructing a polyhedron when the number of branches is greater than 3 includes the following steps:
[0108] S301, determine whether the branches of the node are coplanar, if yes, execute S302-S309, if not, execute S310-S314.
[0109] S302: Select three non-collinear points in the nodes and branches of the nodes to calculate the plane normal vector, and construct a plane with the node as the origin.
[0110] S303: Construct a local coordinate system.
[0111] The origin of the local coordinate system is the node (denoted as O), the plane normal vector is the Z axis (denoted as zAxis), and the directions of the edge direction vectors of the two branches that are orthogonal to the Z axis and mutually orthogonal are the X axis (denoted as xAxis) and the Y axis (denoted as yAxis).
[0112] S304 , calculating the angle arrAngle between each branch and the X-axis of the local coordinate system in the plane, and the angle dTotalAngle between each branch and the Z-axis of the local coordinate system.
[0113] The branch can be represented by the half edge in the half edge structure, so arrAngle and dTotalAngle are calculated based on the half edge structure.
[0114] S305 . Divide the angle and dTotalAngle by the number of branches to obtain a division result, and calculate a cosecant value w of the division result.
[0115] S306: Construct the 0th point p0 and the 1st point p1 of the polyhedron.
[0116] p0=O+w*zAxis(0,0,1), p1=Ow*zAxis(0,0,1). zAxis(0,0,1) represents the point with coordinates (0,0,1) on the Z axis, and w*zAxis means the offset of the point on the Z axis, that is, p0 and p1 are the offset points of the origin O on the Z axis.
[0117] S307 , arranging the edge direction vectors of the branches in ascending order of arrAngle to obtain an edge direction vector sequence.
[0118] Based on S103 and S304, it can be known that arrAngle and the edge direction vector can establish a corresponding relationship through branches, that is, the arrAngle of the first branch corresponds to the edge direction vector of the first branch. Therefore, the edge direction vectors of the branches can be sorted from small to large based on the corresponding arrAngle.
[0119] S308. Add points to the polyhedron based on the edge direction vector sequence.
[0120] Specifically, traverse the edge direction vectors in the edge direction vector sequence, for the i-th (i starts from 0 and takes values 1, 2, ...) edge direction vector, then: 1) calculate the average of the angles between the i-th edge direction vector and the plane X-axis and the i+1-th edge direction vector and the plane X-axis to obtain dMean, 2) add the node coordinates to the i-th edge direction vector to obtain point P, rotate point p around the local coordinate system Z axis and the origin O by dMean degrees to obtain Pr, 3) subtract the origin O from Pr and normalize to obtain unit vector Np, add Np to the origin O to obtain Prn, 4) calculate the angle between unit vector Np and the i-th edge direction vector, and the average of the angles between unit vector Np and the i+1-th edge direction vector, dMean1, 5) calculate the cosecant value k of dMean1, scale point Prn by k times to obtain point Pi, and add point Pi to the polyhedron as the (2+i)-th point.
[0121] S309: Add faces to the polyhedron based on the branches and the points added to the polyhedron.
[0122] For the configuration index of each branch, the branch index starts from 2+i, i starts from 0, and takes the values 1, 2, ... in sequence. Based on the 2+i-th branch, the 1st point, the 2+i-th point, the 0th point, and the 2+i+1-th point, a face is determined as the face in the orientation polyhedron.
[0123] S310, constructing a three-dimensional convex hull based on the node coordinates and the edge direction vectors of the branches.
[0124] The starting point coordinates and the ending point coordinates of the edge direction vector and the coordinates of the node constitute the point array arrPts, and a three-dimensional convex hull is constructed based on the point array arrPts.
[0125] S311. Based on the node coordinates, the edge direction vectors of the branches and the three-dimensional convex hull, construct a dual polyhedron of the three-dimensional convex hull.
[0126] by Figure 7For example, the purple part is the three-dimensional convex hull, and the green part is the dual polyhedron. Each face of the three-dimensional convex hull corresponds to a vertex of the dual polyhedron.
[0127] The specific process of constructing a dual polyhedron based on the three-dimensional convex hull can be found in the relevant technology, which will not be repeated here.
[0128] S312. Expand the dual polyhedron by expanding each vertex of the dual polyhedron.
[0129] In some implementations, the faces of the three-dimensional convex hull are traversed, and for the currently traversed face (referred to as the current face), the corresponding vertex P of the current face in the dual polyhedron is obtained, the coordinates of the node are subtracted from the coordinates of P, and the result is normalized to obtain the unit vector Nd, the coordinates of the node are subtracted from the coordinates of the current 0th vertex to obtain the unit vector Nc, the cosecant value w of the angle between Nc and Nd is calculated, and the coordinates of the expanded vertex P1 are calculated as the sum of the node coordinates and Nd×w.
[0130] S313. Use the midpoint of the half edge of the expanded dual polyhedron to split the half edge of the expanded dual polyhedron to obtain a new dual polyhedron.
[0131] The method to obtain the midpoint of any half edge in the dual polyhedron is: 1) obtain the midpoint Pm of the edge represented by the half edge and the adjacent half edge, subtract the node coordinates from the edge midpoint Pm and normalize to get Nm, 2) use the adjacent face index to obtain the vertices of the corresponding convex hull, subtract the node coordinates to get the vector P, 3) calculate the angle between the unit vector Nm and the vector P, and find the cosecant value w of the angle, 4) add the node coordinates + Nm*w to get the new point PN.
[0132] The method of using PN to split the half edge in the dual polyhedron is: take the starting point of the half edge as the starting point and PN as the end point to obtain the first half edge, take PN as the starting point and the end point of the half edge as the end point to obtain the second half edge.
[0133] S314. Delete the boundaries between the new dual polyhedrons that meet the conditions to obtain the constructed oriented polyhedron.
[0134] For any edge, the conditions include: the length of the edge is less than the unit vector length, and n1 == 2, n2 != 2, where the edge represents the edge of the adjacent half-edge, n1 is the number of faces connected to the current half-edge, and n2 is the number of faces connected to the adjacent half-edge of the current half-edge.
[0135] Deleting a boundary includes deleting two half edges of the boundary and removing the start points of the two half edges at adjacent faces of the two half edges.
[0136] In this embodiment, constructing an orientation polyhedron based on the convex hull can ensure that, for a situation where a node has more than three branches and is not coplanar, a more accurate orientation polyhedron can be obtained.
[0137] Figure 8 This is an example of a model of a pipe point and a pipeline constructed using the three-dimensional pipeline modeling method provided in the above embodiment. The model obtained using the method provided in this embodiment can more accurately reflect the internal connection of the non-planar intersection at the connection point of the pipe point and the pipeline.
[0138] The present application also provides a three-dimensional pipeline modeling device, including:
[0139] The half-edge structure building module is used to build the half-edge structure of the three-dimensional pipe based on the position information of the three-dimensional pipe.
[0140] A polyhedron construction module is used to obtain the edge direction vector of each branch of the node based on the half-edge structure. The node connects two or more branches, and the two or more branches are not coplanar, based on the convex hull and the convex hull pair Odd Multifaceted A convex hull is obtained based on the coordinates of the node and the start and end points of the edge direction vector.
[0141] A modeling module is used to obtain the starting surface of each branch in the oriented polyhedron based on the half-edge structure of the three-dimensional pipeline, the starting surface of the first branch includes the node and is associated with the first branch, and the first branch is any one of the branches; based on the half-edge structure of the three-dimensional pipeline, construct the first plane of each branch, the first plane of the first branch takes the node as the origin, and takes the direction of the edge direction vector of the first branch as the normal; translate the first plane along the direction of the edge direction vector of the branch by a first distance to obtain the first plane after movement, and the first distance of movement of the first plane of the first branch is determined based on the distance between the first plane of the first branch and the starting surface of the first branch; rotate and translate the section corresponding to the branch to the corresponding first plane after movement to obtain a pipe point model, and the section corresponding to the first branch is the cross-section of the pipeline corresponding to the first branch.
[0142] The device provided in this embodiment can provide a model that is more closely aligned with the three-dimensional pipeline.
[0143] An embodiment of the present application also provides an electronic device, comprising at least one processor and a memory connected to the processor, wherein: the memory is used to store a computer program; the processor is used to execute the computer program, so that the electronic device can implement the three-dimensional pipeline modeling method described in the above embodiment.
[0144] An embodiment of the present application also provides a computer program product including computer-readable instructions. When the computer-readable instructions are executed on an electronic device, the electronic device implements the three-dimensional pipeline modeling method provided in the embodiment of the present application.
[0145] A computer-readable storage medium is also provided in an embodiment of the present application. The storage medium carries one or more computer programs. When the one or more computer programs are executed by an electronic device, the electronic device can implement the three-dimensional pipeline modeling method provided in the embodiment of the present application.
[0146] It should also be noted that the device embodiments described above are merely schematic, wherein the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed over multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the scheme of this embodiment. In addition, in the drawings of the device embodiments provided by the present application, the connection relationship between the modules indicates that there is a communication connection between them, which may be specifically implemented as one or more communication buses or signal lines.
[0147] Through the description of the above implementation mode, the technicians in the field can clearly understand that the present application can be implemented by means of software plus necessary general hardware, and of course, it can also be implemented by special hardware including special integrated circuits, special CPUs, special memories, special components, etc. In general, all functions completed by computer programs can be easily implemented by corresponding hardware, and the specific hardware structure used to implement the same function can also be various, such as analog circuits, digital circuits or special circuits. However, for the present application, software program implementation is a better implementation mode in more cases. Based on such an understanding, the technical solution of the present application is essentially or the part that contributes to the prior art can be embodied in the form of a software product, which is stored in a readable storage medium, such as a computer floppy disk, a U disk, a mobile hard disk, a ROM, a RAM, a disk or an optical disk, etc., including a number of instructions to enable a computer device (which can be a personal computer, a training device, or a network device, etc.) to execute the methods described in each embodiment of the present application.
[0148] In the above embodiments, all or part of the embodiments may be implemented by software, hardware, firmware or any combination thereof. When implemented by software, all or part of the embodiments may be implemented in the form of a computer program product.
[0149] The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, the process or function described in the embodiment of the present application is generated in whole or in part. The computer may be a general-purpose computer, a special-purpose computer, a computer network, or other programmable devices. The computer instructions may be stored in a computer-readable storage medium, or transmitted from one computer-readable storage medium to another computer-readable storage medium. For example, the computer instructions may be transmitted from a website site, a computer, a training device, or a data center by wired (e.g., coaxial cable, optical fiber, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) mode to another website site, computer, training device, or data center. The computer-readable storage medium may be any available medium that a computer can store or a data storage device such as a training device, a data center, etc. that includes one or more available media integrations. The available medium may be a magnetic medium, (e.g., a floppy disk, a hard disk, a tape), an optical medium (e.g., a DVD), or a semiconductor medium (e.g., a solid-state drive (SSD)), etc.
Claims
1. A three-dimensional pipeline modeling method, characterized in that: The three-dimensional pipeline includes a pipe point and a pipeline, a node is abstractly obtained based on the pipe point, and a branch of the node is abstractly obtained based on the pipeline connected to the pipe point. The method includes: Based on the position information of the three-dimensional pipeline, construct a half-edge structure of the three-dimensional pipeline; Based on the half-edge structure, obtaining an edge direction vector of each branch of the node; If the node connects more than two branches, and the two branches are not coplanar, a direction polyhedron is constructed based on the convex hull and the dual polyhedron of the convex hull, wherein the direction polyhedron represents the three-dimensional shape of the connection between the pipeline and the pipe point, and the convex hull is obtained based on the coordinates of the node and the starting and ending points of the edge direction vector; Based on the half-edge structure of the three-dimensional pipe, in the orientation polyhedron, obtaining a starting face of each of the branches, wherein the starting face of the first branch includes the node and is associated with the first branch, and the first branch is any one of the branches; Based on the half-edge structure of the three-dimensional pipeline, construct a first plane of each branch, wherein the first plane of the first branch takes the node as an origin and takes the direction of the edge direction vector of the first branch as a normal; The first plane is translated by a first distance along the direction of the side direction vector of the branch to obtain a first plane after translation, wherein the first distance of translation of the first plane of the first branch is determined based on the distance between the first plane of the first branch and the starting surface of the first branch; The cross section corresponding to the branch is rotated and translated to the corresponding first plane after the movement to obtain a pipe point model, wherein the cross section corresponding to the first branch is the cross section of the pipeline corresponding to the first branch.
2. The method according to claim 1, characterized in that: The method of constructing an oriented polyhedron based on the convex hull and the dual polyhedron of the convex hull includes: Expanding the dual polyhedron by expanding each vertex of the dual polyhedron; Using the midpoint of a half edge in the expanded dual polyhedron, split the half edge to obtain a new dual polyhedron; Delete the boundaries between the new dual polyhedrons that meet the conditions to obtain the oriented polyhedron, the conditions of the first boundary include: the length is less than a preset threshold, and the number of faces connected by the first half edge is equal to a first value, the number of faces connected by the second half edge is not equal to the first value, the first half edge and the second half edge are adjacent half edges and represent the first boundary, and the first boundary is any boundary.
3. The method according to claim 2, characterized in that The step of expanding the dual polyhedron by expanding each vertex of the dual polyhedron includes: Obtain the corresponding vertex P of the first face of the convex hull in the dual polyhedron; Subtract the coordinates of the node from the coordinates of P, and normalize the result to obtain a unit vector Nd; Subtract the coordinates of the node from the coordinates of the 0th vertex of the first face of the convex hull to obtain a unit vector Nc; Calculate the cosecant value w of the angle between Nc and Nd; The coordinates of the vertex P1 of the expanded P are calculated as the sum of the node coordinates and the product, where the product is the product of Nd and w.
4. The method according to claim 2, characterized in that: The process of obtaining the midpoint includes: Based on the half-edge structure, obtain the midpoint Pm of the edge represented by the first half-edge and the adjacent half-edge; Subtract the coordinates of the node from Pm and normalize to obtain Nm; Obtain the vertices of the convex hull corresponding to the adjacent face of the first half edge; Calculate the difference between the coordinates of the vertex and the node to obtain a vector P; Calculate the cosecant value w of the angle between Nm and vector P; The sum of the coordinates of the node and the product is used as the coordinates of the new midpoint of the first half edge, and the product is Nm and w The product of .
5. The method according to claim 1 or 2, characterized in that: Also includes: If the node connects more than two branches, and the two branches are coplanar, three non-colinear points are selected in the node and the branches of the node to calculate the plane normal vector, and the plane is constructed with the node as the origin; Taking the node as the origin and the normal vectors calculated from three non-collinear points selected in the node and the branches of the node as the Z axis, a local coordinate system is constructed, wherein the coordinate axes of the local coordinate system are orthogonal to each other; Calculate the angle arrAngle of each branch with the X-axis of the local coordinate system in the plane, and the sum of the angles dTotalAngle with the Z-axis; Divide dTotalAngle by the number of branches to obtain a division result, and calculate a cosecant value of the division result; Constructing the 0th point p0 and the 1st point p1 of the polyhedron based on the coordinates of the node, the cosecant value of the division result, and the Z axis; Arrange the edge direction vectors of the branches in ascending order of arrAngle to obtain an edge direction vector sequence; Based on the sequence of edge direction vectors, additional points are added to the polyhedron.
6. The method according to claim 1 or 2, characterized in that: Also includes: If the node connects two of the branches, the angle bisector plane of the two branches is calculated, the circumscribed rectangle of the unit circle is projected onto the angle bisector plane along the side direction vector of the branch to obtain a projected rectangle, and a polyhedron is constructed based on the projected rectangle to obtain a polyhedron; If the node is connected to one of the branches, a reference plane perpendicular to the edge direction vector is constructed according to the node and the edge direction vector of the branch, and the cross section of the branch is transformed by referring to the reference plane to obtain an oriented polyhedron.
7. The method according to claim 1 or 2, characterized in that: Before obtaining the starting surface of each branch, the method further includes: Based on the coordinates of the node and the maximum radius, the positions of the vertices of the facing polyhedron are corrected to obtain a corrected facing polyhedron, wherein the maximum radius is the maximum value of a plurality of lengths, the plurality of lengths are the lengths of the diagonals of a plurality of circumscribed rectangles, and the plurality of circumscribed rectangles are the circumscribed rectangles of the cross sections of the pipelines represented by the branches of the node.
8. The method according to claim 1, characterized in that The first distance moved by the first plane of the first branch is determined based on the distance between the first plane of the first branch and a starting surface of the first branch, comprising: Calculating a maximum distance between a first plane of the first branch and a starting plane of the first branch; The maximum distance is added to a preset offset to obtain a first distance of first plane movement of the first branch.
9. An electronic device, characterized in that: The method comprises at least one processor and a memory connected to the processor, wherein: The memory is used to store computer programs; The processor is used to execute the computer program so that the electronic device can implement the three-dimensional pipeline modeling method as described in any one of claims 1 to 8.
10. A computer storage medium, characterized in that: The storage medium carries one or more computer programs, and when the one or more computer programs are executed by an electronic device, the electronic device can implement the three-dimensional pipeline modeling method as described in any one of claims 1 to 8.