WebGL-based automatic modeling method and device

The automated modeling method based on WebGL solves the problems of low building modeling accuracy and efficiency in the existing technology by generating building sketch points, judging the inner polygons and normal vectors, generating holes and merging the outer frames of the walls, and realizes an efficient and fast modeling process.

CN120180681APending Publication Date: 2025-06-20GUANGZHOU FRONTOP DIGITAL ORIGINALITY TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510197839.7
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-02-21
Publication Date
2025-06-20

AI Technical Summary

Technical Problem

The existing building automation modeling methods have problems of low accuracy and efficiency, and have high user skills requirements, making it difficult to iterate and deal with complex scenarios quickly.

Method used

Using an automated modeling method based on WebGL, we use the acquisition of architectural parameters and styles, generate sketch points, build wall sketches, judge the inner polygons and normal vectors, generate holes, and merge the outer frames of the wall to achieve efficient modeling.

Benefits of technology

It improves the accuracy and efficiency of building modeling, lowers the modeling threshold, and allows users to perform 3D modeling and rendering without additional plug-ins, achieving rapid iteration and efficient rendering.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120180681A_ABST
    Figure CN120180681A_ABST
Patent Text Reader

Abstract

The invention relates to the technical field of three-dimensional modeling, and discloses a WebGL-based automatic modeling method and device, and the method comprises the steps: generating a complete sketch of a target building according to obtained target building parameters and a target building style; generating a corresponding wall sketch for each layer by cyclically generating each layer of the target building; traversing and judging whether all wall line segments of the wall sketch have corresponding inner side polygons or not; if yes, acquiring a normal vector of an inner side polygon corresponding to the wall line segment, and judging whether the normal vector is equal to a preset direction vector or not; if yes, whether an effective hole position exists in the wall face where the wall line segment is located or not is searched; if yes, a hole is formed in the wall face where the wall line segment is located; a wall body outer frame is generated for each layer of the target building, and the hole is formed in the wall body outer frame; and updating, combining and rendering the wall sketches, the holes and the wall outer frames of all the layers. The method has the effects of improving the modeling efficiency and precision and realizing rapid model rendering.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the technical field of 3D modeling, and particularly to an automated modeling method and device based on WebGL. Background Art

[0002] With the acceleration of digital transformation, the demand for 3D modeling in multiple industries has been increasing, such as game development, virtual reality (VR), augmented reality (AR), architectural design, film and television animation, and industrial manufacturing. Traditional manual modeling processes rely on designers' skills, such as Blender, Maya, and 3ds Max. Although they provide powerful modeling tools and rich functions, they usually require users to have certain professional skills and experience, and a large amount of time and effort are needed to create accurate models and repeatedly modify them to meet project requirements. In addition, the manual modeling process is often time-consuming, which limits rapid iteration. With the shortening of the product development cycle and the intensification of market competition, enterprises are facing the pressure of rapid iteration, and the efficiency of traditional modeling is difficult to meet the rapid response requirements of modern industries.

[0003] Currently, existing automated modeling methods for buildings include machine learning, deep learning, evolutionary algorithms, rule-based modeling, and synthetic modeling, etc. These methods have obvious advantages in processing large-scale data, automatically identifying patterns, and flexibly generating models, but there are also some disadvantages, such as the need for a large amount of labeled data, high computational resource requirements, unstable model training processes, and relatively high requirements for user skills. In addition, the applicability is limited, and it is difficult to handle complex situations in actual application scenarios.

[0004] In view of the above related technologies, the inventors found that existing automated modeling methods for buildings have problems of low accuracy and efficiency. Summary of the Invention

[0005] In order to improve the accuracy and efficiency of automated building modeling, the present application provides an automated modeling method and device based on WebGL.

[0006] In a first aspect, the present application provides an automated modeling method based on WebGL.

[0007] The present application is achieved through the following technical solutions:

[0008] An automated modeling method based on WebGL includes the following steps,

[0009] Obtain target building parameters and set a target building style;

[0010] Generate target building sketch points according to the target building parameters and the target building style, and form a complete sketch of the target building;

[0011] Based on the complete sketch, generate each level of the target building through a loop, construct and merge the basic shape and outer frame of the target building, and generate corresponding wall sketches for each level;

[0012] Traverse all wall segments of the wall sketch, and determine whether there is a corresponding inner polygon for the wall segment;

[0013] If there is a corresponding inner polygon for the wall segment, obtain the normal vector of the inner polygon corresponding to the wall segment;

[0014] Determine whether the normal vector of the inner polygon is equal to a preset direction vector;

[0015] If the normal vector of the inner polygon is equal to the direction vector, then search for whether there is a valid opening position on the wall surface where the wall segment is located;

[0016] When there is a valid opening position, generate an opening on the wall surface where the wall segment is located;

