[go: up one dir, main page]

CN117745910B - A fast rendering method for heat map of 3D model with massive grid points - Google Patents

A fast rendering method for heat map of 3D model with massive grid points Download PDF

Info

Publication number
CN117745910B
CN117745910B CN202311814998.4A CN202311814998A CN117745910B CN 117745910 B CN117745910 B CN 117745910B CN 202311814998 A CN202311814998 A CN 202311814998A CN 117745910 B CN117745910 B CN 117745910B
Authority
CN
China
Prior art keywords
data
modelblock
file
point
thermal value
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN202311814998.4A
Other languages
Chinese (zh)
Other versions
CN117745910A (en
Inventor
毛莺池
王孜博
岳建锋
曲力涛
梁继媛
陈时
陈映喜
王哲
吴封奎
王子成
杨怀荣
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Hohai University HHU
Huaneng Lancang River Hydropower Co Ltd
Original Assignee
Hohai University HHU
Huaneng Lancang River Hydropower Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Hohai University HHU, Huaneng Lancang River Hydropower Co Ltd filed Critical Hohai University HHU
Priority to CN202311814998.4A priority Critical patent/CN117745910B/en
Publication of CN117745910A publication Critical patent/CN117745910A/en
Application granted granted Critical
Publication of CN117745910B publication Critical patent/CN117745910B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Landscapes

  • Image Generation (AREA)

Abstract

The invention discloses a method for quickly rendering a thermodynamic diagram of a three-dimensional model of a mass grid point in a blocking way, which comprises the steps of data file preprocessing, data file reading and thermodynamic value matching calculation, and the rendering speed of the thermodynamic diagram of the three-dimensional model of the mass grid point is improved on the basis of ensuring the rendering effect by means of spatial cluster analysis, file fragmentation, multithreading, strategy caching, blocking loading and the like. The data preprocessing stage is used for fragmenting the model grid point file and the point thermodynamic value file; in the data file reading stage, multithreading is adopted to read two types of file fragments, a spatial index tree STRtree is built based on point thermal value file fragments, a model grid block ModelBlock is built based on model grid point file fragments, and a built result is cached according to a certain caching strategy; and in the thermodynamic value matching calculation stage, based on the established STRtree, the thermodynamic values of the vertexes of each block ModelBlock grid are matched in parallel, the vertex colors are calculated, and the vertex colors of each block ModelBlock are returned to the client to realize the block thermodynamic diagram rendering.

Description

一种海量网格点三维模型热力图分块快速渲染方法A fast rendering method for heat map of 3D model with massive grid points

技术领域Technical Field

本发明涉及一种海量网格点三维模型热力图分块快速渲染方法和系统,属于三维空间数据可视化技术领域。The invention relates to a method and system for fast block rendering of a heat map of a massive grid point three-dimensional model, belonging to the technical field of three-dimensional space data visualization.

背景技术Background Art

热力图是一种数据可视化技术,它通过颜色的差异来展示数值的大小,能够直观地表示数据点的集中趋势和分布范围。在三维空间中,热力图通常用于展示与地理位置相关的数据,如温度、压力或者任何其他可以量化的指标,最终形成三维热力分布图。这种图形化的表示方法可以帮助用户快速识别数据的关键区域。在水利工程数字孪生应用中,热力图尤其重要。其作为一个强有力的工具,可用于实时监控和分析水体的温度分布、水流速度、污染物浓度等多维度信息。这不仅有助于水利工程的日常管理,而且在应对紧急情况如洪水或水质突发事件时,能够提供实时关键的信息支持。Heatmap is a data visualization technology that uses color differences to show the size of values and can intuitively represent the concentration trend and distribution range of data points. In three-dimensional space, heatmaps are usually used to display data related to geographic location, such as temperature, pressure, or any other quantifiable indicators, and finally form a three-dimensional heat distribution map. This graphical representation method can help users quickly identify key areas of data. Heatmaps are particularly important in the application of digital twins of water conservancy projects. As a powerful tool, it can be used to monitor and analyze multi-dimensional information such as temperature distribution, water flow velocity, and pollutant concentration of water bodies in real time. This not only helps the daily management of water conservancy projects, but also provides real-time critical information support when responding to emergencies such as floods or water quality emergencies.

在水利工程数字孪生场景中,物理实体的复杂性导致其对应的虚拟三维模型具有庞大的网格点数量。这些物理实体可能包括水系网络、泵站、防洪系统、水库和其他水利设施,由于其地形或结构上的复杂性,需要对其进行高精度建模。为了精确模拟和分析这些复杂系统的行为和性能,需要创建包含数百万甚至上千万个网格点的精细三维模型。三维模型中每个网格点都代表了该位置的具体数据,如水流速度、水质参数、温度等。需要对这些数据进行准确表示,同时能够随时间动态更新这些数据以反映实际情况的变化。因此需要在短时间内完成海量网格点三维模型热力图渲染,以支持水利工程数字孪生中的实时分析和决策。In the digital twin scenario of water conservancy projects, the complexity of physical entities leads to a huge number of grid points in their corresponding virtual three-dimensional models. These physical entities may include water networks, pumping stations, flood control systems, reservoirs and other water conservancy facilities, which need to be modeled with high precision due to their topographical or structural complexity. In order to accurately simulate and analyze the behavior and performance of these complex systems, it is necessary to create a detailed three-dimensional model containing millions or even tens of millions of grid points. Each grid point in the three-dimensional model represents specific data at that location, such as water flow velocity, water quality parameters, temperature, etc. These data need to be accurately represented and dynamically updated over time to reflect changes in actual conditions. Therefore, it is necessary to complete the rendering of thermal maps of three-dimensional models with massive grid points in a short period of time to support real-time analysis and decision-making in the digital twin of water conservancy projects.

由于物理实体的复杂性,对海量网格点三维模型进行热力图渲染面临诸多困难。一方面,高密度的网格点需要巨大的计算资源来处理,同时还要求渲染系统能够管理和维护大量的数据流。另一方面,热力图渲染需要将这些网格点的数据转换成用户可以理解的视觉表示,这一过程涉及到复杂的数据到图形的映射,以及颜色编码的使用。此外为了满足实际应用需求,需要尽可能提升海量网格点三维模型热力图渲染速度,进而降低等待时延,提升用户体验。所有这些要求都使得在水利工程数字孪生场景中,对海量网格点三维模型进行热力图渲染成为一项具有挑战性的任务。Due to the complexity of physical entities, there are many difficulties in rendering heat maps for 3D models with massive grid points. On the one hand, the high density of grid points requires huge computing resources to process, and also requires the rendering system to be able to manage and maintain a large number of data streams. On the other hand, heat map rendering needs to convert the data of these grid points into a visual representation that users can understand. This process involves complex data-to-graphic mapping and the use of color coding. In addition, in order to meet the needs of practical applications, it is necessary to increase the rendering speed of heat maps for 3D models with massive grid points as much as possible, thereby reducing waiting delays and improving user experience. All these requirements make it a challenging task to render heat maps for 3D models with massive grid points in the digital twin scenario of water conservancy projects.

发明内容Summary of the invention

发明目的:针对海量网格点三维模型热力图渲染消耗资源大、渲染时间长导致其难以在实际工程中应用的问题,提供一种海量网格点三维模型热力图分块快速渲染方法和系统,结合多种技术手段在保证内存消耗以及渲染效果的同时降低整体渲染耗时,提升用户使用体验,为水利工程数字孪生应用提供关键技术支持。Purpose of the invention: To address the problem that rendering of heat maps of three-dimensional models with massive grid points consumes large resources and takes a long time to render, making it difficult to apply in actual engineering projects, a method and system for fast rendering of heat maps of three-dimensional models with massive grid points in blocks is provided. By combining various technical means, the overall rendering time is reduced while ensuring memory consumption and rendering effects, thereby improving user experience and providing key technical support for the application of digital twins of water conservancy projects.

技术方案:一种海量网格点三维模型热力图分块快速渲染方法,该方法包括数据文件预处理、数据文件读取以及热力值匹配计算三个阶段,结合空间聚类分析、文件分片、多线程处理、策略缓存、分块计算渲染等手段,在保证内存消耗以及渲染效果的同时降低整体渲染耗时,该方法包括以下步骤:Technical solution: A method for fast rendering of heat maps of 3D models with massive grid points in blocks. The method includes three stages: data file preprocessing, data file reading, and heat value matching calculation. It combines spatial clustering analysis, file segmentation, multi-threaded processing, strategy caching, block calculation and rendering, etc., to reduce the overall rendering time while ensuring memory consumption and rendering effect. The method includes the following steps:

步骤1)在数据文件预处理阶段,对点位热力值文件中的点位进行空间聚类分析,压缩同一区域内相似热力值点位数量,生成稀疏化点位热力值数据,降低待处理数据量;Step 1) In the data file preprocessing stage, spatial clustering analysis is performed on the points in the point thermal value file to compress the number of points with similar thermal values in the same area, generate sparse point thermal value data, and reduce the amount of data to be processed;

