Virtual building generation method and device, computer program product and electronic device
Patent Information
- Application Number
- CN202610648471.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-05-11
- Publication Date
- 2026-08-18
AI Technical Summary
然而,目前如果在非线性区域,如存在曲率变化的弯道进行内容(如建筑)生成时,以中心线为基准进行两侧撒点,不仅容易导致建筑生成密度不一致,还可能存在模型相互穿插的问题,一定程度影响了场景的视觉质量和游戏体验
[0017]The virtual building generation method in the exemplary embodiments of this disclosure obtains the center reference line and boundary parameters of the target area, and obtains the spatial contour parameters of the building to be generated; based on the center reference line and boundary parameters, a reference auxiliary line is generated on at least one side of the center reference line, and redundant nodes on the reference auxiliary line are removed to obtain the target auxiliary line, where redundant nodes refer to nodes on the reference auxiliary line located within self-intersecting intervals; nodes are sampled on the target auxiliary line according to the spatial contour parameters, and the placement position of the building to be generated is determined based on the sampling results; the building to be generated is loaded to the placement position to generate a virtual building model on at least one side of the center reference line. On the one hand, by removing redundant nodes on the reference auxiliary line, subsequent building placement calculations are avoided in invalid or overlapping areas, thereby reducing the number of invalid sampling points, reducing the amount of data processing, and thus improving the computational speed and resource utilization of virtual building generation. Furthermore, by removing nodes in self-intersecting intervals, the generation of buildings at the intersection or overlapping positions of reference lines is effectively prevented, making the final generated virtual building more reasonable and regular in spatial layout, and avoiding penetration or overlap problems between adjacent building models due to improper generation positions. On the other hand, by combining the center reference line, boundary parameters, and spatial contour parameters for node sampling, the generated building position can be adaptively adjusted according to the actual planning boundary. Compared with the fixed spacing arrangement, it can better adapt to complex fields such as curved roads and irregular plots, improving the visual quality of the scene and the gaming experience.
Smart Images