[0017] Generate an outer frame for the walls of each level of the target building, and place the opening on the outer frame of the wall;

[0018] Update the wall sketches, openings, and outer frames of each level, and merge the wall sketches, openings, and outer frames of all levels to render and obtain the target building model.

[0019] In a preferred example of the present application, it can be further configured that when traversing all wall segments of the wall sketch, the following steps are further included:

[0020] Calculate the intersection points of the newly added line segments and the existing wall segments;

[0021] Determine whether the intersection points are the endpoints of the existing wall segments;

[0022] If the intersection points are not the endpoints of the existing wall segments, create new endpoints to cut the existing wall segments into two new wall segments.

[0023] In a preferred example of the present application, it can be further configured that the step of determining whether the intersection points are the endpoints of the existing wall segments includes:

[0024] Use a precision comparison method to determine whether the intersection points are above or below or on the extension lines of the newly added line segments and the existing wall segments;

[0025] If not, then determine that the intersection points are the endpoints of the existing wall segments.

[0026] In a preferred example, the present application can be further configured as follows: The step of generating the outer frame of the wall for each floor of the target building further includes,

[0027] Multiplying the index of the current floor by the height of the outer frame of the wall of the current floor so that the outer frames of the walls of each floor are stacked vertically.

[0028] In a preferred example, the present application can be further configured as follows: Before the step of generating each level of the target building through a loop based on the complete sketch, it further includes,

[0029] Judging whether the sketch of the current floor to be generated is the top floor sketch;

[0030] If the sketch of the current floor to be generated is the top floor sketch, then after setting materials, adjusting the height, generating and merging and updating according to the preset design requirements, generate the wall sketch of the current floor.

[0031] In a preferred example, the present application can be further configured as follows: The step of judging whether the sketch of the current floor to be generated is the top floor sketch includes,

[0032] Judging whether the index of the sketch of the current floor to be generated is equal to the preset total number of floors minus 1;

[0033] If the index of the sketch of the current floor is equal to the total number of floors minus 1, then it is determined that the sketch of the current floor to be generated is the top floor sketch.

[0034] In a preferred example, the present application can be further configured as follows: The step of generating the sketch points of the target building and forming the complete sketch of the target building includes,

[0035] Defining a coordinate system in a three-dimensional space;

[0036] Based on the sketch points of the target building, determining the key node coordinates of the target building in the three-dimensional space;

[0037] According to the wall thickness of the target building, adjusting the key node coordinates to determine the position coordinates of each corner point;

[0038] Taking the bottom surface of the target building as a reference, calculating the normal vector of each corner point;

[0039] Taking each normal vector as the Z-axis, establishing a local coordinate system, and generating the side lines of the target building according to each corner point;

[0040] Connecting the adjacent side lines, merging all the side lines and faces, and obtaining the complete sketch of the target building.

[0041] In a preferred example, the present application can be further configured as follows: It further includes the following steps,

[0042] Export the target building model in a preset target format, where the target format includes the GLTF format and the GLB format.

[0043] In a second aspect, the present application provides an automated modeling device based on WebGL.

[0044] The present application is achieved through the following technical solutions:

[0045] An automated modeling device based on WebGL includes:

[0046] An initial module for obtaining target building parameters and setting a target building style;

[0047] A complete sketch module for generating target building sketch points according to the target building parameters and the target building style and forming a complete sketch of the target building;

[0048] A wall sketch module for constructing and merging the basic shape and outer frame of the target building by generating each level of the target building in a loop based on the complete sketch and generating corresponding wall sketches for each level;

[0049] An inner polygon detection module for traversing all wall segments of the wall sketch to determine whether there is a corresponding inner polygon for the wall segment;

[0050] An opening data determination module for obtaining the normal vector of the inner polygon corresponding to the wall segment when there is a corresponding inner polygon for the wall segment;

[0051] An opening detection module for determining whether the normal vector of the inner polygon is equal to a preset direction vector;

[0052] An opening verification module for finding whether there is a valid opening position on the wall surface where the wall segment is located when the normal vector of the inner polygon is equal to the direction vector;

[0053] An opening generation module for generating an opening on the wall surface where the wall segment is located when there is a valid opening position;

[0054] A wall outer frame module for generating a wall outer frame for each level of the target building and placing the opening on the wall outer frame;

[0055] A rendering module for updating the wall sketches, openings, and wall outer frames of each level and merging the wall sketches, openings, and wall outer frames of all levels to render and obtain the target building model.

[0056] In a third aspect, the present application provides a computer device.

[0057] This application is realized through the following technical solutions:

[0058] 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 steps of any one of the above-mentioned WebGL-based automated modeling methods are implemented.

[0059] In a fourth aspect, this application provides a computer-readable storage medium.

[0060] This application is realized through the following technical solutions:

[0061] A computer-readable storage medium stores a computer program. When the computer program is executed by a processor, the steps of any one of the above-mentioned WebGL-based automated modeling methods are implemented.

[0062] In a fifth aspect, this application provides a computer program product.

[0063] This application is realized through the following technical solutions:

[0064] A computer program product includes a computer program. When the computer program is executed by a processor, the steps of any one of the above-mentioned WebGL-based automated modeling methods are implemented.

[0065] In summary, compared with the prior art, the beneficial effects brought by the technical solutions provided by this application at least include:

[0066] Obtain the target building parameters and set the target building style. According to the target building parameters and the target building style, generate the target building sketch points and form the complete sketch of the target building to guide the construction of the target building model, ensuring that the target building model can meet the design requirements and has higher model accuracy. Based on the complete sketch, generate each level of the target building through looping, construct and merge the basic shape and outer frame of the target building, and generate the corresponding wall sketch for each level to obtain the initial model of the target building. Traverse all the wall segments of the wall sketch to determine whether there is a corresponding inner polygon for each wall segment to check whether each segment is suitable for digging a hole. If there is a corresponding inner polygon for the wall segment, obtain the normal vector of the inner polygon corresponding to the wall segment and determine whether the normal vector of the inner polygon is equal to the preset direction vector to determine whether to generate a hole and the direction and position of the hole. If the normal vector of the inner polygon is equal to the direction vector, find whether there is a valid hole position on the wall where the wall segment is located to determine whether a hole can be successfully generated. When there is a valid hole position, generate a hole on the wall where the wall segment is located according to the incoming hole position and model type, thereby realizing an efficient hole-digging modeling operation with a higher hole-digging success rate to improve the modeling efficiency of the target building. Generate the outer frame of the wall for each level of the target building, place the hole on the outer frame of the wall, and complete the construction of each level of the target building model. Finally, update the wall sketch, hole, and outer frame of the wall for each level and merge the wall sketches, holes, and outer frames of all levels, and render to obtain the target building model, reducing the rendering time and having a higher modeling efficiency. Furthermore, an automated modeling method based on WebGL improves the automated modeling accuracy and modeling efficiency of the target building, can effectively reduce the modeling threshold, simplifies the modeling process, enables users to directly perform 3D modeling and rendering through a web page without installing additional plugins, realizes fast rendering of the model, and improves the modeling efficiency. Description of the Drawings

[0067] Figure 1 Schematic diagram of the main process of an automated modeling method based on WebGL provided by an exemplary embodiment of the present application.

[0068] Figure 2 Schematic diagram of the model export effect of an automated modeling method based on WebGL provided by another exemplary embodiment of the present application.

[0069] Figure 3 Block diagram of the structure of an automated modeling device based on WebGL provided by another exemplary embodiment of the present application. Detailed Implementation Manner

[0070] This specific embodiment is only an interpretation of the present application and does not limit the present application. After reading this specification, those skilled in the art can make modifications to this embodiment without creative contributions as needed, but as long as it is within the scope of the claims of the present application, it is protected by the patent law.

[0071] To make the objectives, technical solutions, and advantages of the embodiments of the present application clearer, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the accompanying drawings in the embodiments of the present application. Obviously, the described embodiments are some, but not all, of the embodiments of the present application. All other embodiments obtained by those of ordinary skill in the art based on the embodiments of the present application without creative efforts belong to the scope of protection of the present application.

[0072] In addition, the term "and / or" in this article is only a description of the association relationship of associated objects, indicating that three relationships can exist. For example, A and / or B can represent three situations: A exists alone, A and B exist simultaneously, and B exists alone. In addition, the character " / " in this article generally represents an "or" relationship between the associated objects before and after, unless otherwise specified.

[0073] The embodiments of the present application will be further described in detail below with reference to the accompanying drawings of the specification.

[0074] Refer to Figure 1 , the embodiments of the present application provide an automated modeling method based on WebGL, and the main steps of the method are described as follows.

[0075] S1: Obtain target building parameters and set a target building style;

[0076] S2: Generate target building sketch points according to the target building parameters and the target building style, and form a complete sketch of the target building;

[0077] S3: Based on the complete sketch, generate each level of the target building through a loop, construct and merge the basic shape and outer frame of the target building, and generate corresponding wall sketches for each level;

[0078] S4: Traverse all wall segments of the wall sketch and determine whether there is a corresponding inner polygon for the wall segment;

[0079] S5: If there is a corresponding inner polygon for the wall segment, obtain the normal vector of the inner polygon corresponding to the wall segment;

[0080] S6: Determine whether the normal vector of the inner polygon is equal to a preset direction vector;

[0081] S7: If the normal vector of the inner polygon is equal to the direction vector, then check whether there is a valid opening position on the wall surface where the wall segment is located;

[0082] S8: When there is a valid opening position, generate an opening on the wall surface where the wall segment is located;

