Osgearth-based physical simulation hierarchical control method

CN122595641APending Publication Date: 2026-08-18TIANJIN XUNLIAN TECH CO LTD +1
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202611076341.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-07-20
Publication Date
2026-08-18

AI Technical Summary

Technical Problem

[0006]针对现有技术在地球级三维场景中进行物理仿真时存在的坐标精度不足、大规模场景计算资源浪费以及物理组件生命周期管理不合理等缺陷,提供基于osgEarth的物理仿真分级控制方法

Benefits of technology

(1)本发明通过在地球级场景中建立基于ENU局部坐标的物理世界,将地理坐标通过球面模型转换为局部坐标进行物理计算,有效解决了ECEF大数值导致的浮点精度不足问题,在激活阈值范围内保证往返转换精度优于1厘米;同时,重新定中机制确保实体在长期运动中不超出ENU精度边界,且切换前后位置连续无瞬跳,满足了高精度物理仿真的需求。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122595641A_ABST
    Figure CN122595641A_ABST
Patent Text Reader

Abstract

The application discloses a physical simulation hierarchical control method based on osgEarth and relates to the technical fields of computer simulation and three-dimensional geographic information system.The method comprises the following steps: separating entities from physical double components and managing the life cycle, realizing the decoupling of kinematics and physical components and the reuse of physical components; constructing a physical world based on an ENU local coordinate, realizing high-precision bidirectional conversion between geographic coordinates and local coordinates through a spherical model and atomized recentering, and solving the problem of large-scale coordinate precision loss; and double-threshold hysteresis physical LOD control based on the distance of a camera, dynamically managing physical computing resources, and avoiding frequent switching and shaking at the critical distance.The application effectively solves the problems of insufficient physical simulation precision and large-scale scene performance bottleneck in an earth-level scene and is suitable for fields such as digital twin situation deduction.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention belongs to the field of computer simulation and three-dimensional geographic information system technology, and in particular relates to a physical simulation hierarchical control method based on osgEarth. Background Technology

[0002] In the field of digital twin potential simulation, it is often necessary to manage a large number of heterogeneous moving entities such as ground vehicles, aircraft, and ships simultaneously. osgEarth, as an open-source 3D earth engine, is widely used for the construction and rendering of global-scale 3D scenes. When introducing a general-purpose physics engine into osgEarth's earth-scale 3D scenes to achieve realistic physical collision and dynamics simulation, the following core technical challenges are encountered: First, there's the issue of accuracy in physical calculations at Earth-scale coordinates. osgEarth typically uses the ECEF (Earth-centered Earth-fixed) coordinate system, whose coordinate values ​​are on the order of 6.4 × 10⁻⁶. 6 Meters. However, general-purpose physics engines typically use floating-point numbers for dynamics calculations. At this large numerical scale, the significant number of digits in floating-point numbers is largely occupied by the integer part, resulting in severely insufficient precision in the fractional part, making it impossible to guarantee the millimeter-level precision required for physical simulation. Current technology lacks an effective mechanism for establishing high-precision bidirectional conversion between global geographic coordinates and local physical coordinates at the Earth level, which is a technical bottleneck for the normal operation of physics engines in Earth-level scenes.

[0003] Second, there's the performance issue of physics simulation in large-scale scenarios. In typical situational simulation scenarios, the total number of entities can reach hundreds or even more, but only a minority are within the camera's close range. If physics simulation is enabled for all entities, the computational resources for distant entities will be severely wasted. Traditional LOD technology is only optimized for visual geometry rendering, and existing research on osgEarth also focuses on visual rendering, without an effective solution that combines physical detail levels with geographic spatial scale. Furthermore, how to achieve a smooth transition without destroying physical components during the activation and deactivation of physics simulation, avoiding the system overhead caused by frequent rigid body construction and destruction, is also a key factor affecting overall performance.

[0004] In summary, the existing technologies have the following shortcomings: (1) lack of a high-precision method to convert global geographic coordinates into local coordinates suitable for physics engine calculation in earth-level scenes; (2) lack of a physical hierarchical mechanism to dynamically manage physical computing resources based on camera distance; (3) lack of a decoupled architecture between kinematic state and physical state, and the life cycle of physical components is often strongly coupled with kinematic components, resulting in inflexible resource scheduling.

[0005] Therefore, there is an urgent need to develop a hierarchical physical simulation method suitable for global-scale scenarios in osgEarth to solve the problems of Earth-level coordinate accuracy loss and large-scale scene performance bottlenecks. Summary of the Invention

[0006] To address the shortcomings of existing technologies in physical simulation of Earth-scale 3D scenes, such as insufficient coordinate accuracy, waste of large-scale scene computing resources, and unreasonable lifecycle management of physical components, a hierarchical control method for physical simulation based on osgEarth is provided.

[0007] Specifically, the present invention mainly solves the following technical problems: First, how to establish a high-precision local coordinate system for the physics engine at the Earth-scale coordinate system to solve the problem of floating-point precision loss caused by large-value global coordinates, so as to meet the precision requirements of millimeter-level physical simulation; Second, how to dynamically manage physical computing resources based on camera distance, establish a hierarchical control mechanism for physical simulation, and solve the performance bottleneck problem of wasting physical computing resources for distant entities in large-scale scenarios; Third, how to decouple the kinematic state from the physical state architecture, optimize the lifecycle management of physical components, avoid frequent creation and destruction of physical components, thereby reducing system overhead and achieving a smooth transition when switching states.

