Three-dimensional plot drawing method and device based on GIS and digital twin integration
Through the three-dimensional plot drawing method based on the integration of GIS and digital twins, the shortcomings of traditional GIS technology in processing high-precision data and visual effects are solved, and convenient drawing and efficient rendering of three-dimensional plots are achieved, improving user interaction experience and land The physical interaction capability of the block.
Patent Information
- Application Number
- CN202411320318.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-23
- Publication Date
- 2024-11-26
- Estimated Expiration
- 2044-09-23
AI Technical Summary
Traditional GIS technology has shortcomings in processing high-precision data, multi-source data fusion, visual effects and interactive experience, expansion and integration, and it is difficult to meet the needs of digital twins for complex data processing, realistic visual effects and efficient interactive experience, and may Increase development and maintenance costs.
Using the three-dimensional plot drawing method based on the integration of GIS and digital twins, a three-dimensional plot model is generated by creating foundation center points, ray detection, Vector2 list processing, triangulation processing and collider components to simplify the three-dimensional plot drawing process and improve convenience and efficiency.
It realizes the convenience and efficiency of drawing three-dimensional plots, provides an intuitive and easy-to-use operation interface, and customizes plot properties without professional GIS knowledge, improving the rendering quality and physical interaction capabilities of three-dimensional plots.
Smart Images