[0083] S9: Generate an outer frame for each floor of the target building and place the opening on the outer frame of the wall;

[0084] S10: Update the wall sketch, opening, and outer frame of each floor and merge the wall sketches, openings, and outer frames of all floors, and render to obtain the target building model.

[0085] Specifically, based on WebGL, in the input box of the user interface, the user inputs the target building parameters, including length, width, and number of floors, and sets the target building style to determine the subsequent sketch generation method and style. Then, click the generate button. The system can call the method of generating sketch points according to the target building parameters and target building style, generate the sketch points of this floor according to the input length, width, thickness, and style parameters, generate the sketch points of the target building, and form a complete sketch of the target building, realizing the automatic generation of a complete sketch of the building model with the set style.

[0086] Using the graphical user interface (GUI) and combining with the real-time rendering ability of WebGL, the user can conveniently input parameters and perform operations, can immediately view the changes in the building model, and supports dynamic adjustment of the building's dimensions, number of floors, and style, reducing the learning cost. Even novice users can quickly get started, reducing the disadvantage of high learning cost in traditional methods.

[0087] In one embodiment, before entering the target building parameters and setting the target building style, first clear the previous data state to ensure that there is no legacy old data when generating a new building model, which may affect the modeling accuracy and efficiency.

[0088] In one embodiment, the steps of generating the sketch points of the target building and forming a complete sketch of the target building include,

[0089] Define a coordinate system in three-dimensional space;

[0090] Based on the sketch points of the target building, determine the key node coordinates of the target building in three-dimensional space;

[0091] According to the wall thickness of the target building, adjust the key node coordinates to determine the position coordinates of each corner point;

[0092] Taking the bottom surface of the target building as the reference, calculate the normal vector of each corner point;

[0093] Taking each normal vector as the Z-axis, establish a local coordinate system, and generate the outline of the target building according to each corner point;

[0094] Connect the adjacent outlines, merge all the outlines and surfaces, and obtain the complete sketch of the target building.

[0095] Taking the generation of an L-shaped building outline as an example, determine the key node coordinates of the L-shaped building in three-dimensional space, including the corner points of the right-angle part and the extended part; according to the actual wall thickness dimension of the building, adjust the key node coordinates, determine the position coordinates of each corner point, and ensure that each corner point is in the exact position; taking the bottom surface of the L-shaped building as a reference, calculate the normal vector of each corner point to determine the height of the L-shaped building; establish a local coordinate system with the normal vector as the Z-axis to ensure the accuracy of subsequent modeling operations; generate the outline of the L-shaped building according to each corner point; by adding lines, connect the adjacent outlines, merge all the outlines and surfaces, and generate a three-dimensional model of a closed L-shaped outline to obtain the complete sketch of the target building.

[0096] Among them, a corner point refers to a point with particularly prominent attributes in a certain aspect, such as the end point of a line segment, an isolated point with the maximum or minimum intensity, the intersection point of two or more line segments, a point where the change rate of the gradient value and the gradient direction is higher than the threshold, etc. Apply the corner points to three-dimensional scene reconstruction, and each corner point is in the exact position. Combining the normal vector of the corner points can effectively reduce the amount of data required for modeling while retaining the important features of the target building, thereby further improving the modeling efficiency while ensuring the modeling accuracy of the target building and achieving faster modeling.

[0097] By defining the coordinate system in three-dimensional space, determine the key node coordinates of the target building, and then perform mathematical operations on the length, width, and thickness of the building to calculate different three-dimensional vector points, and connect and merge them to form the complete sketch of the target building, that is, the outline of the target building. By means of the exact position of each corner point and the normal vector of the corner point, the complete sketch of the target building can be accurately formed, which is beneficial to accurately generating the three-dimensional model of the target building, realizing the rapid generation of the three-dimensional model of the building, and improving the efficiency and accuracy of modeling.

[0098] Based on the complete sketch, generate each layer of the target building through a loop, construct and merge the basic shape and outer frame of the target building, and generate the corresponding wall sketch for each layer. During the process of generating the wall sketch, according to the specified number of layers, generate the wall sketch of each layer through a loop.

[0099] In one embodiment, before the step of generating each layer of the target building through a loop based on the complete sketch, it further includes

[0100] Determine whether the sketch of the currently generated layer is the top-layer sketch;

[0101] If the sketch of the current layer to be generated is the top - layer sketch, after performing material setting, height adjustment, outer - frame generation, and merging and updating according to the preset design requirements, then generate the wall sketch of the current layer.

[0102] In one embodiment, the step of determining whether the sketch of the current layer to be generated is the top - layer sketch includes

[0103] Determine whether the index of the sketch of the current layer to be generated is equal to the preset total number of layers minus 1;

[0104] If the index of the sketch of the current layer is equal to the total number of layers minus 1, then determine that the sketch of the current layer to be generated is the top - layer sketch.