[0008] To achieve the above objectives, the technical solution of the present invention is implemented as follows: This invention provides a hierarchical control method for physical simulation based on osgEarth, comprising the following steps: Step 1, Separation and lifecycle management of entity and physics components: Construct kinematic and physics components. The kinematic component is always running to maintain the rendering and kinematic state of the entity. The physics component performs activation, deactivation or reuse operations as needed based on the distance relationship between the entity and the camera. Step 2, Physical world construction based on ENU local coordinates: Convert the geographic coordinates of entities to ENU local coordinates, and use double-precision floating-point numbers to perform physical calculations and inverse transformations; Step 3, dual-threshold hysteresis physical LOD control based on camera distance: calculate the Euclidean distance from the entity to the camera in real time, and combine it with the preset activation threshold and deactivation threshold to control the activation and deactivation status of physical components through hysteresis logic; Step 4, State Synchronization and Recentering Processing: Perform bidirectional data synchronization at the moment the physical component is activated or deactivated, and trigger an atomic recentering operation when the value of the local coordinate of ENU exceeds the recentering threshold. Step 5, Scene Graph Update and Physics Stepping: Update the OSG scene graph and perform Bullet physics stepping, where the kinematics component is always updated and the physics component is executed according to the LOD state.

[0009] Furthermore, in step one, the lifecycle management of physical components includes the following stages: Initial state: no physical components exist, only pure kinematic calculations are performed; Create activation: Construct a rigid body and add it to the physical world; Disable Preservation: Removes the rigidbody from the physical world, but preserves the physical component object and the rigidbody instance in memory; Reuse activation: Skip the creation step and directly add the preserved rigidbody to the physical world; Destroy: Release rigid body objects, collision shape objects, and physical component objects.

[0010] Furthermore, in step two, the conversion formula for converting geographic coordinates to ENU local coordinates is: ; ; ; The inverse transform formula is: ; ; ; in, , h and h represent the entity's current longitude, latitude, and altitude, respectively. , , The coordinates of the globally unified geographic reference point; X represents the Earth spherical transformation coefficient; X, Y, and Z represent the eastward, northward, and celestial components of the local ENU coordinates.

[0011] Furthermore, the recentering operation in step four specifically includes: The absolute value of the entity's local ENU coordinates is monitored in real time. When any component in the X, Y, or Z direction exceeds the recentering threshold, the entity's current geographic coordinates are set as the new ENU origin. The offset vector between the old and new origins is calculated. All physical rigid bodies are traversed and the offset vector is accumulated to the world transformation position component of each rigid body. At the same time, the ENU reference origin saved in the kinematics component is updated. This migration operation is completed atomically within a single frame.

[0012] Furthermore, the hysteresis logic control in step three specifically includes: when Furthermore, activate the physics simulation when the current physics is in a disabled state; when Furthermore, when the current physics is active, physics simulation is disabled; when At that time, the current physical state remains unchanged; Where d is the Euclidean distance from the entity held by the kinematic component to the camera. The physical activation threshold, This is the physical deactivation threshold.

[0013] Furthermore, the physical activation threshold With physical deactivation threshold A hysteresis band is formed between them, and its width The calculation formula is: ; Hysteresis band width satisfies ,in The camera's typical flight speed, The duration of a single frame.

[0014] Furthermore, the bidirectional data synchronization in step four specifically includes: When switching the activation of physics from far to near: obtain the current geographic coordinates of the kinematic components and convert them into ENU coordinates. Write the ENU coordinates into the origin component of the rigid body world transformation matrix. After converting the attitude angles of the kinematic components, write them into the rotation component. Set the linear velocity and angular velocity of the rigid body to zero and then add them to the physics world. When switching off physics from near to far: the rigid body is removed from the physics world but the physics component object and rigid body instance are not destroyed. They are kept in memory for reuse when reactivated. The kinematic components resume pure kinematic updates.

[0015] Furthermore, in step one, the kinematics component provides an interface for the upper-level control logic, which ensures that the interface behavior of the three upper-level control modules—automatic tracking, manual control, and UDP real-time pose injection—is consistent when the physical component is activated or deactivated, and the upper-level control logic is unaware of changes in the physical activation state.

[0016] Compared with existing technologies, the osgEarth-based hierarchical control method for physical simulation of the present invention has the following advantages: (1) This invention establishes a physical world based on ENU local coordinates in an Earth-level scene, converts geographic coordinates into local coordinates through a spherical model for physical calculation, effectively solves the problem of insufficient floating-point precision caused by large values ​​of ECEF, and ensures that the round-trip conversion accuracy is better than 1 cm within the activation threshold range; at the same time, the re-centering mechanism ensures that the entity does not exceed the ENU precision boundary during long-term movement, and the position before and after switching is continuous without instantaneous jump, which meets the requirements of high-precision physical simulation.

[0017] (2) This invention achieves decoupling of kinematic and physical components through a dual-component separation architecture of physical and physical components and a five-stage lifecycle management. The distant physical component does not need to bear the burden of physical simulation calculation. When switching from near to far, the physical component is kept in memory for subsequent reuse, avoiding the overhead of frequent rigid body construction and destruction, and significantly improving the system performance in large-scale scenarios.