Figure CN122597735A_ABST
Abstract
Description
Technical Field
[0001] This disclosure relates to the field of computer technology, and more specifically, to a method and apparatus for generating virtual buildings, computer program products, and electronic devices. Background Technology
[0002] In modern game development and virtual reality applications, to meet the demand for real-time and rapid scene construction, developers often adopt runtime procedural content generation solutions. These solutions are typically based entirely on the game engine's code logic, dynamically generating street scenes, such as virtual buildings, during game runtime. However, currently, when generating content (such as buildings) in non-linear regions, such as curves with varying curvature, using the centerline as a reference for scattering points on both sides can easily lead to inconsistent building generation density and may also result in models intersecting, which to some extent affects the visual quality of the scene and the gaming experience.
[0003] It should be noted that the information in the background section above is only used to enhance the understanding of the background of this disclosure, and therefore may include information that does not constitute prior art known to those skilled in the art. Summary of the Invention
[0004] The purpose of this disclosure is to provide a method and apparatus for generating virtual buildings, a computer program product and an electronic device, thereby overcoming, to some extent, the defects of related technologies and improving the quality of virtual building models generated on both sides of a nonlinear target region.
[0005] Other features and advantages of this disclosure will become apparent from the following detailed description, or may be learned in part from practice of this disclosure.
[0006] According to one aspect of this disclosure, a method for generating a virtual building is provided, comprising: acquiring a center reference line and boundary parameters of a target area, and acquiring spatial contour parameters of a building to be generated; generating a reference auxiliary line on at least one side of the center reference line based on the center reference line and boundary parameters, and removing redundant nodes on the reference auxiliary line to obtain a target auxiliary line, wherein redundant nodes refer to nodes on the reference auxiliary line located within self-intersecting intervals; sampling nodes on the target auxiliary line based on the spatial contour parameters, and determining the placement position of the building to be generated based on the sampling results; and loading the building to be generated to the placement position to generate a virtual building model on at least one side of the center reference line.
[0007] In one exemplary embodiment of this disclosure, generating a reference auxiliary line on at least one side of a center reference line based on a center reference line and boundary parameters includes: determining a reference distance by which the center reference line is offset to at least one side of the center reference line based on the boundary parameters; offsetting nodes on the center reference line along the node normal direction by the reference distance based on the center reference line to obtain an offset node set; and generating a reference auxiliary line on at least one side of the center reference line based on the offset node set.
[0008] In one exemplary embodiment of this disclosure, redundant nodes on a reference auxiliary line are removed to obtain a target auxiliary line. This includes: traversing the nodes on the reference auxiliary line and determining multiple reference line segments based on the traversed nodes; performing cross detection on the multiple reference line segments, and if cross-connecting reference line segments are detected, determining self-intersecting intervals based on the cross-connecting nodes; removing redundant nodes on the reference auxiliary line located within the self-intersecting intervals, and reconstructing lines based on the cross-connecting nodes to obtain reconstructed lines; and determining the target auxiliary line based on the reference auxiliary line after removing redundant nodes and the reconstructed lines.
[0009] In one exemplary embodiment of this disclosure, node sampling is performed on a target auxiliary line based on spatial contour parameters, and the placement position of the building to be generated is determined based on the sampling results. This includes: determining a current node on the target auxiliary line for generating the building to be generated, and determining the length of the virtual building based on the spatial contour parameters; taking the current node as the starting point, node sampling is performed on the target auxiliary line to obtain a target sampling point that meets a preset condition, wherein the preset condition is that the distance between the target sampling point and the current node is greater than or equal to the length of the virtual building; and determining the placement position of the building to be generated based on the target sampling point and the current node; wherein the target sampling point is determined as the current node of the next building to be generated.
[0010] In one exemplary embodiment of this disclosure, determining the placement position of the building to be generated based on the target sampling point and the current node includes: determining the direction vector from the current node to the target sampling point, the direction vector being used to determine the placement orientation of the building to be generated at the current node; and determining the placement position of the building to be generated based on the current node, the target sampling point, and the direction vector.
[0011] In an exemplary embodiment of this disclosure, if the building to be generated is a virtual building complex, the method further includes: performing an intersection test between the virtual building complex and the target area and the target auxiliary line based on the generation center point and building boundary of the virtual building complex; if the intersection detection result indicates that there is a geometric intersection, then offsetting the building boundary to the target position, wherein the building boundary has no geometric intersection with the target area and the target auxiliary line at the target position; loading the building to be generated to the placement position to generate a virtual building model on at least one side of the center reference line, including: updating the placement position according to the target position to load the virtual building complex to the updated placement position to obtain a virtual building model.
[0012] In one exemplary embodiment of this disclosure, if the intersection detection result indicates that there is a geometric intersection, the building boundary is offset to the target position, including: obtaining the normal vector of the tangent line of the target area corresponding to the generated center point based on the generated center point; and moving the building boundary to the target position based on the normal vector.
[0013] In one exemplary embodiment of this disclosure, updating the placement position according to the target position to load the virtual building complex to the updated placement position and obtain a virtual building model includes: obtaining the maximum movement distance of each sub-building component in the virtual building complex according to the target position; adjusting the placement position of each sub-building component based on the maximum movement distance, and loading the virtual building complex to the adjusted placement position to obtain a virtual building model.
[0014] According to one aspect of this disclosure, a virtual building generation apparatus is provided, comprising: a parameter acquisition module for acquiring a center reference line and boundary parameters of a target area, and acquiring spatial contour parameters of a building to be generated; an auxiliary line construction module for generating a reference auxiliary line on at least one side of the center reference line based on the center reference line and boundary parameters, and removing redundant nodes on the reference auxiliary line to obtain a target auxiliary line, wherein redundant nodes refer to nodes on the reference auxiliary line located within self-intersecting intervals; a position determination module for sampling nodes on the target auxiliary line based on the spatial contour parameters, and determining the placement position of the building to be generated based on the sampling results; and a model generation module for loading the building to be generated to the placement position and generating a virtual building model on at least one side of the center reference line.
[0015] According to one aspect of this disclosure, a computer program product is provided, comprising a computer program that, when executed by a processor, implements any of the above methods.
[0016] According to one aspect of this disclosure, an electronic device is provided, comprising: a processor; and a memory for storing executable instructions of the processor; wherein the processor is configured to perform any of the above methods by executing the executable instructions.
[0017] The virtual building generation method in the exemplary embodiments of this disclosure obtains the center reference line and boundary parameters of the target area, and obtains the spatial contour parameters of the building to be generated; based on the center reference line and boundary parameters, a reference auxiliary line is generated on at least one side of the center reference line, and redundant nodes on the reference auxiliary line are removed to obtain the target auxiliary line, where redundant nodes refer to nodes on the reference auxiliary line located within self-intersecting intervals; nodes are sampled on the target auxiliary line according to the spatial contour parameters, and the placement position of the building to be generated is determined based on the sampling results; the building to be generated is loaded to the placement position to generate a virtual building model on at least one side of the center reference line. On the one hand, by removing redundant nodes on the reference auxiliary line, subsequent building placement calculations are avoided in invalid or overlapping areas, thereby reducing the number of invalid sampling points, reducing the amount of data processing, and thus improving the computational speed and resource utilization of virtual building generation. Furthermore, by removing nodes in self-intersecting intervals, the generation of buildings at the intersection or overlapping positions of reference lines is effectively prevented, making the final generated virtual building more reasonable and regular in spatial layout, and avoiding penetration or overlap problems between adjacent building models due to improper generation positions. On the other hand, by combining the center reference line, boundary parameters, and spatial contour parameters for node sampling, the generated building position can be adaptively adjusted according to the actual planning boundary. Compared with the fixed spacing arrangement, it can better adapt to complex fields such as curved roads and irregular plots, improving the visual quality of the scene and the gaming experience.
[0018] It should be understood that the above general description and the following detailed description are exemplary and explanatory only, and are not intended to limit this disclosure. Attached Figure Description
[0019] The above and other objects, features, and advantages of this disclosure will become readily apparent from the following detailed description of exemplary embodiments, taken in conjunction with the accompanying drawings. Several embodiments of this disclosure are illustrated in the drawings by way of example and not limitation.
[0020] Figure 1 An application environment according to an exemplary embodiment of this disclosure is shown.
[0021] Figure 2 A flowchart of a virtual building generation method according to an exemplary embodiment of the present disclosure is shown.
[0022] Figure 3 A schematic diagram of the center reference line of a nonlinear road path (i.e., a curve with varying curvature) according to an exemplary embodiment of the present disclosure is shown.
[0023] Figure 4 A schematic diagram of a redundant node according to an exemplary embodiment of the present disclosure is shown.
[0024] Figure 5 A flowchart illustrating an implementation of generating reference auxiliary lines according to an exemplary embodiment of the present disclosure is shown.
[0025] Figure 6 A schematic diagram of determining a reference auxiliary line according to an exemplary embodiment of the present disclosure is shown.
[0026] Figure 7 A flowchart illustrating an implementation of determining a target auxiliary line according to an exemplary embodiment of the present disclosure is shown.
[0027] Figure 8 A schematic diagram of obtaining a target auxiliary line is shown according to an exemplary embodiment of the present disclosure.
[0028] Figure 9 A flowchart illustrating an implementation of determining the placement location of a building to be generated according to an exemplary embodiment of the present disclosure is shown.
[0029] Figure 10 A schematic diagram illustrating a method for acquiring target sampling points by sampling according to an exemplary embodiment of the present disclosure is shown.
[0030] Figure 11 A schematic diagram is shown illustrating a method of moving a building boundary along a normal vector to a target location according to an exemplary embodiment of the present disclosure.
[0031] Figure 12 A schematic diagram of the composition of a virtual building generation apparatus according to an exemplary embodiment of the present disclosure is shown.
[0032] Figure 13 A block diagram of an electronic device according to an exemplary embodiment of the present disclosure is shown.
[0033] In the accompanying drawings, the same or corresponding reference numerals indicate the same or corresponding parts. Detailed Implementation
[0034] Exemplary embodiments will now be described more fully with reference to the accompanying drawings. However, exemplary embodiments can be implemented in many forms and should not be construed as limited to the examples set forth herein; rather, these embodiments are provided so that this disclosure will be more comprehensive and complete, and will fully convey the concept of exemplary embodiments to those skilled in the art. The same reference numerals in the drawings denote the same or similar structures, and therefore their detailed description will be omitted.
[0035] Furthermore, the described features, structures, or characteristics can be combined in any suitable manner in one or more embodiments. Numerous specific details are provided in the following description to give a thorough understanding of embodiments of this disclosure. However, those skilled in the art will recognize that the technical solutions of this disclosure can be practiced without one or more of the specific details described, or other methods, components, apparatuses, steps, etc., can be employed. In other instances, well-known structures, methods, apparatuses, implementations, or operations are not shown or described in detail to avoid obscuring various aspects of this disclosure.
[0036] The block diagrams shown in the accompanying drawings are merely functional entities and do not necessarily correspond to physically independent entities. That is, these functional entities can be implemented in software, or in one or more software-hardened modules, or in different network and / or processor devices and / or microcontroller devices.
[0037] Currently, to meet the demand for real-time and rapid scene construction, developers often adopt runtime procedural content generation solutions. These solutions are typically based entirely on the code logic of game engines (such as Unreal Engine), dynamically generating street scenes, such as virtual buildings, during game runtime. However, when generating content in non-linear regions, such as curves with varying curvature, the current method of scattering points on both sides based on the centerline not only easily leads to inconsistent building generation density but may also result in models intersecting, which to some extent affects the visual quality of the scene and the gaming experience.
[0038] In one approach, a spline curve can be created in the scene as the centerline of the road. Using this centerline as a reference, fixed distances are offset to the left and right sides of the road to calculate the generation points for buildings on both sides. Static meshes are instantiated at these generated points, ensuring the buildings face or are parallel to the road, but using the road centerline as the sole reference line for scattering. At road curves, geometric characteristics dictate that the arc length of the outer curve is much greater than the centerline, while the arc length of the inner curve is much smaller. This results in sparsely distributed buildings on the outer curve (gap formations) and overly densely distributed buildings on the inner curve (overlapping formations), creating a visually unnatural effect. Furthermore, adjacent models are prone to geometric interpenetration on the inner curve side, severely compromising the realism of the scene. When the road curvature is large or special-shaped building assets are used, building models may extend and encroach on the road surface, obstructing the player's view or hindering the passage of game characters.
[0039] Based on one or more of the above-mentioned problems, an exemplary embodiment of this disclosure provides a virtual building generation method that improves the quality of virtual building models generated on both sides of a nonlinear target region by optimizing the generation logic of reference auxiliary lines and combining it with node sampling.
[0040] It should be noted that the exemplary method of this disclosure can be applied to scenarios involving the generation of virtual building models in game development, digital city map construction, navigation map rendering, and film and television special effects, and is not specifically limited thereto. This disclosure uses the generation of virtual building models in a game scene as an example for illustration.
[0041] The virtual building generation method provided in the exemplary embodiments of this disclosure can be applied to, for example... Figure 1 The application environment shown is illustrated. Terminal 101 communicates with server 102 via a network. A data storage system can store the data that server 102 needs to process. The data storage system can be integrated onto server 102, or it can be located in the cloud or on another network server.
[0042] In one exemplary embodiment, the provided virtual building generation method can be executed by server 102, and the corresponding virtual building generation device is disposed in server 102. Correspondingly, in this method executed by server 102, server 102 can start executing the steps of the technical solution of the exemplary embodiment of this disclosure in response to a triggering command, wherein the triggering command can be sent by a terminal used by a user, or can be triggered locally by the server in response to some automated event.
[0043] Server 102 can be a standalone physical server, a server cluster or distributed system composed of multiple physical servers, or a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communication, middleware services, domain name services, security services, CDN, and big data and artificial intelligence platforms. Server 102 can execute background tasks.
[0044] Furthermore, in another exemplary embodiment, terminal 101 may also have similar functions to server 102, thereby executing the virtual building generation method provided by the exemplary embodiments of this disclosure. Terminal 101 may be a smartphone, tablet, laptop, desktop computer, IoT device, or portable wearable device. IoT devices may include smart TVs and smart in-vehicle devices, etc. Portable wearable devices may include smartwatches, head-mounted devices, etc. Terminal 101 may also be referred to as a mobile terminal, terminal device, mobile device, etc., and the exemplary embodiments of this disclosure do not limit the type of terminal 101.
[0045] Furthermore, the technical solutions of the exemplary embodiments of this disclosure can also be executed collaboratively by terminal 101 and server 102. In this collaborative execution method, some steps of the technical solutions provided in the exemplary embodiments of this disclosure are executed by terminal 101, while other steps are executed by server 102. In this collaborative execution method, the steps executed by terminal 101 and server 102 respectively can be dynamically adjusted according to actual conditions, and no special restrictions are placed on this. Terminal 101 and server 102 can be directly or indirectly connected via wireless communication, and no special restrictions are placed on this in the exemplary embodiments of this disclosure.
[0046] refer to Figure 2 The diagram shown is a flowchart of a virtual building generation method according to an exemplary embodiment of this disclosure. Figure 2 As shown, the virtual building generation method includes steps S210 to S240, as detailed below: In step S210, the center reference line and boundary parameters of the target area are obtained, and the spatial outline parameters of the building to be generated are obtained.
[0047] In an exemplary embodiment of this disclosure, the center reference line is a line used to define the baseline trajectory for generating virtual buildings. It serves as the core framework line of the target area, determining the arrangement direction and trend of the building complex. Examples include straight urban main roads, the central axis of a rectangular plot, roundabout roads, winding mountain roads, riverbanks, or center lines. For instance,... Figure 3 The diagram illustrates the center reference line of a nonlinear road path (i.e., a curve with varying curvature). The red line represents the defined center reference line. Boundary parameters are constraints used to limit the generation range of the virtual building; these can be geometric boundaries, such as the total width of a road or the width of a body of water. Spatial contour parameters describe the 3D footprint of the building to be generated; for example, they can be the projected length and width of the building on the ground, its total height, floor height, and geometric shape.
[0048] The aforementioned center reference line can be directly specified or drawn by the artist, or it can be imported from an external file; there are no special restrictions on this.
[0049] In step S220, a reference auxiliary line is generated on at least one side of the center reference line based on the center reference line and boundary parameters, and redundant nodes on the reference auxiliary line are removed to obtain the target auxiliary line. Redundant nodes refer to nodes on the reference auxiliary line located within the self-intersection interval.
[0050] In the exemplary embodiments of this disclosure, the reference auxiliary line is a baseline determined based on the center reference line and boundary parameters, used to specifically locate the building placement position. Wherein, if the boundary parameters specify that the building is generated only on one side of the center reference line, the reference auxiliary line is a parallel offset line located on that one side. If the boundary parameters specify that it is generated on both sides, two reference auxiliary lines are generated. Redundant nodes refer to nodes located within the self-intersection interval of the reference auxiliary line; these redundant nodes can be understood as key nodes that lead to errors in the building layout logic. The self-intersection interval is the area on the same reference auxiliary line where the line intersects or overlaps with itself. In two-dimensional geometry, self-intersection curves form several closed loops or overlapping segments. For example, as... Figure 4 The diagram shows a redundant node. No sampling point within the intersecting interval can generate a reasonably laid-out building. Therefore, due to the existence of redundant nodes (forming closed loops), the generated virtual building models may overlap or intersect.
[0051] In one exemplary embodiment, an implementation method for generating reference auxiliary lines is provided. For example... Figure 5 As shown, generating a reference auxiliary line on at least one side of the center reference line, based on the center reference line and boundary parameters, includes: Step S510: Determine the reference distance by which the center reference line is offset to at least one side of the center reference line based on the boundary parameters.
[0052] Step S520: Based on the center reference line, offset the nodes on the center reference line along the node normal direction by a reference distance to obtain the offset node set.
[0053] Step S530: Generate a reference auxiliary line on at least one side of the center reference line based on the offset node set.
[0054] It's important to note that nodes are discrete points that make up the center reference line. In computer graphics, curves and polylines are essentially composed of ordered nodes and their connections. The reference distance is a specific numerical value determined by boundary parameters, representing the offset of the center reference line to one side. For example, if the road width is determined to be W based on boundary parameters, then the reference distances offset to either side of the road can be W / 2. Of course, the offset distances to each side can be flexibly determined based on boundary parameters or actual needs.
[0055] The node normal direction is a unit vector perpendicular to the tangent direction of the center reference line at the node. The offset node set is the set of new nodes obtained by offsetting each node on the center reference line along the normal direction by a reference distance. The offset node set is the intermediate data form for generating reference auxiliary lines. By connecting the offset node sets, continuous reference auxiliary lines can be obtained.
[0056] For example, such as Figure 6 The diagram shows how to determine the reference auxiliary line. Taking the road width as W as an example, by offsetting the nodes on the center reference line along the node normal direction by a reference distance of W / 2, an offset node set is obtained. Then, by connecting the nodes in the offset node set, reference auxiliary lines are generated on both sides of the center reference line. Based on this, it can be ensured that the distance from the left and right reference auxiliary lines to the center reference line is the same.
[0057] The exemplary embodiments of this disclosure, by discretizing the central reference line into nodes and offsetting it along the normal direction of each node, ensure that the generated reference auxiliary line maintains an accurate equidistance relationship with the central reference line. This avoids the distance distortion that may occur in curve segments in traditional overall offset algorithms, providing an accurate reference position basis for subsequent model generation. Furthermore, it can flexibly support scenarios where the reference distance dynamically changes along the curve, improving adaptability to complex environments.
[0058] In one exemplary embodiment, an implementation method for determining a target auxiliary line is also provided. For example... Figure 7 As shown, removing redundant nodes on the reference auxiliary line to obtain the target auxiliary line may include: Step S710: Traverse the nodes on the reference auxiliary lines and determine multiple reference line segments based on the traversed nodes.
[0059] A reference segment is a line segment formed by connecting adjacent nodes on a reference auxiliary line. For example, a reference auxiliary line consisting of n nodes can be divided into n-1 reference segments, each defined by the coordinates of its two endpoints.
[0060] Step S720: Perform cross detection on multiple reference line segments. If cross reference line segments are detected, determine the self-intersection interval based on the cross nodes.
[0061] Step S730: Remove redundant nodes located in the self-intersecting interval on the reference auxiliary line, and reconstruct the line based on the intersection nodes to obtain the reconstructed line.
[0062] Cross-intersection detection determines whether two reference line segments intersect, thus identifying the self-intersection locations on the reference auxiliary lines. This process detects non-adjacent line segments; since adjacent line segments share an endpoint, their intersections are considered normal connection points and should not be considered self-intersections. Geometric algorithms such as straddle experiments and parametric equation solving can be used to determine whether two line segments intersect and calculate the intersection coordinates. For example, intersection detection can be performed by calling the "Segment Intersection2D" function in the engine. A self-intersection interval is a continuous segment on the reference auxiliary line where a self-intersection occurs. When the reference auxiliary line loops due to excessive offset or curvature, one or more self-intersection intervals are formed. By detecting the pairs of intersection nodes, the start and end points of the self-intersection interval can be determined, thus identifying all nodes within that interval. An intersection node is the point of intersection formed when two reference line segments intersect during cross-intersection detection. It is important to note that the intersection point may not be an original node on the original reference auxiliary line, but a new point formed by the intersection of two line segments. This intersection node serves as the boundary point of the self-intersecting interval. After eliminating redundant nodes, it is used to connect the broken curve parts to achieve line reconstruction. In other words, the endpoints on both sides of the self-intersecting interval are directly connected to form a new line segment or curve segment, thereby skipping the invalid area of the self-intersection.
[0063] This involves iterating through the reference line segments and calling the aforementioned function to determine if any intersecting line segments exist. If so, the self-intersecting interval is determined. For example, the intersection type can be interior angle self-intersection. See also... Figure 4 The diagram shows an interior angle self-intersection. Of course, other types of intersections are also possible, and the handling method is the same.
[0064] Step S740: Determine the target auxiliary line based on the reference auxiliary line and the reconstructed line after removing redundant nodes.
[0065] After removing redundant nodes, the target auxiliary line can be determined based on the reference auxiliary line and the reconstructed line. The reconstructed line is a smooth, non-self-intersecting continuous curve, which can be directly used to construct the target auxiliary line. For example... Figure 8 As shown in Figure 801, after removing redundant nodes, a smooth target auxiliary line is obtained, as shown in Figure 802.
[0066] The exemplary embodiments of this disclosure, by discretizing continuous curves into reference line segments and performing cross-detection, can accurately locate self-intersecting intervals, ensuring the accuracy of the elimination operation, thereby improving the accuracy of generating target auxiliary lines and providing a basis for avoiding interlacing or overlapping when generating subsequent models.
[0067] In step S230, node sampling is performed on the target auxiliary line according to the spatial contour parameters, and the placement position of the building to be generated is determined based on the sampling results.
[0068] In an exemplary embodiment of this disclosure, node sampling is the process of selecting a location on a target auxiliary line for placing the building. This sampling process uses spatial contour parameters as sampling constraints. The placement location refers to the final location of the building to be generated in three-dimensional space, and may include planar position, spatial orientation, and elevation information, etc.
[0069] In one exemplary embodiment, an implementation method is provided for determining the placement location of a building to be generated. For example... Figure 9 The process of sampling nodes on the target auxiliary line based on spatial contour parameters and determining the placement of the building to be generated based on the sampling results may include: Step S910: Determine the current node on the target auxiliary line for generating the building to be generated, and determine the length of the virtual building based on the spatial contour parameters.
[0070] The current node refers to the reference point that serves as the starting point for sampling in the current iteration, i.e., the position that has already been processed. The initial value of the current node is the starting point of the target auxiliary line. After sampling is completed in the current iteration, the target node is used as the current node for the next iteration. The virtual building length refers to a value determined based on spatial contour parameters, used to characterize the spatial length occupied by a single building along the direction of the target auxiliary line.
[0071] Step S920: Starting from the current node, perform node sampling on the target auxiliary line to obtain target sampling points that meet preset conditions. The preset conditions are that the distance between the target sampling point and the current node is greater than or equal to the length of the virtual building.
[0072] Step S930: Determine the placement location of the building to be generated based on the target sampling point and the current node.
[0073] In this process, the target sampling point is determined as the current node of the next building to be generated. The target sampling point is a new location point that meets preset conditions, found by a sampling algorithm in the current iteration. Starting from the current node, the node moves forward along the target auxiliary line until the cumulative arc length is greater than or equal to the length of the virtual building; this location is the target sampling point. Optionally, the length of the virtual building to be generated can be used as a fixed step size. The node moves forward along the target auxiliary line by this fixed step size from the current node, and the resulting location is the target sampling point. Specifically, the arc length parameter of the current node on the target auxiliary line can be obtained, and the target arc length can be calculated as the sum of the arc length parameter and the fixed step size; the determined location is the target sampling point.
[0074] Optionally, considering curved bends where the building's orientation changes abruptly, the step size can be adjusted based on the local curvature of the curve. For example, a smaller step size can be used where the curvature is large, while a preset standard step size can be used where the curvature is small. This can be achieved by pre-setting an adjustment function with the curve curvature as the independent variable, such as a sigmoid function to control the step size variation. The local curvature of the curve is then input into the adjustment function, and the length of the virtual building to be placed is adjusted based on the adjustment value output by the function. This serves as the adaptive step size for sampling, resulting in a more natural visual transition for the building at bends. The specific form of this adjustment function can also vary. Of course, this method can also limit the minimum step size to avoid overly dense sampling.
[0075] As mentioned above, the preset condition is that the distance between the target sampling point and the current node is greater than or equal to the length of the virtual building. In an optional implementation, the preset condition can be set as follows: the arc distance between the target sampling point and the current node is greater than or equal to the length of the virtual building, and less than or equal to the maximum allowable step size. This maximum allowable step size can be a preset multiple of the length of the virtual building, such as 1.2 times. Based on this, the density of the building layout can be controlled within a reasonable range while ensuring no overlap.
[0076] In another alternative approach, while ensuring the distance between the target sampling point and the current node is greater than or equal to the length of the virtual building, the preset condition may also include that the angle between the tangent direction of the curve at the target sampling point and the tangent direction at the current node is less than a preset angle threshold, such as 30 degrees. This ensures smooth changes in orientation between adjacent buildings, guaranteeing visual continuity. In yet another alternative approach, in addition to the aforementioned distance between the target sampling point and the current node being greater than or equal to the length of the virtual building, the preset condition may also include that the radius of curvature of the curve at the target sampling point is greater than or equal to a preset minimum turning radius. This avoids placing virtual buildings on overly curved road sections. Furthermore, the preset condition may also include that the maximum distance from the target sampling point to the boundary of the target area is greater than or equal to a preset distance threshold, thereby preventing virtual buildings from being too close to the boundary of the target area.
[0077] Based on the above example, in addition to distance constraints, the preset conditions can be set to include constraints of other dimensions according to actual needs, in order to make comprehensive judgments. Therefore, by flexibly selecting these node sampling methods, the generated virtual buildings can be made more adaptable to diverse scenario requirements.
[0078] For example, such as Figure 10 The diagram shows a method of obtaining target sampling points through sampling. If the above situation is not considered, a reasonable placement position cannot be obtained, as shown in Figure 1010. However, by determining the final target sampling point (green circle) through sampling, such as in Figure 1020, a reasonable placement position can be accurately determined.
[0079] After obtaining the target sampling point and the current node, the placement location of the building to be generated can be determined accordingly. Optionally, determining the placement location of the building to be generated based on the target sampling point and the current node includes: Determine the direction vector from the current node to the target sampling point. The direction vector is used to determine the orientation of the building to be generated at the current node. The placement position of the building to be generated is determined based on the current node, the target sampling point, and the direction vector.
[0080] In this context, the current node and the target sampling point are two adjacent placement positions. The target sampling point is the position of the current node after moving along the target auxiliary line by one virtual building length. The direction vector refers to the vector corresponding to the directed line segment from the current node to the target sampling point. Geometrically, this vector represents the overall direction of the sampling path within the current iteration interval. The placement orientation refers to the direction that the front of the building to be generated faces in 3D space. The front orientation of the building is usually set to be collinear with or perpendicular to the direction vector, depending on the building type and layout requirements.
[0081] For example, the direction vector can be calculated using the following equation: V = Normalize(target sampling point - current node) Equation 1 Where V represents the direction vector, and Normalize() represents the normalization process used to obtain a unit vector.
[0082] Once the current node, target sampling point, and direction vector are determined, the placement position of the building to be generated can be determined.
[0083] The exemplary embodiments of this disclosure automatically calculate the direction vector from the current node to the target sampling point, improving the automation of layout generation. Furthermore, because the direction vector naturally transitions with the curve, the orientation of adjacent buildings smoothly transitions, avoiding abrupt orientation changes that may occur at curves and improving the overall aesthetic harmony of the layout. In addition, since node sampling is constrained by the length of the virtual building, it further ensures more reasonable spacing between generated buildings and avoids penetration or overlap issues between building models caused by improper generation positions.
[0084] In step S240, the building to be generated is loaded into the placement position to generate a virtual building model on at least one side of the center reference line.
[0085] In the exemplary embodiments of this disclosure, the virtual building model is a three-dimensional digital asset of a building. Loading the building to be generated to the placement location involves instantiating the pre-built or programmatically generated building model resources into the three-dimensional scene according to the specified position, orientation, scaling, etc. The geometric data, material maps, textures, and other resources of the building model can be obtained from local storage, memory, or a remote server. Loading can be done in real-time or offline in batches, without particular limitation. The virtual building model can be an independent mesh or a building cluster composed of multiple sub-components (such as the main structure, roof, windows, and streetlights).
[0086] In an exemplary embodiment, if the building to be generated is a virtual building complex, i.e., a point cloud (Lot), the method for determining the target location may further include the following: Based on the generation center point and building boundaries of the virtual building complex, an intersection test is performed between the virtual building complex and the target area and target auxiliary lines; If the intersection detection result indicates that there is a geometric intersection, the building boundary will be offset to the target location, wherein the building boundary has no geometric intersection with the target area and the target auxiliary line at the target location.
[0087] A virtual building complex is a collection of individual buildings, forming a unified architectural unit in space. Unlike individual buildings, a building complex has a holistic layout, with predefined relative positional relationships between its internal buildings. The generation center point is a reference point used to locate the entire virtual building complex; this point acts as the anchor point in space, determining the overall placement of the complex. The building boundary is the outer contour of the virtual building complex, such as a closed polygon, representing the spatial extent occupied by the complex. Examples include a bounding box or boundary border. This boundary is the direct object for intersection testing, used to determine if the building complex conflicts with the target area or target auxiliary lines. If the intersection test indicates geometric intersection, the building boundary (along with the entire building complex) can be moved to a new location to eliminate the intersection problem. Thus, the target location is a new position, after offset, where the building boundary has no geometric intersection with the target area or target auxiliary lines.
[0088] Specifically, the target location can be determined in the following ways: Based on the generated center point, obtain the normal vector of the tangent line of the target region corresponding to the generated center point; Based on the normal vector, the building boundary is moved to the target location.
[0089] The tangent to the target area is the tangent line on the boundary of the target area that passes through the nearest projection point of the generator center point on the boundary of the target area, such as the tangent line of the curved road corresponding to the generator center point. The nearest projection point can be determined by calculating the shortest distance from the generator center point to each boundary segment of the target area, or by selecting the perpendicular point with the smallest distance among all boundary segments. Furthermore, the normal vector is the unit vector perpendicular to the tangent line of the target area at the nearest projection point. When a group of buildings exceeds the target area, a normal vector pointing inwards is selected to pull the group of buildings back into the area. When a group of buildings encroaches on the road setback area (i.e., conflicts with the target auxiliary line), a normal vector pointing outwards may be selected to move the group of buildings away from the road.
[0090] For example, such as Figure 11 The diagram illustrates how to move a building boundary along a normal vector to a target location. The normal vector in this diagram points outwards from the road. Based on this, the building movement value shown in Figure 1110 is illustrated in Figure 1120, thus avoiding intersections between the building and the road.
[0091] In an exemplary embodiment of this disclosure, moving along the normal vector direction is the path with the shortest distance required to move the building boundary away from the conflict area, minimizing the impact of offset on the original layout of the building complex and ensuring the efficiency of the adjustment. Moreover, compared to the point-by-point adjustment scheme, which can disrupt the relative positional relationships within the combined assets, this disclosure can achieve automatic avoidance while ensuring the integrity of the combination, thus ensuring the overall aesthetics and efficiency of the virtual building complex generation.
[0092] Based on the aforementioned exemplary embodiments, loading the building to be generated to the placement position to generate a virtual building model on at least one side of the center reference line further includes: updating the placement position according to the target position to load the virtual building group to the updated placement position to obtain the virtual building model.
[0093] The updated placement position is obtained by updating the original placement positions of each individual building (or the entire building complex) within the complex according to the target position. For example, the target position corresponding to each node can be determined as the updated placement position, thereby instantiating the building model resources into the 3D scene according to the updated placement position (including coordinates, orientation, and other information), ensuring that there is no intersection between the virtual building complex and the target area or target auxiliary lines in the new position.
[0094] In one exemplary embodiment, an implementation method for generating a virtual building complex is also provided. The virtual building complex is loaded into the updated placement location based on the target location to obtain a virtual building model, including: Based on the target location, obtain the maximum movement distance of each sub-building component in the virtual building complex; The placement positions of each sub-building component are adjusted based on the maximum movement distance, and the virtual building complex is loaded into the adjusted placement positions to obtain a virtual building model.
[0095] In this system, sub-building components are the independently identifiable building units that constitute the virtual building complex. The maximum movement distance is the maximum distance that all sub-building components need to move during the offset adjustment process. This distance can be calculated based on the overall offset vector of the building complex and the positional relationship of the sub-components relative to the center of the building complex. For example, if the virtual building complex is offset, all sub-components move the same distance; this distance is the maximum movement distance. If the virtual building complex rotates, different sub-components will move different distances depending on their distance from the rotation center. The sub-component furthest from the rotation center moves the largest distance; this maximum value is the maximum movement distance. Based on the target position and the maximum movement distance, the original placement position of each sub-building component can be transformed to obtain a new placement position. The virtual building complex is then loaded into the adjusted placement position to obtain the virtual building model.
[0096] For example, during the offset process, the displacement D of each sub-building component is recorded, and the maximum displacement Max D is obtained. Then, each sub-building component in the virtual building group is traversed, and its position P is updated to P+N·Max D, where N is the normal vector of the tangent line of the target area corresponding to the generated center point.
[0097] The exemplary embodiments of this disclosure, by calculating and adjusting the position based on the maximum moving distance, can uniformly quantify the overall adjustment range and ensure that all components update their positions according to consistent transformation rules, thus fully preserving the relative structural relationships within the building complex and improving the quality and efficiency of generating virtual building complexes on both sides of the target area.
[0098] The virtual building generation method in the exemplary embodiments of this disclosure, on the one hand, avoids subsequent building placement calculations in invalid or overlapping areas by eliminating redundant nodes on the reference auxiliary lines, thereby reducing the number of invalid sampling points, reducing data processing volume, and improving the computational speed and resource utilization of virtual building generation. Furthermore, by eliminating nodes in self-intersecting intervals, it effectively prevents buildings from being generated at the intersections or overlaps of reference lines, making the final generated virtual buildings more reasonable and regular in spatial layout, avoiding penetration or overlap problems between adjacent building models due to improper generation positions. On the other hand, by combining the center reference line, boundary parameters, and spatial contour parameters for node sampling, the building generation position can be adaptively adjusted according to the actual planning boundaries. Compared to a fixed-spacing arrangement, it can better adapt to complex fields such as curved roads and irregular plots, improving the visual quality of the scene and the gaming experience.
[0099] In an exemplary embodiment of this disclosure, a virtual building generation apparatus is also provided. (See reference...) Figure 12 As shown, the virtual building generation device 1200 may include a parameter acquisition module 1210, an auxiliary line construction module 1220, a position determination module 1230, and a model generation module 1240. Specifically: The parameter acquisition module 1210 is used to acquire the center reference line and boundary parameters of the target area, and to acquire the spatial contour parameters of the building to be generated; the auxiliary line construction module 1220 is used to generate a reference auxiliary line on at least one side of the center reference line according to the center reference line and boundary parameters, and to remove redundant nodes on the reference auxiliary line to obtain the target auxiliary line, wherein the redundant nodes refer to the nodes on the reference auxiliary line located within the self-intersection interval; the position determination module 1230 is used to sample nodes on the target auxiliary line according to the spatial contour parameters, and to determine the placement position of the building to be generated according to the sampling results; the model generation module 1240 is used to load the building to be generated to the placement position and generate a virtual building model on at least one side of the center reference line.
[0100] In one exemplary embodiment of this disclosure, generating a reference auxiliary line on at least one side of a center reference line based on a center reference line and boundary parameters includes: determining a reference distance by which the center reference line is offset to at least one side of the center reference line based on the boundary parameters; offsetting nodes on the center reference line along the node normal direction by the reference distance based on the center reference line to obtain an offset node set; and generating a reference auxiliary line on at least one side of the center reference line based on the offset node set.
[0101] In one exemplary embodiment of this disclosure, redundant nodes on a reference auxiliary line are removed to obtain a target auxiliary line. This includes: traversing the nodes on the reference auxiliary line and determining multiple reference line segments based on the traversed nodes; performing cross detection on the multiple reference line segments, and if cross-connecting reference line segments are detected, determining self-intersecting intervals based on the cross-connecting nodes; removing redundant nodes on the reference auxiliary line located within the self-intersecting intervals, and reconstructing lines based on the cross-connecting nodes to obtain reconstructed lines; and determining the target auxiliary line based on the reference auxiliary line after removing redundant nodes and the reconstructed lines.
[0102] In one exemplary embodiment of this disclosure, node sampling is performed on a target auxiliary line based on spatial contour parameters, and the placement position of the building to be generated is determined based on the sampling results. This includes: determining a current node on the target auxiliary line for generating the building to be generated, and determining the length of the virtual building based on the spatial contour parameters; taking the current node as the starting point, node sampling is performed on the target auxiliary line to obtain a target sampling point that meets a preset condition, wherein the preset condition is that the distance between the target sampling point and the current node is greater than or equal to the length of the virtual building; and determining the placement position of the building to be generated based on the target sampling point and the current node; wherein the target sampling point is determined as the current node of the next building to be generated.
[0103] In one exemplary embodiment of this disclosure, determining the placement position of the building to be generated based on the target sampling point and the current node includes: determining the direction vector from the current node to the target sampling point, the direction vector being used to determine the placement orientation of the building to be generated at the current node; and determining the placement position of the building to be generated based on the current node, the target sampling point, and the direction vector.
[0104] In an exemplary embodiment of this disclosure, if the building to be generated is a virtual building complex, the model generation module 1240 is further configured to perform: based on the generation center point and building boundary of the virtual building complex, perform an intersection test between the virtual building complex and the target area and the target auxiliary line; if the intersection detection result indicates that there is a geometric intersection, offset the building boundary to the target position, wherein the building boundary has no geometric intersection with the target area and the target auxiliary line at the target position; load the building to be generated to the placement position to generate a virtual building model on at least one side of the center reference line, including: updating the placement position according to the target position to load the virtual building complex to the updated placement position to obtain a virtual building model.
[0105] In one exemplary embodiment of this disclosure, if the intersection detection result indicates that there is a geometric intersection, the building boundary is offset to the target position, including: obtaining the normal vector of the tangent line of the target area corresponding to the generated center point based on the generated center point; and moving the building boundary to the target position based on the normal vector.
[0106] In one exemplary embodiment of this disclosure, updating the placement position according to the target position to load the virtual building complex to the updated placement position and obtain a virtual building model includes: obtaining the maximum movement distance of each sub-building component in the virtual building complex according to the target position; adjusting the placement position of each sub-building component based on the maximum movement distance, and loading the virtual building complex to the adjusted placement position to obtain a virtual building model.
[0107] Since the details of each functional module of the virtual building generation apparatus of the exemplary embodiments of this disclosure have been described in the exemplary embodiments of the virtual building generation method described above, they will not be repeated here.
[0108] It should be noted that although several modules or units of the virtual building generation device have been mentioned in the detailed description above, this division is not mandatory. In fact, according to embodiments of this disclosure, the features and functions of two or more modules or units described above can be embodied in one module or unit. Conversely, the features and functions of one module or unit described above can be further divided and embodied by multiple modules or units.
[0109] Exemplary embodiments of this disclosure also provide a computer program product. The computer program product includes a computer program that, when executed by a processor, implements the virtual building generation method described above.
[0110] In one implementation, the computer program product can be a tangible product containing a computer program, such as a computer-readable storage medium storing the computer program. The readable storage medium can be a storage medium based on electrical, magnetic, optical, electromagnetic, infrared, or other signals, including but not limited to: random access memory (RAM), read-only memory (ROM), magnetic tape, floppy disk, flash memory, hard disk drive (HDD), solid-state drive (SSD), etc. For example, the computer program product can be implemented as a non-volatile storage medium storing a computer program, such as read-only memory, NAND flash memory, etc.
[0111] In one implementation, the computer program product can be an intangible product containing a computer program. For example, the computer program product can be implemented as a virtual digital product, such as an executable file, installation package, or other digital file storing the computer program.
[0112] Computer program code can be written in one or more programming languages. Examples of programming languages include C, Java, and C++. Program code can execute entirely on the user's computing device, partially on the user's computing device, or as a standalone software package. It can also execute partially on the user's computing device and partially on a remote computing device, or entirely on a remote computing device or server. In cases involving remote computing devices, the remote computing device can be connected to the user's computing device via any type of network, such as a local area network (LAN) or a wide area network (WAN), or it can be connected to an external computing device (e.g., via an internet connection provided by a mobile network operator).
[0113] Computer programs can be carried or transmitted via signals such as electricity, magnetism, light, electromagnetic fields, and infrared radiation. Electronic devices can convert the signals carrying computer programs into digital signals, thereby running the computer programs. When a computer program runs on an electronic device, its code is used to cause the electronic device to execute (more specifically, to execute by the processor of the electronic device) the method steps of various exemplary embodiments of this disclosure, such as the virtual building generation method described above.
[0114] Furthermore, in an exemplary embodiment of this disclosure, an electronic device capable of implementing the above-described method is also provided, comprising: a processor; and a memory for storing executable instructions of the processor; wherein the processor is configured to perform an exemplary method of any of the above-described methods by executing the executable instructions.
[0115] The following is for reference. Figure 13 The electronic device is illustrated by way of a general-purpose computing device. It should be understood that... Figure 13 The electronic device 1300 shown is merely an example and should not be construed as limiting the functionality and scope of the embodiments disclosed herein.
[0116] like Figure 13 As shown, the electronic device 1300 may include: a processor 1310, a memory 1320, a bus 1330, an I / O (input / output) interface 1340, and a network adapter 1350.
[0117] Memory 1320 may include volatile memory, such as RAM 1321 and cache unit 1322, and may also include non-volatile memory, such as ROM 1323. Memory 1320 may also include one or more program modules 1324, such program modules 1324 including, but not limited to: operating system, one or more application programs, other program modules, and program data. Each or some combination of these examples may include an implementation of a network environment. For example, program module 1324 may include the modules in the above-described apparatus.
[0118] The processor 1310 may include one or more processing units, such as an AP (Application Processor), a modem processor, a GPU (Graphics Processing Unit), an ISP (Image Signal Processor), a controller, an encoder, a decoder, a DSP (Digital Signal Processor), a baseband processor, and / or an NPU (Neural-Network Processing Unit).
[0119] The processor 1310 can be used to execute executable instructions stored in the memory 1320 to perform method steps of various embodiments of this disclosure, such as... Figure 2 The steps are shown.
[0120] Bus 1330 is used to connect different components of electronic device 1300 and may include a data bus, an address bus and a control bus.
[0121] Electronic device 1300 can communicate with one or more external devices 1400 (such as keyboard, mouse, external controller, etc.) through I / O interface 1340.
[0122] Electronic device 1300 can communicate with one or more networks via network adapter 1350. For example, network adapter 1350 can provide mobile communication solutions such as 3G / 4G / 5G, or wireless communication solutions such as wireless LAN, Bluetooth, and near-field communication. Network adapter 1350 can communicate with other modules of electronic device 1300 via bus 1330.
[0123] In one embodiment, the electronic device 1300 further includes a display for displaying a graphical user interface.
[0124] although Figure 13 As not shown in the diagram, other hardware and / or software modules may also be configured in the electronic device 1300, including but not limited to: microcode, device drivers, redundant processors, external disk drive arrays, RAID (Redundant Arrays of Independent Disks) systems, tape drives, and data backup storage systems.
[0125] As can be seen from the above, the technical solutions disclosed herein can be implemented as methods, apparatus, systems, computer program products, storage media, electronic devices, etc. Those skilled in the art will understand that various aspects of this disclosure can be specifically implemented in the following forms: a completely hardware implementation, a completely software implementation (including firmware, microcode, etc.), or an implementation combining hardware and software aspects, which may be referred to as "circuit," "module," or "system," respectively.
[0126] It should be understood that this disclosure is not limited to the specific methods, steps, or structures described above and shown in the accompanying drawings, and various modifications and changes can be made without departing from its scope. Those skilled in the art will readily conceive of other embodiments based on the specific implementations provided in this disclosure. Therefore, the specific implementations provided in this disclosure are merely exemplary, and the scope and spirit of this disclosure are indicated by the claims, and should cover any variations, uses, or adaptations of this disclosure that follow the general principles of this disclosure and include common knowledge or customary technical means in the art not disclosed in this disclosure.
Claims
1. A method for generating virtual buildings, characterized in that, include: Obtain the center reference line and boundary parameters of the target area, and obtain the spatial outline parameters of the building to be generated; Based on the center reference line and boundary parameters, a reference auxiliary line is generated on at least one side of the center reference line, and redundant nodes on the reference auxiliary line are removed to obtain the target auxiliary line. The redundant nodes refer to the nodes on the reference auxiliary line located within the self-intersection interval. Based on the spatial contour parameters, node sampling is performed on the target auxiliary line, and the placement position of the building to be generated is determined based on the sampling results; The building to be generated is loaded into the placement location to generate a virtual building model on at least one side of the central reference line.
2. The method according to claim 1, characterized in that, The step of generating a reference auxiliary line on at least one side of the center reference line based on the center reference line and boundary parameters includes: Based on the boundary parameters, a reference distance is determined to offset the center reference line to at least one side of the center reference line; Based on the central reference line, the nodes on the central reference line are offset by the reference distance along the node normal direction to obtain the offset node set; Based on the offset node set, a reference auxiliary line is generated on at least one side of the center reference line.
3. The method according to claim 1 or 2, characterized in that, The step of removing redundant nodes on the reference auxiliary line to obtain the target auxiliary line includes: The nodes on the reference auxiliary line are traversed, and multiple reference line segments are determined based on the traversed nodes. Cross-intersection detection is performed on the multiple reference line segments. If cross-intersecting reference line segments are detected, the self-intersecting interval is determined based on the cross-intersection nodes. Redundant nodes on the reference auxiliary line located within the self-intersection interval are removed, and the line is reconstructed based on the intersection nodes to obtain the reconstructed line; The target auxiliary line is determined based on the reference auxiliary line after removing redundant nodes and the reconstructed line.
4. The method according to claim 1, characterized in that, The step of sampling nodes on the target auxiliary line according to the spatial contour parameters and determining the placement position of the building to be generated based on the sampling results includes: The current node for generating the building to be generated is determined on the target auxiliary line, and the length of the virtual building is determined according to the spatial contour parameters; Starting from the current node, node sampling is performed on the target auxiliary line to obtain target sampling points that meet preset conditions, wherein the preset conditions are that the distance between the target sampling point and the current node is greater than or equal to the length of the virtual building; Based on the target sampling point and the current node, determine the placement position of the building to be generated; The target sampling point is determined as the current node of the next building to be generated.
5. The method according to claim 4, characterized in that, Determining the placement location of the building to be generated based on the target sampling point and the current node includes: Determine the direction vector from the current node to the target sampling point, and the direction vector is used to determine the placement orientation of the building to be generated at the current node; The placement position of the building to be generated is determined based on the current node, the target sampling point, and the direction vector.
6. The method according to claim 1, characterized in that, If the building to be generated is a virtual building complex, the method further includes: Based on the generation center point and building boundaries of the virtual building complex, an intersection test is performed between the virtual building complex and the target area and the target auxiliary line; If the intersection detection result indicates that there is a geometric intersection, the building boundary is offset to the target position, wherein the building boundary has no geometric intersection with the target area and the target auxiliary line at the target position; The step of loading the building to be generated to the placement position to generate a virtual building model on at least one side of the center reference line includes: The placement position is updated according to the target location, and the virtual building complex is loaded into the updated placement position to obtain the virtual building model.
7. The method according to claim 6, characterized in that, If the intersection detection result indicates that a geometric intersection exists, then offsetting the building boundary to the target location includes: Based on the generated center point, obtain the normal vector of the tangent line of the target region corresponding to the generated center point; Based on the normal vector, the building boundary is moved to the target position.
8. The method of fundamental claim 6, characterized in that, The step of updating the placement position according to the target position to load the virtual building complex into the updated placement position, thereby obtaining the virtual building model, includes: Based on the target location, obtain the maximum movement distance of each sub-building component in the virtual building complex; The placement positions of each sub-building component are adjusted based on the maximum movement distance, and the virtual building complex is loaded into the adjusted placement positions to obtain the virtual building model.
9. A virtual building generation device, characterized in that, The device includes: The parameter acquisition module is used to acquire the center reference line and boundary parameters of the target area, and to acquire the spatial outline parameters of the building to be generated; The auxiliary line construction module is used to generate a reference auxiliary line on at least one side of the center reference line according to the center reference line and boundary parameters, and to remove redundant nodes on the reference auxiliary line to obtain the target auxiliary line. The redundant nodes refer to the nodes on the reference auxiliary line located within the self-intersection interval. The location determination module is used to perform node sampling on the target auxiliary line according to the spatial contour parameters, and determine the placement position of the building to be generated based on the sampling results; The model generation module is used to load the building to be generated into the placement position and generate a virtual building model on at least one side of the center reference line.
10. A computer program product, comprising a computer program, characterized in that, When the computer program is executed by a processor, it implements the method described in any one of claims 1 to 8.
11. An electronic device, characterized in that, include: processor; as well as Memory for storing the executable instructions of the processor; The processor is configured to perform the method of any one of claims 1 to 8 by executing the executable instructions.