步骤2)在数据文件预处理阶段,按照分片数据量相同原则,将稀疏化点位热力值数据存储为多个文件分片,保证后续不同线程处理的数据量相同,以最小化整体处理时间;Step 2) In the data file preprocessing stage, according to the principle of the same amount of shard data, the sparse point thermal value data is stored as multiple file shards to ensure that the amount of data processed by different threads is the same, so as to minimize the overall processing time;

步骤3)在数据文件预处理阶段,首先将模型网格点文件按照模型部位划分为多个部位切片,以保证后续热力图渲染效果;其次基于近似分片数据量相同原则,将每个部位切片存储为多个近似大小的文件分片;Step 3) In the data file preprocessing stage, the model grid point file is first divided into multiple part slices according to the model parts to ensure the subsequent thermal map rendering effect; secondly, based on the principle of the same amount of data for approximate slices, each part slice is stored as multiple file slices of similar size;

步骤4)在数据文件读取阶段,使用多线程读取点位热力值文件切片,多个线程在读取过程中协同构建空间索引树STRtree,降低处理时间;Step 4) In the data file reading stage, multiple threads are used to read the point thermal value file slices, and multiple threads collaborate to build a spatial index tree STRtree during the reading process to reduce processing time;

步骤5)在数据文件读取阶段,使用多线程读取模型网格点文件切片,构建多块模型分块ModelBlock;Step 5) In the data file reading stage, use multi-threading to read the model grid point file slices and construct multiple model blocks ModelBlock;

步骤6)在数据文件读取阶段,对构建完毕的STRtree以及ModelBlock依据一定的缓存策略进行缓存处理,在保证内存消耗的同时提升后续访问速度;Step 6) During the data file reading phase, the constructed STRtree and ModelBlock are cached according to a certain cache strategy to improve subsequent access speed while ensuring memory consumption;

步骤7)在热力值匹配计算阶段,使用多线程处理对应的ModelBlock,将ModelBlock与STRtree进行坐标值匹配以计算网格顶点热力值并映射网格顶点颜色;Step 7) In the thermal value matching calculation stage, use multithreading to process the corresponding ModelBlock, match the coordinate values of the ModelBlock and the STRtree to calculate the thermal value of the mesh vertex and map the mesh vertex color;

步骤8)若某一线程处理完毕,则将对应ModelBlock的网格颜色返回客户端进行渲染,实现分块渲染效果。Step 8) If a thread is processed, the grid color of the corresponding ModelBlock is returned to the client for rendering to achieve a block rendering effect.

进一步的,所述步骤1)中对点位热力值文件的点位进行空间聚类分析的具体步骤如下:Furthermore, the specific steps of performing spatial cluster analysis on the points of the point thermal value file in step 1) are as follows:

将点位热力值文件表示为如下集合:The point thermal value file is represented as the following set:

Fheat={p1,p2,…,pN}F heat = {p 1 , p 2 ,..., p N }

其中,N为点位热力值文件数据行数,pi=<xi,yi,zi,υi>为点位热力值文件第i行点位数据,xi,yi,zi为三维坐标值,υi为对应的热力值,令为第k轮聚类中的第c类,将初始分类定义为随后计算当前聚类轮次各类之间的欧式距离矩阵:Where N is the number of rows of data in the point thermal value file, p i =< xi , yi , z i , υ i > is the i-th row of point data in the point thermal value file, x i , yi , z i are the three-dimensional coordinate values, υ i is the corresponding thermal value, and For the cth class in the kth round of clustering, the initial classification is defined as Then calculate the Euclidean distance matrix between the categories in the current clustering round:

其中,Nk为第k轮聚类中类的数量,da,b为第a类与第b类间的欧氏距离,表示为第a类与第b类类心间的欧氏距离,类心表示为类内数据均值:Among them, Nk is the number of classes in the kth round of clustering, d a,b is the Euclidean distance between the ath class and the bth class, expressed as the Euclidean distance between the class centers of the ath class and the bth class, and the class center is expressed as the mean of the data within the class:

计算距离矩阵后,假设为其中最小距离,则将两类合并,并进行下一轮聚类操作;聚类结束后,随机剔除每类中的部分点位数据,并将剩余全部点位数据合并,得到稀疏化点位热力值数据 After calculating the distance matrix, assuming is the minimum distance, then and The two categories are merged and the next round of clustering operation is performed; after the clustering is completed, some point data in each category are randomly removed, and all the remaining point data are merged to obtain sparse point thermal value data

进一步的,所述步骤2)中对稀疏化点位热力值数据做分片处理的具体步骤如下:Furthermore, the specific steps of slicing the sparse point thermal value data in step 2) are as follows:

设稀疏化点位热力值数据所包含的数据条数为则分片数据所包含的数据条数Sizesplit为:Sparse point thermal value data The number of data items included is The number of data entries contained in the shard data is:

其中,Numsplit为分片数量,则第k块分片数据表示为:Where Num split is the number of shards, then the kth shard data It is expressed as:

其中,[k*Sizesplit:(k+1)*Sizesptit]为切片操作,表示截取k*Sizesplit索引到(k+1)*Sizesplit索引位置的数据,得到分片数据后,将分片数据存储为分片文件。[k * Size split : (k+1) * Size split ] is a slicing operation, which means intercepting the data at the position from the k*Size split index to the (k+1)*Size split index, and after obtaining the slicing data, storing the slicing data as a slicing file.

进一步的,所述步骤4)中STRtree的具体构建过程如下:Furthermore, the specific construction process of STRtree in step 4) is as follows:

首先初始化集合S={s1,s2,...,sN},其中S中每个元素是仅包含一个热力值点位数据pi的空间对象,对于初始化集合S,有si.mbt=pi.mbr,mbt为空间对象的最小边界立方体;First, initialize the set S = {s 1 , s 2 , ..., s N }, where each element in S is a spatial object containing only one thermal value point data p i . For the initialization set S, s i .mbt = p i .mbr, mbt is the minimum bounding cube of the spatial object;