[0018] (3) The present invention uses a dual-threshold hysteresis physical LOD mechanism to determine the activation threshold based on the ground projection range of the camera's view cone and the hysteresis band width based on the camera's typical flight speed, ensuring that a single crossing triggers at most one state switch, effectively avoiding frequent switching jitter when the camera moves slowly at the critical distance; in addition, the linear velocity and angular velocity are set to zero when the physical is activated, preventing false collision detection caused by trajectory interpolation, and improving the stability and accuracy of physical simulation. Attached Figure Description

[0019] The accompanying drawings, which form part of this invention, are used to provide a further understanding of the invention. The illustrative embodiments of the invention and their descriptions are used to explain the invention and do not constitute an undue limitation of the invention. In the drawings: Figure 1 This is a schematic flowchart of a hierarchical control method for physical simulation based on osgEarth provided in an embodiment of the present invention. Figure 2 This is a schematic diagram of the entity-physical dual-component architecture and lifecycle state machine provided in the embodiments of the present invention; Figure 3 This is a schematic diagram of the ENU local coordinate transformation link and recentering mechanism provided in an embodiment of the present invention; Figure 4 This is a schematic diagram of the physical LOD state machine provided in an embodiment of the present invention; Figure 5 This is a schematic diagram of the state synchronization timing and core characteristics provided in the embodiments of the present invention; Figure 6 This is a schematic diagram of ENU local coordinate round-trip transformation error accuracy analysis provided in an embodiment of the present invention. Detailed Implementation

[0020] It should be noted that, unless otherwise specified, the embodiments and features described in the present invention can be combined with each other.

[0021] In the description of this invention, it should be understood that the terms "center," "longitudinal," "lateral," "upper," "lower," "front," "rear," "left," "right," "vertical," "horizontal," "top," "bottom," "inner," and "outer," etc., indicating orientations or positional relationships based on the orientations or positional relationships shown in the accompanying drawings, are only for the convenience of describing the invention and simplifying the description, and do not indicate or imply that the device or element referred to must have a specific orientation, or be constructed and operated in a specific orientation, and therefore should not be construed as a limitation of the invention. Furthermore, the terms "first," "second," etc., are used for descriptive purposes only and should not be construed as indicating or implying relative importance or implicitly specifying the number of indicated technical features. Thus, a feature defined with "first," "second," etc., may explicitly or implicitly include one or more of that feature. In the description of this invention, unless otherwise stated, "a plurality of" means two or more.

[0022] In the description of this invention, it should be noted that, unless otherwise explicitly specified and limited, the terms "installation," "connection," and "linking" should be interpreted broadly. For example, they can refer to a fixed connection, a detachable connection, or an integral connection; they can refer to a mechanical connection or an electrical connection; they can refer to a direct connection or an indirect connection through an intermediate medium; and they can refer to the internal connection of two components. Those skilled in the art will understand the specific meaning of the above terms in this invention based on the specific circumstances.

[0023] The present invention will now be described in detail with reference to the accompanying drawings and embodiments.

[0024] This invention provides a hierarchical control method for physical simulation based on osgEarth and Bullet, comprising the following steps: Step 1, Separation and lifecycle management of entity and physics components: Construct kinematic and physics components. The kinematic component is always running to maintain the rendering and kinematic state of the entity. The physics component performs activation, deactivation or reuse operations as needed based on the distance relationship between the entity and the camera. Step 2, Physical world construction based on ENU local coordinates: Convert the geographic coordinates of entities to ENU local coordinates, and use double-precision floating-point numbers for physical calculations and inverse transformations. The coordinate transformation and inverse transformation use double precision, while the physics engine internally uses single precision. Step 3, dual-threshold hysteresis physical LOD control based on camera distance: calculate the Euclidean distance from the entity to the camera in real time, and combine it with the preset activation threshold and deactivation threshold to control the activation and deactivation status of physical components through hysteresis logic; Step 4, State Synchronization and Recentering Processing: Perform bidirectional data synchronization at the moment the physical component is activated or deactivated, and trigger an atomic recentering operation when the value of the local coordinate of ENU exceeds the recentering threshold. Step 5, Scene Graph Update and Physics Stepping: Update the OSG scene graph and perform Bullet physics stepping, where the kinematics component is always updated and the physics component is executed according to the LOD state.

[0025] In this embodiment, the method is mainly applied to the field of digital twin potential extrapolation, aiming to solve two core technical problems: insufficient physical calculation accuracy and performance bottlenecks in large-scale scenes when simultaneously managing heterogeneous moving entities such as ground vehicles, aircraft, and ships in a three-dimensional Earth-scale scene. This method is implemented in the osgEarth three-dimensional Earth platform and Bullet physics engine environment. Through architectural decoupling, coordinate transformation, and hierarchical control, it achieves high-precision and high-performance physical simulation.

[0026] like Figure 1 The diagram shows the overall operation flowchart of the method of this invention. This method employs a loop-driven mechanism, and its execution logic is as follows: After system startup, it enters a frame loop. Each frame first proceeds to step one, namely, the separation and lifecycle management of the entity and physical components. Under this architecture, the kinematic component remains running, responsible for maintaining the rendering and basic motion data of the entity, while the physical component performs activation, deactivation, or reuse operations as needed based on the distance between the entity and the camera, thereby achieving dynamic allocation of computing resources and avoiding unnecessary physical computing resources being occupied by distant entities.