[0105] Specifically, when constructing the wall sketch of each layer, before generating the wall sketch of the current layer, first determine whether it is the top - layer sketch. The determination method is whether the index i of the sketch of the current layer to be generated is equal to the total number of layers count - 1. If they are equal, it means that the current sketch is the top - layer sketch, so as to perform special processing on the top - layer sketch, including material setting, height adjustment, outer - frame generation, and merging and updating, etc. Performing special processing on the top - layer sketch according to the preset design requirements ensures that the appearance and function of the top - layer sketch meet the design requirements, further ensuring the accurate generation of the 3D model of the target building and improving the modeling accuracy.

[0106] Next, traverse all the wall segments of the wall sketch and determine whether there is a corresponding inner polygon for the wall segment;

[0107] If there is a corresponding inner polygon for the wall segment, then obtain the normal vector of the inner polygon corresponding to the wall segment;

[0108] Determine whether the normal vector of the inner polygon is equal to the preset direction vector;

[0109] If the normal vector of the inner polygon is equal to the direction vector, then search for whether there is a valid opening position on the wall surface where the wall segment is located;

[0110] When there is a valid opening position, generate an opening on the wall surface where the wall segment is located.

[0111] By obtaining all the wall segments of the current floor's wall sketch, where the wall segments represent the boundaries and structures of the building, determine whether there is a corresponding inner polygon for each wall segment. The inner polygon is a geometric shape representing the positions of windows or doors inside the wall, to check whether each wall segment is suitable for performing the hole-digging operation. Obtain the normal vector of the inner polygon corresponding to the wall segment. The normal vector is used to determine the direction and position of the hole, and determine whether the normal vector is equal to a preset direction vector to determine whether a hole needs to be generated, that is, whether the normal vector points to the inside of the building, and whether the length and position of the wall segment meet the size requirements of the doors and windows to determine whether a hole needs to be generated and the direction and position of the hole; and check whether there is a valid hole position on the wall surface where the wall segment is located to determine whether a hole can be successfully generated; when there is a valid hole position, such as calling the addHole method, passing the line segment and the calculated length to the system, and according to the incoming hole position and model type, calling the executePotholing method to generate holes on the wall surface where the wall segment is located, such as windows and doors, that is, digging holes in the actual wall, thereby efficiently determining which line segments can perform the hole-digging operation, realizing an efficient hole-digging modeling operation with a higher hole-digging success rate, so as to improve the modeling efficiency of the target building.

[0112] Further, generate a wall outer frame for each floor of the target building, call the executePotholing method, and according to the incoming hole position and the style type of the building model, create the corresponding wall outer frame and place the holes on the wall outer frame to ensure that the appearance of the building meets the design requirements.

[0113] And, update the wall sketch, holes, and wall outer frame of each floor and merge the wall sketches, holes, and wall outer frames of all floors, render to obtain the target building model, update the window instances and merge all instances to optimize the rendering performance and reduce the workload during rendering.

[0114] Refer to Figure 1 In one embodiment, a WebGL-based automated modeling method further includes the following steps.

[0115] S11: Export the target building model in a preset target format, where the target format includes the GLTF format and the GLB format.

[0116] Refer to Figure 2, for example, call the exporter function to convert the building object into the GLB format. By parsing the building object and converting its data into the JSON format, then create a Blob object to package the data, then generate a download link pointing to the Blob, and set the name of the downloaded file. Finally, trigger the download procedurally. The whole process ensures that users can conveniently export the generated building model as a GLB format file for use and display on other platforms or software, enhancing the portability and practicality of the model, broadening the application scenarios, and having stronger applicability.

[0117] In one embodiment, when traversing all the wall segments of the wall sketch, the following steps are further included:

[0118] Calculate the intersection points of the newly added line segments and the existing wall segments;

[0119] Judge whether the intersection points are the endpoints of the existing wall segments;

[0120] If the intersection points are not the endpoints of the existing wall segments, create new endpoints to cut the existing wall segments into two new wall segments.

[0121] By judging whether the intersection points are endpoints, such as using recursive calls to further check the new line segments. If the intersection points are not endpoints, create new endpoints and cut the existing wall segments into two new wall segments, effectively avoiding overlapping and unreasonable door and window structures, ensuring that the hole-digging operation complies with the specifications and requirements of architectural design, making the generated building model more reasonable and having higher modeling accuracy.

[0122] In one embodiment, the step of judging whether the intersection points are the endpoints of the existing wall segments includes:

[0123] Use the method of precision comparison to judge whether the intersection points are above or below or on the extension line of the newly added line segments and the existing wall segments;

[0124] If not, judge that the intersection points are the endpoints of the existing wall segments.

[0125] The method of precision comparison includes:

[0126] 1. Standard deviation: The standard deviation is the most commonly used measure of precision, which can reflect the degree of dispersion of data. The smaller the standard deviation, the higher the data precision. The calculation formula is:

[0127] [\sigma=\sqrt{\frac{1}{N}\sum_{i=1}^{N}(X_i–\mu)^2}]

[0128] Among them, (\sigma) is the standard deviation, (N) is the number of data points, (X_i) is the i-th data point, and (\mu) is the mean;

[0129] 2. Coefficient of variation: The coefficient of variation is the ratio of the standard deviation to the mean, used to measure the relative dispersion of data. The smaller the coefficient of variation, the higher the precision of the data. The calculation formula is:

[0130] [CV = \frac{\sigma}{\mu} \times 100\%]

[0131] Among them, (CV) is the coefficient of variation, (\sigma) is the standard deviation, and (\mu) is the mean;

[0132] 3. Confidence interval: The confidence interval is a range that estimates the range containing the true parameter value. The narrower the confidence interval, the higher the precision of the data. The confidence interval is usually expressed at a certain confidence level (such as 95%);

[0133] 4. Absolute error and relative error: The absolute error is the gap between the measurement result and the true value of the measured quantity, and the relative error is the ratio of the absolute error to the true value of the measured quantity. The smaller the absolute error and relative error, the higher the measurement accuracy;

[0134] 5. Precision range: The precision range refers to the fluctuation range of the measurement result. The smaller the precision range, the higher the measurement accuracy.

[0135] When judging whether the intersection point is the endpoint of the line segment, using the method of precision comparison can more accurately handle the floating-point precision problem, avoid misjudgment, and has better flexibility. Compared with the traditional threshold method that is prone to errors in complex geometric calculations, in this embodiment, the method of precision comparison is used to judge whether the intersection point is the endpoint of the line segment, which is more suitable for applications in scenarios with high-precision requirements such as building model generation.

[0136] In one embodiment, the step of generating the outer frame of the wall for each floor of the target building further includes

[0137] Multiplying the index of the current floor by the height of the outer frame of the wall of the current floor to stack the outer frames of the walls of each floor vertically.

[0138] When setting the position of the outer frame of the wall, by multiplying the index i of the current floor by the height Store.houseParameter.height of the outer frame of the wall of the current floor, when stacking the outer frames of the walls of each floor, it can ensure that the outer frames of the walls of each floor are correctly stacked vertically. The operation is simple and effective, further enhancing the stability and rationality of the building model structure and having higher modeling accuracy.

[0139] In summary, obtain the target building parameters and set the target building style. According to the target building parameters and the target building style, generate the target building sketch points and form the complete sketch of the target building to guide the construction of the target building model, ensuring that the target building model can meet the design requirements and has higher model accuracy. Based on the complete sketch, generate each level of the target building through loops, construct and merge the basic shape and outer frame of the target building, and generate the corresponding wall sketches for each level to obtain the initial model of the target building. Traverse all the wall segments of the wall sketches to determine whether there is a corresponding inner polygon for each wall segment to check whether each segment is suitable for digging a hole. If there is a corresponding inner polygon for the wall segment, obtain the normal vector of the inner polygon corresponding to the wall segment and determine whether the normal vector of the inner polygon is equal to the preset direction vector to determine whether to generate a hole and the direction and position of the hole. If the normal vector of the inner polygon is equal to the direction vector, check whether there is a valid hole position on the wall surface where the wall segment is located to determine whether a hole can be successfully generated. When there is a valid hole position, generate a hole on the wall surface where the wall segment is located according to the incoming hole position and model type, thereby realizing an efficient hole-digging modeling operation with a higher hole-digging success rate to improve the modeling efficiency of the target building. Generate the outer frame of the wall for each level of the target building, place the holes on the outer frame of the wall, and complete the construction of each level of the target building model. Finally, update the wall sketches, holes, and outer frames of the wall for each level and merge the wall sketches, holes, and outer frames of all levels to render the target building model, reducing the rendering time and having a higher modeling efficiency. Furthermore, an automated modeling method based on WebGL improves the automated modeling accuracy and modeling efficiency of the target building. Utilizing the real-time rendering ability of WebGL, it allows users to import the target building parameters and texture maps, dynamically adjust the size and number of floors of the building, and perform stylization processing, which can effectively lower the modeling threshold, simplify the modeling process, enable users to directly perform 3D modeling and rendering through the web without installing additional plugins, achieve fast rendering of the model, have a low learning cost, and also improve the modeling efficiency.

[0140] An automated modeling method based on WebGL not only improves the modeling efficiency but also enables users to obtain higher flexibility and creativity during the modeling process, thereby improving the modeling efficiency and achieving rapid iteration. Moreover, through rapid iteration and real-time feedback, users can perform architectural design more efficiently, significantly shortening the modeling time and further greatly enhancing the modeling efficiency.