构建STRtree,设定STRtree的阈值m,其表示一个非叶子节点所包含的最大子节点数量,随后将集合S划分为γ=[N/m]个空间对象,若γ=1则将集合S作为根节点,将S中每个元素作为根节点的子节点,构建过程结束;若γ>1则执行空间对象划分操作;Construct STRtree, set the threshold m of STRtree, which represents the maximum number of child nodes contained in a non-leaf node, and then divide the set S into γ = [N/m] spatial objects. If γ = 1, set S is used as the root node, and each element in S is used as a child node of the root node, and the construction process ends; if γ > 1, perform the spatial object division operation;

在空间对象划分中,表示在每个方向上的划分次数,划分操作为:将S中每个元素si在x方向上升序排序,并平均地划分为ε份;对x方向上的每份划分结果,在y方向上执行上述划分操作;最后对y方向上的每份划分结果,在z方向上执行上述划分操作,完成空间对象划分,继续构建STRtree。In the spatial object division, It represents the number of divisions in each direction. The division operation is as follows: sort each element si in S in ascending order in the x direction and divide it into ε parts evenly; for each division result in the x direction, perform the above division operation in the y direction; finally, for each division result in the y direction, perform the above division operation in the z direction to complete the spatial object division and continue to build the STRtree.

进一步的,所述步骤6)中对构建完毕的STRtree以及ModelBlock依据一定的缓存策略进行缓存处理的过程具体如下:Furthermore, in step 6), the process of caching the constructed STRtree and ModelBlock according to a certain caching strategy is as follows:

采用LRU缓存策略对STRtree以及ModelBlock构建结果进行缓存处理,首先定义缓存队列Ql,其中l为缓存容量,将STRtree以及ModelBlock构建结果统称为元素e;The LRU cache strategy is used to cache the STRtree and ModelBlock construction results. First, the cache queue Q l is defined, where l is the cache capacity, and the STRtree and ModelBlock construction results are collectively referred to as elements e;

在构建e前首先查询Ql中是否存在元素e,若存在则直接获取使用,跳过元素e的构建过程,并将元素e置于队列Ql的头部,表示最近访问;否则执行元素e构建过程;Before constructing e, first check whether element e exists in Q l . If it exists, directly obtain and use it, skip the construction process of element e, and put element e at the head of queue Q l to indicate the most recent access; otherwise, execute the construction process of element e;

在对元素e进行构建后,若队列Ql未满,则将元素e插入队首;若队列Ql已满则将队尾元素移除并将元素e插入队首。After constructing element e, if the queue Q l is not full, element e is inserted at the head of the queue; if the queue Q l is full, the tail element is removed and element e is inserted at the head of the queue.

进一步的,所述步骤7)中将ModelBlock与STRtree进行坐标值匹配的具体步骤如下:Furthermore, the specific steps of matching the coordinate values of ModelBlock and STRtree in step 7) are as follows:

假设ModelBlock包含m个三维网格顶点信息,即M={g1,g2,...,gm},其中gj=<xj,yj,zj>为网格顶点坐标,首先计算ModelBlock的最小边界立方体:Assume that ModelBlock contains m 3D mesh vertex information, that is, M = {g 1 , g 2 , ..., g m }, where g j = <x j , y j , z j > is the mesh vertex coordinate. First, calculate the minimum bounding cube of ModelBlock:

M.mbr={min(X),max(X),min(Y),max(Y),min(Z),max(Z)}M.mbr={min(X), max(X), min(Y), max(Y), min(Z), max(Z)}

其中X、Y和Z分别为ModelBlock的x、y、z坐标集合,遍历STRtree节点,将ModelBlock的最小边界立方体与节点的最小边界立方体进行匹配,若两者相交则将节点中空间对象包括的热力值点位数据置入结果集R={p1,p2,...,pn},将ModelBlock中每个三维网格顶点与结果集R进行匹配,更新三维网格顶点gj=<gj.x,gj.y,gj.z,po.υ>,即为其匹配热力值,其中po∈R满足:Where X, Y and Z are the x, y and z coordinate sets of ModelBlock respectively. Traverse the STRtree nodes and match the minimum bounding cube of ModelBlock with the minimum bounding cube of the node. If the two intersect, place the thermal value point data included in the spatial object in the node into the result set R = {p 1 , p 2 , ..., p n }. Match each 3D mesh vertex in ModelBlock with the result set R, and update the 3D mesh vertex g j = <g j .x, g j .y, g j .z, p o .υ>, that is, match the thermal value for it, where p o ∈ R satisfies:

进一步的,所述步骤7)中映射网格顶点颜色的具体步骤如下:Furthermore, the specific steps of mapping the mesh vertex colors in step 7) are as follows:

定义ModelBlock所有网格顶点热力值中最大值、最小值分别为vmax和vmin,使用蓝色对应vmin,使用红色对应vmax,对于gj∈M,定义则网格顶点颜色映射公式如下:Define the maximum and minimum values of the thermal values of all mesh vertices in ModelBlock as v max and v min respectively. Use blue to correspond to v min and red to correspond to v max . For g j ∈ M, define The mesh vertex color mapping formula is as follows:

redj=[min(255,max(255*ratioj))]red j = [min(255, max(255*ratio j ))]

greenj=[min(255,max(0,255-abs(255*(ratioj-0.5)*2)))]green j = [min(255, max(0, 255-abs(255*(ratio j -0.5)*2)))]

blu%=[min(0,max(0,255*(1一ratioj)))]blu% = [min(0, max(0, 255*(1-ratio j )))]

其中,redj、greenj以及bluej分别为网格顶点gj的红色、绿色和蓝色分量值。Among them, red j , green j and blue j are the red, green and blue component values of the mesh vertex g j respectively.

一种海量网格点三维模型热力图分块快速渲染系统,包括用于模型网格点热力值匹配计算的服务器和基于网格顶点颜色进行热力图渲染的客户端。A block-based rapid rendering system for heat maps of a massive grid point three-dimensional model includes a server for matching and calculating the heat values of the model grid points and a client for rendering the heat map based on the colors of the grid vertices.

在数据文件预处理阶段,服务器使用空间聚类分析和等大小分片策略生成点位热力值文件分片,使用部位分片策略和近似大小分片策略生成模型网格点文件分片;In the data file preprocessing stage, the server uses spatial clustering analysis and equal-size sharding strategy to generate point thermal value file shards, and uses position sharding strategy and approximate-size sharding strategy to generate model grid point file shards;

在数据文件读取阶段,使用多线程读取点位热力值文件分片,在读取过程中构建空间索引树STRtree;使用多线程读取模型网格点文件分片,构建多个模型分块ModelBlock;在构建结束后,对STRtree和ModelBlock进行缓存处理;In the data file reading stage, multi-threading is used to read the point thermal value file shards, and the spatial index tree STRtree is built during the reading process; multi-threading is used to read the model grid point file shards and build multiple model blocks ModelBlock; after the construction is completed, STRtree and ModelBlock are cached;

在热力值匹配计算阶段,多个线程将其构建的ModelBlock与STRtree进行坐标值匹配,为每个ModelBlock设置网格点热力值,并基于网格点热力值映射网格颜色,在每块ModelBlock匹配计算结束后,将其网格顶点颜色返回客户端;In the thermal value matching calculation phase, multiple threads match the coordinate values of the ModelBlock they built with the STRtree, set the grid point thermal value for each ModelBlock, and map the grid color based on the grid point thermal value. After the matching calculation of each ModelBlock is completed, the grid vertex color is returned to the client;

客户端每次获取ModelBlock网格顶点颜色后,基于三维引擎加载对应部位热力图,实现三维热力图分块渲染。Each time the client obtains the vertex color of the ModelBlock mesh, it loads the heat map of the corresponding part based on the 3D engine to achieve block rendering of the 3D heat map.

系统的具体实现过程与方法相同,不再赘述。The specific implementation process and method of the system are the same and will not be repeated here.