[0027] The second step involves constructing the physical world based on ENU local coordinates. The system converts macroscopic geographic coordinates into microscopic ENU local coordinates using double-precision floating-point numbers for high-precision round-trip conversion. Since the coefficients of Earth-scale coordinates are enormous, direct use would result in loss of floating-point precision. This step, by establishing a local coordinate system, fundamentally solves the problem of precision loss at large scales, ensuring the millimeter-level accuracy requirements of the physical simulation.

[0028] Next, we proceed to step three, which is the dual-threshold hysteresis physical LOD control based on camera distance. The system calculates the Euclidean distance from the entity to the camera in real time and, combined with preset activation and deactivation thresholds, uses hysteresis logic to determine whether to enable physical simulation. This dual-threshold design effectively avoids the frequent creation and destruction of physical components caused by the camera moving slowly at critical distances, thus improving system stability.

[0029] The system then enters a decision branch. If the physics entity is determined to be active, state synchronization and recentering are performed. This step is responsible for bidirectional data synchronization at the moment the physics entity is activated or deactivated, ensuring consistency between visual and physical positions. It also triggers an atomized recentering operation when the coordinate values ​​are too large, resetting the coordinate origin to ensure long-term accuracy. If the physics entity is determined to be inactive, the system only enters a pure kinematics update node to save computational resources. In this case, the entity only updates its position using kinematic formulas and does not participate in physical collision and dynamics calculations.

[0030] Finally, the system performs OSG scene graph updates and Bullet physics stepping. During this phase, the kinematics components are continuously updated to ensure rendering continuity, while the physics components strictly adhere to the LOD state. After completing all calculations for the current frame, the system enters the next frame loop until the entire simulation process ends.

[0031] In a preferred embodiment of the present invention, such as Figure 2 As shown, the dual-component architecture of entity and physical components and its lifecycle state machine are illustrated. The core idea of ​​this architecture is decoupling, which breaks down the management of the traditional single entity into two independent but collaborative components.

[0032] The upper part of the architecture illustrates the division of responsibilities between the two components. The kinematics component is responsible for managing OSG scene graph nodes, maintaining the kinematic states of position, orientation, and velocity, and providing interfaces for upper-level control logic. Its lifecycle is equivalent to the entire lifecycle of the entity, ensuring that the entity is always visible and controllable in the scene. The physics component contains Bullet rigid body objects, collision shapes, and motion states, and only exists at close range. The two interact with each other through state synchronization and physics write-back. The lifecycle of the physics component is a subset of the entire lifecycle of the entity, created, retained, and reused on demand. This design significantly reduces the frequency of memory allocation and deallocation.

[0033] The lower half of the architecture illustrates the physical component lifecycle state machine, comprising five main phases. In the initial state, the physical component does not exist; the system performs only pure kinematic calculations, suitable for situations where the entity has just been generated or is extremely far away. The creation and activation phase constructs a rigid body and adds it to the physical world, assigning it physical properties. The deactivation and retention phase removes the rigid body from the physical world through a deactivation operation, but the rigid body remains in memory without releasing resources; this is key to the significant performance improvement of this invention. The reuse and activation phase skips the tedious creation steps and directly adds the retained rigid body to the physical world through a reuse operation, achieving rapid activation. The destruction phase releases all related resources through a destruction operation when the entity is completely removed, preventing memory leaks.

[0034] The architecture follows key design principles: kinematic components always run, unaffected by changes in the state of physical components, ensuring the stability of upper-layer logic; upper-layer control modules do not need to be aware of the switching of the underlying physical state; physical components retain memory after being deactivated and are reused when reactivated, avoiding the performance overhead caused by frequent construction and destruction.

[0035] In a preferred embodiment of the present invention, such as Figure 3 As shown, the ENU local coordinate transformation link and recentering mechanism are illustrated.

[0036] The transformation process illustrates the data flow: geographic coordinates, including longitude, latitude, and altitude, are converted into ENU local coordinates using formulas 1 to 3. These ENU local coordinates include east, north, and celestial components. These ENU coordinates are then written into the transformed data and fed into the Bullet physics calculation module for rigid body transformation, collision detection, and integration. After calculation, the data is inversely transformed back to geographic coordinates using formulas 4 to 6, achieving a seamless connection between the physical and geographic worlds.

[0037] The ENU conversion formula is based on a spherical model of the WGS-84 ellipsoid parameters, and the specific expression is as follows: (1); (2); (3); In the formula, The current longitude of the entity. h represents the current latitude of the entity, and h represents the current height of the entity. For a globally unified geographical reference point longitude, For a globally unified geographical reference point latitude, The elevation of the globally unified geographic reference point; The conversion factor for the Earth's sphere is usually taken as 111320.0 m / deg.

[0038] The inverse transform formula is as follows: (4); (5); (6); In the formula, The longitude of the entity after inverse transformation. h represents the entity's dimension after the inverse transformation, and h represents the entity's height after the inverse transformation. , , , The meaning is the same as above; X is the east coordinate of the entity, Y is the north coordinate of the entity, and Z is the sky coordinate of the entity.