Figure CN118840498B_ABST
Abstract
Description
Technical Field
[0001] The present application belongs to the field of geographic information system technology, and specifically relates to a three-dimensional plot drawing method and device based on the fusion of GIS and digital twins. Background Art
[0002] In the development history of traditional GIS technology, the focus has been on the integrated management of three-dimensional data, with limited investment in rendering effects. In order to improve rendering capabilities, traditional GIS technology makes full use of digital twin three-dimensional rendering technology. New layers are added through the layer editor management tool, which provides editing functions, and can customize the properties, styles, and interaction methods of layers with other layers, thereby creating accurate, detailed, and expressive GIS maps.
[0003] However, after the combination of GIS and digital twins, traditional layer editors have obvious deficiencies in processing high-precision data, multi-source data fusion, visual effects and interactive experience, scalability and integration, etc., which makes it difficult to meet the digital twins' requirements for complex data processing, realistic visual effects and efficient interactive experience, and may also increase development and maintenance costs. Summary of the invention
[0004] In order to solve at least one technical problem existing in the background technology, the present application provides a three-dimensional plot drawing method based on the fusion of GIS and digital twin, which simplifies the process of three-dimensional plot drawing and can improve the convenience and efficiency of three-dimensional plot drawing.
[0005] The technical solution adopted in this application is:
[0006] The first embodiment of the present application provides a three-dimensional land plot drawing method based on the fusion of GIS and digital twin, comprising:
[0007] Creating a foundation center point, and generating a custom model including mesh information and material information based on the foundation center point, and defining the custom model as a foundation;
[0008] When the ray detects an object and the ray collides with the foundation, a sphere object is instantiated at the collision point, coordinate information of the sphere object is converted into Vector2 type coordinate information, and the Vector2 type coordinate information is added to a Vector2 list, and the range of the drawn three-dimensional plot is determined based on at least three points in the Vector2 list that are not on the same straight line;
[0009] Triangulate the two-dimensional vectors in the Vector2 list to obtain triangle indices, create a three-dimensional vertex array, and construct a three-dimensional mesh based on the three-dimensional vertex array and the triangle indices, instantiate a mesh surface and place it at a preset position in the three-dimensional land parcel range, offset the mesh surface along the Z axis so that the mesh surface generates a thickness value in the Z axis direction, calculate the normal, boundary volume and tangent of the mesh surface, and load the mesh surface into the mesh rendering component in the three-dimensional land parcel model, and add a collision body component to the three-dimensional land parcel model to generate the bottom surface of the three-dimensional land parcel;
[0010] Create an inverse vertex array to generate vertex data required for the upper and lower surfaces and side meshes of the three-dimensional plot, define four vertices on the side of the three-dimensional plot based on the vertex data, create a side mesh based on the four vertices, and load the side mesh into the mesh rendering component in the three-dimensional plot model, and add a collision body component to the three-dimensional plot model to generate a closed geometric body of the three-dimensional plot;
[0011] The properties of the three-dimensional land parcel closed geometry are edited.
[0012] According to an embodiment of the present application, the creation of the foundation center point, and the generation of a custom model including mesh information and material information based on the foundation center point, and the definition of the custom model as the foundation, are specifically as follows:
[0013] The foundation center point includes location information and label information, and uses Vector2 type data to represent the longitude and latitude of the foundation center point.
[0014] According to an embodiment of the present application, the two-dimensional vectors in the Vector2 list are triangulated to obtain triangle indexes, specifically:
[0015] Determine the convex triangle formed by a vertex and its adjacent edges in a polygon;
[0016] Select one of the vertices and remove the convex triangle corresponding to the vertex until the number of the convex triangle is one.
[0017] According to an embodiment of the present application, the creation of the reverse vertex array to generate vertex data required for the upper and lower surfaces and side meshes of the three-dimensional plot is specifically as follows:
[0018] Define the three vertices of a triangle using vertex indices, following either clockwise or counter-clockwise order to ensure the correct facing direction.
[0019] According to an embodiment of the present application, the normal, boundary volume and tangent of the mesh surface are calculated, and the mesh surface is loaded into a mesh rendering component in a three-dimensional land parcel model, specifically:
[0020] Calculating the illumination parameters of the mesh surface based on the normal line, calculating the size and shape of the mesh surface based on the boundary volume, and calculating the texture mapping of the mesh surface based on the tangent line;
[0021] The mesh surface is converted into a visible three-dimensional graphic through the mesh rendering component, and the visible three-dimensional graphic includes material parameters, color parameters and texture parameters.
[0022] According to an embodiment of the present application, adding a collision body component to the three-dimensional land parcel model is specifically:
[0023] Associating the collision volume component with the mesh surface, and making the collision volume component cover the visible part of the mesh surface;
[0024] Wherein, the collision body component includes a box body and / or a sphere.
[0025] According to an embodiment of the present application, the editing of the attributes of the three-dimensional land parcel closed geometric body is specifically:
[0026] Update the height, color and transparency of the three-dimensional land parcel closed geometry.
[0027] The second embodiment of the present application provides a three-dimensional land plot drawing device based on the fusion of GIS and digital twin, including:
[0028] A creation module, used for creating a foundation center point, and generating a custom model including mesh information and material information based on the foundation center point, and defining the custom model as a foundation;
[0029] A determination module, for detecting an object by ray and when the ray collides with the foundation, instantiating a spherical object at the collision point, converting the coordinate information of the spherical object into Vector2 type coordinate information, adding the Vector2 type coordinate information to a Vector2 list, and determining the range of the drawn three-dimensional plot based on at least three points in the Vector2 list that are not on the same straight line;
[0030] A first generation module is used to triangulate the two-dimensional vectors in the Vector2 list to obtain triangle indexes, create a three-dimensional vertex array, and construct a three-dimensional mesh based on the three-dimensional vertex array and the triangle indexes, instantiate a mesh surface and place it at a preset position in the three-dimensional land parcel range, offset the mesh surface along the Z axis so that the mesh surface generates a thickness value in the Z axis direction, calculate the normal, boundary volume and tangent of the mesh surface, and load the mesh surface into a mesh rendering component in the three-dimensional land parcel model, and add a collision body component to the three-dimensional land parcel model to generate a bottom surface of the three-dimensional land parcel;
[0031] The second generation module is used to create an inverse vertex array to generate vertex data required for the upper and lower surfaces and side meshes of the three-dimensional plot, define four vertices on the side of the three-dimensional plot based on the vertex data, create a side mesh based on the four vertices, and load the side mesh into a mesh rendering component in the three-dimensional plot model, and add a collision body component to the three-dimensional plot model to generate a closed geometric body of the three-dimensional plot;
[0032] The attribute editing module is used to edit the attributes of the three-dimensional land parcel closed geometric body.
[0033] An embodiment of the third aspect of the present application provides an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the program, the three-dimensional plot drawing method based on the fusion of GIS and digital twins as described in any embodiment of the first aspect as described above is implemented.
[0034] The fourth aspect embodiment of the present application provides a non-volatile computer storage medium having computer executable instructions stored thereon. When the computer program is executed by a processor, a three-dimensional plot drawing method based on the fusion of GIS and digital twins as described in any embodiment of the first aspect described above is implemented.
[0035] Due to the adoption of the above technical solution, the beneficial effects achieved by this application are as follows:
[0036] According to the three-dimensional plot drawing method based on the fusion of GIS and digital twin provided by the first embodiment of the present application, first, a foundation center point is created, and a custom model containing grid information and material information is generated based on this, which is defined as the foundation. The foundation center point provides a starting point for three-dimensional plot drawing, which helps to accurately locate subsequent operations. The custom model serves as the foundation and contains the necessary grid and material information, providing a solid foundation for subsequent three-dimensional plot drawing. In the second step, ray detection technology is used. When the ray collides with the foundation, a sphere object is instantiated at the collision point, and the coordinate information of the sphere object is converted into Vector2 type coordinate information. , and then add this information to the Vector2 list, and determine the 3D plot range based on at least three points in the list that are not on the same line. Users can determine the boundaries of the 3D plot through intuitive interactive methods (such as clicking or dragging), which makes the selection of plots more flexible and convenient. At least three points that are not on the same line can ensure that the selected area is a closed polygon, avoiding errors caused by straight lines; in the third step, the 2D vectors in the Vector2 list are triangulated, the triangle index is obtained, a 3D vertex array is created, and a 3D mesh is constructed based on the 3D vertex array and triangle index. The triangulation process makes the mesh more Adding smoothing helps improve rendering quality, instantiating the mesh surface and placing it at a preset position within the range of the three-dimensional plot, offsetting the mesh surface along the Z axis to generate thickness, giving thickness to the plane mesh through the offset on the Z axis, realizing the transition from two-dimensional to three-dimensional, calculating the normal, boundary volume and tangent of the mesh surface, loading the mesh surface into the mesh rendering component of the three-dimensional plot model, and adding a collision body component to generate the bottom surface. Adding a collision body component can simulate physical behaviors in the real world, such as collision detection, which is very important for simulation and planning; in the fourth step, create an inverse vertex array to generate the vertex data required for the upper, bottom and side meshes, and define the sides of the three-dimensional plot Four vertices are used to create a side mesh and load it into the mesh rendering component. A collision body component is added to the three-dimensional land parcel model to generate a closed geometry. The side-enclosed geometry is generated to ensure the integrity of the land parcel and facilitate further expansion and modification. The collision detection function of the three-dimensional land parcel is added to make it more realistic in the virtual environment and conducive to user interactive exploration. Finally, the properties of the three-dimensional land parcel closed geometry are edited, such as material, color, etc., allowing users to adjust the appearance of the land parcel according to their needs, enhancing the practicality and aesthetics of the land parcel. By editing the properties, the expressiveness of the land parcel in different application scenarios can be enhanced, such as display, education or entertainment.From the above, it can be seen that the three-dimensional plot drawing method based on the fusion of GIS and digital twins provided in the first aspect of the embodiment of the present application greatly simplifies the process of three-dimensional plot drawing. Through an intuitive and easy-to-use operation interface, users can easily customize the various attributes of the plot without professional GIS knowledge background. Users can quickly and accurately complete the drawing and editing of the plot, thereby improving the convenience and efficiency of three-dimensional plot drawing. BRIEF DESCRIPTION OF THE DRAWINGS
[0037] The drawings described herein are used to provide a further understanding of the present application and constitute a part of the present application. The illustrative embodiments of the present application and their descriptions are used to explain the present application and do not constitute an improper limitation on the present application. In the drawings:
[0038] Figure 1 A schematic diagram of a process for a three-dimensional plot drawing method based on the fusion of GIS and digital twins provided in an embodiment of the present application;
[0039] Figure 2 A schematic diagram of the structure of a three-dimensional plot drawing device based on the fusion of GIS and digital twins provided in an embodiment of the present application;
[0040] Figure 3 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application.
[0041] in,
[0042] 110, creation module; 120, determination module; 130, first generation module; 140, second generation module; 150, attribute editing module;
[0043] 810, processor; 820, communication interface; 830, memory; 840, communication bus. DETAILED DESCRIPTION
[0044] In order to more clearly illustrate the overall concept of the present application, a detailed description is given below in an illustrative manner in conjunction with the accompanying drawings.
[0045] In the following description, many specific details are set forth to facilitate a full understanding of the present application. However, the present application may also be implemented in other ways different from those described herein. Therefore, the protection scope of the present application is not limited by the specific embodiments disclosed below. It should be noted that the embodiments of the present application and the features in each embodiment may be combined with each other without conflict.
[0046] In the present application, unless otherwise clearly specified and limited, a first feature "above" or "below" a second feature may be that the first and second features are in direct contact, or the first and second features are in indirect contact through an intermediate medium. In the description of this specification, the description with reference to the terms "one embodiment", "some embodiments", "example", "specific example", or "some examples" means that the specific features, structures, materials or characteristics described in conjunction with the embodiment or example are included in at least one embodiment or example of the present application. In this specification, the schematic representation of the above terms does not necessarily refer to the same embodiment or example. Moreover, the specific features, structures, materials or characteristics described may be combined in an appropriate manner in any one or more embodiments or examples.
[0047] like Figure 1 As shown, the first embodiment of the present application provides a three-dimensional land plot drawing method based on the fusion of GIS and digital twin, including:
[0048] Step 100: Create a foundation center point, and generate a custom model including mesh information and material information based on the foundation center point, and define the custom model as the foundation.
[0049] Step 200, when the ray detects the object and collides with the foundation, a spherical object is instantiated at the collision point, the coordinate information of the spherical object is converted into Vector2 type coordinate information, and the Vector2 type coordinate information is added to the Vector2 list, and the range of the drawn three-dimensional plot is determined based on at least three points in the Vector2 list that are not on the same straight line.
[0050] Step 300, triangulate the two-dimensional vectors in the Vector2 list to obtain triangle indices, create a three-dimensional vertex array, and build a three-dimensional mesh based on the three-dimensional vertex array and the triangle indices, instantiate a mesh surface and place it at a preset position in the three-dimensional plot range, offset the mesh surface along the Z axis so that the mesh surface generates a thickness value in the Z axis direction, calculate the normal, boundary volume and tangent of the mesh surface, and load the mesh surface into the mesh rendering component in the three-dimensional plot model, and add a collision body component to the three-dimensional plot model to generate the bottom surface of the three-dimensional plot.
[0051] Step 400, create a reverse vertex array to generate the vertex data required for the upper and lower surfaces and side meshes of the three-dimensional plot, define the four vertices of the side of the three-dimensional plot based on the vertex data, create a side mesh based on the four vertices, and load the side mesh into the mesh rendering component in the three-dimensional plot model, add a collision body component to the three-dimensional plot model to generate a closed geometry of the three-dimensional plot.
[0052] Step 500: Edit the attributes of the three-dimensional land parcel closed geometry.
[0053] In step 100, the custom model is used as a foundation, which is not limited to a simple plane or geometric shape, but can be any shape to adapt to different application scenarios. The custom model generated above is defined as the foundation, which will play a basic supporting role in the subsequent three-dimensional plot drawing process. The custom model contains mesh and material information, which gives the foundation basic visualization and interactive properties. For example, the foundation can have specific textures, colors, and lighting effects, so that it appears more vivid in a three-dimensional environment. By defining a custom model as the foundation, the three-dimensional plot drawing process is made more flexible, and the foundation can be modified and expanded according to actual needs, such as adjusting the size and shape.
[0054] In step 200, ray detection and mouse click event processing are used. Ray detection is to launch rays for detection in a three-dimensional environment. This is a common interactive means for identifying user intentions and capturing targets. The user triggers ray detection through a mouse or other input device, and the system launches a virtual ray into the scene. When the ray collides with the foundation, the system generates a sphere object at the collision point. The function of this sphere object is to identify the position selected by the user and provide a reference point for subsequent operations. The coordinate information of the sphere will be recorded and converted to Vector2 type data, because the Vector2 type is more suitable for representing points in a plane coordinate system, which is convenient for subsequent two-dimensional processing. The coordinate information of the sphere object is converted from a three-dimensional coordinate system to Vector2 type coordinate information. The purpose of this is to simplify data processing and make it easier to perform plane geometric operations. The converted Vector2 type coordinate information is added to a Vector2 list, which is used to collect the position information of all points selected by the user. When at least three points that are not on the same straight line are accumulated in the Vector2 list, these points can be used to define a closed polygon, which is the range of the three-dimensional plot that the user wants to draw.
[0055] Users can specify the range of the plot by simply clicking or dragging the mouse, making the plot selection process very intuitive and easy to operate. This method lowers the user's usage threshold, and the plot selection task can be successfully completed without professional GIS knowledge. The plot range is determined by at least three points that are not on the same line, ensuring that the boundaries of the plot are clear and clear, avoiding the problem of unclear boundaries caused by single or two point definitions. The way of instantiating the sphere object at the collision point makes the selection of each point have clear feedback, increasing the certainty and accuracy of user operations. Users can freely select the boundaries of the plot according to actual needs, whether it is an irregular shape or a regular shape, it can be easily defined in this way. The point information is recorded through the Vector2 list, which is convenient for subsequent geometric processing, such as calculating the area, generating the grid, etc. The coordinate information of the Vector2 type is more convenient for two-dimensional processing, reduces the complexity of three-dimensional coordinate processing, and simplifies the design and implementation of the algorithm.
[0056] In step 300, the two-dimensional vectors in the Vector2 list are triangulated in order to connect the points into multiple triangles to form a polygonal mesh. A three-dimensional vertex array is created based on the triangulation results. Since the original Vector2 list is a two-dimensional coordinate, these coordinates need to be converted into three-dimensional coordinates, usually by adding a fixed value on the Z axis, so that the two-dimensional polygons can be expanded into three-dimensional space to form a surface with height. The created three-dimensional vertex array and triangle index are used to build a three-dimensional mesh, which will serve as the bottom surface of the three-dimensional plot. The construction of the three-dimensional mesh involves how to organize vertices and indices so that the graphics engine can correctly render the geometric shape.
[0057] Instantiate a mesh face and place it at a preset position within the range of the three-dimensional plot. The position and orientation of the mesh face can be adjusted according to the actual needs of the plot. In order to add thickness to the mesh face, it is necessary to offset the mesh face along the Z axis, so that a thickness value can be added to the mesh face in the Z axis direction to form a three-dimensional face with volume. This thickness value can be user-defined or a system default value. Normals are an important factor in calculating lighting and shadows, bounding volumes are used to determine the bounding range of objects, and tangents are used to support advanced rendering techniques such as normal maps. These geometric properties are calculated to ensure that the mesh face can correctly display lighting effects when rendering and can correctly respond to collisions in physical simulations.
[0058] Load the mesh surface into the mesh rendering component in the 3D land model, so that the mesh surface becomes part of the 3D land. This step ensures that the mesh surface can be displayed correctly in the 3D environment. Add a collision component to the 3D land model so that the land can support physical interactions in the virtual environment, such as collision detection. The collision component is crucial for applications such as game engines and simulation software because it can simulate the physical behavior of the real world.
[0059] In summary, through triangulation and the creation of a three-dimensional vertex array, a smooth three-dimensional mesh can be generated, thereby improving the rendering quality. Calculating geometric properties such as normals, bounding volumes, and tangents can enhance the realism of the land. Adding collision body components gives the land parcels physical properties in the virtual environment and supports functions such as collision detection, which is crucial for application scenarios such as simulations and games. Users can intuitively see the position and shape of the land parcels in three-dimensional space, enhancing the operability and interactivity of the land parcels. Through triangulation and the organization of vertex indices, the structure of the three-dimensional mesh is clearer, which is convenient for subsequent editing and expansion.
[0060] In step 400, the reverse vertex array refers to the vertex data used to generate the upper bottom surface and side surface meshes relative to the existing bottom surface vertex array. Usually, these vertex data are based on the bottom surface vertices, and are offset upward by a certain distance in the vertical direction (usually the Z axis) to generate a new vertex set. The vertex data of the upper bottom surface is generated based on the reverse vertex array. These vertex data correspond to the bottom surface vertices one by one, but there is a fixed offset in the Z axis direction to form a certain thickness of the land. The vertex data of the upper bottom surface will be used to create a top surface mesh corresponding to the bottom surface.
[0061] Using the defined side vertex data, create a side mesh. The side mesh is a rectangular or polygonal mesh consisting of the lines between the bottom and the upper bottom. Each side is a quadrilateral consisting of two bottom vertices and the corresponding two upper bottom vertices. Load the created side meshes into the mesh rendering component in the 3D land model so that these meshes can be correctly rendered by the rendering engine. After loading, the side mesh will form a complete 3D land geometry together with the bottom and upper bottom. In order to ensure the correct physical behavior of the 3D land in the virtual environment, it is necessary to add a collision component to the 3D land model. The collision component can help detect collisions between the land and other objects and simulate the physical behavior of the land.
[0062] By creating the top and side meshes, a complete three-dimensional plot geometry is formed, rather than being limited to a flat bottom surface. This makes the plot more three-dimensional in three-dimensional space and closer to a real physical entity. The creation of the side mesh makes the plot visually richer, increases the level of detail, and enhances the sense of reality. By defining the side vertices and creating the side mesh, the structural stability of the plot is ensured, which is convenient for subsequent editing and expansion.
[0063] In step 500, the user can perform comprehensive editing on the three-dimensional plot to achieve the best visual effect and spatial expression. This editing not only improves the flexibility of plot design, but also enhances creativity, making the adjustment of plot attributes both intuitive and efficient.
[0064] According to the three-dimensional plot drawing method based on the fusion of GIS and digital twin provided by the first embodiment of the present application, first, a foundation center point is created, and a custom model containing grid information and material information is generated based on this, which is defined as the foundation. The foundation center point provides a starting point for three-dimensional plot drawing, which helps to accurately locate subsequent operations. The custom model serves as the foundation and contains the necessary grid and material information, providing a solid foundation for subsequent three-dimensional plot drawing. In the second step, ray detection technology is used. When the ray collides with the foundation, a sphere object is instantiated at the collision point, and the coordinate information of the sphere object is converted into Vector2 type coordinate information. , and then add this information to the Vector2 list, and determine the 3D plot range based on at least three points in the list that are not on the same line. Users can determine the boundaries of the 3D plot through intuitive interactive methods (such as clicking or dragging), which makes the selection of plots more flexible and convenient. At least three points that are not on the same line can ensure that the selected area is a closed polygon, avoiding errors caused by straight lines; in the third step, the 2D vectors in the Vector2 list are triangulated, the triangle index is obtained, a 3D vertex array is created, and a 3D mesh is constructed based on the 3D vertex array and triangle index. The triangulation process makes the mesh more Adding smoothing helps improve rendering quality, instantiating the mesh surface and placing it at a preset position within the range of the three-dimensional plot, offsetting the mesh surface along the Z axis to generate thickness, giving thickness to the plane mesh through the offset on the Z axis, realizing the transition from two-dimensional to three-dimensional, calculating the normal, boundary volume and tangent of the mesh surface, loading the mesh surface into the mesh rendering component of the three-dimensional plot model, and adding a collision body component to generate the bottom surface. Adding a collision body component can simulate physical behaviors in the real world, such as collision detection, which is very important for simulation and planning; in the fourth step, create an inverse vertex array to generate the vertex data required for the upper, bottom and side meshes, and define the sides of the three-dimensional plot Four vertices are used to create a side mesh and load it into the mesh rendering component. A collision body component is added to the three-dimensional land parcel model to generate a closed geometry. The side-enclosed geometry is generated to ensure the integrity of the land parcel and facilitate further expansion and modification. The collision detection function of the three-dimensional land parcel is added to make it more realistic in the virtual environment and conducive to user interactive exploration. Finally, the properties of the three-dimensional land parcel closed geometry are edited, such as material, color, etc., allowing users to adjust the appearance of the land parcel according to their needs, enhancing the practicality and aesthetics of the land parcel. By editing the properties, the expressiveness of the land parcel in different application scenarios can be enhanced, such as display, education or entertainment.From the above, it can be seen that the three-dimensional plot drawing method based on the fusion of GIS and digital twins provided in the first aspect of the embodiment of the present application greatly simplifies the process of three-dimensional plot drawing. Through an intuitive and easy-to-use operation interface, users can easily customize the various attributes of the plot without professional GIS knowledge background. Users can quickly and accurately complete the drawing and editing of the plot, thereby improving the convenience and efficiency of three-dimensional plot drawing.
[0065] In some embodiments of the present application, a foundation center point is created, and a custom model including mesh information and material information is generated based on the foundation center point, and the custom model is defined as a foundation, specifically:
[0066] The center point of the foundation includes location information and label information, and uses Vector2 type data to represent the longitude and latitude of the center point of the foundation.
[0067] Specifically, the location information mainly includes:
[0068] Longitude and latitude coordinates: Geographic coordinates represented by Vector2 type data, usually including longitude and latitude, which are used to accurately determine the position of the center point of the base in the global coordinate system.
[0069] Height information: Although the Vector2 type is used to represent longitude and latitude in some cases, if altitude needs to be considered, additional height information (Height / Elevation) may be included to ensure accurate position in three-dimensional space.
[0070] By using Vector2 type data to represent longitude and latitude, the location information of the center point of the foundation is ensured to be accurate, providing a reliable foundation for subsequent three-dimensional plot drawing.
[0071] Label information can include but is not limited to the following types:
[0072] Descriptive label: text information used to describe the nature or purpose of the center point of the foundation, such as "center of the plot", "landmark", etc.
[0073] Identifier: A unique identifier assigned to the center point of the foundation to distinguish different locations or plots, such as plot number, project number, etc.
[0074] Attribute tag: additional attribute information, such as the purpose of the plot (residential, commercial, industrial, etc.), land ownership status, planning zoning, etc.
[0075] Metadata tags: other auxiliary information related to the plot, such as creation time, last update time, version control information, etc.
[0076] Related information: Information that links to other related resources or datasets, such as database entry IDs, related documents or image links, etc.
[0077] Status information: Information describing the current status of the plot, such as whether it is occupied, whether it can be used for new projects, etc.
[0078] Together, this information forms a detailed description of the center point of the foundation, which helps the accuracy and practicality of subsequent plot drawing and other related operations. By including this information, you can provide a richer and more detailed background information for the plot, thereby creating a more accurate and meaningful plot model in a three-dimensional environment.
[0079] In some embodiments of the present application, the two-dimensional vectors in the Vector2 list are triangulated to obtain triangle indexes, specifically:
[0080] Determine the convex triangle formed by a vertex and its adjacent edges in a polygon;
[0081] Select one of the vertices and remove the convex triangle corresponding to the vertex until the number of convex triangles is one.
[0082] Specifically, the specific method of triangulation processing usually uses the "Ear Clipping Algorithm". The working principle of this method is as follows:
[0083] Definition of ear:
[0084] An "ear" is a convex triangle formed by a vertex and its adjacent edges that does not contain any other vertices of the polygon.
[0085] Algorithm flow:
[0086] Choose a starting vertex and look for an "ear", a convex triangle that can be removed.
[0087] Remove the found "ear", update the polygon state, and continue looking for the next "ear".
[0088] Repeat this process until only the last triangle remains.
[0089] Specifically used in the embodiment of the present application, first, determine the convex triangle formed by a vertex in a polygon and its adjacent sides. The "convex triangle" here refers to a triangle formed by a vertex in a polygon and its two adjacent sides, and the triangle does not contain other vertices of the polygon. Next, select a vertex and remove the convex triangle corresponding to the vertex. Removing the triangle means excluding this triangle from the polygon and updating the state of the polygon. This process is repeated continuously, removing the convex triangle corresponding to a vertex each time, until only the last triangle is left. Through the above steps, the polygon is gradually decomposed into a series of triangles until the entire polygon is completely divided into triangles.
[0090] After polygons are decomposed into triangles, subsequent geometric processing can be simplified. Triangles are the simplest polygons and are easy to process and calculate. In 3D rendering, triangles are the most basic graphics units. Decomposing polygons into triangles helps improve rendering efficiency, especially in real-time rendering scenes. Triangle indexes are also important for physical simulations, because physics engines usually perform collision detection and rigid body simulation based on triangles. Triangulation ensures data consistency, so that each part of the polygon is represented in a unified way, which is convenient for subsequent editing and operation.
[0091] In some embodiments of the present application, a reverse vertex array is created to generate vertex data required for the upper, lower and side meshes of a three-dimensional plot, specifically:
[0092] Define the three vertices of a triangle using vertex indices, following either clockwise or counter-clockwise order to ensure the correct facing direction.
[0093] Specifically, based on the bottom mesh generated in the previous step, we already have the vertex array of the bottom surface. Now we need to create a new vertex array to define the vertices of the upper bottom surface. The vertices of the upper bottom surface are usually offset by a fixed distance along the Z axis based on the vertices of the bottom surface to form a block of a certain thickness.
[0094] The three vertices of a triangle are defined using vertex indices. The vertex index is the index number that selects the vertex from the vertex array and is used to define the three vertices of each triangle. Make sure that these vertices are arranged in a certain order, usually in clockwise (CW) or counter-clockwise (CCW) order. This depends on the requirements of the rendering engine or 3D application. In general, a consistent direction is usually chosen to ensure that the front-facing direction is correct. The order of the vertices determines the direction of the triangle face. If the vertices are arranged in clockwise order, the face faces outward; if they are arranged in counter-clockwise order, the face faces inward. In 3D rendering, the correct face orientation is very important for lighting calculations and visibility testing. Therefore, it is necessary to ensure that all triangle faces are defined in a consistent direction, usually counter-clockwise, because this is the default front-facing direction in many rendering engines. Using the vertices of the bottom and top base faces, define the vertices of the side mesh. The side mesh is usually a quadrilateral formed by connecting the vertices of the bottom face and the corresponding vertices of the top base face. For each side face, it is also necessary to ensure that the vertices are arranged in a consistent order to ensure the correct face orientation.
[0095] Suppose we have a bottom mesh consisting of a series of vertices. We now want to create a top bottom and need to define the side meshes.
[0096] Create the top and bottom vertex arrays:
[0097] If the bottom vertex array is vertices_bottom, then the top vertex array vertices_top can be created by adding a Z-axis offset to each bottom vertex.
[0098] Define the triangle vertices:
[0099] Suppose we have a triangle with vertex indices i, j, and k, and we choose to define the vertices in counter-clockwise order, then the vertices of the triangle can be represented as (vertices_top[i], vertices_top[j], vertices_top[k]) or (vertices_bottom[i], vertices_bottom[j], vertices_bottom[k]).
[0100] Define the side mesh vertices:
[0101] For the side mesh, assuming we have a quadrilateral side with vertex indices i,j,k,l, the vertices of the side mesh can be represented as (vertices_bottom[i],vertices_top[i], vertices_top[j],vertices_bottom[j]) or (vertices_bottom[k], vertices_top[k], vertices_top[l], vertices_bottom[l]).
[0102] The above steps ensure that all generated triangles and quadrilateral sides are defined in a consistent direction, thereby correctly representing the structure of the 3D plot and being displayed correctly when rendered.
[0103] In some embodiments of the present application, the normal, bounding volume and tangent of the mesh surface are calculated, and the mesh surface is loaded into the mesh rendering component in the three-dimensional land model, specifically:
[0104] Calculate the lighting parameters of the mesh surface based on the normal, calculate the size and shape of the mesh surface based on the boundary volume, and calculate the texture mapping of the mesh surface based on the tangent;
[0105] The mesh surface is converted into a visible three-dimensional graphic through the mesh rendering component. The visible three-dimensional graphic includes material parameters, color parameters and texture parameters.
[0106] Specifically, the normal is a vector perpendicular to the mesh surface, which is used to determine how lighting affects each part of the mesh. The calculation of the normal is based on the position information of each vertex on the mesh surface. The main purpose of calculating the normal is to calculate the lighting parameters, that is, when the light hits the mesh surface, how to determine the light intensity and shadow effect received by the mesh surface according to the direction of the normal.
[0107] The bounding volume is the minimum volume that encloses a mesh face. This volume can be a bounding box, a bounding sphere, or other types of volumes. The bounding volume is calculated to get the approximate size and shape of the mesh face, which is very useful for determining the position, rotation, and scale of the mesh face in 3D space.
[0108] The tangent is a vector related to the direction of the texture mapped on the surface of a mesh. In 3D modeling, tangents are used to correctly map textures onto the surface of a mesh. Tangent calculations are mainly used to implement advanced texture mapping techniques such as normal mapping, ambient occlusion, etc. These techniques rely on tangents to correctly simulate lighting effects.
[0109] Once the normals, bounding volumes, and tangents are calculated, this data can be used to optimize the rendering of the mesh faces. Applying these calculations to the mesh rendering component will allow the mesh faces to be displayed correctly in the 3D viewport.
[0110] In some embodiments of the present application, a collision body component is added to the three-dimensional land model, specifically:
[0111] Associate the collider component with the mesh face and make the collider component cover the visible part of the mesh face;
[0112] The collision body component includes a box and / or a sphere.
[0113] Specifically, the collider component is associated with the mesh surface in the land model to ensure that the collider component can correctly reflect the position and shape of the mesh surface so that collision events can be accurately detected in the physical simulation. The collider component needs to cover the visible part of the mesh surface, which means that the collider must not only match the position of the mesh surface, but also be large enough to cover every possible contact point on the mesh surface. This ensures that any object that contacts the mesh surface can be correctly detected in the physical simulation.
[0114] Collider components can include boxes and / or spheres. The specific type you choose depends on the shape of the mesh surface and the needs of the application scenario. Box Collider: Suitable for mesh surfaces that are approximately rectangular or regular in shape. The box can fit the edges of the mesh surface well and provide more accurate collision detection. Sphere Collider: Suitable for circular or spherical mesh surfaces, or when you need to simplify collision detection. Sphere Collider can perform collision detection quickly, but its accuracy is lower.
[0115] If the mesh surface is a regular rectangular or cubic shape, you can choose a box; if it is a circle or sphere, you can choose a sphere. For a box, you need to set its length, width, and height; for a sphere, you need to set its radius.
[0116] In some embodiments of the present application, the attributes of the three-dimensional land parcel closed geometric body are edited, specifically:
[0117] Updates the height, color, and transparency of the 3D parcel enclosure geometry.
[0118] Specifically, users can adjust the height of the plot according to actual needs. This step is crucial to adapt to different terrain needs. For example, if the plot is located on a hill, the user can adjust the height of the plot to match the height change of the terrain. The operation of adjusting the height can be achieved through controls in the user interface, such as sliders or input boxes, where users can intuitively enter or adjust values to change the height of the plot.
[0119] The color of the plot can be set according to the function or visual effect requirements of the plot. For example, different land use properties can be distinguished by different colors, such as residential land can be blue, commercial land can be red, etc. The color setting can be achieved by selecting a color palette or entering a hexadecimal color code, and users can flexibly select the color of the plot.
[0120] By adjusting the transparency of the plot, you can achieve different degrees of perspective effects. This helps to better understand and show the relationship between the plot and other objects in a complex scene. The transparency can be adjusted using a slider, and users can drag the slider to change the transparency of the plot to achieve different visual effects.
[0121] Users can adjust the height, color, and transparency of the plot at any time according to their needs, making the plot design more flexible and able to quickly respond to different design needs. By setting the color and transparency of the plot, you can create a more colorful visual effect and make the three-dimensional plot more vivid. Adjusting the height and transparency of the plot helps to improve the expression of the plot in three-dimensional space, making it still clearly visible under complex terrain conditions. The easy-to-use editing tools lower the professional threshold. Even users without GIS professional knowledge background can easily get started, which promotes creativity in plot design.
[0122] like Figure 2 As shown, the second embodiment of the present application provides a three-dimensional plot drawing device based on the fusion of GIS and digital twin, including:
[0123] A creation module 110 is used to create a foundation center point, generate a custom model including mesh information and material information based on the foundation center point, and define the custom model as a foundation;
[0124] A determination module 120 is used for instantiating a spherical object at a collision point when the ray detects an object and the ray collides with the foundation, converting the coordinate information of the spherical object into Vector2 type coordinate information, and adding the Vector2 type coordinate information to a Vector2 list, and determining the range of the drawn three-dimensional plot based on at least three points in the Vector2 list that are not on the same straight line;
[0125] The first generation module 130 is used to triangulate the two-dimensional vectors in the Vector2 list to obtain triangle indexes, create a three-dimensional vertex array, and construct a three-dimensional mesh based on the three-dimensional vertex array and the triangle index, instantiate a mesh surface and place it at a preset position in the three-dimensional land area, offset the mesh surface along the Z axis so that the mesh surface generates a thickness value in the Z axis direction, calculate the normal, boundary volume and tangent of the mesh surface, and load the mesh surface into the mesh rendering component in the three-dimensional land model, and add a collision body component to the three-dimensional land model to generate the bottom surface of the three-dimensional land;
[0126] The second generation module 140 is used to create an inverse vertex array to generate vertex data required for the upper and lower surfaces and side meshes of the three-dimensional land parcel, define four vertices of the side of the three-dimensional land parcel based on the vertex data, create a side mesh based on the four vertices, load the side mesh into a mesh rendering component in the three-dimensional land parcel model, and add a collision body component to the three-dimensional land parcel model to generate a closed geometric body of the three-dimensional land parcel;
[0127] The attribute editing module 150 is used to edit the attributes of the three-dimensional land parcel closed geometric body.
[0128] The three-dimensional plot drawing device based on the fusion of GIS and digital twin provided in the second aspect embodiment of the present application can realize the three-dimensional plot drawing method based on the fusion of GIS and digital twin in any embodiment of the first aspect mentioned above, and thus can realize any technical effect of the three-dimensional plot drawing method based on the fusion of GIS and digital twin mentioned above, which will not be repeated here.
[0129] An embodiment of the third aspect of the present application provides an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the program, the three-dimensional plot drawing method based on the fusion of GIS and digital twins in any embodiment of the first aspect is implemented.
[0130] Figure 3 An example of a physical structure diagram of an electronic device is shown in FIG. Figure 3 As shown, the electronic device may include: a processor 810, a communication interface 820, a memory 830 and a communication bus 840, wherein the processor 810, the communication interface 820, and the memory 830 communicate with each other through the communication bus 840. The processor 810 may call the logic instructions in the memory 830 to execute the three-dimensional plot drawing method based on the fusion of GIS and digital twins in any embodiment of the first aspect above, and the method includes:
[0131] Step 100: Create a foundation center point, and generate a custom model including mesh information and material information based on the foundation center point, and define the custom model as the foundation.
[0132] Step 200, when the ray detects the object and collides with the foundation, a spherical object is instantiated at the collision point, the coordinate information of the spherical object is converted into Vector2 type coordinate information, and the Vector2 type coordinate information is added to the Vector2 list, and the range of the drawn three-dimensional plot is determined based on at least three points in the Vector2 list that are not on the same straight line.
[0133] Step 300, triangulate the two-dimensional vectors in the Vector2 list to obtain triangle indices, create a three-dimensional vertex array, and build a three-dimensional mesh based on the three-dimensional vertex array and the triangle indices, instantiate a mesh surface and place it at a preset position in the three-dimensional plot range, offset the mesh surface along the Z axis so that the mesh surface generates a thickness value in the Z axis direction, calculate the normal, boundary volume and tangent of the mesh surface, and load the mesh surface into the mesh rendering component in the three-dimensional plot model, and add a collision body component to the three-dimensional plot model to generate the bottom surface of the three-dimensional plot.
[0134] Step 400, create a reverse vertex array to generate the vertex data required for the upper and lower surfaces and side meshes of the three-dimensional plot, define the four vertices of the side of the three-dimensional plot based on the vertex data, create a side mesh based on the four vertices, and load the side mesh into the mesh rendering component in the three-dimensional plot model, add a collision body component to the three-dimensional plot model to generate a closed geometry of the three-dimensional plot.
[0135] Step 500: Edit the attributes of the three-dimensional land parcel closed geometry.
[0136] In addition, the logic instructions in the above-mentioned memory 830 can be implemented in the form of a software functional unit and can be stored in a computer-readable storage medium when it is sold or used as an independent product. Based on this understanding, the technical solution of the present invention is essentially or the part that contributes to the prior art or the part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including a number of instructions to enable a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present invention. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), disk or optical disk and other media that can store program codes.
[0137] Finally, the present invention also provides a non-volatile computer storage medium having computer executable instructions stored thereon. When the computer program is executed by a processor, the method for three-dimensional plot drawing based on GIS and digital twin fusion provided by the above methods is implemented, and the method includes:
[0138] Step 100: Create a foundation center point, and generate a custom model including mesh information and material information based on the foundation center point, and define the custom model as the foundation.
[0139] Step 200, when the ray detects the object and collides with the foundation, a spherical object is instantiated at the collision point, the coordinate information of the spherical object is converted into Vector2 type coordinate information, and the Vector2 type coordinate information is added to the Vector2 list, and the range of the drawn three-dimensional plot is determined based on at least three points in the Vector2 list that are not on the same straight line.
[0140] Step 300, triangulate the two-dimensional vectors in the Vector2 list to obtain triangle indices, create a three-dimensional vertex array, and build a three-dimensional mesh based on the three-dimensional vertex array and the triangle indices, instantiate a mesh surface and place it at a preset position in the three-dimensional plot range, offset the mesh surface along the Z axis so that the mesh surface generates a thickness value in the Z axis direction, calculate the normal, boundary volume and tangent of the mesh surface, and load the mesh surface into the mesh rendering component in the three-dimensional plot model, and add a collision body component to the three-dimensional plot model to generate the bottom surface of the three-dimensional plot.
[0141] Step 400, create a reverse vertex array to generate the vertex data required for the upper and lower surfaces and side meshes of the three-dimensional plot, define the four vertices of the side of the three-dimensional plot based on the vertex data, create a side mesh based on the four vertices, and load the side mesh into the mesh rendering component in the three-dimensional plot model, add a collision body component to the three-dimensional plot model to generate a closed geometry of the three-dimensional plot.
[0142] Step 500: Edit the attributes of the three-dimensional land parcel closed geometry.
[0143] Anything not described in this application can be achieved by adopting or drawing on existing technologies.
[0144] The various embodiments in this specification are described in a progressive manner, and the same or similar parts between the various embodiments can be referenced to each other, and each embodiment focuses on the differences from other embodiments.
[0145] The above is only the embodiment of the present application and is not intended to limit the present application. For those skilled in the art, the present application may have various changes and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application should be included in the protection scope of the present application.
Claims
1. A three-dimensional plot drawing method based on the fusion of GIS and digital twin, characterized in that: include: Creating a foundation center point, and generating a custom model including mesh information and material information based on the foundation center point, and defining the custom model as a foundation; When the ray detects an object and the ray collides with the foundation, a sphere object is instantiated at the collision point, coordinate information of the sphere object is converted into Vector2 type coordinate information, and the Vector2 type coordinate information is added to a Vector2 list, and the range of the drawn three-dimensional plot is determined based on at least three points in the Vector2 list that are not on the same straight line; Triangulate the two-dimensional vectors in the Vector2 list to obtain triangle indices, create a three-dimensional vertex array, and construct a three-dimensional mesh based on the three-dimensional vertex array and the triangle indices, instantiate a mesh surface and place it at a preset position in the three-dimensional land parcel range, offset the mesh surface along the Z axis so that the mesh surface generates a thickness value in the Z axis direction, calculate the normal, boundary volume and tangent of the mesh surface, and load the mesh surface into the mesh rendering component in the three-dimensional land parcel model, and add a collision body component to the three-dimensional land parcel model to generate the bottom surface of the three-dimensional land parcel; Create an inverse vertex array to generate vertex data required for the upper and lower surfaces and side meshes of the three-dimensional plot, define four vertices on the side of the three-dimensional plot based on the vertex data, create a side mesh based on the four vertices, and load the side mesh into the mesh rendering component in the three-dimensional plot model, and add a collision body component to the three-dimensional plot model to generate a closed geometric body of the three-dimensional plot; The properties of the three-dimensional land parcel closed geometry are edited.
2. The three-dimensional plot drawing method based on the fusion of GIS and digital twin according to claim 1 is characterized in that: The step of creating a foundation center point, generating a custom model including mesh information and material information based on the foundation center point, and defining the custom model as a foundation is as follows: The foundation center point includes location information and label information, and uses Vector2 type data to represent the longitude and latitude of the foundation center point.
3. The three-dimensional plot drawing method based on the fusion of GIS and digital twin according to claim 1 is characterized in that: The two-dimensional vectors in the Vector2 list are triangulated to obtain triangle indexes, specifically: Determine the convex triangle formed by a vertex and its adjacent edges in a polygon; Select one of the vertices and remove the convex triangle corresponding to the vertex until the number of the convex triangle is one.
4. The three-dimensional plot drawing method based on the fusion of GIS and digital twin according to claim 3 is characterized in that: The creation of the reverse vertex array to generate the vertex data required for the upper, lower and side meshes of the three-dimensional plot is specifically as follows: Define the three vertices of a triangle using vertex indices, following either clockwise or counter-clockwise order to ensure the correct facing direction.
5. The three-dimensional plot drawing method based on the fusion of GIS and digital twin according to claim 1 is characterized in that: The calculating of the normal, boundary volume and tangent of the mesh surface and loading the mesh surface into the mesh rendering component in the three-dimensional land parcel model is specifically as follows: Calculating the illumination parameters of the mesh surface based on the normal line, calculating the size and shape of the mesh surface based on the boundary volume, and calculating the texture mapping of the mesh surface based on the tangent line; The mesh surface is converted into a visible three-dimensional graphic through the mesh rendering component, and the visible three-dimensional graphic includes material parameters, color parameters and texture parameters.
6. The three-dimensional plot drawing method based on the fusion of GIS and digital twin according to claim 5 is characterized in that: The collider component is added to the three-dimensional land model, specifically: Associating the collision volume component with the mesh surface, and making the collision volume component cover the visible part of the mesh surface; Wherein, the collision body component includes a box body and / or a sphere.
7. The three-dimensional plot drawing method based on the fusion of GIS and digital twin according to claim 1 is characterized in that: The editing of the attributes of the three-dimensional land parcel closed geometric body is specifically as follows: Update the height, color and transparency of the three-dimensional land parcel closed geometry.
8. A three-dimensional plot drawing device based on the fusion of GIS and digital twin, characterized in that: include: A creation module, used for creating a foundation center point, and generating a custom model including mesh information and material information based on the foundation center point, and defining the custom model as a foundation; A determination module, for detecting an object by ray and when the ray collides with the foundation, instantiating a spherical object at the collision point, converting the coordinate information of the spherical object into Vector2 type coordinate information, adding the Vector2 type coordinate information to a Vector2 list, and determining the range of the drawn three-dimensional plot based on at least three points in the Vector2 list that are not on the same straight line; A first generation module is used to triangulate the two-dimensional vectors in the Vector2 list to obtain triangle indexes, create a three-dimensional vertex array, and construct a three-dimensional mesh based on the three-dimensional vertex array and the triangle indexes, instantiate a mesh surface and place it at a preset position in the three-dimensional land parcel range, offset the mesh surface along the Z axis so that the mesh surface generates a thickness value in the Z axis direction, calculate the normal, boundary volume and tangent of the mesh surface, and load the mesh surface into a mesh rendering component in the three-dimensional land parcel model, and add a collision body component to the three-dimensional land parcel model to generate a bottom surface of the three-dimensional land parcel; The second generation module is used to create an inverse vertex array to generate vertex data required for the upper and lower surfaces and side meshes of the three-dimensional plot, define four vertices on the side of the three-dimensional plot based on the vertex data, create a side mesh based on the four vertices, and load the side mesh into a mesh rendering component in the three-dimensional plot model, and add a collision body component to the three-dimensional plot model to generate a closed geometric body of the three-dimensional plot; The attribute editing module is used to edit the attributes of the three-dimensional land parcel closed geometric body.
9. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein: When the processor executes the program, it implements the three-dimensional plot drawing method based on the fusion of GIS and digital twin as described in any one of claims 1 to 7.
10. A non-volatile computer storage medium having computer executable instructions stored thereon, characterized in that: When the computer program is executed by a processor, a three-dimensional plot drawing method based on the fusion of GIS and digital twins as described in any one of claims 1 to 7 is implemented.