一种计算机设备,该计算机设备包括存储器、处理器及存储在存储器上并可在处理器上运行的计算机程序,处理器执行上述计算机程序时实现如上述的海量网格点三维模型热力图分块快速渲染方法。A computer device includes a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, the method for fast block rendering of a heat map of a three-dimensional model with a large number of grid points as described above is implemented.

一种计算机可读存储介质,该计算机可读存储介质存储有执行如上述的海量网格点三维模型热力图分块快速渲染方法的计算机程序。A computer-readable storage medium stores a computer program for executing the above-mentioned method for fast rendering of a heat map of a three-dimensional model with a large number of grid points.

有益效果:与现有技术相比,本发明提供海量网格点三维模型热力图分块快速渲染方法和系统,将海量网格点三维模型热力图渲染过程分为数据文件预处理、数据文件读取以及热力值匹配计算三个阶段,结合多种技术手段在保证内存消耗和渲染效果的前提下,加速海量网格点三维模型热力图渲染,降低用户等待时延,为海量网格点三维模型热力图分块快速渲染提供技术基础。在数据文件预处理阶段对热力值文件以及模型网格点文件进行切片划分,为后续多线程处理提供数据基础;在数据文件读取阶段采用多线程读取上一步划分的切片文件,在读取过程中构建STRtree以及ModelBlock,并对构建结果进行缓存,保证内存消耗的同时提升整体处理速度以及后续访问效率;在热力值匹配计算阶段,采用多线程将ModelBlock与STRtree进行匹配,计算网格点热力值并映射为网格点颜色,将ModelBlock网格点颜色多次返回客户端实现分块渲染。本发明解决了海量网格点三维模型热力图渲染难度大、渲染速度慢、消耗资源较大等问题,为数字孪生水利工程提供海量网格点三位热力图分块快速渲染技术基础,能够较好地服务于相关行业。Beneficial effect: Compared with the prior art, the present invention provides a method and system for fast block rendering of heat maps of three-dimensional models with massive grid points, and divides the rendering process of heat maps of three-dimensional models with massive grid points into three stages: data file preprocessing, data file reading, and thermal value matching calculation. Combining a variety of technical means, the rendering of heat maps of three-dimensional models with massive grid points is accelerated under the premise of ensuring memory consumption and rendering effect, and the user waiting delay is reduced, providing a technical basis for fast block rendering of heat maps of three-dimensional models with massive grid points. In the data file preprocessing stage, the thermal value file and the model grid point file are sliced and divided to provide a data basis for subsequent multi-threaded processing; in the data file reading stage, multi-threading is used to read the sliced file divided in the previous step, and STRtree and ModelBlock are constructed during the reading process, and the construction results are cached to ensure memory consumption while improving the overall processing speed and subsequent access efficiency; in the thermal value matching calculation stage, multi-threading is used to match ModelBlock with STRtree, the thermal value of the grid point is calculated and mapped to the grid point color, and the ModelBlock grid point color is returned to the client multiple times to realize block rendering. The present invention solves the problems of difficulty in rendering three-dimensional model heat maps of massive grid points, slow rendering speed, and large resource consumption, and provides a technical basis for rapid rendering of three-dimensional heat maps of massive grid points in blocks for digital twin water conservancy projects, which can better serve related industries.

附图说明BRIEF DESCRIPTION OF THE DRAWINGS

图1为本发明实施例的方法架构图;FIG1 is a diagram of a method architecture according to an embodiment of the present invention;

图2为本发明实施例的方法流程图。FIG. 2 is a flow chart of a method according to an embodiment of the present invention.

具体实施方式DETAILED DESCRIPTION

下面结合具体实施例,进一步阐明本发明,应理解这些实施例仅用于说明本发明而不用于限制本发明的范围,在阅读了本发明之后,本领域技术人员对本发明的各种等价形式的修改均落于本申请所附权利要求所限定的范围。The present invention is further explained below in conjunction with specific embodiments. It should be understood that these embodiments are only used to illustrate the present invention and are not used to limit the scope of the present invention. After reading the present invention, various equivalent forms of modifications to the present invention by those skilled in the art all fall within the scope defined by the claims attached to this application.

海量网格点三维模型热力图分块快速渲染方法,通过空间聚类分析、文件分片、多线程处理、策略缓存、分块计算渲染等手段,在保证渲染效果和内存消耗的同时提升海量网格点三维模型热力图渲染效果,为水利工程数字孪生提供基础技术支持。A fast block rendering method for heat maps of three-dimensional models with massive grid points, through spatial clustering analysis, file sharding, multi-threaded processing, strategy caching, block calculation and rendering, etc., can improve the rendering effect of heat maps of three-dimensional models with massive grid points while ensuring the rendering effect and memory consumption, providing basic technical support for digital twins of water conservancy projects.

如图1所示,海量网格点三维模型热力图分块快速渲染方法共分为数据文件预处理、数据文件读取、热力值匹配计算三个阶段,图2所描述的海量网格点三维模型热力图分块快速渲染方法包括如下步骤:As shown in FIG1 , the method for fast rendering of a heat map of a three-dimensional model with massive grid points is divided into three stages: data file preprocessing, data file reading, and thermal value matching calculation. The method for fast rendering of a heat map of a three-dimensional model with massive grid points described in FIG2 includes the following steps:

步骤1)在数据文件预处理阶段,对点位热力值文件进行空间聚类分析,将点位热力值文件表示为如下集合:Step 1) In the data file preprocessing stage, spatial clustering analysis is performed on the point thermal value files, and the point thermal value files are represented as the following set:

Fheat={p1,p2,…,pN}F heat = {p 1 , p 2 ,..., p N }

其中,N为点位热力值文件数据行数,pi=<xi,yi,ziυi>为点位热力值文件第i行点位数据,xi,yi,zi为三维坐标值,υi为对应的热力值,令为第k轮聚类中的第c类,将初始分类定义为随后计算当前聚类轮次各类之间的欧式距离矩阵:Where N is the number of rows of data in the point thermal value file, p i =< xi , yi , zi , υi > is the i-th row of point data in the point thermal value file, xi , yi , zi are the three-dimensional coordinate values, υi is the corresponding thermal value, let For the cth class in the kth round of clustering, the initial classification is defined as Then calculate the Euclidean distance matrix between the categories in the current clustering round:

其中,Nk为第k轮聚类中类的数量,da,b为第a类与第b类间的欧氏距离,表示为第a类与第b类类心间的欧氏距离,类心表示为类内数据均值:Among them, Nk is the number of classes in the kth round of clustering, d a,b is the Euclidean distance between the ath class and the bth class, expressed as the Euclidean distance between the class centers of the ath class and the bth class, and the class center is expressed as the mean of the data within the class:

计算距离矩阵后,假设为其中最小距离,则将两类合并,并进行下一轮聚类操作;聚类结束后,随机剔除每类中的部分点位数据,并将剩余全部点位数据合并,得到稀疏化点位热力值数据 After calculating the distance matrix, assuming is the minimum distance, then and The two categories are merged and the next round of clustering operation is performed; after the clustering is completed, some point data in each category are randomly removed, and all the remaining point data are merged to obtain sparse point thermal value data

步骤2)在数据文件预处理阶段,按照分片数据量相同原则,将稀疏化点位热力值数据做分片处理,设稀疏化点位热力值数据所包含的数据条数为则分片数据所包含的数据条数Sizesplit为:Step 2) In the data file preprocessing stage, according to the principle of the same amount of shard data, the sparse point thermal value data is sharded. The number of data items included is The number of data entries contained in the shard data is:

其中,Numsplit为分片数量,则第k块分片数据表示为:Where Num split is the number of shards, then the kth shard data It is expressed as:

其中,[k*Sizesplit:(k+1)*Sizesplit]为切片操作,表示截取k*Sizesplit索引到(k+1)*Sizesplit索引位置的数据,得到分片数据后,将分片数据存储为分片文件;Among them, [k*Size split :(k+1)*Size split ] is a slicing operation, which means intercepting the data from the k*Size split index to the (k+1)*Size split index position, and after obtaining the shard data, storing the shard data as a shard file;

步骤3)在数据文件预处理阶段,首先将模型网格点文件按照模型部位划分为多个部位切片,以保证后续热力图渲染效果;其次基于近似分片数据量相同原则,将每个部位切片划分为近似大小的模型切片,并存储为多个文件,保证后续不同线程处理的数据量近似相同,以最小化整体处理时间;步骤1)-步骤3)为离线过程,不计入热力图渲染耗时;Step 3) In the data file preprocessing stage, the model grid point file is first divided into multiple part slices according to the model part to ensure the subsequent thermal map rendering effect; secondly, based on the principle of the same amount of data in the approximate slices, each part slice is divided into model slices of similar size and stored as multiple files to ensure that the amount of data processed by different threads is approximately the same, so as to minimize the overall processing time; Step 1)-Step 3) is an offline process and does not include the time consumption of thermal map rendering;

步骤4)在数据文件读取阶段,使用多线程读取步骤1)和步骤2)生成的点位热力值文件切片,并在读取过程中协同构建线程安全的STRtree,首先初始化集合S={s1,s2,...,sN},S中每个元素是仅包含一个热力值点位数据pi的空间对象,对于初始化集合S,有si.mbr=pi.mbr,mbr为空间对象的最小边界立方体;Step 4) In the data file reading stage, use multithreading to read the point thermal value file slices generated in step 1) and step 2), and collaboratively build a thread-safe STRtree during the reading process. First, initialize the set S = {s 1 , s 2 , ..., s N }, each element in S is a spatial object containing only one thermal value point data p i. For the initialization set S, s i .mbr = p i .mbr, mbr is the minimum bounding cube of the spatial object;

构建STRtree,设定STRtree的阈值m,其表示一个非叶子节点所包含的最大子节点数量,随后将集合S划分为个空间对象,若γ=1则将集合S作为根节点,将S中每个元素作为根节点的子节点,构建过程结束;若γ>1则执行空间对象划分操作;Construct STRtree, set the threshold m of STRtree, which represents the maximum number of child nodes contained in a non-leaf node, and then divide the set S into If γ = 1, the set S is taken as the root node, and each element in S is taken as the child node of the root node, and the construction process ends; if γ > 1, the spatial object division operation is performed;

在空间对象划分中,表示在每个方向上的划分次数,将S中每个元素si在x方向上升序排序,并平均地划分为ε份;对x方向上的每份划分结果,在y方向上执行上述划分操作;最后对y方向上的每份划分结果,在z方向上执行上述划分操作,完成空间对象划分,继续构建STRtree;In the spatial object division, Indicates the number of divisions in each direction. Sort each element si in S in ascending order in the x direction and divide it into ε parts evenly. For each division result in the x direction, perform the above division operation in the y direction. Finally, for each division result in the y direction, perform the above division operation in the z direction to complete the spatial object division and continue to build the STRtree.

步骤5)在数据文件读取阶段,使用多线程读取步骤3)生成的模型网格点文件切片,构建多块ModelBlock,步骤4)与步骤5)并行进行,提升处理速度;Step 5) In the data file reading stage, use multi-threading to read the model grid point file slices generated in step 3) to construct multiple ModelBlocks, and step 4) and step 5) are performed in parallel to improve the processing speed;

步骤6)在数据文件读取阶段,采用LRU缓存策略对STRtree以及ModelBlock构建结果进行缓存处理,首先定义缓存队列Ql,其中l为缓存容量,将STRtree以及ModelBlock构建结果统称为元素e;Step 6) In the data file reading phase, the LRU cache strategy is used to cache the STRtree and ModelBlock construction results. First, a cache queue Q l is defined, where l is the cache capacity, and the STRtree and ModelBlock construction results are collectively referred to as elements e;

在构建e前首先查询Ql中是否存在元素e,若存在则直接获取使用,跳过元素e的构建过程,并将元素e置于队列Ql的头部,表示最近访问;否则执行元素e构建过程;Before constructing e, first check whether element e exists in Q l . If it exists, directly obtain and use it, skip the construction process of element e, and put element e at the head of queue Q l to indicate the most recent access; otherwise, execute the construction process of element e;

在对元素e进行构建后,若队列Ql未满,则将元素e插入队首;若队列Ql已满则将队尾元素移除并将元素e插入队首;After constructing element e, if queue Q l is not full, element e is inserted at the head of the queue; if queue Q l is full, the tail element is removed and element e is inserted at the head of the queue;

步骤7)由步骤5)中的每个线程继续处理对应的ModelBlock,将其与STRtree进行坐标值匹配,假设ModelBlock包含m个三维网格顶点信息,即M={g1,g2,...,gm},其中gj=<xj,yj,zj>为网格顶点坐标,首先计算ModelBlock的最小边界立方体:Step 7) Each thread in step 5) continues to process the corresponding ModelBlock and matches its coordinate value with the STRtree. Assuming that ModelBlock contains m three-dimensional mesh vertex information, that is, M = {g 1 , g 2 , ..., g m }, where g j = <x j , y j , z j > is the mesh vertex coordinate, first calculate the minimum bounding cube of ModelBlock:

M.mbr={min(X),max(X),min(Y),max(Y),min(Z),max(Z)}M.mbr={min(X), max(X), min(Y), max(Y), min(Z), max(Z)}

其中X、Y和Z分别为ModelBlock的x、y、z坐标集合,遍历STRtree节点,将ModelBlock的最小边界立方体与节点的最小边界立方体进行匹配,若两者相交则将节点中空间对象包括的热力值点位数据置入结果集R={p1,p2,...,pn},将ModelBlock中每个三维网格顶点与结果集R进行匹配,更新三维网格顶点gj=<gj.x,gj.y,gj.z,po.υ>,即为其匹配热力值,其中po∈R满足:Where X, Y and Z are the x, y and z coordinate sets of ModelBlock respectively. Traverse the STRtree nodes and match the minimum bounding cube of ModelBlock with the minimum bounding cube of the node. If the two intersect, place the thermal value point data included in the spatial object in the node into the result set R = {p 1 , p 2 , ..., p n }. Match each 3D mesh vertex in ModelBlock with the result set R, and update the 3D mesh vertex g j = <g j .x, g j .y, g j .z, p o .υ>, that is, match the thermal value for it, where p o ∈ R satisfies:

定义ModelBlock所有网格顶点热力值中最大值、最小值分别为vmax和vmin,使用蓝色对应vmin,使用红色对应vmax,对于gj∈M,定义则网格顶点颜色映射公式如下:Define the maximum and minimum values of the thermal values of all mesh vertices in ModelBlock as vmax and vmin respectively. Use blue to correspond to vmin and red to correspond to vmax . For gj∈M , define The mesh vertex color mapping formula is as follows:

其中,redj、greenj以及bluej分别为网格顶点gj的红色、绿色和蓝色分量值;Among them, red j , green j and blue j are the red, green and blue component values of the mesh vertex g j respectively;

步骤8)若步骤7)中某一线程处理完毕,则将对应ModelBlock的网格颜色返回客户端进行渲染,实现分块渲染效果。Step 8) If a thread in step 7) is processed, the grid color of the corresponding ModelBlock is returned to the client for rendering to achieve a block rendering effect.