[0039] The recentering mechanism prevents precision loss due to excessively large coordinate values. The system monitors the absolute values ​​of entity ENU coordinates in real time. When any component in the X, Y, or Z direction exceeds the recentering threshold D_recenter, it is considered to have exceeded the threshold. If it does not exceed the threshold, normal physics calculations continue; if it does exceed the threshold, an atomization recentering operation is performed. This operation includes: setting the new ENU origin to the current geographic coordinates, calculating the offset vector between the old and new origins, traversing all rigid bodies and accumulating this offset to the world transformation position component, and simultaneously updating the reference origin of the kinematic components. This operation ensures completion within a single frame, with no visible jumps, and that the relative positional relationships of all entities remain unchanged.

[0040] In a preferred embodiment of the present invention, such as Figure 4 The diagram illustrates the physical LOD state machine. This state machine includes a deactivated state, an active state, and a hysteresis region.

[0041] The deactivated state corresponds to pure kinematic updates. When the distance d is less than the activation threshold D_act, and the system is currently in the deactivated state, it switches to the activated state and performs physical simulation activation.

[0042] The active state corresponds to the activation of the physical simulation. When the distance d is greater than the deactivation threshold D_deact, and the system is currently in the active state, it switches back to the deactivated state.

[0043] The hysteresis region is defined as the range between D_act and D_deact. Within this region, the system maintains its current physical state, neither activating nor deactivating, thus forming a buffer zone.

[0044] The specific logical expression for state transition is as follows: when Furthermore, if the current physics is in a disabled state, activate the physics simulation (7a); when Furthermore, when the current physics is active, the physics simulation is disabled (7b); when At that time, the current physical state remains unchanged (7c); In the formula, d is the Euclidean distance from the entity held by the kinematic component to the camera, D_act is the physical activation threshold, and D_deact is the physical deactivation threshold.

[0045] The formula for calculating the hysteresis band width W_hyst is as follows: (8); In the formula, W_hyst is the hysteresis band width, D_deact is the physical deactivation threshold, and D_act is the physical activation threshold. The selection of this width must satisfy the condition that W_hyst is greater than v_cam and... The product of and , where v_cam is the typical flight speed of the camera. The duration is set to a single frame to ensure that the camera triggers a switch at most once per pass, thus eliminating edge jitter.

[0046] The specific process of state switching is as follows: Switching from far to near is the activation process. If the physical component does not exist, a rigid body is created and constructed. If the physical component is already retained, it is directly reused. The geographic coordinates are converted to ENU coordinates, written to the rigid body's world transformation, and the linear and angular velocities are set to zero. It is then added to the physical world, while the kinematics component continues to run independently. Switching from near to far is the deactivation process. The rigid body is removed from the physical world, but the component is not destroyed. The physical component object is retained in memory, and the rigid body instance is not destroyed for reuse. The kinematics component takes over and performs pure kinematic updates. The upper-level logic is unaware of the state change.

[0047] In a preferred embodiment of the present invention, such as Figure 5 As shown, the state synchronization timing diagram and core features are illustrated.

[0048] The switching process from far to near is as follows: After the activation condition is detected, a component is created or reused, the geographic coordinates are converted to ENU coordinates, the rigid body world transformation is written, the velocity and angular velocity are set to zero, and finally the active state is entered.

[0049] Switching process from near to far: After detecting the deactivation condition, the rigid body is removed from the physical world without destroying the component. The kinematic component is restored to pure kinematic updates and finally enters the deactivation state.

[0050] The core features of state synchronization include: When moving from far to near, geographic coordinates are transformed into rigid body transformations via ENU, and then added to the physical world after zero velocity and angular velocity, involving multiple meticulous operation steps to ensure the correct initial state. When moving from near to far, the rigid body is removed, the component retains memory, and the kinematics component takes over, simplifying the steps and ensuring rapid resource release. The positions before and after the switch are equal, and the geographic coordinates and ENU are precise inverse transformations of each other, with no instantaneous jumps. During recentering, any coordinate axis exceeds D_recenter, the ENU origin is atomically migrated, and the offset of all rigid bodies is accumulated.

[0051] Consistency of upper-layer control modules: The interface behavior of the three upper-layer control modules, namely automatic tracking, manual control, and UDP real-time pose injection, is consistent in the physical activation or deactivation state. The upper layer is unaware of changes in the physical LOD state, thus achieving complete decoupling between the underlying physics engine and the upper-layer business logic.

[0052] In a preferred embodiment of the present invention, such as Figure 6The figure shows the ENU accuracy analysis. The horizontal axis represents the distance from the ENU origin, and the vertical axis represents the round-trip error. The curve shows that the error increases slowly with distance. Double-precision floating-point accuracy analysis indicates that the effective number of decimal digits is 15 to 16. At 4500m, the round-trip error is less than... m, far below the millimeter-level physical simulation requirements. The 10km accuracy boundary is marked in the figure. Recentering is triggered at D_recenter = 8000m. Note: The ENU round-trip conversion error increases slowly with distance from the origin, remaining relatively constant at 10km. The accuracy is on the order of m, far less than the 1mm physical simulation accuracy requirement, proving the accuracy and reliability of this method in long-distance motion.

[0053] The present invention will be described in detail below through two specific embodiments.

[0054] Example 1: Construction, accuracy verification, and recentering of the ENU local coordinate physical world This embodiment details the process of determining the global reference point, calculating the ENU conversion, verifying accuracy, and executing the recentering mechanism. In this embodiment, the physical activation threshold is set to 4500 meters, the deactivation threshold to 5500 meters, the hysteresis band width to 1000 meters, and the recentering threshold to 8000 meters. R_earth is set to 111320.0 m / deg, based on R_earth equal to 2. R is calculated by dividing by 360 and rounding to the nearest whole number. In the formula, R equals 6378137m, which is the Earth's equatorial radius. The conversion is performed in double-precision floating-point mode, with 15 to 16 significant decimal digits.