[0141] It should be understood that the magnitudes of the sequence numbers of the steps in the above embodiments do not imply the order of execution. The order of execution of each process should be determined by its function and internal logic and should not constitute any limitation to the implementation process of the embodiments of the present application.

[0142] Refer toFigure 3 , an embodiment of the present application also provides an automated modeling device based on WebGL, which corresponds one-to-one with an automated modeling method based on WebGL in the above embodiment. The automated modeling device based on WebGL includes

[0143] An initial module for obtaining target building parameters and setting a target building style;

[0144] A complete sketch module for generating target building sketch points according to the target building parameters and the target building style, and forming a complete sketch of the target building;

[0145] A wall sketch module for constructing and merging the basic shape and outer frame of the target building by generating each layer of the target building in a loop based on the complete sketch, and generating corresponding wall sketches for each layer;

[0146] An inner polygon detection module for traversing all wall segments of the wall sketch to determine whether there is a corresponding inner polygon for the wall segment;

[0147] A hole data determination module for obtaining the normal vector of the inner polygon corresponding to the wall segment when there is a corresponding inner polygon for the wall segment;

[0148] A hole detection module for determining whether the normal vector of the inner polygon is equal to a preset direction vector;

[0149] A hole verification module for finding whether there is a valid hole position on the wall surface where the wall segment is located when the normal vector of the inner polygon is equal to the direction vector;

[0150] A hole generation module for generating a hole on the wall surface where the wall segment is located when there is a valid hole position;

[0151] An outer wall frame module for generating an outer wall frame for each layer of the target building and placing the hole on the outer wall frame;

[0152] A rendering module for updating the wall sketches, holes, and outer wall frames of each layer and merging the wall sketches, holes, and outer wall frames of all layers to render and obtain a target building model.

[0153] An automated modeling device based on WebGL further includes

[0154] An export module for exporting the target building model in a preset target format, where the target format includes GLTF format and GLB format.

[0155] For the specific limitations of an automated modeling device based on WebGL, reference can be made to the limitations of an automated modeling method based on WebGL in the above text, which will not be elaborated here.

[0156] Each module in the above-mentioned automated modeling device based on WebGL can be implemented in whole or in part by software, hardware, or a combination thereof. Each of the above modules can be embedded in the processor of the computer device in hardware form or be independent of it, or can be stored in the memory of the computer device in software form, so that the processor can call and execute the operations corresponding to each of the above modules.

[0157] In one embodiment, a computer device is provided. The computer device can be a server. The computer device includes a processor, a memory, a network interface, and a database connected through a system bus. Among them, the processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program, and a database. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The network interface of the computer device is used to communicate with an external terminal through a network connection. When the computer program is executed by the processor, it implements any one of the above-mentioned automated modeling methods based on WebGL.

[0158] In one embodiment, a computer-readable storage medium is provided, including a memory, a processor, and a computer program stored on the memory and executable on the processor. When the processor executes the computer program, it implements any one of the above-mentioned automated modeling methods based on WebGL.

[0159] In one embodiment, a computer program product is provided. The computer program product includes a computer program, and when the computer program is executed by the processor, it implements any one of the above-mentioned automated modeling methods based on WebGL.

[0160] Those of ordinary skill in the art can understand that all or part of the processes in the methods of the above embodiments can be completed by instructing relevant hardware through a computer program. The computer program can be stored in a non-volatile computer-readable storage medium, including several instructions to enable a computer device (which can be a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of the present application. When the computer program is executed, it can include the processes of the embodiments of the above methods. Among them, any reference to a memory, storage, database, or other medium used in the various embodiments provided by the present application can include non-volatile and / or volatile memories. Non-volatile memories can include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM), or flash memory. Volatile memories can include random access memory (RAM) or external cache memory. By way of illustration and not limitation, RAM is available in various forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double data rate SDRAM (DDR SDRAM), enhanced SDRAM (ESDRAM), synchronous link DRAM (SLDRAM), Rambus direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and Rambus dynamic RAM (RDRAM), etc.

[0161] Those skilled in the art can clearly understand that, for the convenience and brevity of description, only the above division of each functional unit and module is used as an example. In actual applications, the above functions can be allocated to different functional units and modules according to needs, that is, the internal structure of the system can be divided into different functional units or modules to complete all or part of the functions described above.

Claims