海量网格点三维模型热力图分块快速渲染方法系统,包括用于模型网格点热力值匹配计算的服务器和基于网格顶点颜色进行热力图渲染的客户端。A method system for fast rendering of heat maps of three-dimensional models with massive grid points in blocks includes a server for matching and calculating heat values of model grid points and a client for rendering heat maps based on grid vertex colors.

在数据文件预处理阶段,服务器使用空间聚类分析和等大小分片策略生成点位热力值文件分片,使用部位分片策略和近似大小分片策略生成模型网格点文件分片;In the data file preprocessing stage, the server uses spatial clustering analysis and equal-size sharding strategy to generate point thermal value file shards, and uses position sharding strategy and approximate-size sharding strategy to generate model grid point file shards;

在数据文件读取阶段,使用多线程读取点位热力值文件分片,在读取过程中构建线程安全的STRtree;使用多线程读取模型网格点文件分片,构建多个模型分块ModelBlock;在构建结束后,对STRtree和ModelBlock构建结果进行缓存处理;In the data file reading stage, multi-threading is used to read the point thermal value file shards, and a thread-safe STRtree is constructed during the reading process; multi-threading is used to read the model grid point file shards and construct multiple model blocks ModelBlock; after the construction is completed, the STRtree and ModelBlock construction results are cached;

在热力值匹配计算阶段,多线程将其构建的ModelBlock与STRtree进行坐标值匹配,为每个ModelBlock设置网格点热力值,并基于网格点热力值映射网格颜色,在每块ModelBlock匹配计算结束后,将其网格顶点颜色返回客户端;In the thermal value matching calculation phase, multithreading matches the coordinate values of the constructed ModelBlock with the STRtree, sets the grid point thermal value for each ModelBlock, and maps the grid color based on the grid point thermal value. After the matching calculation of each ModelBlock is completed, the grid vertex color is returned to the client;

客户端每次获取ModelBlock网格顶点颜色后,基于三维引擎加载对应部位热力图,实现三维热力图分块渲染。Each time the client obtains the vertex color of the ModelBlock mesh, it loads the heat map of the corresponding part based on the 3D engine to achieve block rendering of the 3D heat map.

显然,本领域的技术人员应该明白,上述的本发明实施例的海量网格点三维模型热力图分块快速渲染方法各步骤或海量网格点三维模型热力图分块快速渲染系统各模块可以用通用的计算装置来实现,它们可以集中在单个的计算装置上,或者分布在多个计算装置所组成的网络上,可选地,它们可以用计算装置可执行的程序代码来实现,从而,可以将它们存储在存储装置中由计算装置来执行,并且在某些情况下,可以以不同于此处的顺序执行所示出或描述的步骤,或者将它们分别制作成各个集成电路模块,或者将它们中的多个模块或步骤制作成单个集成电路模块来实现。这样,本发明实施例不限制于任何特定的硬件和软件结合。Obviously, those skilled in the art should understand that the various steps of the method for rapid rendering of a heat map of a three-dimensional model with a large number of grid points or the various modules of the system for rapid rendering of a heat map of a three-dimensional model with a large number of grid points in the above-mentioned embodiment of the present invention can be implemented by a general computing device, which can be concentrated on a single computing device or distributed on a network composed of multiple computing devices. Optionally, they can be implemented by executable program codes of computing devices, so that they can be stored in a storage device and executed by the computing device, and in some cases, the steps shown or described can be executed in a different order from that herein, or they can be made into individual integrated circuit modules respectively, or multiple modules or steps therein can be made into a single integrated circuit module for implementation. In this way, the embodiments of the present invention are not limited to any specific combination of hardware and software.

Claims (6)