[0055] The selection of the activation threshold of 4500 meters is based on the following: Under a typical display configuration with a horizontal field of view (FOV) of 60 degrees and a resolution of 1920 x 1080, the ground projection width W_ground is calculated as follows: ; In the formula, W_ground is the ground projection width, D_act is the physical activation threshold, and FOV is the horizontal field of view. The ground projection at a distance of 4500 meters covers the main part of the visible area. The visual size of entities beyond this distance is less than a few pixels, and the physical simulation details are indistinguishable. Therefore, there is no need to enable physical simulation, thus saving computational resources.

[0056] Step 1: Determining the global reference point and converting to ENU.

[0057] During system initialization, the geographic coordinates of the scene center are used as the global reference point, with longitude of 103.899°E, latitude of 30.545°N, and altitude of 500m.

[0058] Taking an aircraft located at longitude 103.920°E, latitude 30.550°N, and altitude 11000m as an example, calculate its ENU coordinates.

[0059] Calculate the X component according to Formula 1: ; Calculate the Y component according to Formula 2: ; Calculate the Z component according to Formula 3: ; The physical coordinates of the spacecraft in ENU space are 2013,557,10500, all well within the double-precision floating-point margin. These coordinates are then inversely transformed into geographic coordinates for verification. The calculations are performed with R_earth equal to 111320.0 m / deg and cos(30.545°) equal to 0.8612.

[0060] Calculate longitude using formula 4: ; Calculate latitude using formula 5: ; Calculate the height using formula 6: ; The round-trip position error is less than 0.001m, which is negligible. For example... Figure 6 As shown, within a 10km radius of the origin, the ENU round-trip conversion error increases slowly with distance, and remains relatively constant at 10km. The m-level accuracy, far below the millimeter-level threshold, demonstrates the high precision of the conversion formula.

[0061] Step 2: Triggering and executing the re-centering mechanism.

[0062] The aircraft continues to fly in the ENU space. When the displacement in the X direction reaches 8200m, exceeding D_recenter (8000m), a recentering is triggered.

[0063] Set the aircraft's current geographic coordinates as the new reference point, offset vector It is (-8200,0,0).

[0064] Traverse all rigid bodies in the global physical world, Accumulate to the world transformation position component of each rigid body.

[0065] The ENU reference origin of the kinematic components is updated synchronously.

[0066] The operation is completed atomically within a single frame, with no visible jumps between frames. Before triggering re-centering at 8000m, the double-precision round-trip conversion error remains within [a certain range]. The value is on the order of meters (m), far smaller than 1 mm. The 8000m threshold leaves a 2km margin within a 10km safety boundary. When multiple moving entities are displayed on the same screen in the same osgEarth scene, they independently determine and perform recentering without interfering with each other.

[0067] Example 2: Lifecycle of Physical-Physical Dual Components and Physical LOD Switching This embodiment details the entire process of creating, activating, deactivating, reusing, and destroying physical components during the movement of an entity.

[0068] Step 1: Initial state, i.e., long-distance pure kinematics.

[0069] The fixed-wing aircraft is initially 7000m from the camera, at which point the distance d is greater than 5500m. The kinematics component holds OSG scene graph nodes and kinematic states, while the physics component pointer is null. The kinematics component performs kinematic updates every frame; the CPU overhead consists only of algebraic operations, with no physics engine call overhead.

[0070] Step 2: Enter close proximity, i.e., create and activate.

[0071] The camera zooms in to 3000m. At this point, the distance d is less than 4500m, triggering a switch from far to near.

[0072] If the physical component does not exist, call the creation interface: First, create physical components based on the aircraft type, namely Bullet physics simulation units that encapsulate rigid bodies and related resources; Second, inject a mass m equal to 1200 kg from the GLB (glTF Binary) file; Third, the collision shape half-size is calculated based on the model bounding box. The formula for calculating the half-size S is as follows: ; In the formula, S is the half-side length of the model bounding box along the corresponding axis. This represents the maximum value of the model's bounding box along the corresponding axis. This represents the minimum value of the model's bounding box along the corresponding axis. The calculated half-dimensions are 7.5, 4.2, and 1.8 meters. Fourth, construct rigid body objects to store the dynamic states of entities, such as mass, velocity, and world transformations; Fifth, rigid bodies are added to the discrete dynamics world of the physical components, and the discrete dynamics world manages the collision detection and dynamic integration of all rigid bodies.

[0073] Perform ENU bidirectional synchronization: Obtain geographic coordinates: longitude 103.899°, latitude 30.545°, altitude 11000m; reference point: longitude 103.920°, latitude 30.550°, altitude 500m.

[0074] Substitute into formulas 1 to 3: ; ; ; The ENU coordinates are -2013, -557, 10500. In this embodiment, the aircraft's geographic coordinates and the reference point's latitude and longitude are exactly interchanged with those in Embodiment 1. Therefore, the X and Y components have the opposite signs of those in Embodiment 1, demonstrating the reversibility and symmetry of the ENU transformation. In double precision, the enuToGeo function returns longitude 103.8990000° and latitude 30.5450000°, with a negligible round-trip error of less than 0.001m.