1. An automated modeling method based on WebGL, characterized in that: The following steps are included: Obtain target building parameters and set target building style; Generate target building sketch points according to the target building parameters and the target building style, and form a complete sketch of the target building; Based on the complete sketch, each layer of the target building is generated by looping, the basic shape and outer frame of the target building are constructed and merged, and a corresponding wall sketch is generated for each layer; Traversing all the wall line segments of the wall sketch to determine whether there is a corresponding inner polygon for the wall line segment; If the wall line segment has a corresponding inner polygon, obtaining the normal vector of the inner polygon corresponding to the wall line segment; Determine whether the normal vector of the inner polygon is equal to a preset direction vector; If the normal vector of the inner polygon is equal to the direction vector, then searching whether there is a valid opening position on the wall where the wall line segment is located; When there is a valid opening position, generating an opening on the wall surface where the wall line segment is located; Generate a wall frame for each floor of the target building, and place the opening on the wall frame; The wall sketches, openings and wall frames of each layer are updated and the wall sketches, openings and wall frames of all layers are merged, and the target building model is obtained by rendering.

2. The WebGL-based automated modeling method according to claim 1, characterized in that: When traversing all the wall line segments of the wall sketch, the following steps are also included: Calculate the intersection of the newly added line segment and the existing wall line segment; Determine whether the intersection point is an endpoint of an existing wall segment; If the intersection point is not an endpoint of an existing wall line segment, a new endpoint is created to cut the existing wall line segment into two new wall line segments.

3. The WebGL-based automated modeling method according to claim 2, characterized in that: The step of determining whether the intersection point is an endpoint of an existing wall segment includes: Use the precision comparison method to determine whether the intersection point is above or below the extension line of the newly added line segment and the existing wall line segment or on the extension line of the line segment; If not, it is determined that the intersection point is the endpoint of an existing wall line segment.

4. The WebGL-based automated modeling method according to claim 1, characterized in that: The step of generating a wall frame for each layer of the target building also includes: Multiply the index of the current layer by the height of the wall frame of the current layer, so that the wall frames of each layer are superimposed in the vertical direction.

5. The WebGL-based automated modeling method according to claim 1, characterized in that: Based on the complete sketch, before the step of generating each level of the target building through a loop, it also includes: Determine whether the sketch of the current layer to be generated is the top-level sketch; If the sketch of the current layer to be generated is the top-level sketch, the material setting, height adjustment, frame generation and merging and updating are performed according to the preset design requirements, and then the wall sketch of the current layer is generated.

6. The WebGL-based automated modeling method according to claim 5, characterized in that: The step of judging whether the sketch of the current layer to be generated is a top-level sketch comprises: Determine whether the index of the sketch of the current layer to be generated is equal to the preset total number of layers minus 1; If the index of the sketch of the current layer is equal to the total number of layers minus 1, the sketch of the current layer to be generated is determined to be the top-level sketch.

7. The WebGL-based automated modeling method according to any one of claims 1 to 6, characterized in that: The step of generating the target building sketch points and forming a complete sketch of the target building includes: Define a coordinate system in three-dimensional space; Based on the sketch points of the target building, determining the key node coordinates of the target building in the three-dimensional space; According to the wall thickness of the target building, the key node coordinates are adjusted to determine the position coordinates of each corner point; Take the bottom surface of the target building as the reference and calculate the normal vector of each corner point; With each normal vector as the Z axis, a local coordinate system is established, and the edge line of the target building is generated according to each corner point; Connect the adjacent edges, merge all edges and faces, and obtain a complete sketch of the target building.

8. The WebGL-based automated modeling method according to claim 7, characterized in that: The following steps are also included: The target building model is exported in a preset target format, wherein the target format includes a GLTF format and a GLB format.

9. An automatic modeling device based on WebGL, characterized in that: include, The initial module is used to obtain the target building parameters and set the target building style; A complete sketch module, used to generate target building sketch points according to the target building parameters and the target building style, and form a complete sketch of the target building; A wall sketch module, for generating various layers of the target building through a loop based on the complete sketch, constructing and merging the basic shape and outer frame of the target building, and generating a corresponding wall sketch for each layer; An inner polygon detection module is used to traverse all wall line segments of the wall sketch and determine whether there is a corresponding inner polygon for the wall line segment; The opening data determination module is used to obtain the normal vector of the inner polygon corresponding to the wall line segment when the wall line segment has a corresponding inner polygon; A hole detection module, used to determine whether the normal vector of the inner polygon is equal to a preset direction vector; An opening verification module, used for finding whether there is a valid opening position on the wall surface where the wall line segment is located when the normal vector of the inner polygon is equal to the direction vector; An opening generation module is used to generate an opening on the wall surface where the wall line segment is located when there is a valid opening position; A wall frame module, used for generating a wall frame for each floor of the target building, and placing the opening on the wall frame; The rendering module is used to update the wall sketch, opening and wall frame of each layer and merge the wall sketch, opening and wall frame of all layers to render the target building model.

10. A computer device, characterized in that: The method comprises a memory, a processor and a computer program stored in the memory, wherein the processor executes the computer program to implement the steps of the method according to any one of claims 1 to 8.

11. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 8 are implemented.

12. A computer program product, characterized in that The invention comprises a computer program, which implements the steps of the method according to any one of claims 1 to 8 when being executed by a processor.