A method and system for vector pipeline three-dimensional instantiation coherent rendering
By using a vector pipeline 3D instantiation coherent rendering method, the real-time and coherence issues in large-scale pipeline network scenarios are solved, achieving efficient and low-cost 3D rendering effects.
Patent Information
- Application Number
- CN202511033726.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-07-25
- Publication Date
- 2026-02-27
- Estimated Expiration
- 2045-07-25
AI Technical Summary
Existing technologies are insufficient to meet the requirements of real-time performance and current availability in large-scale pipeline network scenarios, and there is also the problem of discontinuity at pipeline connections.
The method employs a vector pipeline 3D instantiation coherent rendering approach. By acquiring vector pipeline data, a basic 3D model set is constructed, pipeline connection point information is traversed, a coherently rendered pipeline system is established, and model transformation is performed during the graphics accelerator rendering stage.
It enables real-time 3D rendering of large-scale pipeline networks, reduces modeling costs, improves rendering performance, and ensures the continuity of pipeline connections.
Smart Images

Figure CN120807741B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The application belongs to the technical field of three-dimensional visualization of pipe networks, and particularly relates to a three-dimensional instantiation coherent rendering method and system for vector pipelines. BACKGROUND
[0002] Most of the existing pipeline visualization schemes adopt three-dimensional modeling and then publish 3dtiles services to realize three-dimensional visualization, which provides an effective scheme for the management of various pipelines. Although 3dtiles can provide better display effects, with the acceleration of the transformation of various pipelines and the continuous expansion of the pipeline scale, the traditional mode has been difficult to adapt to the current real-time and present situation requirements. Moreover, this technical route needs to create three-dimensional models in advance and convert them into 3dtiles format, which requires a lot of time and high economic cost.
[0003] To this end, the existing scheme proposes to calculate the three-dimensional information of the pipe network in real time and render, which can partially solve the problems of real-time and present situation, but with the increasing scale of the pipe network, the rendering efficiency of this scheme will become worse and worse, and it is difficult to adapt to large-scale scenes. In addition, there are also researches on the scheme of adopting conventional instantiation, which can solve the problem of large-scale rendering, but the conventional instantiation scheme will cause the problem of incoherence at the connection of each pipeline and model, and the display effect is not good.
[0004] The application proposes a three-dimensional instantiation coherent rendering method and system for vector pipelines, aiming to solve the problems of real-time pipeline updating, real-time visualization, present situation and coherence at the connection of the pipe network in a large-scale real-time pipe network updating scene. SUMMARY
[0005] The application aims to provide a three-dimensional instantiation coherent rendering method and system for vector pipelines to solve the problems that the existing scheme is difficult to meet the requirements of real-time and present situation, and is difficult to adapt to large-scale scenes, and each pipeline and model connection is incoherent.
[0006] To achieve the above-mentioned purpose, the application adopts the following technical scheme:
[0007] In a first aspect, the application provides a three-dimensional instantiation coherent rendering method for vector pipelines, comprising the following steps:
[0008] S1, acquiring vector pipeline data and analyzing to obtain pipeline data;
[0009] S2, constructing a basic three-dimensional model set; the basic three-dimensional model is divided into pipeline main components, connecting components and transition components according to functions;
[0010] S3, traverse pipeline data, obtain pipeline connection point information; build a first model matrix and first model data of each basic three-dimensional model, and establish a pipeline system for coherent rendering;
[0011] S4, traverse the basic three-dimensional model set, and instantiate a complete pipeline system according to the basic three-dimensional model and the corresponding first model matrix;
[0012] S5, the model transformation is performed according to the transformation rule of the first model data in the graphics accelerator rendering stage, and the pipeline and the coherent rendering of the pipeline connection are performed.
[0013] Preferably, the S3 is specifically as follows:
[0014] S3.1, traverse the pipeline data, obtain the pipeline list associated with each pipeline connection point and the primary and secondary pipelines of the pipeline connection point, and calculate the first model matrix and the first model data of the basic three-dimensional model set associated with the pipeline of the pipeline connection point;
[0015] The basic three-dimensional model set associated with the pipeline of the pipeline connection point is calculated, specifically: selecting the primary and secondary pipelines and establishing the basic three-dimensional model components of the primary and secondary pipelines, traversing the remaining pipeline associated with the pipeline connection point, and establishing the basic three-dimensional model components of each pipeline one by one;
[0016] S3.2, traverse the pipeline connection point information, and comprehensively build the first model matrix and the first model data of the basic three-dimensional model of the pipeline system by comprehensively building the first model matrix and the first model data of the basic three-dimensional model set associated with all the pipeline connection points.
[0017] Preferably, the selection of the primary and secondary pipelines and the establishment of the basic three-dimensional model components of the primary and secondary pipelines are specifically as follows:
[0018] Selecting the primary and secondary pipelines: traversing the pipeline list associated with the pipeline connection point according to the descending order of the pipe diameter specification; judging whether it is a round pipe or a square pipe according to the pipe diameter specification, if it is a round pipe, sorting according to the radius, if it is a square pipe, sorting according to the minimum half of the side length, if there are the same values, sorting according to the traversal order;
[0019] The construction rule of the primary and secondary pipelines: the primary and secondary pipelines include pipeline body components, if the primary and secondary pipelines are not on a straight line, the connecting components are also included, if the shapes of the connecting components do not match, the transition components are also included; the first model matrix and the first model data of the basic three-dimensional model components are solved, and the first model matrix is a transformation matrix composed of an offset matrix, a rotation matrix and a scaling matrix.
[0020] Preferably, the first model matrix of the connecting component is specifically as follows:
[0021] Let the included angle of the primary and secondary pipelines be , the connecting member is in the opposite direction of the main pipeline from the pipe point distance is ; connecting member start and end coordinates with the center of the connecting member to build the center angle of the circle is ; the coordinates of the connecting member center ( ); so:
[0022] The offset matrix of the connecting member is:
[0023] The scaling matrix of the connecting member is , the rotation matrix of the connecting member is ; the first model matrix of the connecting member is .
[0024] Further, the scaling matrix of the connecting member is as follows:
[0025] If the connecting member is a circular pipe, let its inner ring radius be , the outer ring radius is , the circular pipe diameter radius is , the main pipeline diameter radius is ;
[0026] The scaling matrix of the connecting member is:
[0027] If the connecting member is a square pipe, let its inner ring radius be , the outer ring radius is , the square pipe diameter edge length is , the other edge length is ; the main pipeline diameter radius is and ;
[0028] The scaling matrix of the connecting member is:
[0029] .
[0030] Further, the rotation matrix of the connecting member is as follows:
[0031] According to the vector from the connecting member start point to the connecting member center and the vector from the other pipe point of the main pipeline to the current pipe point, the normal vector direction of the plane composed of the two vectors is ;
[0032] According to the vector (0, 0, -1) and the vector (1, 0, 0), the normal vector direction of the plane composed of the two vectors is ;
[0033] Solve Turn to the rotation angle and rotation axis of ;
[0034] Based on the rotation angle and the rotation axis, the rotation matrix is solved using the Rodrigues rotation formula ;
[0035] With the rotation axis, the rotation matrix of the tangent direction rotation of the starting point of the connection member axis after transformation to the tangent direction of the main pipeline pointing to the connection member is calculated again according to the Rodrigues rotation formula ;
[0036] The rotation matrix of the connection member is calculated .
[0037] Preferably, the first model data of the connection member is specifically as follows:
[0038] Any point A on the torus ( , , ) is in the final position after two transformations, and the transformation matrix is the first model data of the connection member;
[0039] The first transformation is a scaling transformation in the radial direction of the torus, and the pipe diameter radius of the torus before scaling is ; The projection distance of point A in the xoz coordinate system from the origin of the xoz coordinate system is ;
[0040] The scaling matrix of point A is:
[0041] The second transformation is a rotation transformation around the center of the torus, and the angle between OA and the z-axis before transformation is: , and the angle between OA and the z-axis after transformation is: ;
[0042] The angle transformation around the y-axis before and after is: , and the rotation matrix is:
[0043] .
[0044] Preferably, the first model matrix and the first model data of the transition member are specifically as follows:
[0045] Let the coordinate of the end point of the connection member axis be , the pipe diameter specifications be and , the direction of the main pipeline point pointing to the other end pipe point be the vector a, the direction of the transition member axis be b (0, 1, 0), the length of the transition member be l, the length of the selected three-dimensional model of the transition member be , and the pipe diameter specifications of the three-dimensional model of the transition member connected with the connection member be and The coordinate origin of the transition component is at the center of the pipe diameter at the end connected to the connecting component. and The coordinate origin of the transition component is at the center of the pipe diameter at the end connected to the connecting component.
[0046] The rotation matrix of vector a to vector b is obtained according to the Rodrigues rotation formula The rotation matrix of vector a to vector b is obtained according to the Rodrigues rotation formula The rotation matrix required for the aligned port of the transition component and the connecting component after the transformation The rotation matrix of the transition component is: ;
[0047] Suppose the corresponding relationship of the pipe diameter specifications of the connecting component and the transition component after the rotation transformation is: Corresponding ; Corresponding Then:
[0048] The scaling matrix of the transition component is:
[0049] The offset matrix of the transition component is:
[0050] The first model matrix of the transition component is: ;
[0051] The first model data of the transition component includes the transformation rule of the vertex connected to the secondary pipeline of the transition component. Specifically, the vertex connected to the secondary pipeline of the transition component is transformed through two vertex transformations. The first is a scaling transformation corresponding to the edge length or a scaling transformation of the radius, and the second is a rotation around the axis of the secondary pipeline to achieve the alignment of the connection. The other intermediate vertices use an interpolation method.
[0052] Preferably, the first model matrix and the first model data of the pipeline main component are as follows:
[0053] The pipeline base three-dimensional model is l long, and the pipeline length , the scaling factor of the pipeline pipe diameter , and the position coordinates of the pipeline starting point after cutting the corresponding length ; then:
[0054] The offset matrix of the pipeline main component is:
[0055] The scaling matrix of the pipeline main component is
[0056] The rotation matrix of the pipeline main body component is a rotation matrix of the axial direction of the pipeline basic three-dimensional model turning to another pipeline point and pointing to the direction vector of the current pipeline point ;
[0057] The first model matrix of the pipeline main body component is: ;
[0058] The first model data of the pipeline main body component is empty.
[0059] Preferably, S5 is specifically as follows:
[0060] The first model data is stored into a graphic accelerator cache;
[0061] The first model data of the current instance is acquired in a graphic accelerator rendering stage, and model transformation is performed on the current instance based on the transformation rule of the first model data.
[0062] The present application provides a vector pipeline three-dimensional instantiation coherent rendering system in a second aspect, comprising:
[0063] A vector data analysis module: reading vector pipeline data and analyzing to obtain pipeline data;
[0064] A basic three-dimensional model construction module: constructing a basic three-dimensional model set;
[0065] A pipeline processing module: traversing the pipeline data to construct a first model matrix and first model data of each basic three-dimensional model;
[0066] A pipeline rendering module: traversing the basic three-dimensional model set, rendering a pipeline according to the basic three-dimensional model and the corresponding first model matrix, and performing model transformation according to the first model data in a graphic accelerator rendering stage.
[0067] Compared with the prior art, the present application has the following beneficial effects:
[0068] (1) The method of the present application does not need pre-modeling, but directly renders a three-dimensional model from vector pipeline data in real time, reduces the modeling and three-dimensional model maintenance cost, and also provides technical support for the real-time and present situation of pipeline data three-dimensional rendering. By dividing the three-dimensional pipeline into a pipeline main body component, a connecting component and a transition component, the pipeline construction process is simplified, and the system implementation difficulty is significantly reduced. The present application performs vertex transformation on vertices according to the transformation rule in the shader stage, which provides a feasible path for coherent instantiation rendering. The present application effectively solves the technical problem of coherent instantiation three-dimensional rendering of a vector pipeline, and provides a method and system which are efficient, low-cost, coherent and support the real-time and present situation of pipeline data rendering for the current large-scale underground pipe network reconstruction project in China.
[0069] (2) The method in this invention significantly reduces the amount of video memory occupied and the number of GPU drawcall calls by using instantiation rendering technology, thereby significantly improving rendering performance.
[0070] (3) The method in this invention can realize the 3D rendering of pipeline networks in complex scenes with tree-like or even loop-like structures. Compared with the existing technology that performs vertex transformation through instantiation rendering to perform 3D rendering of simple linear pipeline connection types, this invention divides the 3D pipeline into pipeline main components, connecting components and transition components, and designs corresponding transformation rules to perform vertex transformation. This invention can realize the 3D rendering of pipeline data in complex scenes, and thus can adapt to the 3D rendering of pipeline data in large-scale scenes, and achieve coherent instantiation rendering. Attached Figure Description
[0071] Figure 1 This is a flowchart of the three-dimensional instantiation and coherent rendering method for vector pipelines in this invention;
[0072] Figure 2 This is a schematic diagram of the main pipeline component, connecting component, and transition component in this invention;
[0073] Figure 3 This is a schematic diagram of the construction of the primary and secondary pipeline connection components in this invention;
[0074] Figure 4 This refers to the transformation rules for each vertex of the connecting component during the shader stage in this invention;
[0075] Figure 5 This is a schematic diagram illustrating the construction of additional pipelines in this invention. Figure 1 ;
[0076] Figure 6 This is a schematic diagram illustrating the construction of additional pipelines in this invention. Figure 2 ;
[0077] Figure 7 This is a diagram illustrating the processing effect of the tee connection pipe in this invention. Detailed Implementation
[0078] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0079] Example 1:
[0080] See Figure 1 The vector pipeline 3D instantiation coherent rendering method specifically includes the following steps:
[0081] S1, read vector pipeline data, and parse the pipeline data.
[0082] The vector pipeline data is obtained from an original data source, and the vector data is processed and calculated to obtain the pipeline data. The data mainly includes the following fields: pipeline number, starting point coordinates, end point coordinates, and pipe diameter specification.
[0083] The original data does not directly provide the height of the starting point coordinates and the end point coordinates, which need to be calculated according to the ground elevation and the buried depth of the starting point and the end point. The calculation formula is as follows: mgc - ms, wherein h represents the elevation, dmgc represents the ground elevation, and ms represents the buried depth.
[0084] S2, construct a basic three-dimensional model set.
[0085] The application selects one or more from a solid cylinder, a hollow cylinder, a circular pipe, a square pipe, a hemisphere, a sphere, a part of a sphere, a cube, a cone, a part of a cone, a square cone, a part of a square cone, a square body to a circular body, a square pipe to a circular pipe, a square body to a circular pipe, a circular body to a square pipe, a circular ring, and a part of a circular ring to construct a basic three-dimensional model set.
[0086] The basic three-dimensional model can also be an equivalent model of these models, such as a basic three-dimensional model with a flange ring. These equivalent models change the shape on the basis of the basic three-dimensional model, but the essential function is consistent.
[0087] According to the use, the basic three-dimensional models can be divided into three categories: pipeline body components, connecting components, and transition components, as shown in the figure. Figure 2 The connecting component connects two pipeline corners, and the transition component connects the connecting component and the pipeline. The three types of components do not need to exist at the same time in the same basic three-dimensional model set, and the components can realize equivalent functions through subsequent model transformation stages. For example, by performing vertex transformation on the vertices within a certain range at both ends of the pipeline body component, the functions of the pipeline body component, the transition component, and the transition component are realized at the same time. For another example, by performing vertex transformation on the vertices within a certain range of the connecting component port, the functions of the connecting component and the transition component are realized at the same time.
[0088] The application realizes the coherent rendering of the final pipeline by constructing a basic three-dimensional model set and simultaneously obtaining the equivalent functions of the pipeline body component, the connecting component, and the transition component.
[0089] For example, a solid cylinder with a length of 1 m and a radius of 10 cm is selected as a basic three-dimensional model set, and subsequent vertex transformation is performed to realize the coherent rendering of the pipeline connection.
[0090] For example, a solid cylinder with a length of 1 m and a radius of 10 cm is selected as the pipeline body member, a square tube with a length of 1 m and a side length of 10 cm is selected as the connecting member, and a part of the circular ring is selected as the transition member to construct the basic three-dimensional model set. 10cm of square tube as the pipeline body member, a part of the circular ring as the connecting member, and the square-to-circular transition member to construct the basic three-dimensional model set. Although there are many combinations, in order to simply and clearly describe the principles and embodiments of the present application, this embodiment will use the combination of the above three basic three-dimensional models to construct the basic three-dimensional model set.
[0091] S3, traversing the pipeline data to construct the first model matrix and the first model data of each basic three-dimensional model. Specifically, the following steps are included:
[0092] S3.1, traversing the pipeline data to obtain the pipeline list associated with each pipeline connection point and the primary and secondary pipelines of the pipe point, and calculating the first model matrix and the first model data of the basic three-dimensional model set of the pipeline associated with the pipe point.
[0093] The present application establishes a complete coherent rendering pipeline system through the pipeline body, the connecting member, and the transition member. The first model matrix of the basic model is used to instantiate and render each component, and then the first model data is used to perform vertex transformation on the above members in the shader stage, thereby finally realizing coherent rendering.
[0094] Let the offset matrix of the basic model instance be , the rotation matrix be , and the scaling matrix be , then the first model matrix of the model instance is The first model data of each basic model is a dependent parameter used by each instance of each basic model in the shader stage to calculate the correct position of each vertex. For different types of basic model members, the first model data parameter field will be different.
[0095] The pipeline associated with the pipe point construction process includes the following two steps:
[0096] 1) Selecting the primary and secondary pipelines and establishing the basic three-dimensional model members of the primary and secondary pipelines;
[0097] 2) Traversing the remaining pipeline associated with the pipe point, and establishing the basic three-dimensional model members of each basic pipeline one by one.
[0098] The first model matrix of the pipeline body member is determined by the two pipe points associated with the pipeline, and the pipeline body member has no first model data.
[0099] Specifically, the primary and secondary pipelines are selected and the basic three-dimensional model members of the primary and secondary pipelines are established as follows.
[0100] The pipeline list associated with the pipe point is sorted in descending order according to the pipe diameter specification. First, it is determined whether it is a circular pipe or a square pipe according to the pipe diameter specification. If it is a circular pipe, it is sorted according to the radius. If it is a square pipe, it is sorted according to the minimum half of the side length. If there are the same values, they are sorted according to the traversal order.
[0101] The basic three-dimensional model component of the pipe point is determined according to the pipe point condition:
[0102] If the pipe point is associated with only one pipeline, the pipe point only has the pipeline body component of the pipeline, and the constructed pipeline body stops at the pipe point;
[0103] If the pipe point is associated with multiple pipelines, the basic three-dimensional model components of the primary and secondary pipelines are first constructed, and then the three-dimensional model components of the other pipelines associated with the pipe point are added in turn.
[0104] The construction rules of the primary and secondary pipelines are as follows:
[0105] The primary and secondary pipelines are composed of three parts, namely the pipeline body component, the connection component, and the transition component. According to the situation, not all of these components are needed. The connection component is only needed when the primary and secondary pipelines are not on the same straight line. The transition component is only needed when the pipe diameter specifications of the primary and secondary pipelines are inconsistent or the shapes at the connection with the connected component do not match. The connection component is mainly composed of a part of a circular ring or a square ring, which plays the role of rendering the elbow. The transition component mainly functions to smoothly transition between different pipe diameters and different shapes.
[0106] Please refer to Figure 3 , the construction process of the connection component is as follows:
[0107] The connection component has the same pipe diameter specification as the main pipeline, and the central axes of the primary and secondary pipelines both point to the pipe point. According to the system default or user input turning radius, the start and end positions of the central axis of the connection component are calculated. The calculation rules are as follows:
[0108] Assuming that the included angle of the primary and secondary pipelines is and the turning radius is r, the distance of the connection component from the pipe point in the opposite direction of the main pipeline is . According to the coordinates of the pipe point and the direction of the main pipeline, the starting coordinate of the central axis of the connection component ( ) is easily obtained. This coordinate is also the coordinate at which the central axis of the main pipeline stops at the pipe point. The terminal coordinate of the central axis of the connection component is equal in distance to the starting coordinate from the pipe point and is in the opposite direction of the secondary pipeline. Similarly, the terminal coordinate of the central axis of the connection component ( ) is easily obtained. This coordinate is also the coordinate at which the central axis of the secondary pipeline stops at the pipe point. The central angle of the connection component between the start and end coordinates and the center of the connection component is The center of the connecting member is the center of the concentric circle of the ring or square ring where the connecting member is located. The coordinates of the center of the connecting member can be easily obtained according to the starting and ending coordinates of the connecting member, the geometric relationship that the line connecting the starting coordinate and the center of the connecting member is perpendicular to the direction of the main pipeline, and the turning radius. ).
[0109] (1) According to the pipe diameter specification of the main pipeline, the first model matrix and the first model data of the connecting member are solved:
[0110] 1) For a circular pipe, the coordinate origin of the basic three-dimensional model of the connecting member is at the center of the connecting member, the starting and ending points of the circular pipe diameter axis are on the z-axis and the x-axis respectively, the central angle is 90°, the inner ring radius is cm, the outer ring radius is cm, and the circular pipe diameter radius is cm. The pipe diameter radius of the main pipeline is cm, the whole is in the first quadrant of the zox coordinate system, and the coordinate unit of the rendering engine is cm.
[0111] The offset matrix of the connecting member is: .
[0112] The scaling matrix of the connecting member is: .
[0113] The rotation matrix of the connecting member is calculated in the following steps:
[0114] 1) According to the vector of the starting point of the connecting member pointing to the center of the connecting member and the vector of the other pipe point of the main pipeline pointing to the pipe point, the normal vector direction of the plane formed by the two vectors is ;
[0115] 2) According to the vectors (0, 0, -1) and (1, 0, 0), the normal vector direction of the plane formed by the two vectors is ;
[0116] 3) Solve the rotation angle and rotation axis of ;
[0117] 4) According to the rotation angle and rotation axis obtained in 3), the rotation matrix is solved using the Rodrigues rotation formula;
[0118] 5) Taking as the rotation axis, the rotation matrix is calculated again according to the Rodrigues rotation formula to rotate the tangent direction of the starting point of the connecting member axis after the transformation in 4) to the tangent direction of the main pipeline pointing to the connecting member;
[0119] 6) The rotation matrix of the connecting member is calculated .
[0120] The first model matrix of the connecting member is calculated as .
[0121] Referring to Figure 4 , the final position of any point A on the circle ring (θ, φ) after two transformations is obtained, and the transformation matrix is the first model data of the connecting member. , , Figure 4
[0122] The first transformation is a scaling transformation in the radial direction of the circle ring. The pipe diameter radius of the circle ring before scaling is:
[0123]
[0124] The distance of the projection of point A in the xoz coordinate system from the origin of the xoz coordinate system is:
[0125]
[0126] The scaling matrix of point A is: .
[0127] The second transformation is a rotation transformation around the center of the circle ring. The angle between OA and the z-axis before transformation is: , and the angle between OA and the z-axis after transformation is: ;
[0128] The angle transformation around the y-axis before and after transformation is: , and the rotation matrix is:
[0129] .
[0130] According to the above calculation, the transformation formula of the connecting member in the shader stage is , and the first model data of the connecting member is a parameter set composed of common parameters in formula .
[0131] 2) For a square tube, the coordinate origin of the connecting member basic three-dimensional model is at the center of the connecting member, the start and end points of the square ring pipe diameter axis are on the z-axis and the x-axis respectively, the central angle is 90°, the inner ring radius is cm, the outer ring radius is cm, the edge length of the square ring pipe diameter perpendicular to the xoz coordinate plane is cm, and the other edge length is cm. The pipe diameter radius of the main pipe line is cm and cm, respectively, the whole is in the first quadrant of the zox coordinate system, and the coordinate unit of the rendering engine is cm.
[0132] The offset matrix of the connecting component is: .
[0133] The scaling matrix of the connecting component is:
[0134] .
[0135] The rotation matrix of the connecting components is calculated in the following steps:
[0136] 1) Based on the vector from the starting point of the connecting component to the center of the connecting component and the vector from another point on the main pipeline to this point, find the direction of the normal vector of the plane formed by these two vectors. ;
[0137] 2) Given vectors (0,0,-1) and (1,0,0), find the direction of the normal vector of the plane formed by these two vectors. ;
[0138] 3) Solve Go to The rotation angle and axis of rotation;
[0139] 4) Based on the rotation angle and rotation axis obtained in 3), use the Rodriguez rotation formula to solve for the rotation matrix. ;
[0140] 5) with Using the rotation axis, calculate again, according to the Rodriguez rotation formula, the rotation matrix from the tangent direction of the connecting member's axis starting point after transformation 4) to the tangent direction of the main line pointing towards the connecting member. ;
[0141] 6) Calculate the rotation matrix of the connecting components. .
[0142] Based on the above calculations, the first model matrix of the connecting component is: .
[0143] Please see Figure 4 Any point A on the annulus ( , , )go through Figure 4 The final position is obtained after two transformations, and its transformation matrix is the first model data of the connecting component.
[0144] The first transformation is a radial scaling transformation of the toroidal ring. The radius of the toroidal ring before scaling is:
[0145]
[0146] The distance from the projection of point A in the xoz coordinate system to the origin of the xoz coordinate system is:
[0147]
[0148] The scaling matrix of point A is: .
[0149] The second transformation is a rotation transformation around the center of the torus. The angle between OA and the z-axis before transformation is: , and the angle between OA and the z-axis after transformation is:
[0150] The angle transformation around the y-axis before and after is: , and the rotation matrix is:
[0151] .
[0152] According to the above calculations, the transformation formula of the connecting component in the shader stage is , and the first model data of the connecting component is a parameter set composed of the common parameters in the formula .
[0153] (2) Solve the first model matrix and the first model data of the transition component:
[0154] Please refer to Figure 2 , the transition component includes three types of square-to-square, circle-to-square, and circle-to-circle, and is connected to the connecting component and the secondary pipeline at both ends. The length of the transition component is determined by the system default or user set length, and the offset matrix, rotation matrix, and transition matrix axis start and end point coordinates of the transition component can be determined according to the connecting component axis end coordinates, secondary pipeline direction, and selected transition component basic three-dimensional model. The scaling matrix of the transition component can be determined according to the shape of the main pipeline, the length of the transition component, and the selected transition component basic three-dimensional model. The pipe diameter specifications of the start and end points of the transition component are unified with the pipe diameter specifications of the main and secondary pipelines, so that the pipe diameter specifications of the start and end points of the transition component can be obtained.
[0155] According to the offset matrix, rotation matrix, and scaling matrix of the transition component, the first model matrix of the transition component can be constructed. According to the start and end point coordinates of the transition component axis, the start and end point pipe diameter specifications, the first model data of the transition component can be constructed.
[0156] Let the connecting component axis end coordinates be , and the pipe diameter specifications be cm and cm (where if = The cross section can be square or circular), the direction of the secondary pipeline main point pointing to the other end of the pipeline point is vector a, the selected transition component axis direction is b (0, 1, 0) (the connecting component connected end points to the other end), the transition component length is lcm, the selected transition component three-dimensional model length cm, the selected transition component three-dimensional model connecting end pipe diameter specification with the connecting component is cm and cm, the selected transition component three-dimensional model connecting end pipe diameter specification with the secondary pipeline is cm and cm, the coordinate origin of the transition component is at the center of the pipe diameter of the connecting component connected end.
[0157] According to the Rodrigues rotation formula, the rotation matrix of vector a to vector b can be obtained , and according to the Rodrigues rotation formula, the rotation matrix of vector a as the rotation axis can be obtained The rotation matrix required for the transition component to align with the connecting component connected end port after rotation transformation , then the rotation matrix of the transition component is: .
[0158] Suppose the corresponding relationship between the pipe diameter specifications of the connecting component and the transition component after rotation transformation is: corresponds to ; corresponds to , then the scaling matrix of the transition component is: .
[0159] The offset matrix of the transition component is .
[0160] According to the above calculation, the first model matrix of the transition component is: .
[0161] The transition component is divided into n layers along the pipe diameter axis, each layer has m vertices, each vertex has corresponding vertices with other n-1 layers, and the n corresponding vertices are collinear, then the transition component only needs to modify the position of the m vertices connected with the connecting component after the first model matrix transformation.
[0162] Among them, the most critical is the transformation rule of the vertex connected with the secondary pipeline, and the other intermediate vertices can be obtained by using the interpolation method.
[0163] The vertex transformation of the transition component is a rotation around the axis of the second pipeline and a scaling of the diameter of the transition component. The first model data of the transition component is a parameter set of the scaling factor of the diameter of the transition component and the angle of the rotation around the axis of the second pipeline. The vertex transformation is implemented in the shader rendering stage according to the parameter set, so that the transition at the connection is smooth.
[0164] (3) Solving the first model matrix and the first model data of the pipeline body component:
[0165] The coordinate origin of the basic three-dimensional model of the pipeline body component is at the center of the interface at one end of the pipeline, and the pipeline direction is parallel to the y-axis. If it is a square tube, the pipeline side is parallel to the x-axis and the z-axis, and the length of the pipeline basic three-dimensional model is lcm.
[0166] The first model matrix of the pipeline body component is also a transformation matrix composed of an offset matrix, a rotation matrix, and a scaling matrix, and the first model data is empty.
[0167] If the pipeline has been added in other pipe points, the pipeline body of the pipeline is not added again.
[0168] If the pipeline has not been processed, the rotation matrix of the pipeline body component is easily obtained as the rotation matrix of the axial direction of the selected pipeline basic three-dimensional model to the direction vector of the direction of the other pipe point pointing to the pipe point. .
[0169] According to the conditions of the two ends of the pipeline, the cutting length of the pipeline at both ends (excluding the length occupied by the connection component and the transition component), the length of the pipeline after cutting cm, the scaling factor of the diameter of the pipeline , and the position coordinates of the starting end point after cutting the corresponding length .
[0170] The offset matrix of the pipeline body component is: ;
[0171] The scaling matrix of the pipeline body component is .
[0172] According to the above calculation, the first model matrix of the pipeline body component is: .
[0173] All the first model matrices and the first model data of the pipeline body are calculated according to the above calculation method.
[0174] For square tube, since the tube line has been processed before, the rotation matrix of the tube line has been determined, when it is the main tube line at the current tube point, there may be a situation that the connection member cannot be closed at the connection position, at this time, a transition member needs to be added between the main tube line and the connection member to achieve the goal of continuous connection. The construction method of the transition member is similar to the previous transition member construction method, which will not be repeated here.
[0175] When the main tube line and the secondary tube line are parallel, there is no need to construct the connection member, and the transition member is constructed according to the situation. The main tube line can be used as the connection member to construct the transition member during the construction process, and the construction process is consistent with the previous one.
[0176] The following traverses the remaining tube point associated tube line, and establishes the first model matrix and the first model data of the basic three-dimensional model member of each remaining tube line one by one.
[0177] The tube line member of the remaining tube line includes two parts: the tube line body member and the connection member. Among them, the tube line body member refers to the construction method described above, and only the construction method of the connection member of the remaining tube line is described below.
[0178] Please refer to Figure 5 and Figure 6 , there are four cases for other tube lines associated with tube points outside the main and secondary tube lines: the first is that the new tube line is parallel to one of the main and secondary tube lines, then it can be directly rendered; the second is as shown in Figure 5 The new tube line is on the larger side of the angle between the main and secondary tube lines; the third is as shown in Figure 6 The new tube line is on the smaller side of the angle between the main and secondary tube lines; the fourth is that the main and secondary tube lines are parallel, and the construction method refers to the second case.
[0179] The calculation method of the second and third cases is described below.
[0180] Please refer to Figure 5 for the second case. The tube line is composed of a tube line body and a connection member. The connection member is a circular tube or a sector area of a square tube with the diameter of the new tube line as the radius, the starting side is connected to the new tube line body member, and the ending side is perpendicular to the angle bisector of the angle between the main and secondary tube lines. The center of the sector is the endpoint of the tube line close to the smaller angle side of the angle between the main and secondary tube lines.
[0181] Let the angle of angle AoB be , then the central angle of the connection member is , where oA is the line segment on the angle bisector of the angle between the main and secondary tube lines. The inner ring radius is considered as 0, and according to the above calculation, the connection member can be constructed according to the previous calculation method of the connection member.
[0182] Please refer to Figure 6For the third case, only the pipeline main body member needs to be constructed, and the pipeline at the pipe point is cut to add a pipeline radius or a distance of half the length of the shorter side of the added pipeline section.
[0183] According to the above construction method and process, the first model matrix and the first model data of the basic three-dimensional model set associated with the pipeline of the pipe point are calculated.
[0184] S3.2, the first model matrix and the first model data of the basic three-dimensional model set of each pipe point are integrated, and the first model matrix and the first model data of the basic three-dimensional model of the entire system are constructed.
[0185] The present application integrates the pipeline connection point information, constructs the first model matrix and the first model data of the basic three-dimensional model associated with each pipe point, and then integrates the first model matrix and the first model data of the basic three-dimensional model associated with all pipe points, to construct the first model matrix and the first model data of the entire basic three-dimensional model in the basic three-dimensional model set constructed in step S2.
[0186] S4, traverse the basic three-dimensional model set, and render the pipeline according to the basic three-dimensional model and the corresponding first model matrix.
[0187] The present application renders the basic three-dimensional model according to the first model matrix of each constructed basic three-dimensional model, thereby rendering the complete pipeline model.
[0188] S5, the model transformation is performed according to the first model data in the graphics accelerator rendering stage.
[0189] The present application performs vertex transformation on the vertices of the model instance by the offset of each vertex in the basic three-dimensional model and the vertex transformation rule contained in the first model data in the graphics accelerator stage (such as the vertex shader, geometry shader, mesh shader, material, etc.), thereby realizing the coherent rendering of the pipeline and the pipeline connection. Figure 7 As shown in the processing effect diagram of the pipeline.
[0190] The above is only used to help understand the method of the present application and its core essence, but the protection scope of the present application is not limited thereto. For those skilled in the art, according to the technical solution and the inventive concept of the present application, equivalent replacement or change within the technical scope disclosed by the present application should be covered within the protection scope of the present application. In summary, the content of the present specification should not be understood as a limitation of the present application.
Claims
1. A method of vector pipeline three-dimensional instantiation coherent rendering, the method comprising: The method comprises the following steps: S1, obtaining vector pipeline data, and parsing to obtain pipeline data; S2, constructing a basic three-dimensional model set; S3, traversing the pipeline data to obtain pipeline connection point information; constructing a first model matrix and first model data of each basic three-dimensional model, and establishing a pipeline system for coherent rendering; The S3 specifically comprises: S3.1, traversing the pipeline data to obtain a pipeline list associated with each pipeline connection point and the primary and secondary pipelines of the pipeline connection point, and calculating the first model matrix and first model data of the basic three-dimensional model set of the pipeline associated with the pipeline connection point; The basic three-dimensional model set of the pipeline associated with the pipeline connection point specifically comprises: selecting the primary and secondary pipelines and establishing the basic three-dimensional model components of the primary and secondary pipelines, and traversing the pipeline associated with the remaining pipeline connection points to establish the basic three-dimensional model components of each pipeline one by one; The selection of the primary and secondary pipelines and the establishment of the basic three-dimensional model components of the primary and secondary pipelines are specifically as follows: Selecting the primary and secondary pipelines: traversing the pipeline list associated with the pipeline connection point and sorting according to the pipe diameter specification in descending order; judging whether it is a round pipe or a square pipe according to the pipe diameter specification, if it is a round pipe, sorting according to the radius, if it is a square pipe, sorting according to the smallest half of the side length, if there are the same values, sorting according to the traversal order; The construction rule of the primary and secondary pipelines: the primary and secondary pipelines comprise pipeline body components, if the primary and secondary pipelines are not on a straight line, they further comprise connecting components, if the shapes of the connected components do not match, they further comprise transition components; solving the first model matrix and first model data of the basic three-dimensional model components, the first model matrix is a space transformation matrix composed of an offset matrix, a rotation matrix and a scaling matrix; S3.2, traversing the pipeline connection point information, synthesizing the first model matrix and first model data of all associated basic three-dimensional model sets of the pipeline connection point, and constructing the first model matrix and first model data of the basic three-dimensional model of the pipeline system; S4, traversing the basic three-dimensional model set, and instantiating and rendering a complete pipeline system according to the basic three-dimensional model and the corresponding first model matrix; The first model matrix of the connecting component is specifically as follows:
2. The vector pipeline three-dimensional instantiation coherent rendering method of claim 1, wherein, Therefore: Let the angle between the primary and secondary pipelines be , the turning radius be r, the distance from the connection member to the point on the pipeline in the opposite direction of the primary pipeline be ; the central angle formed by the start and end coordinates of the connection member and the center of the connection member circle be ; the coordinates of the center of the connection member circle be ; The scaling matrix of the connecting component is specifically as follows: The offset matrix of the connection member is: The scaling matrix of the connection member is The rotation matrix of the connection member is ; The first model matrix of the connection member is .
3. The vector pipeline three-dimensional instantiation coherent rendering method of claim 2, wherein, The scaling matrix of the connecting component is: If the connecting member is a circular tube, let its inner ring radius be , its outer ring radius be , its circular tube diameter radius be , and the main pipeline diameter radius be ; The scaling matrix of the connection member is: If the connecting member is a square tube, let its inner ring radius be , outer ring radius be , side length of the square tube be , and the other side length be ; the pipe diameter of the main pipeline corresponds to the side length of the connecting member, and the pipe diameter of the main pipeline is and ; The rotation matrix of the connecting component is specifically as follows: 。 4. The vector pipeline three-dimensional instantiation coherent rendering method of claim 3, wherein, The first model data of the connecting component is specifically as follows: According to the vector of the connection member starting point pointing to the connection member center and the vector of the other pipe point of the main pipeline pointing to the current pipe point, the normal vector direction of the plane formed by the two vectors is calculated ; According to the vector (0, 0, -1) and the vector (1, 0, 0), the normal vector direction of the plane composed of the two vectors is calculated ; solving turning to the angle of rotation and the axis of rotation; Based on the rotation angle and the rotation axis, a rotation matrix is solved using the Rodrigues rotation formula ; With as the rotation axis, the rotation matrix of rotating the tangent direction of the start point of the axis of the connection member after the transformation to the tangent direction in which the main pipeline points to the connection member is calculated again according to the Rodrigues rotation formula ; Computing a rotation matrix of a connection member .
5. The vector pipeline three-dimensional instantiation coherent rendering method of claim 2, wherein, The first model matrix and first model data of the transition component are specifically as follows: Any point A on the circle ring (1) , , ) is transformed twice to the final position, and the transformation matrix is the first model data of the connecting member. The first transformation is a scaling transformation in the radial direction of the torus, and the radius of the tube of the torus before scaling is ; the distance of the projection of point A in the xoz coordinate system from the origin of the xoz coordinate system is ; The scaling matrix for point A is: The second transformation is a rotation transformation around the center of the circular ring, and the angle between OA and the z-axis before transformation is: , and the angle between OA and the z-axis after transformation is: ; The angle of rotation around the y-axis is transformed into: The rotation matrix is: 。 6. The vector pipeline three-dimensional instantiation coherent rendering method of claim 1, wherein, The first model data of the transition component comprises transformation rules of the vertices connected with the secondary pipeline of the transition component; specifically, the vertices connected with the secondary pipeline of the transition component are transformed through two vertex transformations, the first is a scaling transformation corresponding to the side length or a scaling transformation corresponding to the radius, and the second is a rotation around the axis of the secondary pipeline to realize the transformation of the connection alignment; Let the coordinate of the end point of the axis of the connecting member be , the pipe diameter specification be and , the direction of the primary pipe point pointing to the other end pipe point of the secondary pipe be a vector a, the direction of the axis of the transition member be b (0, 1, 0), the length of the transition member be l, the length of the selected three-dimensional model of the transition member be , the pipe diameter specification of the connecting end of the three-dimensional model of the transition member and the connecting member be and , the pipe diameter specification of the connecting end of the three-dimensional model of the transition member and the secondary pipe be and , and the coordinate origin of the transition member be at the center of the pipe diameter of the connecting end of the connecting member. The rotation matrix of vector a rotating to vector b is obtained according to the Rodrigues rotation formula The rotation matrix of vector a rotating to vector b is obtained according to the Rodrigues rotation formula The rotation matrix of the transition component after transformation aligning with the port of the connecting component The rotation matrix of the transition component is: ; Assuming that the corresponding relationship between the connection member and the transition member pipe diameter specifications after the rotation transformation is: corresponds to ; corresponds to then: The scaling matrix of the transition member is: The offset matrix of the transition member is: The first model matrix of the transition member is: ; Other intermediate vertices use an interpolation method. The first model matrix and first model data of the pipeline body component are specifically as follows:
7. The vector pipeline three-dimensional instantiation coherent rendering method of claim 1, wherein, The first model data of the pipeline body component is empty. the length of the pipeline base three-dimensional model is l, the pipeline length , the scaling factor of the pipeline diameter , and the position coordinates of the pipeline starting end point after cutting the corresponding length ; then: The offset matrix for the pipeline body member is: The scaling matrix of the pipeline body member is The rotation matrix of the pipeline body member is a rotation matrix of the axial direction of the pipeline basic three-dimensional model turning to the direction vector of another pipe point pointing to the current pipe point ; The first model matrix of the pipeline body member is: ; It comprises:
8. A vector pipeline three-dimensional instantiation coherent rendering system for use in the method of any one of claims 1-7, wherein, A vector data parsing module: reading vector pipeline data and parsing to obtain pipeline data; a basic three-dimensional model construction module, which constructs a basic three-dimensional model set; a pipeline processing module, which traverses pipeline data to construct a first model matrix and first model data of each basic three-dimensional model; a pipeline rendering module, which traverses the basic three-dimensional model set, renders a pipeline according to the basic three-dimensional model and the corresponding first model matrix, and performs model transformation according to the first model data in a graphics accelerator rendering stage.
Citation Information
Patent Citations
3D automatic modeling and scheduling rendering method for integrated pipe network
CN106683198A
Pipeline model rendering method and device, electronic equipment and storage medium
CN117635797A