[0075] The ENU coordinates and the kinematic component HPR (Heading-Pitch-Roll) values ​​are written into the rigid body world transformation, the linear velocity and angular velocity are set to zero, and the physics body is activated. Nearby entities display collision bounding boxes and physical effects. This activation distance d is equal to 3000, which is less than D_act (4500), ensuring the entity is within the ENU accuracy guarantee range; the round-trip error within ±4500m is less than 1cm. When d approaches the D_act boundary, for example, when d equals 4490m, the hysteresis band defined by formula 7c has not yet been entered. d needs to be further increased to greater than 5500m before the deactivation decision is triggered, eliminating frequent switching when the camera moves slowly near 4500m.

[0076] Step 3: Enter remote mode, i.e., disable and retain.

[0077] The camera moves away to 7000m, at which point the distance d is greater than 5500m. The deactivation interface is called: the rigid body is removed from the dynamic world, but the physics component object and the rigid body instance remain in memory. The kinematic components resume pure kinematic updates. The key to this step is to avoid destroying the objects, preparing for future reuse.

[0078] Step 4: Re-enter close range, i.e., reuse activation.

[0079] The camera zooms in again to 3000m. Since the physical components already exist, they are retained from the previous round. The activation interface is directly invoked to re-add the rigid body to the dynamics world, skipping the creation and construction steps. The switch is completed in just one frame, significantly more efficient than the initial activation. This step demonstrates the significant performance optimization advantages of this invention.

[0080] Step 5: Physical destruction, i.e., complete release.

[0081] When an entity is removed from the scene, the destruction interface is called to release the rigidbody object, collision shape object, motion state object (i.e., the object caching the rigidbody world transformation), and physical component object in sequence. This ensures no memory leaks.

[0082] In summary, this invention, through a dual-component separation architecture for physical and physical components, combined with high-precision local coordinate transformation using ENU and dual-threshold hysteresis LOD control, effectively solves the problems of insufficient accuracy and performance bottlenecks in physical simulation under Earth-scale scenarios, achieving efficient and high-precision management of large-scale heterogeneous moving entities. Compared with existing technologies, the hierarchical control method for physical simulation based on osgEarth provided in this invention has the following significant advantages: First, this invention completely solves the problem of floating-point precision loss caused by excessively large values ​​in the traditional ECEF geocentric-ground-fixed coordinate system by establishing a physical world based on ENU local coordinates in a global-scale scene. As shown in Embodiment 1 of the specific implementation, this invention utilizes double-precision floating-point numbers for bidirectional conversion between geographic coordinates and ENU local coordinates. Within a range of 10km from the origin, the round-trip conversion error remains at 10%. -12 For physical simulations requiring accuracy on the order of meters (m), far less than 1 mm, this invention ensures a round-trip conversion accuracy better than 1 cm within the activation threshold range. Simultaneously, it innovatively introduces an atomic recentering mechanism. When an entity's movement exceeds the safety boundary, the ENU origin is migrated within a single frame, and the offset is accumulated. This ensures that the entity remains within a high-precision calculation range throughout long-term, large-scale movements, with continuous position before and after switching and no visible instantaneous jumps between frames. This provides a solid data foundation for millimeter-level physical simulations in Earth-scale scenes.

[0083] Secondly, this invention achieves deep decoupling between kinematic and physical components through a dual-component architecture separating physical and physical components and a five-stage lifecycle management system. As shown in Embodiment 2, the lifecycle of the physical component is finely divided into five stages: initialization, creation activation, deactivation retention, reuse activation, and destruction. In the long-distance state, the physical component does not exist or is in a deactivated retention state, and the entity is only updated by pure algebraic operations performed by the kinematic component, completely eliminating the physical simulation computation burden on long-distance entities. More importantly, when an entity switches from near to far, the rigid body is only removed from the dynamic world without being destroyed, and is retained in memory; when the entity re-enters the near distance, it directly skips the cumbersome construction steps and performs reuse activation, completing the switch in just one frame. This design avoids the overhead of frequent rigid body construction, memory allocation, and destruction, significantly reducing CPU peak load and memory fragmentation risks, and significantly improving the overall system performance when hundreds of heterogeneous entities are running on the same screen in large-scale scenarios.

[0084] Third, this invention achieves intelligent and smooth scheduling of physical computing resources through a dual-threshold hysteresis physical LOD mechanism. This invention abandons the traditional single-threshold switching method, determining the activation threshold (e.g., 4500 meters) based on the ground projection range of the osgEarth camera's view frustum, and setting the hysteresis band width (e.g., 1000 meters) based on the camera's typical flight speed and single-frame duration. This design ensures that when the camera crosses a critical distance, a single crossing triggers at most one state switch, effectively eliminating the "jitter" phenomenon caused by frequent creation and destruction of physical components when the camera moves slowly or hovers at critical distances. Furthermore, when activating physics from far to near, this invention forcibly sets the rigid body's linear velocity and angular velocity to zero, effectively preventing false initial collision detections caused by trajectory interpolation and improving the stability and accuracy of physical simulation.