1.一种海量网格点三维模型热力图分块快速渲染方法,其特征在于,该方法包括数据文件预处理、数据文件读取以及热力值匹配计算三个阶段,采用多种手段在保证热力图渲染效果的同时提升海量网格点三维模型热力图渲染速度,所述方法包括以下步骤:1. A method for fast rendering of heat maps of three-dimensional models with massive grid points by blocks, characterized in that the method includes three stages: data file preprocessing, data file reading, and thermal value matching calculation. A variety of means are used to improve the rendering speed of heat maps of three-dimensional models with massive grid points while ensuring the rendering effect of the heat map. The method includes the following steps: 步骤1)在数据文件预处理阶段,对点位热力值文件中的点位进行空间聚类分析,压缩同一区域内相似热力值点位数量,生成稀疏化点位热力值数据;Step 1) In the data file preprocessing stage, spatial clustering analysis is performed on the points in the point thermal value file to compress the number of points with similar thermal values in the same area and generate sparse point thermal value data; 步骤2)在数据文件预处理阶段,按照分片数据量相同原则,将稀疏化点位热力值数据存储为多个文件分片;Step 2) In the data file preprocessing stage, according to the principle of equal data volume of the shards, the sparse point thermal value data is stored as multiple file shards; 步骤3)在数据文件预处理阶段,首先将模型网格点文件按照模型部位划分为多个部位切片;其次基于近似分片数据量相同原则,将每个部位切片存储为多个文件分片;Step 3) In the data file preprocessing stage, the model grid point file is first divided into multiple part slices according to the model parts; secondly, based on the principle of the same amount of data in the approximate slices, each part slice is stored as multiple file slices; 步骤4)在数据文件读取阶段,使用多线程读取点位热力值文件切片,多个线程在读取过程中协同构建空间索引树STRtree;Step 4) In the data file reading stage, multiple threads are used to read the point thermal value file slices, and multiple threads collaborate to build a spatial index tree STRtree during the reading process; 步骤5)在数据文件读取阶段,使用多线程读取步骤3)中的模型网格点文件切片,构建多块模型分块ModelBlock;Step 5) In the data file reading stage, use multi-threading to read the model grid point file slices in step 3) to construct multiple model blocks ModelBlock; 步骤6)在数据文件读取阶段,对构建完毕的STRtree以及ModelBlock进行缓存处理;Step 6) During the data file reading phase, the constructed STRtree and ModelBlock are cached; 步骤7)在热力值匹配计算阶段,使用多线程处理对应的ModelBlock,将ModelBlock与STRtree进行坐标值匹配以计算网格顶点热力值并映射网格顶点颜色;Step 7) In the thermal value matching calculation stage, use multithreading to process the corresponding ModelBlock, match the coordinate values of the ModelBlock and the STRtree to calculate the thermal value of the mesh vertex and map the mesh vertex color; 步骤8)若步骤7)中某一线程处理完毕,则将对应ModelBlock的网格颜色返回客户端进行渲染,实现分块渲染效果;Step 8) If a thread in step 7) is processed, the grid color of the corresponding ModelBlock is returned to the client for rendering to achieve a block rendering effect; 所述步骤4)中STRtree的具体构建过程如下:The specific construction process of STRtree in step 4) is as follows: 首先初始化集合S={s1,s2,...,sN},S中每个元素是仅包含一个热力值点位数据pi的空间对象,对于初始化集合S,有si.mbr=pi.mbr,mbr为空间对象的最小边界立方体;First, initialize the set S = {s 1 , s 2 , ..., s N }, each element in S is a spatial object containing only one thermal value point data p i , for the initialization set S, s i .mbr = p i .mbr, mbr is the minimum bounding cube of the spatial object; 构建STRtree,设定STRtree的阈值m,其表示一个非叶子节点所包含的最大子节点数量,随后将集合S划分为个空间对象,若γ=1则将集合S作为根节点,将S中每个元素作为根节点的子节点,构建过程结束;若γ>1则执行空间对象划分操作;Construct STRtree, set the threshold m of STRtree, which represents the maximum number of child nodes contained in a non-leaf node, and then divide the set S into If γ = 1, the set S is taken as the root node, and each element in S is taken as the child node of the root node, and the construction process ends; if γ > 1, the spatial object division operation is performed; 在空间对象划分中,表示在每个方向上的划分次数,将S中每个元素si在x方向上升序排序,并平均地划分为ε份;对x方向上的每份划分结果,在y方向上执行上述划分操作;最后对y方向上的每份划分结果,在z方向上执行上述划分操作,完成空间对象划分,继续构建STRtree;In the spatial object division, Indicates the number of divisions in each direction. Sort each element si in S in ascending order in the x direction and divide it into ε parts evenly. For each division result in the x direction, perform the above division operation in the y direction. Finally, for each division result in the y direction, perform the above division operation in the z direction to complete the spatial object division and continue to build the STRtree. 步骤6)在数据文件读取阶段,采用LRU缓存策略对STRtree以及ModelBlock构建结果进行缓存处理,首先定义缓存队列Ql,其中l为缓存容量,将STRtree以及ModelBlock构建结果统称为元素e;Step 6) In the data file reading phase, the LRU cache strategy is used to cache the STRtree and ModelBlock construction results. First, a cache queue Q l is defined, where l is the cache capacity, and the STRtree and ModelBlock construction results are collectively referred to as elements e; 在构建e前首先查询Ql中是否存在元素e,若存在则直接获取使用,跳过元素e的构建过程,并将元素e置于队列Ql的头部,表示最近访问;否则执行元素e构建过程;Before constructing e, first check whether element e exists in Q l . If it exists, directly obtain and use it, skip the construction process of element e, and put element e at the head of queue Q l to indicate the most recent access; otherwise, execute the construction process of element e; 在对元素e进行构建后,若队列Ql未满,则将元素e插入队首;若队列Ql已满则将队尾元素移除并将元素e插入队首;After constructing element e, if queue Q l is not full, element e is inserted at the head of the queue; if queue Q l is full, the tail element is removed and element e is inserted at the head of the queue; 步骤7)由步骤5)中的每个线程继续处理对应的ModelBlock,将其与STRtree进行坐标值匹配,设ModelBlock包含m个三维网格顶点信息,即N={g1,g2,...,gm},其中gj=<xj,yj,zj>为网格顶点坐标,首先计算ModelBlock的最小边界立方体,遍历STRtree节点,将ModelBlock的最小边界立方体与节点的最小边界立方体进行匹配,若两者相交则将节点中空间对象包括的热力值点位数据置入结果集R={p1,p2,...,pn},将ModelBlock中每个三维网格顶点与结果集R进行匹配,更新三维网格顶点gj=<gj.x,gj.y,gj.z,po.v>,即为其匹配热力值,其中po∈R满足:Step 7) Each thread in step 5) continues to process the corresponding ModelBlock and matches its coordinate value with the STRtree. Assume that ModelBlock contains m three-dimensional mesh vertex information, that is, N = {g 1 , g 2 , ..., g m }, where g j = <x j , y j , z j > is the mesh vertex coordinate. First, calculate the minimum bounding cube of ModelBlock, traverse the STRtree nodes, and match the minimum bounding cube of ModelBlock with the minimum bounding cube of the node. If the two intersect, place the thermal value point data included in the spatial object in the node into the result set R = {p 1 , p 2 , ..., p n }, match each three-dimensional mesh vertex in ModelBlock with the result set R, and update the three-dimensional mesh vertex g j = <g j .x, g j .y, g j .z, p o .v>, that is, match its thermal value, where p o ∈ R satisfies: 定义ModelBlock所有网格顶点热力值中最大值、最小值分别为vmax和vmin,使用蓝色对应vmin,使用红色对应vmax,对于gj∈M,定义则网格顶点颜色映射公式如下:Define the maximum and minimum values of the thermal values of all mesh vertices in ModelBlock as v max and v min respectively. Use blue to correspond to v min and red to correspond to v max . For g j ∈ M, define The mesh vertex color mapping formula is as follows: 其中,redj、greenj以及bluej分别为网格顶点gj的红色、绿色和蓝色分量值。Among them, red j , green j and blue j are the red, green and blue component values of the mesh vertex g j respectively. 2.根据权利要求1所述的海量网格点三维模型热力图分块快速渲染方法,其特征在于,所述步骤1)中对点位热力值文件的点位进行空间聚类分析的具体步骤如下:2. The method for fast rendering of heat maps of three-dimensional models of massive grid points according to claim 1 is characterized in that the specific steps of performing spatial clustering analysis on the points of the point heat value file in step 1) are as follows: 将点位热力值文件表示为如下集合:The point thermal value file is represented as the following set: Fheat={p1,p2,…,pv}F heat ={p 1 , p 2 ,…,p v } 其中,N为点位热力值文件数据行数,pi=<xi,yi,zi,vi>为点位热力值文件第i行点位数据,xi,yi,zi为三维坐标值,vi为对应的热力值,令为第k轮聚类中的第c类,将初始分类定义为随后计算当前聚类轮次各类之间的欧式距离矩阵:Where N is the number of rows of data in the point thermal value file, p i = < xi , yi , zi , vi > is the i-th row of point data in the point thermal value file, x i , yi , zi are the three-dimensional coordinate values, and vi is the corresponding thermal value. For the cth class in the kth round of clustering, the initial classification is defined as Then calculate the Euclidean distance matrix between the categories in the current clustering round: 其中,Nk为第k轮聚类中类的数量,da,b为第a类与第b类间的欧氏距离,表示为第a类与第b类类心间的欧氏距离,类心表示为类内数据均值:Among them, Nk is the number of classes in the kth round of clustering, d a,b is the Euclidean distance between the ath class and the bth class, expressed as the Euclidean distance between the class centers of the ath class and the bth class, and the class center is expressed as the mean of the data within the class: 计算距离矩阵后,假设为其中最小距离,则将两类合并,并进行下一轮聚类操作;聚类结束后,随机剔除每类中的部分点位数据,并将剩余全部点位数据合并,得到稀疏化点位热力值数据 After calculating the distance matrix, assuming is the minimum distance, then and The two categories are merged and the next round of clustering operation is performed; after the clustering is completed, some point data in each category are randomly removed, and all the remaining point data are merged to obtain sparse point thermal value data 3.根据权利要求1所述的海量网格点三维模型热力图分块快速渲染方法,其特征在于,所述步骤2)中对稀疏化点位热力值数据做分片处理的具体步骤如下:3. The method for fast rendering of a heat map of a massive grid point three-dimensional model according to claim 1 is characterized in that the specific steps of performing slicing processing on the sparse point heat value data in step 2) are as follows: 设稀疏化点位热力值数据所包含的数据条数为则分片数据所包含的数据条数Sizesplit为:Sparse point thermal value data The number of data items included is The number of data entries contained in the shard data is: 其中,Numsplit为分片数量,则第k块分片数据表示为:Where Num split is the number of shards, then the kth shard data It is expressed as: 其中,[k*Sizesplit:(k+1)*Sizesplit]为切片操作,表示截取k*Sizesplit索引到(k+1)*Sizesplit索引位置的数据,得到分片数据后,将分片数据存储为分片文件。[k*Size split :(k+1)*Size split ] is a slicing operation, which means intercepting the data at the position from the k*Size split index to the (k+1)*Size split index, and after obtaining the slicing data, storing the slicing data as a slicing file. 4.一种实现权利要求1所述方法的海量网格点三维模型热力图分块快速渲染系统,其特征在于,包括用于模型网格点热力值匹配计算的服务器和基于网格顶点颜色进行热力图渲染的客户端;4. A system for fast rendering of heat maps of three-dimensional models with a large number of grid points by blocks for implementing the method described in claim 1, characterized in that it includes a server for matching and calculating the heat values of model grid points and a client for rendering heat maps based on grid vertex colors; 在数据文件预处理阶段,服务器使用空间聚类分析和等大小分片策略生成点位热力值文件分片,使用部位分片策略和近似大小分片策略生成模型网格点文件分片;In the data file preprocessing stage, the server uses spatial clustering analysis and equal-size sharding strategy to generate point thermal value file shards, and uses position sharding strategy and approximate-size sharding strategy to generate model grid point file shards; 在数据文件读取阶段,使用多线程读取点位热力值文件分片,在读取过程中构建空间索引树STRtree;使用多线程读取模型网格点文件分片,构建多个模型分块ModelBlock;在构建结束后,对STRtree和ModelBlock构建结果进行缓存处理;In the data file reading stage, multi-threading is used to read the point thermal value file shards, and the spatial index tree STRtree is built during the reading process; multi-threading is used to read the model grid point file shards and build multiple model blocks ModelBlock; after the construction is completed, the STRtree and ModelBlock construction results are cached; 在热力值匹配计算阶段,多线程将其构建的ModelBlock与STRtree进行坐标值匹配,为每个ModelBlock设置网格点热力值,并基于网格点热力值映射网格颜色,在每块ModelBlock匹配计算结束后,将其网格顶点颜色返回客户端;In the thermal value matching calculation phase, multithreading matches the coordinate values of the constructed ModelBlock with the STRtree, sets the grid point thermal value for each ModelBlock, and maps the grid color based on the grid point thermal value. After the matching calculation of each ModelBlock is completed, the grid vertex color is returned to the client; 客户端每次获取ModelBlock网格顶点颜色后,基于三维引擎加载对应部位热力图,实现三维热力图分块渲染。Each time the client obtains the vertex color of the ModelBlock mesh, it loads the heat map of the corresponding part based on the 3D engine to achieve block rendering of the 3D heat map. 5.一种计算机设备,其特征在于:该计算机设备包括存储器、处理器及存储在存储器上并可在处理器上运行的计算机程序,处理器执行上述计算机程序时实现如权利要求1-3中任一项所述的海量网格点三维模型热力图分块快速渲染方法。5. A computer device, characterized in that: the computer device includes a memory, a processor and a computer program stored in the memory and executable on the processor, and when the processor executes the computer program, a method for rapid block rendering of a heat map of a three-dimensional model of a massive grid point as described in any one of claims 1-3 is implemented. 6.一种计算机可读存储介质,其上存储有计算机程序/指令,其特征在于:该计算机程序/指令被处理器执行时实现权利要求1-3任一项所述方法的步骤。6. A computer-readable storage medium having a computer program/instruction stored thereon, wherein the computer program/instruction, when executed by a processor, implements the steps of the method according to any one of claims 1 to 3.
CN202311814998.4A 2023-12-26 2023-12-26 A fast rendering method for heat map of 3D model with massive grid points Active CN117745910B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202311814998.4A CN117745910B (en) 2023-12-26 2023-12-26 A fast rendering method for heat map of 3D model with massive grid points

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202311814998.4A CN117745910B (en) 2023-12-26 2023-12-26 A fast rendering method for heat map of 3D model with massive grid points

