Three-dimensional space entity point distribution method and electronic device
By converting the pixel coordinates of the entity distribution mask layer into world coordinates in 3D space, identifying connected regions and performing terrain legality verification, the problem of low efficiency and insufficient accuracy of automatic 3D entity placement in existing technologies is solved, achieving high-quality and legal automatic 3D entity placement.
Patent Information
- Application Number
- CN202611308325.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-08-26
- Publication Date
- 2026-11-06
AI Technical Summary
Existing technologies cannot achieve high-quality, terrain-compliant, and intent-accurate automatic placement of 3D entities. Especially in large-scale 3D scenes, existing methods are inefficient, error-prone, and lack a secure interface mechanism for configuration tables.
The pixel coordinates of the entity distribution mask layer are converted into world coordinates based on a preset mapping relationship. Connected regions are identified, an initial point set is filtered, terrain legality is checked, illegal points are marked as slots, compensation sampling is performed according to logical partitions, a target point set is generated, and the data snapshot and conflict handling mode are confirmed and written into the configuration table.
It achieves precise convergence of the number of points under terrain constraints, avoids distribution distortion and illegal point residue, ensures the high quality and legality of automatic point placement of 3D entities, and improves point placement efficiency and security.
Smart Images

Figure CN123052284A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of information processing technology, and more specifically, to a three-dimensional spatial entity placement method and electronic device. Background Technology
[0002] In a 3D spatial scene, "entity placement" refers to the process of placing interactive or visual objects (such as NPCs, creatures, vegetation, collectibles, decorations, etc.) in batches according to design intent. Each entity object is defined by fields such as world coordinates (x, y, z), orientation (yaw), and type number. As the scale of 3D scenes such as open-world games, virtual simulation platforms, and digital twins of cities continues to expand, the number of entities that need to be placed in a single scene has surged from dozens in the early days to thousands or even tens of thousands, posing a severe challenge to placement efficiency, accuracy, and engineering controllability.
[0003] Existing technologies mainly include three types of entity placement methods: first, purely manual point-by-point placement, relying on manual operation with a 3D editor, which is inefficient and cannot guarantee terrain legality; second, fully automatic general algorithms (such as Poisson disk sampling and Perrone noise), but the script scheme has poor reusability; and third, customized script schemes, where programmers write one-time scripts, which are prone to errors and lack a secure interface mechanism with configuration tables. None of the above placement methods can achieve high-quality, terrain-legal, and accurate automatic placement of 3D entities.
[0004] It should be noted that the information disclosed 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
[0005] In view of this, the purpose of this application is to provide a method, apparatus, electronic device and storage medium for three-dimensional spatial entity placement, which can realize high-quality and legal automatic placement of three-dimensional entities.
[0006] This application mainly includes the following aspects: In a first aspect, embodiments of this application provide a method for locating three-dimensional spatial entities, the method comprising: Based on a preset mapping relationship, the pixel coordinates of the entity distribution mask layer are converted into corresponding world coordinates; wherein, the entity distribution is used to characterize the pixel range in which the entity is allowed to be distributed. Connectivity region identification is performed on the entity distribution mask layer in the world coordinate system, and multiple connected regions are identified; Within the area covered by each of the connected regions, all points within the connected regions are sorted according to a preset sorting rule, and an initial set of points is selected based on the sorting results. Perform terrain validity verification on the initial point set and mark illegal points as slots; assign each slot to the corresponding logical partition according to the preset logical partition. For each logical partition, compensation sampling is performed on the logical partition until the point corresponding to the logical partition passes the terrain legality verification or the compensation sampling reaches the sampling number threshold. Based on the points that satisfy the terrain legality check, obtain the target point set; The target point set is encapsulated into a confirmation data snapshot, and an insertion operation is performed on each point record in the confirmation data snapshot in the target configuration table according to the conflict handling mode.
[0007] Secondly, embodiments of this application also provide a three-dimensional spatial entity placement device, the device comprising: The conversion module is used to convert the pixel coordinates of the entity distribution mask layer into corresponding world coordinates based on a preset mapping relationship; wherein, the entity distribution is used to characterize the pixel range in which the entity is allowed to be distributed. The filtering module is used to perform connected component identification on the entity distribution mask layer in the world coordinate system, identify multiple connected components; sort all points within the area covered by each connected component according to a preset sorting rule, and filter out an initial set of points based on the sorting results. The verification module is used to perform terrain legality verification on the initial point set, marking illegal points as slots; according to the preset logical partitions; for each logical partition, the logical partition is compensated for sampling until the points corresponding to the logical partition pass the terrain legality verification or the compensated sampling reaches the sampling number threshold; based on the points that satisfy the terrain legality verification, the target point set is obtained; The configuration module is used to encapsulate the target point set into a confirmation data snapshot, and according to the conflict handling mode, to perform an insertion operation on each point record in the confirmation data snapshot in the target configuration table.
[0008] Thirdly, embodiments of this application also provide an electronic device, including: a processor, a memory, and a bus. The memory stores machine-readable instructions executable by the processor. When the electronic device is running, the processor and the memory communicate through the bus. The machine-readable instructions are executed by the processor to perform the steps of the three-dimensional spatial entity placement method described in the first aspect or any possible implementation of the first aspect.
[0009] Fourthly, embodiments of this application also provide a computer-readable storage medium storing a computer program, which, when executed by a processor, performs the steps of the three-dimensional spatial entity placement method described in the first aspect or any possible implementation of the first aspect.
[0010] This application provides a method, apparatus, electronic device, and storage medium for placing three-dimensional entities. It maps the pixel coordinates of an entity distribution mask to the world coordinate system through transformation. Based on preset sorting rules, it sorts and filters all points within a connected area to obtain an initial point set. Illegal points are logically partitioned and marked as slots. Single-slot bounded retry compensation sampling is implemented. Finally, only the encapsulated confirmed data snapshot is used as the sole data source. An update and insertion operation with the user-selected conflict handling mode is performed. Compared to existing technologies where purely manual point-by-point placement relies on a 3D editor, resulting in low placement efficiency and inability to guarantee terrain legality, and fully automatic general algorithm scripts with poor reusability, and customized scripts where programmers write one-time scripts prone to errors and lack a secure interface mechanism with the configuration table, this application achieves precise convergence of the number of points under terrain constraints, avoiding distribution distortion and illegal point residue caused by batch resampling or forced adsorption. Simultaneously, through the confirmed data snapshot and conflict-aware update and insertion mechanism, it ensures that the data written to the target configuration table strictly corresponds to the legal point set finally confirmed by the user, enabling high-quality, legal automatic placement of three-dimensional entities.
[0011] To make the above-mentioned objectives, features and advantages of this application more apparent and understandable, preferred embodiments are described below in detail with reference to the accompanying drawings. Attached Figure Description
[0012] To more clearly illustrate the technical solutions of the embodiments of this application, the accompanying drawings used in the embodiments will be briefly introduced below. It should be understood that the following drawings only show some embodiments of this application and should not be regarded as a limitation of the scope. For those skilled in the art, other related drawings can be obtained based on these drawings without creative effort.
[0013] Figure 1 A flowchart of a three-dimensional spatial entity placement method provided in an embodiment of this application is shown; Figure 2 This illustration shows a schematic diagram of three layers of orthogonal annotations under a top view provided in an embodiment of this application; Figure 3 This illustration shows one of the structural schematic diagrams of a three-dimensional spatial entity placement device provided in an embodiment of this application; Figure 4This is a second schematic diagram of the structure of a three-dimensional spatial entity placement device provided in an embodiment of this application; Figure 5 A schematic diagram of the structure of an electronic device provided in an embodiment of this application is shown. Detailed Implementation
[0014] To make the objectives, technical solutions, and advantages of the embodiments of this application clearer, the technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. It should be understood that the drawings in this application are for illustrative and descriptive purposes only and are not intended to limit the scope of protection of this application. Furthermore, it should be understood that the schematic drawings are not drawn to scale. The flowcharts used in this application illustrate operations implemented according to some embodiments of this application. It should be understood that the operations in the flowcharts may not be implemented in sequence, and steps without logical contextual relationships may be reversed or implemented simultaneously. In addition, those skilled in the art, guided by the content of this application, may add one or more other operations to the flowcharts, or remove one or more operations from the flowcharts.
[0015] Furthermore, the described embodiments are merely some, not all, of the embodiments of this application. The components of the embodiments of this application described and illustrated herein can typically be arranged and designed in various different configurations. Therefore, the following detailed description of the embodiments of this application provided in the accompanying drawings is not intended to limit the scope of the claimed application, but merely to illustrate selected embodiments of the application. All other embodiments obtained by those skilled in the art based on the embodiments of this application without inventive effort are within the scope of protection of this application.
[0016] In order to enable those skilled in the art to use the content of this application, and in combination with the specific application scenario of "three-dimensional spatial entity layout", the following implementation method is given. For those skilled in the art, the general principles defined herein can be applied to other embodiments and application scenarios without departing from the spirit and scope of this application.
[0017] The methods, apparatus, electronic devices, or computer-readable storage media described in this application can be applied to any scenario that requires three-dimensional spatial entity placement. This application does not limit the specific application scenario, and any scheme using the three-dimensional spatial entity placement method and apparatus provided in this application is within the protection scope of this application.
[0018] It is worth noting that prior to this application, existing solutions mainly included three types of entity placement methods: first, purely manual point-by-point placement, relying on manual operation with a 3D editor, which is inefficient and cannot guarantee terrain legality; second, fully automatic general algorithms, but the script scheme has poor reusability; and third, customized script schemes, where programmers write one-time scripts, which are prone to errors and lack a secure interface mechanism with configuration tables. None of the above placement methods can achieve high-quality, terrain-legal, and intent-accurate automatic 3D entity placement.
[0019] To address the aforementioned issues, this application provides a method, apparatus, electronic device, and storage medium for 3D spatial entity placement. Based on a preset mapping relationship, the pixel coordinates of the entity distribution mask layer are converted into corresponding world coordinates, identifying multiple connected regions within the entity distribution mask layer. An initial set of points is selected based on each connected region. Terrain validity verification is performed on the initial set of points, marking invalid points as slots. Each slot is assigned to its corresponding logical partition according to a preset logical partition. A target set of points is obtained based on the points that meet the terrain validity verification criteria. According to a conflict resolution mode, each point record in the confirmed data snapshot is inserted into the target configuration table. Thus, by using an entity distribution mask to achieve clustering sampling, terrain verification, and confirmation data snapshot writing, high-quality and valid automatic 3D entity placement can be achieved.
[0020] To facilitate understanding of this application, the technical solutions provided in this application will be described in detail below with reference to specific embodiments.
[0021] Figure 1 This is a flowchart illustrating a three-dimensional spatial entity placement method provided in an embodiment of this application. Figure 1 As shown in the embodiments of this application, the method for locating three-dimensional spatial entities includes the following steps: S101: Based on the preset mapping relationship, convert the pixel coordinates of the entity distribution mask layer into the corresponding world coordinates.
[0022] The entity distribution is used to characterize the pixel range within which entities are allowed to be distributed.
[0023] It should be noted that when designers place points in a 3D space scene, they first formulate multi-dimensional intentions, such as determining what type of entities and their quantity to place in each partition, the visual style of natural or artificial distribution, the relative density relationship with the player's high-frequency paths, and the avoidance of terrain constraints. Then, according to the above intentions, a large number of entities are placed in the 3D world and finally fall into the configuration table (such as Excel, JSON or database) required for runtime so that the engine can load them.
[0024] Here, the top-view base map provided in this embodiment can be a two-dimensional image generated by orthogonal projection rendering of a three-dimensional scene, whose pixel coordinate system maintains geometric similarity with the world coordinate system inside the game engine. This top-view base map can be automatically exported by the engine and includes georeferencing metadata (such as scene scaling ratio and orientation reference), serving as the only reliable spatial canvas for the annotation system. All subsequent operations, such as anchor point calibration, region drawing, mask smearing, and movement line outlining, are based on the pixel plane of this image. In addition, the anchor points are at least three points manually marked by the designer on the top-view base map. Each anchor point is associated with a pair of known pixel coordinates (px, py) and corresponding world XZ coordinates (wx, wz) to construct a spatial reference.
[0025] It should be noted that the entity distribution mask provided in this application embodiment is a binary grayscale image obtained by the user manually painting on the top-view base map, which is directly used to characterize the allowed pixel range of a certain type of entity (such as deer, shrub).
[0026] In practical implementation, coordinate transformation can be achieved by solving a unified affine transformation matrix. For example, based on at least three anchor points with known world coordinates, the least squares method is used for fitting, so that any mask pixel (px, py) is uniquely mapped to world coordinates (wx, wz) after the operation of the affine transformation matrix. Once solved, the affine transformation matrix is globally reused and automatically compatible with clipping offset compensation, ensuring that all annotation layers, such as entity distribution masks, logical partitions, and movement layers, are projected to 3D space based on the same metric, providing a geometric consistency basis for subsequent region clustering, slot compensation, and terrain verification. In addition to the unified affine transformation matrix, embodiments of this application can also use piecewise affine or homography transformation, lookup table interpolation based on offline height maps, or lightweight neural network regression to achieve the transformation of entity distribution mask pixel coordinates to world coordinates. All of the above methods can achieve the preset mapping relationship from annotation intent to 3D space. Embodiments of this application do not limit the specific coordinate transformation algorithm (preset mapping relationship), as long as it can establish a deterministic and reusable mapping relationship between pixel position and world coordinates.
[0027] For example, on the loaded top-down base map, the user manually selects at least three anchor points with known world coordinates, and it is recommended to select four or more to improve the numerical stability and anti-interference capability of the least squares solution process. For each anchor point, the user needs to input its corresponding world X and Z coordinates. The system constructs an overdetermined system of equations based on the correspondence between the pixel coordinates and world coordinates of all anchor points, and uses the least squares method to uniquely solve the two-dimensional affine transformation matrix. This affine transformation matrix contains six undetermined coefficients, corresponding to the two linear transformation components in the X direction, the translation component in the X direction, the two linear transformation components in the Z direction, and the translation component in the Z direction, respectively. After the solution is completed, the matrix parameters are automatically saved to a calibration file, for example, named "Calibration Affine Matrix Configuration File". At the same time, the system calculates the length of each of the two transformation vectors of this matrix, and takes the arithmetic mean of the two as the actual physical length represented by one pixel in the image, i.e., the scale. In addition, when the top-view base map is cropped during the annotation process, the system automatically introduces the offset of the cropping starting point and the corresponding scaling compensation during the coordinate transformation process to ensure that the bidirectional conversion between all pixel coordinates and world coordinates always maintains geometric consistency and full reversibility.
[0028] S102: Perform connected region identification on the entity distribution mask layer in the world coordinate system to identify multiple connected regions; sort all points within the area covered by each connected region according to a preset sorting rule, and select an initial set of points based on the sorting results.
[0029] Here, after the transformation from pixel coordinates to world coordinates, the user-drawn entity distribution mask is essentially a semantically ambiguous binary smear image, lacking a clear spatial structure and quantity carrying capacity, and therefore cannot directly support automated placement. To address this, this application proposes transforming it into an initial sampling unit—a Binary Large Object (Blob)—with a clear spatial clustering morphology representation and quantity allocation interface. This transformation aims to establish a natural mapping relationship between the "smear shape" and the "entity distribution morphology," allowing users to avoid configuring redundant parameters such as "cluster radius" and "cluster number," enabling the entity clustering morphology (e.g., clusters, lines, or discrete communities) to be naturally determined by the geometric features of the smear itself, truly achieving semantically intuitive placement where "smear is intention, shape is strategy."
[0030] In its implementation, the system performs multi-neighborhood connected component analysis on the binary image of the entity distribution mask mapped to the world coordinate system, automatically identifying multiple independent connected regions that are separate and unconnected to each other. Each connected region not only possesses pixel-level topological integrity (such as connectivity and boundary closure), but is also endowed with three key world coordinate layer attributes: pixel area (representing the spatial carrying capacity of the region), pixel centroid (serving as the geometric center of natural aggregation), and reference center (which can be obtained by mapping the pixel centroid using an affine matrix and used for subsequent spatial positioning). Thus, the original entity distribution mask is upgraded from an "uncomputable doodle" to a "quantifiable, allocable, and sampleable initial spatial unit," laying a structured foundation for subsequent differentiated quantity configuration and cluster sampling at the granularity of connected regions.
[0031] Specifically, after the user specifies the desired number of entities for each connected region, the system drives clustering sampling based on this: using the reference center of the connected region as the reference origin, all pixels within its coverage area are sorted in ascending order according to their distance from the reference center; the K nearest pixels (K being the designed number of connected regions) are selected to form an initial candidate pool; then, in this pool, filtering mechanisms such as equivalent point set deduplication and sparsification methods are used to eliminate overly close points, ultimately generating a valid, dispersed, and closely fitted initial point set of connected regions. This initial point set is the starting point for subsequent terrain filtering and slot-level compensation sampling. Each point carries unique pixel coordinates and implicit world location information, ensuring that the spatial clustering pattern of the entire point placement process is entirely determined by the user-defined geometry, without relying on any manually set shape control parameters.
[0032] Among them, methods for deduplicating and spatially optimizing candidate pixel sets to eliminate points that are too close to each other include ordered Poisson disk sampling under minimum spacing constraints, K-center point clustering algorithm, greedy farthest point sampling, empty circle criterion screening based on Delaunay triangulation, centroid sampling guided by Voronoi diagram, blue noise sampling, or particle simulated annealing algorithm with repulsive force.
[0033] S103: Perform terrain validity verification on the initial point set and mark illegal points as slots; assign each slot to the corresponding logical partition according to the preset logical partition; perform compensation sampling on each logical partition until the point corresponding to the logical partition passes the terrain validity verification or the compensation sampling reaches the sampling number threshold; obtain the target point set based on the points that satisfy the terrain validity verification.
[0034] Here, a single slot retry threshold can be configured for each logical partition. Compensation sampling is initiated only for logical partitions that have not reached the retry threshold. When the cumulative retry count of any slot in any logical partition reaches the retry threshold, subsequent compensation sampling for the logical partition is terminated until a target point set that satisfies the terrain constraints is obtained.
[0035] It should be noted that, considering the need to achieve a synergistic balance between ensuring the terrain validity of the sampling results and accurately converging the number of samples, this embodiment concentrates the initial points into illegal points that fail due to terrain obstruction (such as stepping into water, buildings, or tree canopies), and structurally identifies them as traceable, manageable, and bucket-schedulable "slot" units. Based on user-preset logical partitions, slot ownership relationships are established, supplemented by a single slot retry threshold mechanism to ensure that the compensation sampling process has clear boundary constraints and resource quota control. This fundamentally avoids the shortcomings of traditional solutions such as "worshiping performance due to batch recalculation," "forcibly introducing new illegal points," and "uncontrollable final number."
[0036] Here, a logical partition refers to a closed polygon drawn by the user on the top-down base map. Each polygon is assigned a unique and readable name (e.g., "Main City Square," "North Suburb Forest," "Mine Entrance Area"). This logical partition divides a continuous three-dimensional space into several semantically clear and independently configurable management units. It not only supports the regional quota allocation of the total number of entities (e.g., "320 pine trees in the forest area, 18 NPCs in the square area"), but also serves as the basic granular unit for slot allocation, retry scheduling, density weighting, and conflict isolation. Multiple logical partitions are allowed to be adjacent but not overlapping (the system automatically verifies and prompts for correction upon completion of drawing). The accuracy of their boundaries directly affects the determinism of slot allocation and the spatial locality of compensation sampling.
[0037] In practice, the system first performs terrain validity checks on each point in the initial point set. Points that fail the check are marked as illegal points and abstracted into an independent slot. Subsequently, based on the logical partition to which the illegal point belongs, the slot is assigned to the corresponding partition bucket. The system maintains a "slot retry count table" for each partition and sets a uniform threshold for the number of retry attempts per slot (e.g., 20 times). The next round of compensation sampling is initiated for a logical partition only if there are slots in a logical partition that have not yet reached the retry threshold. Once the cumulative number of retry attempts for any slot in a logical partition reaches the retry threshold, subsequent compensation requests for that slot and its logical partition are permanently closed, no new candidates are generated for it, and illegal points are not accepted to "make up the numbers".
[0038] In this way, bounded retry control at the slot granularity can be achieved, ensuring regional decoupling and resource controllability in the compensation process; all illegal points are eliminated without compromise, and the final number of points is precisely converged to the original upper limit of demand, while also satisfying terrain legality constraints.
[0039] S104: Encapsulate the target point set into a confirmation data snapshot, and according to the conflict handling mode, perform an insertion operation on each point record in the confirmation data snapshot in the target configuration table.
[0040] In this embodiment of the application, during the automated deployment process, the system consistently maintains two independent and clearly defined file entities: one is a continuously updated working file during the sampling process, and the other is a confirmation data snapshot generated only by the user. The working file records the intermediate state of the algorithm and may contain temporary markers, unverified coordinates, or debugging fields, which can be repeatedly overwritten by subsequent sampling or drag-and-drop operations; while the confirmation data snapshot is a read-only copy generated from the working file after three steps: height retesting, deployment basis report generation, and file copying, when the user completes all fine-tuning and clicks export. The two have clearly distinct naming rules, their contents are not interchangeable, and their paths are strictly isolated. This dual-file structure ensures that only data that has been finally confirmed by humans can enter the downstream process, eliminating the risk of intermediate algorithm results being mistakenly entered into the formal configuration table from the source, and also providing a clear, reliable, and auditable data boundary for conflict identification and secure writing in the subsequent table writing stage.
[0041] In practice, after the target point set is written to the working file, a confirmation data snapshot with completely identical content is generated in response to the user's export command. The confirmation data snapshot is strictly separated from the working file, and the table writing process uses only this confirmation data snapshot as the sole data source. The target configuration table supports identifying historical output records based on the remarks field and provides four conflict handling modes—replace, skip, append, or cancel—for users to choose from when conflicts exist. In this way, by forcing height retesting, binding deployment basis, and generating independent read-only copies, a key reliable node is established from algorithm output to business implementation, making the confirmation snapshot the only data entry point that cannot be bypassed in the table writing process, laying a solid foundation for conflict detection and row-level secure writing.
[0042] In this embodiment, the pixel coordinates of the entity distribution mask layer are converted into corresponding world coordinates based on a preset mapping relationship, and multiple connected regions are identified in the entity distribution mask layer. An initial point set is selected based on each connected region. Terrain validity verification is performed on the initial point set, and illegal points are marked as slots. According to a preset logical partition, each slot is assigned to its corresponding logical partition. Based on the points that meet the terrain validity verification, a target point set is obtained. According to the conflict handling mode, each point record in the confirmed data snapshot is inserted into the target configuration table. In this way, clustering sampling, terrain verification, and confirmation data snapshot writing are achieved through the entity distribution mask, enabling high-quality and valid automatic placement of 3D entities.
[0043] The following is an example illustrating the specific implementation process of selecting the initial point set. That is, in one possible implementation, step S102, which involves sorting all points within the connected regions based on a preset sorting rule and selecting the initial point set based on the sorting results, includes the following steps: Step 1021a: For any of the connected regions, calculate the distance from all pixels in the entity distribution mask layer that belong to the connected region and are not blocked by cluster avoidance to the reference center of the connected region, and sort them in ascending order of distance.
[0044] Step 1022a: Select multiple pixels with the smallest distance from the sorted pixel sequence to form a candidate pixel set. The number of pixels in the candidate pixel set is a preset multiple of the number of preset points corresponding to the connected region. Step 1023a: In the candidate pixel set, the candidate pixels are sorted in an orderly manner based on a preset minimum spacing constraint. During the sorting process, the original arrangement order of the pixels in the pixel sequence is maintained, and each time a pixel is selected, the pixel is marked as occupied, so as to ensure that the distance between the subsequently sorted pixels and the selected pixels is not less than the preset minimum spacing threshold. Step 1024a: When the number of selected pixels reaches the preset number of points corresponding to the connected region, stop filtering and use the selected pixels as the initial points of the connected region.
[0045] In practice, the initial point set is generated using connected regions as the basic unit. First, the sampling range is limited, meaning only pixels within the entity distribution mask that belong to the current connected region and are not blocked by the settlement avoidance mask are retained. The reference center (i.e., the world center) of the connected region is used as the reference origin, and the squared Euclidean distance of each pixel in the two-dimensional image space is calculated. The sorting aims to establish a spatial priority sequence from near to far. Second, the first K×M pixels are selected to form a candidate pool (K is the preset number of points in the connected region, and M is an empirical multiple, usually 3-5). This ensures sufficient redundancy to cope with the loss of subsequent spacing filtering while avoiding full image traversal. The computational overhead is addressed by several steps. First, ordered Poisson disk sampling is performed without disrupting the sorted sequence. The pixel distance between each candidate pixel and all selected points in the "globally occupied pixel set" is examined. A pixel is only accepted if its distance to all selected points is not less than a preset minimum spacing threshold (e.g., 20 pixels), and it is immediately added to the global occupied set, thus naturally maintaining the discreteness between points and the tendency for local clustering. Finally, the termination condition is set when exactly K points are selected. Sampling stops at this point, and the selected pixels constitute the initial point set corresponding to the connected region. Its spatial distribution naturally inherits the geometric characteristics of the connected region and strictly satisfies the minimum spacing constraint. The entire process implicitly assumes a distance measurement premise under a unified pixel scale, and the global occupied set is cumulatively updated across connected regions, ensuring that there is no point overlap between different connected regions within the same entity distribution mask.
[0046] Furthermore, if, after initial point sampling is completed for all connected regions within a logical region, the total number of valid initial points actually generated by that logical region (i.e., the number of candidate points that have not yet undergone terrain filtering after sorting and filtering) is still lower than the "region-level target number" set for that logical region in the configuration table (explicitly filled in by the user in the region allocation table, or automatically allocated and backfilled by the system according to the area ratio), then motion-weighted supplementary sampling is triggered. At this time, the remaining entity distribution mask pixels within the logical region that are not covered by any connected regions and are not shielded by the settlement avoidance mask are integrated into a new candidate pool. That is, in one possible implementation, the step S102 of sorting all points within the connected regions based on a preset sorting rule and filtering the initial point set based on the sorting results includes the following steps: Step 1021b: After performing distance sorting and filtering on all connected regions within any logical partition, if the total number of initial points generated within the logical partition is still less than the target number corresponding to the logical partition, then all pixels within the logical partition that are not occupied by initial points constitute a supplementary sampling candidate pool.
[0047] In practice, when the total number of sampling points in each connected region within a logical partition does not reach the configuration target, the system can also initiate motion-weighted supplementary sampling and extract all pixels in the logical partition that are not occupied by the initial point and are located within the effective area of the entity distribution mask to form a supplementary sampling candidate pool.
[0048] Step 1022b: Based on the spatial distribution of each movement line entity and the corresponding density weight coefficient in the path preference data associated with the logical partition, assign a weighted sampling probability to each pixel in the candidate pool; the movement line layer is generated by the user interactively drawing on the entity distribution mask, representing the entity movement path preference within the logical partition, i.e., the path preference data.
[0049] Here, path-weighted sampling refers to using the distribution characteristics of player activity paths expressed by path preference data to assign spatial density weights to each pixel in the candidate pool, that is, the closer the position is to the path, the higher the weight; then, based on these weights, probabilistic sampling is performed so that the sampling points naturally cluster along the path within the logical partition, thereby enhancing the spatial consistency between entity distribution and behavioral logic without destroying the original form constraints of the connected area.
[0050] Specifically, the paths in the path preference data are polylines manually drawn by the user on a top-down base map, and can be divided into active paths and secondary paths. Active paths represent core routes (such as main roads and essential task routes), while secondary paths represent secondary activity trajectories (such as side paths and exploration edges). Their coordinates and type identifiers are fixed and stored during the annotation process. During supplementary sampling, weights are dynamically assigned based on the vertical distance of each candidate pixel to the nearest active / secondary path segment, ensuring that the density reflects the true design intent.
[0051] Each active path corresponds to a first density weight coefficient, and each secondary path corresponds to a second density weight coefficient, with the first density weight coefficient being greater than the second density weight coefficient. The active path is the core passage path specified by the user, and its drawing length is greater than a first preset length threshold. The secondary path is the auxiliary passage path or temporary passage area boundary marked by the user, and its drawing length is greater than a second preset threshold and less than a first preset length threshold.
[0052] Step 1023b: Perform random sampling in the candidate pool according to the weighted sampling probability until the target number of points is reached, and obtain a supplementary point set.
[0053] In practice, the system performs random sampling without replacement based on the probability distribution formed by normalizing the weighted density values of the movement lines corresponding to each pixel, until the target gap number for the logical partition is filled. The pixel coordinates are the replacement points.
[0054] Step 1024b: Merge the supplementary point set with the initial point obtained by distance sorting and filtering to generate the initial point set of the logical partition.
[0055] In practice, the pixel coordinates of these supplementary points are merged with the initial points obtained from the aforementioned connected region filtering, and then uniformly converted into world coordinates to form a complete set of initial points for the logical partition, which serves as the input basis for subsequent terrain filtering.
[0056] For example, this application provides a three-layer orthogonal annotation and unified affine matrix mapping mechanism. Figure 2 This illustration shows a schematic diagram of three layers of orthogonal annotations under a top view provided in an embodiment of this application, as shown below. Figure 2 As shown, users can complete three types of semantically independent and spatially orthogonal annotation operations on the top-down base map in sequence: (1) Use the polygon tool to draw logical regions with names, such as "government area", "residential area", "market area", "lonely mountain", etc., to define the spatial partition of entity placement and the number of targets in each region; (2) Use the polyline tool to draw active lines (such as thick black solid lines) and secondary lines (such as light-colored thin dashed lines) to represent the player's high-frequency activity paths, which serve as the spatial weight basis for subsequent density-weighted sampling; (3) For each type of entity, such as "nightingale", "tree", "rain frog", "pheasant", etc., after selecting from the species list, use a brush to paint the allowed binary mask area on the base map. The number of connected regions painted can be configured independently.
[0057] Furthermore, after completing the above annotations, users need to mark at least three anchor points with known 3D world coordinates on the base map. Based on these anchor point pairs, the system uses, for example, the least squares method to solve for a unique 2D affine transformation matrix, mapping pixel coordinates to world plane coordinates. This matrix simultaneously supports cropping offset compensation, ensuring that the annotations after image cropping still maintain strict consistency between pixel and world coordinates. This unified affine matrix is used throughout all subsequent coordinate transformations, height queries, and point output processes, forming the spatial measurement benchmark for the entire system.
[0058] Further, the implementation process of assigning weighted sampling probabilities to each pixel in the candidate pool in step 1022b is illustrated below. That is, step 1022b: Based on the spatial distribution of each movement line entity in the path preference data associated with the logical partition and the corresponding density weight coefficient, a weighted sampling probability is assigned to each pixel in the candidate pool, including the following steps: For each pixel in the candidate pool, the shortest distance from the pixel to each movement line entity in the path preference data is calculated; Based on a preset distance decay function, each shortest distance is converted into a corresponding basic sampling probability component. The distance decay function is a monotonically decreasing continuous function, and its value is greater than zero when the distance is zero, and approaches zero as the distance increases; A density weight coefficient is configured for each movement line entity in the path preference data, and each basic sampling probability component is multiplied by its corresponding density weight coefficient and then summed to obtain the weighted sampling probability of the pixel.
[0059] Here, the probabilistic modeling method provided in this application essentially transforms the spatial semantics of the movement line layer into a computable density field: the shortest distance from a pixel to each movement line reflects its spatial proximity, and the distance decay function (such as a Gaussian kernel or exponential decay) ensures that "the closer to the movement line, the stronger the influence and the slower the decay," avoiding abrupt changes; each movement line is independently configured with a density weight coefficient, allowing users to explicitly express the importance ranking of different paths by adjusting the coefficient differences; finally, a weighted summation is used to achieve the synergistic influence of multiple movement lines. For example, a pixel that is far from the main movement line but adjacent to multiple secondary movement lines may still obtain a considerable probability. The entire mechanism does not rely on grids or interpolation, but is entirely based on geometric relationships and parameterized decay, preserving the original intent of hand-drawn movement lines while generating a continuous, smooth, and differentiable global density response, providing a probabilistic basis that conforms to human spatial cognition for subsequent supplementary sampling.
[0060] In one possible implementation, the terrain validity check performed on the initial point set in S103, marking illegal points as slots, includes the following steps: For each candidate point in the initial point set, based on the world coordinates of the candidate point, query multiple layer height values for the corresponding location in a preset height map data; from the queried layer height values, identify the height value of the surface layer as the ground reference height; when no surface layer exists, use the layer height value with the lowest height value as the ground reference height; compare the queried layer height value with the ground reference height, and for a target layer with a height value higher than the ground reference height, if the target layer type belongs to a preset occlusion layer type set, determine that the target layer occludes the candidate point; when the candidate point is occluded by at least one occlusion layer, remove the candidate point as an illegal point and mark it as a slot; wherein, the occlusion layer type set includes entity obstacle layers, which are layers that have entity volume in the 3D scene and affect entity passage.
[0061] Here, terrain validity is checked for each candidate point generated by compensation sampling. If the check passes, the valid candidate point is retained as part of the target point set. If the check fails, the candidate point is marked as a new slot and assigned to the corresponding logical partition according to the world coordinates of the candidate point. The cumulative number of retries for the corresponding slot in the logical partition is updated.
[0062] It should be noted that the terrain legality verification provided in this application embodiment is a crucial step to ensure that the points can be actually loaded and correctly rendered by the 3D engine. Its core objective is to eliminate illegal candidates located in inaccessible spaces (such as underwater, inside walls, or in tree canopies) to avoid clipping, floating, or interaction failures during subsequent runtime. The terrain legality verification is based on offline pre-built height map data. For each initial point, the world x-coordinate and y-coordinate are used to query the height values of all layers (surface, water, trees, buildings, etc.) at that location. The height of the surface layer (surface, grass) is used as the benchmark. If it is missing, the height of the lowest layer is used, reflecting the physical intuition that "the ground is the lowest accessible surface". Then, a strict comparison is made: only when the height of a non-surface layer (such as trees, rocks) is strictly higher than the benchmark, and its type belongs to the preset occlusion set (i.e., obstacle layers with solid volume that block passage), is it determined to be a real occlusion. In particular, underwater rocks do not trigger occlusion because their height is not higher than the water body benchmark, thereby achieving semantic accuracy. All points that are determined to be occluded are removed and marked as "slots", serving as the smallest retry unit for subsequent compensation sampling.
[0063] In one possible implementation, the step S103, which assigns each slot to a corresponding logical partition based on a preset logical partition and configures a single-slot retry threshold for each logical partition, and initiates compensation sampling only for logical partitions that have not reached the threshold, includes the following steps: assigning the illegal point to the corresponding region bucket based on the logical partition into which the world coordinates of each illegal point fall; accumulating a gap to be filled in the region bucket to record the number of points that still need to be filled in the logical partition; associating a single-slot retry counter with each region bucket, the counter being initially zero and incremented by one each time a compensation sampling request is initiated to the logical partition to which the region bucket belongs.
[0064] The area bucket and the accumulated gaps to be filled therein are used to determine whether the initiation conditions are met in subsequent compensation sampling; when the current value of the counter is less than the preset single slot retry number threshold, a new compensation sampling request is allowed to be initiated to the logical partition; otherwise, initiation is prohibited.
[0065] It should be noted that, to prevent infinite loops and resource exhaustion, and to ensure the controllability and robustness of algorithm convergence, this embodiment configures a single-slot retry threshold for each logical partition. Specifically, when a logical partition suffers from complex terrain (such as dense forests or building complexes) resulting in a large number of slots being unable to legally land for an extended period, without limiting the number of retry rounds, it may fall into invalid calculations or infinite loops. Therefore, the system assigns each illegal point to the corresponding logical partition according to its world coordinates, forming a "region bucket," and independently maintains the number of gaps to be filled and a retry counter for each bucket. The counter only increments when a compensation sampling request is sent to that partition, and is strictly checked before each request to ensure that it is below a preset threshold (such as 20 times). This mechanism isolates the retry budgets of each partition, allowing easily filled areas to complete quickly, while difficult-to-fill areas actively withdraw after exhausting their own quotas. This avoids dragging down global performance and ensures that the final output strictly does not exceed the demand, eliminating the compromise of "accepting illegal points to make up the numbers," and truly achieving industrial-grade placement quality with accurate quantity, predictable process, and fully legal results.
[0066] In specific implementation, the group number to which the illegal point belongs in the initial sampling stage is obtained; the group number is assigned by the point cluster sequence number determined by ordered Poisson filtering within its connected region; based on the group number, a target aggregation point is determined for the group to which the illegal point belongs: if there is at least one surviving point that has not been eliminated within the group, the centroid is calculated using the world coordinates of all surviving points within the group, and this centroid is used as the target aggregation point; if there are no surviving points within the group, the world coordinates of the illegal point are used as the target aggregation point; wherein, the region bucket is used to dynamically determine whether to initiate a new compensation sampling request to the logical partition based on the number of gaps to be filled and the single slot retry threshold in subsequent compensation sampling. Specifically, in response to the compensation sampling request, it is determined whether the current cumulative retry count of any slot in the logical partition is less than its corresponding single slot retry threshold; if so, the current compensation sampling is allowed; if not, it is prohibited.
[0067] Furthermore, the initiation and termination of compensation sampling requests include: before the start of each round of compensation sampling, based on the single-slot retry count counter and the gap to be filled associated in each region bucket, selecting logical partitions that satisfy the condition that the gap to be filled is greater than zero and the counter is less than the single-slot retry count threshold as the active set for this round; if the active set is empty, the compensation sampling loop is terminated; for each logical partition in the active set, its associated counter is incremented by one, and a compensation sampling call is initiated to the core sampling function only for the active set; if there is still a gap to be filled after the counter of any logical partition reaches the single-slot retry count threshold, then any new compensation sampling request is permanently prohibited from being initiated to the logical partition.
[0068] Here, after generating a set of target points that satisfy terrain constraints, this embodiment of the application also introduces a user-led interactive fine-tuning mechanism. This allows users to drag and adjust the pixel-level spatial coordinates of the generated points and verifies their terrain legality (such as height compliance and occlusion relationships) in real time, ensuring the deployability and business adaptability of each point under real geographic semantics. That is, in one possible implementation, after obtaining the target point set in S103 and before encapsulating the target point set into a confirmation data snapshot in S104, the method further includes the following steps: Step 1041: Render the target point set into a point rendering layer. Each point object in the point rendering layer allows the user to adjust the pixel coordinates of the point object on the top-view base map through interactive operations. Step 1042: In response to the user's operation to adjust the position of any point object, call the same verification logic as the terrain legality verification. The verification logic includes using the same surface reference height selection rules, the same preset occlusion layer set, and the same neighborhood occlusion expansion judgment rules. Step 1043: Update the visual status identifier of the point object in real time according to the verification result, and synchronously update the valid point coordinates to the target point set.
[0069] In practice, the target point set is rendered as an interactive point rendering layer, allowing each point object to be dragged to adjust its pixel coordinates on the top-down base map in real time. When the system responds to user dragging, it reuses the same verification logic as the initial terrain validity verification (including the same surface reference height selection rules, preset occlusion layer set, and neighboring occlusion expansion judgment rules, etc.) to ensure that the fine-tuning process does not destroy the integrity of the original constraints. The verification results are immediately fed back to the visual status indicators (such as color / border changes), and the target point set is only updated synchronously when the pixel-level coordinates are verified to be valid.
[0070] It should be noted that this fine-tuning is not a redundant step, but a key step to bridge the gap between "algorithm generation accuracy" and "actual deployment requirements". Due to terrain data resolution, sensor errors or special requirements of business scenarios (such as avoiding hidden facilities and optimizing visual visibility), manual intervention is required to make millimeter-level spatial semantic corrections, so as to balance automation efficiency and engineering implementation reliability.
[0071] In one possible implementation, step 1042, responding to a user's operation to adjust the position of any point object, calls the same verification logic as the terrain validity verification, including the following steps: when the user ends the interaction with the point object, obtain the latest pixel coordinates of the point object on the top-down base map; convert the pixel coordinates into world coordinates using a unified affine matrix defined by at least three anchor points with known world coordinates, combined with clipping offset compensation; call the front-end verification function, which uses the same surface reference height selection rules, the same preset occlusion layer set, and the same preset radius neighborhood occlusion expansion judgment rules as the terrain validity verification; update the visual status identifier of the point object in real time according to the verification result; summarize the detailed information of all point objects that failed the verification in the status bar, including the group number to which the point object belongs and the name of the occlusion layer that was hit; if the verification passes, synchronize the latest world coordinates of the point object to the target point set.
[0072] In specific implementation, the interactive verification process provided to users in this application starts with pixel coordinate adjustment. When the user releases the drag, the latest pixel position of that point on the top-down base map is captured. Subsequently, relying on a unified affine transformation matrix fitted by at least three anchor points with known world coordinates, the pixel coordinates are mapped to geographic space. Here, "cropping offset compensation" is used to correct coordinate system offsets caused by map tile cropping, base map scaling, or UI container scrolling, ensuring spatial transformation accuracy. Then, the front-end verification function is called, the core of which is completely consistent with the initial terrain legality verification: that is, the surface reference height is selected according to the same rules. The system iterates through the same set of preset occlusion layers (such as building outlines, vegetation cover, power line corridors, and other GIS layers) and performs visibility and elevation compliance checks based on the same radius and extended judgment logic (e.g., if the pixel coverage of any occlusion layer in the neighborhood is greater than 30%, it is judged as occlusion). The verification results drive the visual status indicators to change color or be marked in real time. The status bar synchronously aggregates all failed items, displays their logical group number and the name of the specific occlusion layer that was hit, making it easier to locate the root cause of the problem. Finally, only when all verification items pass will the verified world coordinates be written into the target point set to ensure data link consistency and project availability.
[0073] For example, when a point object passes all front-end terrain legality checks, meaning its corresponding world coordinates meet the surface reference height constraints, do not fall within any preset occlusion layer range, and have no excessive occlusion within a specified neighborhood radius, the point object is presented in the point rendering layer, for example, as a solid green ("species color" is a business-defined color representing ecological adaptability or deployment feasibility). When any check item fails (such as the elevation being lower than the minimum safety threshold, being located within the vector plane of a building layer, or the neighborhood occlusion expansion judgment triggering an occlusion alarm), the point object is displayed, for example, as an orange fill (indicating a pending intervention state) with a red dashed border (clearly indicating that it violates terrain constraints, distinguishing it from a normal failure or disabled state). The two work together to form an intuitive and distinguishable visual semantic feedback, allowing users to identify the compliance status and nature of the problem without consulting logs.
[0074] Here, considering that the confirmed data snapshot, as the carrier of the final confirmed point data after user interaction fine-tuning and / or terrain verification, needs to be securely and controllably stored in the target configuration table, this application embodiment further provides an update insertion operation. This aims to manage the point records of each species in the snapshot in collaboration with historical data according to user-specified strategies, avoiding duplicate writing, overwriting errors, or configuration conflicts, and ensuring the consistency and traceability of the configuration table data. That is, in one possible implementation, the insertion operation performed in S105 on each point record in the confirmed data snapshot according to the conflict handling mode includes the following steps: Step 1051: In response to the user's input write command and the selected conflict handling mode, scan all confirmed data snapshots to determine the target species set to be written. Step 1052: For each target species, stream read the metadata field in the target configuration table used to identify the data source, and count the number of existing records of the same species generated in the past according to the preset data source identification rules; Step 1053: Perform a write operation independently for each target species based on the selected conflict handling mode and the number of records; the conflict handling mode includes replacement mode, skip mode, append mode or abort mode.
[0075] In practice, after a user triggers a write command and selects a conflict handling mode, the system first iterates through all confirmed data snapshots, extracts the species identifiers recorded within them, and forms a set of target species to be written. Then, for each species, it streams metadata fields such as the "data source identifier" from the target configuration table. This field identifies the data source according to preset rules, and the system uses this to count the number of existing records generated from historical snapshots for the same species. Finally, it performs independent writes according to the selected mode: the replacement mode clears the old records for the species and writes a new snapshot; the skip mode only writes when there are no historical records; the append mode retains the old records and adds the current snapshot entry after them; the abort mode terminates all writes and returns a conflict list when historical records are detected for any species. All operations are executed in isolation at the species level, ensuring transaction security and policy configurability in multi-species mixed scenarios.
[0076] The data snapshot is generated from the working file after remeasurement of altitude, generation of deployment basis report, and file copying. Before writing, the target configuration table is scanned for historical records with preset identifiers. If similar historical records exist, a conflict handling strategy selection interface is provided, allowing users to choose from replacement, skip, append, and cancel to determine the writing mode. Furthermore, the streaming read method only parses metadata fields, avoiding loading the entire table data, thereby reducing I / O overhead. The report lists the corresponding species, location range, time-series uniqueness number range, and reason for failure in three categories: successful write, skipped write, and failed write.
[0077] In one example, when the number of records is greater than zero, in Replace mode, the historical record is deleted first and then a new record is written; in Skip mode, the writing of this species is terminated; in Append mode, a new record is written directly; and in Abort mode, the writing of all species is canceled. When the number of records is equal to zero, a new record is written directly in all modes.
[0078] Based on the same application concept, this application also provides a three-dimensional spatial entity placement device corresponding to the three-dimensional spatial entity placement method provided in the above embodiments. Since the principle of the device in this application is similar to the three-dimensional spatial entity placement method in the above embodiments of this application, the implementation of the device can refer to the implementation of the method, and the repeated parts will not be described again.
[0079] like Figure 3 , Figure 4 As shown, Figure 3 This is one of the functional block diagrams of a three-dimensional spatial entity placement device 300 provided in an embodiment of this application. Figure 4 This is a second functional block diagram of a three-dimensional spatial entity placement device 300 provided in an embodiment of this application. The three-dimensional spatial entity placement device 300 includes: The conversion module 310 is used to convert the pixel coordinates of the entity distribution mask layer into corresponding world coordinates based on a preset mapping relationship; wherein the entity distribution is used to characterize the pixel range that the entity is allowed to distribute. The filtering module 320 is used to perform connected component identification on the entity distribution mask layer in the world coordinate system, identify multiple connected components; sort all points in the connected components based on a preset sorting rule within the area covered by each connected component, and filter out an initial set of points based on the sorting results. The verification module 330 is used to perform terrain legality verification on the initial point set, mark illegal points as slots; assign each slot to a corresponding logical partition according to a preset logical partition; perform compensation sampling on each logical partition until the points corresponding to the logical partition pass the terrain legality verification or the compensation sampling reaches a sampling number threshold; and obtain a target point set based on the points that satisfy the terrain legality verification. The configuration module 340 is used to encapsulate the target point set into a confirmation data snapshot, and according to the conflict handling mode, to perform an insertion operation on each point record in the confirmation data snapshot in the target configuration table.
[0080] In one possible implementation, such as Figure 3As shown, the filtering module 320 is specifically used to, after performing distance sorting filtering on all connected regions within any logical partition, if the total number of initial points generated within the logical partition is still less than the target number corresponding to the logical partition, then all pixels within the logical partition not occupied by initial points constitute a supplementary sampling candidate pool; based on the spatial distribution of each movement entity in the path preference data associated with the logical partition and the corresponding density weight coefficient, assign a weighted sampling probability to each pixel in the candidate pool; the path preference data is used to characterize the entity movement path preference within the logical partition; perform random sampling in the candidate pool according to the weighted sampling probability until the target number of points is reached, to obtain a supplementary point set; merge the supplementary point set with the initial points obtained from distance sorting filtering to generate the initial point set of the logical partition.
[0081] In one possible implementation, such as Figure 3 As shown, the filtering module 320 is further configured to assign a weighted sampling probability to each pixel in the candidate pool according to the following steps: For each pixel in the candidate pool, calculate the shortest distance from the pixel to each movement entity in the path preference data; convert each shortest distance into a corresponding basic sampling probability component according to a preset distance decay function, wherein the distance decay function is a monotonically decreasing continuous function, and takes a value greater than zero when the distance is zero, and approaches zero as the distance increases; configure a density weight coefficient for each movement entity in the path preference data, and multiply each basic sampling probability component by the corresponding density weight coefficient and sum them to obtain the weighted sampling probability of the pixel.
[0082] In one possible implementation, such as Figure 3 As shown, the filtering module 320 is further configured to, for any connected region, calculate the distance from all pixels in the entity distribution mask layer that belong to the connected region and are not blocked by cluster avoidance to the reference center of the connected region, and sort them in ascending order of distance; select multiple pixels with the smallest distance from the sorted pixel sequence to form a candidate pixel set, the number of pixels in the candidate pixel set being a preset multiple of the number of preset points corresponding to the connected region; in the candidate pixel set, perform ordered filtering of candidate pixels based on a preset minimum spacing constraint, maintaining the original arrangement order of pixels in the pixel sequence during the filtering process, and marking the selected pixel as occupied when selecting a pixel to ensure that the distance between the subsequently filtered pixels and the selected pixels is not less than the preset minimum spacing threshold; when the number of selected pixels reaches the preset number of points corresponding to the connected region, stop filtering, and use the selected pixels as the initial points of the connected region.
[0083] In one possible implementation, such as Figure 3As shown, the verification module 330 is specifically used to query multiple layer height values for each candidate point in the initial point set based on the world coordinates of the candidate point in the preset height map data; identify the height value of the surface layer from the queried layer height values as the ground reference height; when there is no surface layer, take the layer height value with the lowest height value as the ground reference height; compare the queried layer height value with the ground reference height, and for a target layer with a height value higher than the ground reference height, if the target layer type belongs to a preset occlusion layer type set, then determine that the target layer constitutes occlusion of the candidate point; when the candidate point is occluded by at least one occlusion layer, the candidate point is removed as an illegal point and marked as a slot; wherein, the occlusion layer type set includes entity obstacle layer, which is a layer that has entity volume in the three-dimensional scene and affects entity passage.
[0084] In one possible implementation, such as Figure 3 As shown, the verification module 330 is used to initiate compensation sampling according to the following steps: based on the logical partition into which the world coordinates of each illegal point fall, the illegal point is assigned to the corresponding area bucket; a gap to be filled is accumulated in the area bucket to record the number of points that still need to be filled in the logical partition; a single slot retry counter is associated with each area bucket, the initial value of which is zero, and it is incremented by one each time a compensation sampling request is initiated to the logical partition to which the area bucket belongs; wherein, the area bucket and the accumulated gap to be filled in it are used to determine whether the initiation condition is met in subsequent compensation sampling; when the current value of the counter is less than the preset single slot retry threshold, a new compensation sampling request is allowed to be initiated to the logical partition; otherwise, initiation is prohibited.
[0085] In one possible implementation, such as Figure 3 As shown, the verification module 330 is used to initiate and terminate the compensation sampling request according to the following steps: Before the start of each round of compensation sampling, based on the single-slot retry count counter and the gap to be filled associated in each area bucket, logical partitions that meet the condition that the gap to be filled is greater than zero and the counter is less than the single-slot retry count threshold are selected as the active set for this round; if the active set is empty, the compensation sampling loop is terminated; for each logical partition in the active set, its associated counter is incremented by one, and a supplementary sampling call is initiated to the core sampling function only for the active set; if there is still a gap to be filled after the counter of any logical partition reaches the single-slot retry count threshold, any new compensation sampling request is permanently prohibited from being initiated to the logical partition.
[0086] In one possible implementation, such as Figure 4As shown, the three-dimensional spatial entity placement device 300 also includes an adjustment module 350. After the verification module 330 obtains the target potential set, and before the configuration module 340 encapsulates the target point set into a confirmation data snapshot, the adjustment module 350 is used to: render the target point set into a point rendering layer, wherein each point object in the point rendering layer allows the user to adjust the pixel coordinates of the point object on the top-view base map through interactive operations; respond to the user's position adjustment operation on any point object, call the verification logic that is exactly the same as the terrain legality verification, wherein the verification logic includes using the same surface reference height selection rules, the same preset occlusion layer set, and the same neighborhood occlusion expansion judgment rules; update the visual status identifier of the point object in real time according to the verification result, and synchronously update the verified and confirmed legal point coordinates to the target point set.
[0087] In one possible implementation, such as Figure 4 As shown, the adjustment module 350 is used to call the same verification logic as the terrain legality verification according to the following steps: when the user ends the interaction operation with the point object, obtain the latest pixel coordinates of the point object on the top view base map; convert the pixel coordinates into world coordinates by using a unified affine matrix defined by at least three anchor points with known world coordinates and combining it with clipping offset compensation; call the front-end verification function, which uses the same surface reference height selection rules, the same preset occlusion layer set, and the same preset radius neighborhood occlusion expansion judgment rules as the terrain legality verification; update the visual status identifier of the point object in real time according to the verification result; summarize the detailed information of all point objects that failed the verification in the status bar, including the group number to which the point object belongs and the name of the occlusion layer that was hit; if the verification passes, synchronize the latest world coordinates of the point object to the target point set.
[0088] In one possible implementation, such as Figure 3 As shown, the configuration module 340 is specifically used for: responding to the user's input write command and the selected conflict handling mode, scanning all confirmed data snapshots, and determining the set of target species to be written; for each target species, streaming the metadata field used to identify the data source in the target configuration table, and counting the number of existing records of the same species generated in history according to the preset data source identification rules; and independently performing a write operation for each target species according to the selected conflict handling mode and the number of records; the conflict handling mode includes a replacement mode, a skip mode, an append mode, or an abort mode.
[0089] In this embodiment, the pixel coordinates of the entity distribution mask layer are converted into corresponding world coordinates based on a preset mapping relationship, and multiple connected regions are identified in the entity distribution mask layer. An initial point set is selected based on each connected region. Terrain validity verification is performed on the initial point set, and illegal points are marked as slots. According to a preset logical partition, each slot is assigned to its corresponding logical partition. Based on the points that meet the terrain validity verification, a target point set is obtained. According to the conflict handling mode, each point record in the confirmed data snapshot is inserted into the target configuration table. In this way, clustering sampling, terrain verification, and confirmation data snapshot writing are achieved through the entity distribution mask, enabling high-quality and valid automatic placement of 3D entities.
[0090] Based on the same application concept, see [link / reference] Figure 5 The diagram shown is a structural schematic of an electronic device 500 provided in an embodiment of this application. It includes a processor 510, a memory 520, and a bus 530. The memory 520 stores machine-readable instructions executable by the processor 510. When the electronic device 500 is running, the processor 510 and the memory 520 communicate through the bus 530. When the machine-readable instructions are executed by the processor 510, they perform the steps of the three-dimensional spatial entity placement method as described in any of the above embodiments.
[0091] Specifically, when the machine-readable instructions are executed by the processor 510, they can perform the following processing: Based on a preset mapping relationship, the pixel coordinates of the entity distribution mask layer are converted into corresponding world coordinates; wherein, the entity distribution is used to characterize the pixel range in which the entity is allowed to be distributed. Connectivity identification is performed on the entity distribution mask layer in the world coordinate system to identify multiple connected regions; within the area covered by each connected region, all points within the connected region are sorted according to a preset sorting rule, and an initial set of points is selected based on the sorting results; Perform terrain validity verification on the initial point set and mark illegal points as slots; assign each slot to the corresponding logical partition according to the preset logical partition; perform compensation sampling on each logical partition until the points corresponding to the logical partition pass the terrain validity verification or the compensation sampling reaches the sampling number threshold; obtain the target point set based on the points that satisfy the terrain validity verification. The target point set is encapsulated into a confirmation data snapshot, and an insertion operation is performed on each point record in the confirmation data snapshot in the target configuration table according to the conflict handling mode.
[0092] Based on the same concept, this application also provides a computer-readable storage medium storing a computer program, which, when run by a processor, executes the steps of the three-dimensional spatial entity placement method provided in the above embodiments.
[0093] Specifically, the storage medium can be a general-purpose storage medium, such as a portable disk or hard disk. When the computer program on the storage medium is run, it can execute the above-mentioned three-dimensional spatial entity placement method. By using entity distribution masks, clustering sampling, terrain verification, and confirmation snapshot writing can be achieved, thus realizing high-quality and legal automatic placement of three-dimensional entities.
[0094] In this embodiment, the computer program, when run by the processor, can also execute other machine-readable instructions to perform other methods as described in the embodiments. For details on the specific execution steps and principles, please refer to the description of the embodiments, which will not be repeated here.
[0095] The computer program product for three-dimensional spatial entity placement provided in this application includes a computer-readable storage medium storing program code. The instructions included in the program code can be used to execute the methods described in the preceding method embodiments. For specific implementation details, please refer to the method embodiments, which will not be repeated here.
[0096] The device for three-dimensional spatial entity placement provided in this application embodiment can be specific hardware on a device or software or firmware installed on the device. The implementation principle and technical effects of the device provided in this application embodiment are the same as those in the foregoing method embodiments. For the sake of brevity, any parts not mentioned in the device embodiment can be referred to the corresponding content in the foregoing method embodiments. Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the specific working processes of the systems, devices, and units described above can all be referred to the corresponding processes in the above method embodiments, and will not be repeated here.
[0097] In the embodiments provided in this application, it should be understood that the disclosed apparatus and methods can be implemented in other ways. The apparatus embodiments described above are merely illustrative. For example, the division of units is only a logical functional division, and in actual implementation, there may be other division methods. Furthermore, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Additionally, the displayed or discussed mutual couplings, direct couplings, or communication connections may be through some communication interfaces; indirect couplings or communication connections between devices or units may be electrical, mechanical, or other forms.
[0098] The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.
[0099] In addition, the functional units in the embodiments provided in this application can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit.
[0100] If the aforementioned functions are implemented as software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or a portion of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of this application. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.
[0101] It should be noted that similar labels and letters in the following figures indicate similar items. Therefore, once an item is defined in one figure, it does not need to be further defined and explained in subsequent figures. In addition, the terms "first", "second", "third", etc. are used only to distinguish descriptions and should not be construed as indicating or implying relative importance.
[0102] Finally, it should be noted that the above-described embodiments are merely specific implementations of this application, used to illustrate the technical solutions of this application, and not to limit them. The protection scope of this application is not limited thereto. Although this application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that any person skilled in the art can still modify or easily conceive of changes to the technical solutions described in the foregoing embodiments, or make equivalent substitutions for some of the technical features, within the scope of the technology disclosed in this application; and these modifications, changes, or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of this application. All should be covered within the protection scope of this application. Therefore, the protection scope of this application should be determined by the protection scope of the claims.
Claims
1. A method for locating points in three-dimensional space entities, characterized in that, The method includes: Based on a preset mapping relationship, the pixel coordinates of the entity distribution mask layer are converted into corresponding world coordinates; wherein, the entity distribution is used to characterize the pixel range in which the entity is allowed to be distributed. Connectivity region identification is performed on the entity distribution mask layer in the world coordinate system, and multiple connected regions are identified; Within the area covered by each of the connected regions, all points within the connected regions are sorted according to a preset sorting rule, and an initial set of points is selected based on the sorting results. Perform terrain validity verification on the initial point set and mark illegal points as slots; assign each slot to the corresponding logical partition according to the preset logical partition. For each logical partition, compensation sampling is performed on the logical partition until the point corresponding to the logical partition passes the terrain legality verification or the compensation sampling reaches the sampling number threshold. Based on the points that satisfy the terrain legality check, obtain the target point set; The target point set is encapsulated into a confirmation data snapshot, and an insertion operation is performed on each point record in the confirmation data snapshot in the target configuration table according to the conflict handling mode.
2. The method according to claim 1, characterized in that, The step of sorting all points within the areas covered by each of the connected regions according to a preset sorting rule, and selecting an initial set of points based on the sorting results, includes: After filtering is performed on all connected regions within any logical partition, if the total number of initial points generated within the logical partition is still less than the target number corresponding to the logical partition, then all pixels within the logical partition that are not occupied by initial points will form a supplementary sampling candidate pool. Based on the spatial distribution and corresponding density weight coefficients of each movement line entity in the path preference data associated with the logical partition, a weighted sampling probability is assigned to each pixel in the candidate pool; the path preference data is used to characterize the entity movement path preference within the logical partition. Random sampling is performed in the candidate pool according to the weighted sampling probability until the target number of points is reached, thus obtaining a supplementary point set; The supplementary point set is merged with the initial point set obtained by distance sorting to generate the initial point set of the logical partition.
3. The method according to claim 2, characterized in that, The step of assigning a weighted sampling probability to each pixel in the candidate pool based on the spatial distribution and corresponding density weight coefficients of each path entity in the path preference data associated with the logical partition includes: For each pixel in the candidate pool, calculate the shortest distance from the pixel to each movement line entity in the path preference data; Based on a preset distance decay function, each shortest distance is converted into a corresponding basic sampling probability component. The distance decay function is a monotonically decreasing continuous function, and its value is greater than zero when the distance is zero, and it approaches zero as the distance increases. A density weight coefficient is configured for each movement entity in the path preference data. The weighted sampling probability of the pixel is obtained by multiplying each basic sampling probability component by its corresponding density weight coefficient and then summing the results.
4. The method according to claim 1, characterized in that, The step of sorting all points within the areas covered by each of the connected regions according to a preset sorting rule, and selecting an initial set of points based on the sorting results, includes: For any of the connected regions, calculate the distance from all pixels in the entity distribution mask layer that belong to the connected region and are not blocked by cluster avoidance to the reference center of the connected region, and sort them in ascending order of the distance; From the sorted pixel sequence, select the pixels with the smallest distance to form a candidate pixel set. The number of pixels in the candidate pixel set is a preset multiple of the number of preset points corresponding to the connected region. In the candidate pixel set, the candidate pixels are sorted in an orderly manner based on a preset minimum spacing constraint. During the sorting process, the original arrangement order of the pixels in the pixel sequence is maintained, and each time a pixel is selected, the pixel is marked as occupied to ensure that the distance between the subsequently sorted pixels and the selected pixels is not less than the preset minimum spacing threshold. When the number of selected pixels reaches the preset number of points corresponding to the connected region, the filtering stops, and the selected pixels are used as the initial points of the connected region.
5. The method according to claim 1, characterized in that, The step of performing terrain validity verification on the initial point set and marking illegal points as slots includes: For each candidate point in the initial point set, based on the world coordinates of the candidate point, query the corresponding layer height values in the preset height map data; From the queried layer height values, the height value of the surface layer is identified as the ground reference height; when no surface layer exists, the layer with the lowest height value is used as the ground reference height. The queried layer height value is compared with the ground reference height. For a target layer whose height value is higher than the ground reference height, if the target layer type belongs to a preset set of occlusion layer types, it is determined that the target layer occludes the candidate point. When a candidate point is occluded by at least one occluding layer, the candidate point is discarded as an illegal point and marked as a slot. The occlusion layer type set includes entity obstacle layer, which is a layer that has entity volume in a 3D scene and affects the passage of entities.
6. The method according to claim 1, characterized in that, The step of assigning each slot to a corresponding logical partition based on a preset logical partition includes: Based on the logical partition into which each illegal point falls according to its world coordinates, the illegal point is assigned to the corresponding region bucket. An unfilled gap is accumulated in the area bucket to record the number of points that still need to be filled in the logical partition; A single-slot retry counter is associated with each area bucket. The counter is initially set to zero and incremented by one each time a compensation sampling request is sent to the logical partition to which the area bucket belongs. The area bucket and the accumulated gaps to be filled therein are used to determine whether the initiation conditions are met in subsequent compensation sampling. When the current value of the counter is less than the preset single slot retry count threshold, a new compensation sampling request is allowed to be initiated to the logical partition; otherwise, initiation is prohibited.
7. The method according to claim 6, characterized in that, The initiation and termination of compensation sampling requests include: Before each round of compensation sampling begins, based on the single-slot retry count counter and the gap to be filled associated in each area bucket, logical partitions that meet the condition that the gap to be filled is greater than zero and the counter is less than the single-slot retry count threshold are selected as the active set for this round. If the active set is empty, the compensation sampling loop is terminated; For each logical partition in the active set, increment its associated counter and initiate a supplementary sampling call to the core sampling function that is only for the active set; If any logical partition's counter reaches the single-slot retry threshold and there is still a gap to be filled, then any new compensation sampling request to that logical partition is permanently prohibited.
8. The method according to claim 1, characterized in that, After obtaining the target location set and before encapsulating the target location set into a confirmation data snapshot, the method further includes: The target point set is rendered as a point rendering layer, and each point object in the point rendering layer allows the user to adjust the pixel coordinates of the point object on the top-view base map through interactive operations. In response to a user's operation to adjust the position of any point object, the same verification logic as the terrain legality verification is invoked. The verification logic includes using the same surface reference height selection rules, the same preset occlusion layer set, and the same neighborhood occlusion expansion judgment rules. The visual status identifier of the point object is updated in real time according to the verification result, and the valid point coordinates are synchronously updated to the target point set.
9. The method according to claim 8, characterized in that, The response to a user's operation to adjust the position of any point object invokes the same verification logic as the terrain validity verification, including: When the user ends the interaction with the point object, obtain the latest pixel coordinates of the point object on the top-view base map; The pixel coordinates are converted into world coordinates by a unified affine matrix defined by at least three anchor points with known world coordinates, combined with clipping offset compensation. The front-end verification function is called, and the front-end verification function and the terrain legality verification use the same rules for selecting the ground reference height, the same set of preset occlusion layers, and the same rules for determining the occlusion expansion of the preset radius neighborhood. Based on the verification results, the visual status identifier of the point object is updated in real time; The status bar summarizes detailed information about all point objects that failed the verification, including the group number to which the point object belongs and the name of the occlusion layer that was hit. If the verification passes, the latest world coordinates of the point object will be synchronously updated to the target point set.
10. The method according to claim 1, characterized in that, Based on the conflict resolution mode, for each point record in the confirmed data snapshot, an insertion operation is performed in the target configuration table, including: In response to the write command and the selected conflict handling mode, scan all confirmed data snapshots to determine the set of target species to be written; For each target species, the metadata field used to identify the data source in the target configuration table is read in a streaming manner, and the number of existing records of the same species generated in the past is counted according to the preset data source identification rules. Write operations are performed independently for each target species based on the selected conflict handling mode and the number of records; the conflict handling modes include replacement mode, skip mode, append mode, or abort mode.
11. An electronic device, characterized in that, include: The device includes a processor, a memory, and a bus. The memory stores machine-readable instructions executable by the processor. When the electronic device is running, the processor communicates with the memory via the bus. The machine-readable instructions are executed by the processor to perform the steps of the three-dimensional spatial entity placement method as described in any one of claims 1 to 10.