[0085] Fourth, this invention achieves complete isolation between the underlying physical state switching and the upper-level control logic. Through a unified state synchronization interface, various upper-level control modules, such as automatic tracking, manual control, and UDP real-time pose injection, maintain completely consistent interface behavior whether physically active or deactivated. Upper-level business logic does not need to be aware of the complex changes in the underlying physical LOD state, greatly reducing the development difficulty of the digital twin potential inference system and improving code maintainability and system robustness.

[0086] Those skilled in the art will understand that the above-mentioned beneficial effects are the result of the synergistic effect of the various technical features of the present invention. The present invention not only solves the two core technical problems of Earth-level coordinate accuracy loss and large-scale scene performance bottleneck, but also provides a standardized and efficient solution for the deep integration of three-dimensional geographic information systems and general physical engines, which has extremely high engineering application value and broad market prospects.

[0087] The above are merely preferred embodiments of the present invention and are not intended to limit the present invention. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of the present invention should be included within the protection scope of the present invention.

Claims

1. A hierarchical control method for physical simulation based on osgEarth, characterized in that, Includes the following steps: Step 1, Separation and lifecycle management of entity and physics components: Construct kinematic and physics components. The kinematic component is always running to maintain the rendering and kinematic state of the entity. The physics component performs activation, deactivation or reuse operations as needed based on the distance relationship between the entity and the camera. Step 2, Physical world construction based on ENU local coordinates: Convert the geographic coordinates of entities to ENU local coordinates, and use double-precision floating-point numbers to perform physical calculations and inverse transformations; Step 3, dual-threshold hysteresis physical LOD control based on camera distance: calculate the Euclidean distance from the entity to the camera in real time, and combine it with the preset activation threshold and deactivation threshold to control the activation and deactivation status of physical components through hysteresis logic; Step 4, State Synchronization and Recentering Processing: Perform bidirectional data synchronization at the moment the physical component is activated or deactivated, and trigger an atomic recentering operation when the value of the local coordinate of ENU exceeds the recentering threshold. Step 5, Scene Graph Update and Physics Stepping: Update the OSG scene graph and perform Bullet physics stepping, where the kinematics component is always updated and the physics component is executed according to the LOD state.

2. The hierarchical control method for physical simulation based on osgEarth according to claim 1, characterized in that, In step one, the lifecycle management of physical components includes the following stages: Initial state: no physical components exist, only pure kinematic calculations are performed; Create activation: Construct a rigid body and add it to the physical world; Disable Preservation: Removes the rigidbody from the physical world, but preserves the physical component object and the rigidbody instance in memory; Reuse activation: Skip the creation step and directly add the preserved rigidbody to the physical world; Destroy: Release rigid body objects, collision shape objects, and physical component objects.

3. The hierarchical control method for physical simulation based on osgEarth according to claim 1, characterized in that, In step two, the conversion formula for converting geographic coordinates to ENU local coordinates is: ; ; ; The inverse transform formula is: ; ; ; in, , h and h represent the entity's current longitude, latitude, and altitude, respectively. , , The coordinates of globally unified geographic reference points; X represents the Earth spherical transformation coefficient; X, Y, and Z represent the eastward, northward, and celestial components of the local ENU coordinates.

4. The hierarchical control method for physical simulation based on osgEarth according to claim 1, characterized in that, The recentering operation in step four specifically includes: The absolute value of the entity's local ENU coordinates is monitored in real time. When any component in the X, Y, or Z direction exceeds the recentering threshold, the entity's current geographic coordinates are set as the new ENU origin. The offset vector between the old and new origins is calculated. All physical rigid bodies are traversed and the offset vector is accumulated to the world transformation position component of each rigid body. At the same time, the ENU reference origin saved in the kinematics component is updated. This migration operation is completed atomically within a single frame.

5. The hierarchical control method for physical simulation based on osgEarth according to claim 1, characterized in that, The hysteresis logic control in step three is specifically as follows: when Furthermore, activate the physics simulation when the current physics is in a disabled state; when Furthermore, when the current physics is active, physics simulation is disabled; when At that time, the current physical state remains unchanged; Where d is the Euclidean distance from the entity held by the kinematic component to the camera. The physical activation threshold, This is the physical deactivation threshold.

6. The hierarchical control method for physical simulation based on osgEarth according to claim 5, characterized in that, Physical activation threshold With physical deactivation threshold A hysteresis band is formed between them, and its width The calculation formula is: ; Hysteresis band width satisfies ,in The camera's typical flight speed, The duration of a single frame.

7. The hierarchical control method for physical simulation based on osgEarth according to claim 1, characterized in that, Step four, bidirectional data synchronization, specifically includes: When switching the activation of physics from far to near: obtain the current geographic coordinates of the kinematic components and convert them into ENU coordinates. Write the ENU coordinates into the origin component of the rigid body world transformation matrix. After converting the attitude angles of the kinematic components, write them into the rotation component. Set the linear velocity and angular velocity of the rigid body to zero and then add them to the physics world. When switching off physics from near to far: the rigid body is removed from the physics world but the physics component object and rigid body instance are not destroyed. They are kept in memory for reuse when reactivated. The kinematic components resume pure kinematic updates.

8. The hierarchical control method for physical simulation based on osgEarth according to claim 1, characterized in that, In step one, the kinematics component provides an interface for the upper-level control logic, which makes the interface behavior of the three upper-level control modules—automatic tracking, manual control, and UDP real-time pose injection—consistent when the physical component is activated or deactivated, and the upper-level control logic is unaware of changes in the physical activation state.