Publications (2)

Publication Number Publication Date
CN117745910A CN117745910A (en) 2024-03-22
CN117745910B true CN117745910B (en) 2024-08-16

Family

ID=90260787

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202311814998.4A Active CN117745910B (en) 2023-12-26 2023-12-26 A fast rendering method for heat map of 3D model with massive grid points

Country Status (1)

Country Link
CN (1) CN117745910B (en)

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN118887072B (en) * 2024-08-12 2025-05-09 河海大学 A method for processing and rendering slice images of ocean grid data
CN119379880B (en) * 2024-12-27 2025-03-25 星际空间(天津)科技发展有限公司 Three-dimensional data visualization rendering method and visualization rendering engine system

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112417233A (en) * 2020-12-16 2021-02-26 湖北大学 A method and system for generating heat map considering spatial density differences
CN114357694A (en) * 2021-11-17 2022-04-15 国电南瑞科技股份有限公司 A digital twin method and device for substation based on large-scale point cloud

Family Cites Families (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
IL202460A (en) * 2009-12-01 2013-08-29 Rafael Advanced Defense Sys Method and system of generating a three-dimensional view of a real scene
CN114637026A (en) * 2022-03-18 2022-06-17 福建和盛高科技产业有限公司 A method for online monitoring and intelligent inspection of transmission lines based on three-dimensional simulation technology
CN115035211B (en) * 2022-06-06 2025-07-15 西安塔力科技有限公司 Visual rendering method for generating digital twin thermal image projection fusion based on WebGL
CN115965747A (en) * 2023-01-04 2023-04-14 中电鸿信信息科技有限公司 Method for rapidly generating and rendering three-dimensional thermodynamic diagram
CN116740202A (en) * 2023-06-09 2023-09-12 中国电力工程顾问集团中南电力设计院有限公司 A lightweight processing method for PDMS three-dimensional models of thermal power plants

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112417233A (en) * 2020-12-16 2021-02-26 湖北大学 A method and system for generating heat map considering spatial density differences
CN114357694A (en) * 2021-11-17 2022-04-15 国电南瑞科技股份有限公司 A digital twin method and device for substation based on large-scale point cloud

Also Published As

Publication number Publication date
CN117745910A (en) 2024-03-22

Similar Documents

Publication Publication Date Title
CN117745910B (en) A fast rendering method for heat map of 3D model with massive grid points
CN110675480B (en) Method and apparatus for acquiring sampling position of texture operation
CN106951926A (en) The deep learning systems approach and device of a kind of mixed architecture
CN101281654A (en) A large-scale complex 3D scene processing method based on octree
CN110990612B (en) Method and terminal for rapidly displaying vector big data
US12141229B2 (en) Techniques for accelerating matrix multiplication computations using hierarchical representations of sparse matrices
US20220406016A1 (en) Automated weighting generation for three-dimensional models
CN106447768A (en) Three-dimensional model parallel drawing method suitable for three-dimensional scene
US20230298237A1 (en) Data processing method, apparatus, and device and storage medium
CN111985597B (en) Model compression method and device
CN114596423A (en) Model rendering method, device and computer equipment based on virtual scene meshing
CN111583378B (en) Virtual asset processing method and device, electronic equipment and storage medium
CN119378525A (en) A method, device and medium for processing structured data
CN119075304A (en) Virtual scene rendering method, device, electronic device and storage medium
US20240212282A1 (en) Image rendering method and apparatus, device, and medium
CN117237503B (en) Geographic element data accelerated rendering and device
WO2024183288A1 (en) Shadow rendering method and apparatus, computer device, and storage medium
CN116977592A (en) Three-dimensional structured reconstruction method, device and computer medium based on winding number
Marques et al. A cloud computing based framework for general 2D and 3D cellular automata simulation
CN114332405A (en) A real-time display method for ultra-high-definition 3D scanning models of cultural relics
Zhang et al. FastPlane: A Fully Convolutional Network for Real-time 3D Plane Segmentation
US12211080B2 (en) Techniques for performing matrix computations using hierarchical representations of sparse matrices
US20250037186A1 (en) Techniques for performing matrix computations using hierarchical representations of sparse matrices
US11709812B2 (en) Techniques for generating and processing hierarchical representations of sparse matrices
CN118551465B (en) Building group level model construction method, apparatus, device, medium and program product

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant