Space-time trajectory simulation method, device, electronic device and computer storage medium
By constructing reference spatial coordinate points and time points in the twin's own coordinate system, combining WebGL and pre-set motion mode library and time update function, the continuity problem of twin's space-time trajectory simulation is solved, and efficient twin motion simulation and data storage optimization is achieved.
Patent Information
- Application Number
- CN202210107342.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-01-28
- Publication Date
- 2025-07-29
- Estimated Expiration
- 2042-01-28
AI Technical Summary
In the prior art, the spatiotemporal trajectory simulation of twins has poor continuity in time and space, resulting in reduced data accuracy and discontinuity of twin movements.
By constructing reference spatial coordinate points and time points in the twin's own coordinate system, combining WebGL and pre-set motion mode library and time update function, the space-time trajectory of the twin is simulated, and the decoupling of the twin at each motion stage and the decoupling of the motion parameters is realized.
The space-time continuity of twin movements is realized, the amount of storage of spatial coordinate data is reduced, and the authenticity and accuracy of twin movements is improved.
Smart Images

Figure CN114627149B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of digital twin technology. Specifically, this application relates to a spatio-temporal trajectory simulation method, apparatus, electronic device, and computer storage medium. Background Art
[0002] For digital twin technology implemented based on WebGL, the computing power of the GPU (graphics processing unit) of WebGL is mostly utilized to construct a three-dimensional world, render three-dimensional models, and other twins, so as to realize the twin of the real world. This kind of digital twin is similar to taking a "digital snapshot" by pressing a camera at a certain moment, and essentially is a digital mirror of the objective world at a certain moment. As a data carrier, the twin should not be just a static data carrier, but a dynamic carrier that can be connected and tracked, and a real-time dynamic digital twin that can be marked, connected, and tracked on the spatio-temporal trajectory should be realized.
[0003] The spatio-temporal data during the movement of the twin is a kind of massive data set. In order to reduce the data storage volume, the data is usually thinned by means of downsampling, that is, the method of storing sampled data is adopted, and each piece of data after sampling represents the spatial position of the twin at a certain time point. However, this spatio-temporal data storage method not only reduces the data accuracy, but also results in the fact that the spatial data and time data of the twin are not in a continuous relationship on the time axis, but more like a splicing relationship, that is, the continuity of the twin in time and space is poor. Summary of the Invention
[0004] Embodiments of this application provide a spatio-temporal trajectory simulation method, apparatus, electronic device, and computer storage medium, which can solve the problem of poor continuity in time and space of the spatio-temporal trajectory simulation of the twin. The technical solutions are as follows:
[0005] According to one aspect of the embodiments of this application, a spatio-temporal trajectory simulation method is provided, and the method includes:
[0006] Determine the reference spatial coordinate point and reference time point of the twin. The reference spatial coordinate point is the origin of the pre-constructed twin coordinate system, and the reference time point is an N*N time matrix, where N is an integer greater than 1;
[0007] Based on WebGL, according to the reference spatial coordinate point, reference time point, the motion information corresponding to each motion stage included in the pre-set piecewise aggregate approximation (PAA) motion sequence list, the motion function corresponding to each motion mode included in the pre-constructed motion mode library, and the pre-set motion time update function, simulate the spatio-temporal trajectory of the twin passing through each motion stage, where the motion information includes motion duration, motion mode, and motion parameters.
[0008] In a possible implementation, determining the reference space coordinate points of the twin includes:
[0009] Based on the WebGL three-dimensional world coordinate system and the vertex coordinate data of the twin, determining the coordinate control points of the twin;
[0010] According to the perspective projection matrix and the coordinate control points of the twin, determining the coordinate transformation matrix;
[0011] According to the coordinate transformation matrix and the WebGL three-dimensional world coordinate system, constructing the twin coordinate system of the twin and determining the origin of the twin coordinate system as the reference space coordinate point of the twin.
[0012] In a possible implementation, based on the WebGL three-dimensional world coordinate system and the vertex coordinate data of the twin, determining the coordinate control points of the twin includes:
[0013] Based on the WebGL three-dimensional world coordinate system, constructing the spherical bounding box of the twin according to the vertex coordinate data of the twin;
[0014] Obtaining the center point of the spherical bounding box and determining it as the center point of the twin;
[0015] Adding fourth-dimensional data with a preset value to the center point of the twin and determining the center point of the twin after adding the fourth-dimensional data as the coordinate control point.
[0016] In a possible implementation, based on WebGL, according to the reference space coordinate point, the reference time point, the motion information corresponding to each motion stage included in the preset piecewise aggregation approximation PAA motion sequence list, the motion functions corresponding to each motion pattern included in the pre-constructed motion pattern library, and the preset motion time update function, simulating the spatio-temporal trajectory of the twin passing through each motion stage, including:
[0017] Step A: Based on the PAA motion sequence list, determining the current motion stage of the twin and the first motion duration, the first motion pattern, and the first motion parameters corresponding to the current motion stage;
[0018] Step B: According to the motion pattern library, determining the first motion function corresponding to the first motion pattern;
[0019] Step C: Based on WebGL, determining the first reference space coordinate point of the current motion stage according to the reference space coordinate point and determining the first reference time point of the current motion stage according to the reference time point;
[0020] Step D: Based on WebGL, according to the first reference space coordinate points, the first reference time point, a preset motion time update function, the first motion duration, the first motion parameters, and the first motion function, simulate the spatio-temporal trajectory of the digital twin passing through the current motion stage;
[0021] When it is determined that the current motion stage ends based on the first motion duration, update the current motion stage to the next motion stage of the current motion stage, and repeat Steps A to D until the spatio-temporal trajectory simulation of the digital twin passing through each motion stage included in the PAA motion sequence list is completed.
[0022] In a possible implementation manner, based on WebGL, determining the first reference space coordinate points of the current motion stage according to the reference space coordinate points includes:
[0023] When the current motion stage is the first motion stage in the PAA motion sequence list, determine the first reference space coordinate points of the current motion stage as the reference space coordinate points;
[0024] When the current motion stage is not the first motion stage in the PAA motion sequence list, determine the first reference space coordinate points of the current motion stage as the space coordinate points after the last frame of motion in WebGL of the previous motion stage of the current motion stage, where the space coordinate points after the last frame of motion in WebGL of the previous motion stage are calculated according to the motion function corresponding to the motion mode of the previous motion stage, the motion duration, and the motion parameters of the previous motion stage.
[0025] In a possible implementation manner, based on WebGL, determining the first reference time point of the current motion stage according to the reference time point includes:
[0026] When the current motion stage is the first motion stage in the PAA motion sequence list, determine the first reference time point of the current motion stage as the reference time point;
[0027] When the current motion stage is not the first motion stage in the PAA motion sequence list, determine the first reference time point of the current motion stage as the time point after the last frame of motion in WebGL of the previous motion stage of the current motion stage, where the time point after the last frame of motion in WebGL of the previous motion stage is calculated according to the preset motion time update function, the reference time point, and the motion duration of the previous motion stage.
[0028] In a possible implementation manner, the current motion stage includes multiple WebGL frames; based on WebGL, according to the first reference space coordinate points, the first reference time point, a preset motion time update function, the first motion duration, the first motion parameters, and the first motion function, simulating the spatio-temporal trajectory of the digital twin passing through the current motion stage includes:
[0029] Step E, determine the second reference spatial coordinate point of the current frame of WebGL in the current motion phase according to the first reference spatial coordinate point, and determine the second reference time point of the current frame of WebGL in the current motion phase according to the first reference time point;
[0030] Step F, based on the first motion function, determine the spatial coordinate point after the motion of the current frame of WebGL according to the second reference spatial coordinate point and the first motion parameter, and determine the spatial coordinate point after the motion of the current frame of WebGL as the second reference spatial coordinate point of the next frame of WebGL. The next frame of WebGL is the next WebGL frame of the current frame of WebGL;
[0031] Step G, based on the preset motion time update function, determine the time point after the motion of the current frame of WebGL according to the second reference time point and the time required for the motion of the current frame of WebGL, and determine the time point after the motion of the current frame of WebGL as the second reference time point of the next frame of WebGL;
[0032] When the motion of the current frame of WebGL ends, update the current frame of WebGL to the next WebGL frame of the current frame of WebGL, and repeat steps E to G until the spatio-temporal trajectory simulation of each WebGL frame included in the current motion phase is completed.
[0033] In a possible implementation manner, determining the second reference spatial coordinate point of the current frame of WebGL in the current motion phase according to the first reference spatial coordinate point includes:
[0034] When the current frame of WebGL is the first frame of WebGL in the current motion phase, determine the second reference spatial coordinate point as the first reference spatial coordinate point;
[0035] When the current frame of WebGL is not the first frame of WebGL in the current motion phase, determine the second reference spatial coordinate point as the spatial coordinate point after the motion of the previous frame of WebGL. The previous frame of WebGL is the previous WebGL frame of the current frame of WebGL;
[0036] Determining the second reference time point of the current frame of WebGL in the current motion phase according to the first reference time point includes:
[0037] When the current frame of WebGL is the first frame of WebGL in the current motion phase, determine the second reference time point as the first reference time point;
[0038] When the current frame of WebGL is not the first frame of WebGL in the current motion phase, determine the second reference time point as the time point after the motion of the previous frame of WebGL.
[0039] In a possible implementation, determining whether the current motion stage ends based on the first motion duration includes:
[0040] Determining the time difference between the time point after the last frame of motion of the current motion stage in WebGL and the reference time point of the first frame of WebGL;
[0041] Comparing the first motion duration with the time difference. If it is determined that the time difference is equal to the first motion duration, or if it is determined that the difference between the first motion duration and the time difference is less than the time required for the motion of one WebGL frame, it is determined that the current motion stage ends; otherwise, it is determined that the current motion stage does not end.
[0042] In a possible implementation, the motion mode includes at least one of the following:
[0043] Linear motion mode; Hermite motion mode; Lagrange motion mode.
[0044] According to another aspect of the embodiments of the present application, a spatio-temporal trajectory simulation device is provided. The device includes:
[0045] A determination module, configured to determine the reference space coordinate point and the reference time point of the twin. The reference space coordinate point is the origin of the pre-constructed twin coordinate system, and the reference time point is an N×N time matrix, where N is an integer greater than 1;
[0046] A processing module, configured to simulate the spatio-temporal trajectory of the twin passing through each motion stage based on WebGL, according to the reference space coordinate point, the reference time point, the motion information corresponding to each motion stage included in the pre-set piecewise aggregate approximation (PAA) motion sequence list, the motion function corresponding to each motion mode included in the pre-constructed motion mode library, and the pre-set motion time update function, where the motion information includes motion duration, motion mode, and motion parameters.
[0047] In a possible implementation, when determining the reference space coordinate point of the twin, the determination module is configured to:
[0048] Determine the coordinate control points of the twin based on the WebGL three-dimensional world coordinate system and the vertex coordinate data of the twin;
[0049] Determine the coordinate system conversion matrix according to the perspective projection matrix and the coordinate control points of the twin;
[0050] Construct the twin coordinate system of the twin according to the coordinate system conversion matrix and the WebGL three-dimensional world coordinate system, and determine the origin of the twin coordinate system as the reference space coordinate point of the twin.
[0051] In a possible implementation, when the determination module determines the coordinate control points of the twin based on the WebGL three-dimensional world coordinate system and the vertex coordinate data of the twin, it is used for:
[0052] Based on the WebGL three-dimensional world coordinate system, construct a spherical bounding box of the twin according to the vertex coordinate data of the twin;
[0053] Obtain the center point of the spherical bounding box and determine it as the center point of the twin;
[0054] Add fourth-dimensional data with a preset value to the center point of the twin, and determine the center point of the twin after adding the fourth-dimensional data as the coordinate control point.
[0055] In a possible implementation, when the processing module simulates the spatio-temporal trajectory of the twin passing through each motion stage based on WebGL, according to the reference space coordinate point, the reference time point, the motion information corresponding to each motion stage included in the preset piecewise aggregation approximation (PAA) motion sequence list, the motion function corresponding to each motion pattern included in the pre-constructed motion pattern library, and the preset motion time update function, it is used for:
[0056] Step A: Based on the PAA motion sequence list, determine the current motion stage of the twin and the first motion duration, the first motion pattern, and the first motion parameters corresponding to the current motion stage;
[0057] Step B: According to the motion pattern library, determine the first motion function corresponding to the first motion pattern;
[0058] Step C: Based on WebGL, determine the first reference space coordinate point of the current motion stage according to the reference space coordinate point and determine the first reference time point of the current motion stage according to the reference time point;
[0059] Step D: Based on WebGL, simulate the spatio-temporal trajectory of the twin passing through the current motion stage according to the first reference space coordinate point, the first reference time point, the preset motion time update function, the first motion duration, the first motion parameters, and the first motion function;
[0060] When it is determined that the current motion stage ends based on the first motion duration, update the current motion stage to the next motion stage of the current motion stage, and repeat steps A to D until the simulation of the spatio-temporal trajectory of the twin passing through each motion stage included in the PAA motion sequence list is completed.
[0061] In a possible implementation, when the processing module determines the first reference space coordinate point of the current motion stage based on WebGL according to the reference space coordinate point, it is used for:
[0062] When the current motion stage is the first motion stage in the PAA motion sequence list, determine the first reference spatial coordinate point of the current motion stage as the reference spatial coordinate point;
[0063] When the current motion stage is not the first motion stage in the PAA motion sequence list, determine the first reference spatial coordinate point of the current motion stage as the spatial coordinate point after the last frame of WebGL motion in the previous motion stage of the current motion stage, where the spatial coordinate point after the last frame of WebGL motion in the previous motion stage is calculated based on the motion function corresponding to the motion mode of the previous motion stage, according to the motion duration and motion parameters of the previous motion stage.
[0064] In a possible implementation, when the processing module determines the first reference time point of the current motion stage based on WebGL according to the reference time point, it is used for:
[0065] When the current motion stage is the first motion stage in the PAA motion sequence list, determine the first reference time point of the current motion stage as the reference time point;
[0066] When the current motion stage is not the first motion stage in the PAA motion sequence list, determine the first reference time point of the current motion stage as the time point after the last frame of WebGL motion in the previous motion stage of the current motion stage, where the time point after the last frame of WebGL motion in the previous motion stage is calculated based on the preset motion time update function, according to the reference time point and motion duration of the previous motion stage.
[0067] In a possible implementation, the processing module includes multiple WebGL frames in the current motion stage; when simulating the spatio-temporal trajectory of the twin through the current motion stage based on WebGL, according to the first reference spatial coordinate point, the first reference time point, the preset motion time update function, the first motion duration, the first motion parameters, and the first motion function, it is used for:
[0068] Step E, determine the second reference spatial coordinate point of the current WebGL frame of the current motion stage according to the first reference spatial coordinate point, and determine the second reference time point of the current WebGL frame of the current motion stage according to the first reference time point;
[0069] Step F, based on the first motion function, determine the spatial coordinate point after the motion of the current WebGL frame according to the second reference spatial coordinate point and the first motion parameters, and determine the spatial coordinate point after the motion of the current WebGL frame as the second reference spatial coordinate point of the next WebGL frame, where the next WebGL frame is the next WebGL frame of the current WebGL frame;
[0070] Step G: Based on a pre-set motion time update function, determine the time point after the motion of the current WebGL frame according to the second reference time point and the time required for the motion of the current WebGL frame, and determine the time point after the motion of the current WebGL frame as the second reference time point of the next WebGL frame;
[0071] When the motion of the current WebGL frame ends, update the current WebGL frame to the next WebGL frame of the current WebGL frame, and repeat steps E to G until the spatio-temporal trajectory simulation of each WebGL frame included in the current motion phase is completed.
[0072] In a possible implementation, when the processing module determines the second reference spatial coordinate point of the current WebGL frame of the current motion phase according to the first reference spatial coordinate point, it is used for:
[0073] When the current WebGL frame is the first WebGL frame of the current motion phase, determine the second reference spatial coordinate point as the first reference spatial coordinate point;
[0074] When the current WebGL frame is not the first WebGL frame of the current motion phase, determine the second reference spatial coordinate point as the spatial coordinate point after the motion of the previous WebGL frame, and the previous WebGL frame is the previous WebGL frame of the current WebGL frame;
[0075] Determining the second reference time point of the current WebGL frame of the current motion phase according to the first reference time point includes:
[0076] When the current WebGL frame is the first WebGL frame of the current motion phase, determine the second reference time point as the first reference time point;
[0077] When the current WebGL frame is not the first WebGL frame of the current motion phase, determine the second reference time point as the time point after the motion of the previous WebGL frame.
[0078] In a possible implementation, when the processing module determines whether the current motion phase ends based on the first motion duration, it is used for:
[0079] Determine the time difference between the time point after the motion of the last WebGL frame of the current motion phase and the reference time point of the first WebGL frame;
[0080] Compare the first motion duration with the time difference. If it is determined that the time difference is equal to the first motion duration, or it is determined that the difference between the first motion duration and the time difference is less than the time required for the motion of one WebGL frame, determine that the current motion phase ends; otherwise, determine that the current motion phase has not ended.
[0081] In a possible implementation, the motion mode includes at least one of the following:
[0082] Linear motion mode; Hermite motion mode; Lagrange motion mode.
[0083] According to another aspect of the embodiments of the present application, an electronic device is provided. The electronic device includes: a memory, a processor, and a computer program stored on the memory. The processor executes the computer program to implement the above-mentioned spatio-temporal trajectory simulation method.
[0084] According to still another aspect of the embodiments of the present application, a computer-readable storage medium is provided. When the computer program is executed by a processor, the above-mentioned spatio-temporal trajectory simulation method is implemented.
[0085] According to one aspect of the embodiments of the present application, a computer program product is provided. When the computer program is executed by a processor, the above-mentioned spatio-temporal trajectory simulation method is implemented.
[0086] The beneficial effects brought by the technical solutions provided in the embodiments of the present application are as follows: By pre-constructing the twin coordinate system, not only can the spatio-temporal trajectory simulation be directly based on the coordinate system of the twin itself during the movement of the twin, so that there is no need to obtain values from the world coordinate system for spatial movement, but also, when calculating and updating the reference time point and reference spatial coordinates frame by frame during the movement of the twin subsequently, the operation result of the previous frame can be directly passed as a parameter into the operation of the next frame, thereby realizing the spatio-temporal trajectory simulation with spatio-temporal continuity; By presetting the PAA motion sequence list and pre-constructing the motion mode library, not only the decoupling of each motion stage of the twin and the decoupling of the motion parameters of the twin in each motion stage from the motion mode library are realized, thus conforming to the true simulation of the movement of objects in the real world, but also the spatial coordinate points during the movement of the twin can be dynamically calculated according to the motion function and motion parameters in WebGL, thereby greatly reducing the storage amount of spatial coordinate data. BRIEF DESCRIPTION OF THE DRAWINGS
[0087] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the following will briefly introduce the drawings required for the description in the embodiments of the present application.
[0088] Figure 1 It is a schematic flowchart of a spatio-temporal trajectory simulation method provided by the embodiments of the present application;
[0089] Figure 2 It is a schematic diagram of the process of twin spatio-temporal trajectory simulation provided by the embodiments of the present application;
[0090] Figure 3 It is a schematic structural diagram of a spatio-temporal trajectory simulation device provided by the embodiments of the present application;
[0091] Figure 4 This is a schematic diagram of the structure of an electronic device provided by an embodiment of the present application. Detailed implementation manners
[0092] The embodiments of the present application will be described below with reference to the accompanying drawings in the present application. It should be understood that the embodiments described below in conjunction with the drawings are exemplary descriptions for explaining the technical solutions of the embodiments of the present application, and do not constitute limitations on the technical solutions of the embodiments of the present application.
[0093] Those skilled in the art of the present technology can understand that, unless specifically stated otherwise, the singular forms "a", "an", "" and "the" used herein may also include the plural forms. It should be further understood that the terms "including" and "comprising" used in the embodiments of the present application mean that the corresponding features can be implemented as the presented features, information, data, steps, operations, elements, and / or components, but do not exclude the implementation of other features, information, data, steps, operations, elements, components, and / or their combinations supported by the art of the present technology, etc. It should be understood that when we say that an element is "connected" or "coupled" to another element, the one element can be directly connected or coupled to the other element, or it can mean that the one element and the other element establish a connection relationship through an intermediate element. In addition, the "connection" or "coupling" used here can include wireless connection or wireless coupling. The term "and / or" used here indicates at least one of the items defined by the term, for example, "A and / or B" indicates being implemented as "A", or being implemented as "A", or being implemented as "A and B".
[0094] To make the objectives, technical solutions and advantages of the present application clearer, the embodiments of the present application will be further described in detail below in conjunction with the accompanying drawings.
[0095] First, several terms related to the present application will be introduced and explained:
[0096] WebGL (Web Graphics Library) is a 3D drawing protocol. This drawing technology standard allows JavaScript and OpenGL ES 2.0 to be combined. By adding a JavaScript binding to OpenGL ES 2.0, WebGL can provide hardware 3D accelerated rendering for HTML5 Canvas. In this way, Web developers can use the system graphics card to more smoothly display 3D scenes and models in the browser, and can also create complex navigation and data visualization. Obviously, the WebGL technology standard eliminates the trouble of developing dedicated rendering plugins for web pages, and can be used to create website pages with complex 3D structures, and even can be used to design 3D web games, etc.
[0097] Digital Twin (DT): Also translated as digital twin, digital double, digital mirror, or digital mapping, it is driven by the new generation of information technology and manufacturing technology. It makes full use of data such as physical models, sensor updates, and operation history, integrates the simulation processes of multiple disciplines, multiple physical quantities, multiple scales, and multiple probabilities, and completes the mapping in the virtual space, thus reflecting the entire life cycle process of the corresponding physical equipment. It has the characteristics of ultra-realism, multi-system integration, and high precision, and can realize functions such as monitoring, prediction, and data mining. As a digital copy of a physical system, Digital Twin can simulate the entire life cycle of the operating system and perform synchronous mapping with the physical twin, and interact the relevant data of the physical entity and the digital entity in real time, so as to support simulation-related applications such as analysis, prediction, and decision-making. Digital Twin provides a new idea for the analysis and solution of traffic problems.
[0098] The technical solutions of the embodiments of the present application and the technical effects produced by the technical solutions of the present application will be described below through the description of several exemplary embodiments. It should be noted that the following embodiments can be referenced, learned from, or combined with each other. For the same terms, similar features, and similar implementation steps in different embodiments, they will not be described repeatedly.
[0099] Figure 1 It is a schematic flowchart of the spatio-temporal trajectory simulation method provided by the embodiments of the present application. As Figure 1 shown, the method includes: Step S110, determining the reference space coordinate point and reference time point of the twin. The reference space coordinate point is the origin of the pre-constructed twin coordinate system, and the reference time point is an N*N time matrix, where N is an integer greater than 1; Step S120, based on WebGL, according to the reference space coordinate point, reference time point, the motion information corresponding to each motion stage included in the pre-set piecewise aggregate approximation (PAA) motion sequence list, the motion functions corresponding to each motion mode included in the pre-constructed motion mode library, and the pre-set motion time update function, simulating the spatio-temporal trajectory of the twin passing through each motion stage, where the motion information includes motion duration, motion mode, and motion parameters.
[0100] The premise for the embodiments of the present application to be realized is that the twin is a simulation of an object in the real world, and its motion is related to the object attributes, rather than random motion.
[0101] Before simulating the spatio-temporal trajectory of the digital twin, it is necessary to first construct the basic surface of the 3D digital twin in WebGL, mainly including the shape and appearance. Among them, the shape of the digital twin can be constructed by passing the vertex array (i.e., vertex data) of the digital twin into the WebGL vertex buffer. This vertex array is a set of coordinates of the triangular faces of the digital twin. The appearance of the digital twin can be constructed by reading the material of the digital twin through the texture and then passing the material into the WebGL color buffer.
[0102] After constructing the basic surface of the 3D digital twin in WebGL, in the 3D world constructed by WebGL, the coordinate system is the spatial rectangular coordinate system of the entire world, and the coordinate origin is located at the center point of the world. Therefore, it is necessary to continuously obtain values from the world coordinate system for spatio-temporal trajectory simulation of the digital twin. However, obtaining values from the world coordinate system each time for spatio-temporal trajectory simulation of the digital twin makes the calculation process relatively complicated. Therefore, for the convenience of subsequent real-time simulation of the spatio-temporal trajectory of the digital twin, a digital twin coordinate system of the digital twin itself can be pre-constructed based on the world coordinate system, so that the digital twin performs spatio-temporal trajectory simulation in its own digital twin coordinate system.
[0103] In the process of simulating the spatio-temporal trajectory of the digital twin based on the digital twin coordinate system of the digital twin itself, it is necessary to first determine the reference spatial coordinate point and reference time point of the digital twin. Among them, the reference spatial coordinate point is the spatial coordinate position of the starting point of the digital twin's movement, which can be the origin (0, 0, 0, 0) of the pre-constructed digital twin coordinate system. The reference time point is an N * N time matrix, where N is an integer greater than 1 set according to needs. For example, N is 2, 3, 4, etc. In this application embodiment, the case where the value of N is 4 is taken as an example for specific introduction.
[0104] It should be noted that before determining the reference time point of the digital twin, a time matrix (denoted as base_Time) of the reference time point of the digital twin can be pre-constructed according to needs to store the time data of the starting point of the digital twin's movement, that is, taking the time matrix of the reference time point of the digital twin as the reference time point of the digital twin. Among them, this time matrix can be in the form of a 4 * 4 matrix, such as:
[0105]
[0106] Among them, A11 to A41 represent years, A12 to A42 represent months and days, A13 to A43 represent hours and minutes, and A14 to A44 represent seconds and milliseconds. Through this matrix, the storage of the "year - millisecond" time string can be realized, and millisecond-level accuracy can be achieved in the spatio-temporal trajectory simulation of the digital twin.
[0107] Before simulating the spatio-temporal trajectory of the twin, the various motion stages passed by the twin, the sequence of passing through the various motion stages, the respective motion durations corresponding to the various motion stages, the motion modes, and the motion parameters, etc. can be preset according to the scene requirements of the twin. Among them, the above-mentioned various motion stages can be just 1 motion stage, or 2 motion stages, or 3 or 4 or more motion stages, and the embodiments of the present application do not limit it; the motion durations of the various motion stages can be the same or different, and the embodiments of the present application do not limit it.
[0108] In practical applications, a PAA (piecewise aggregate approximation) motion sequence table can be used to store the various motion stages passed by the twin, the sequence of passing through the various motion stages, the respective motion durations corresponding to the various motion stages, the motion modes, and the motion parameters, etc., that is, a motion sequence table for the entire life cycle of the twin's motion is constructed through the PAA motion sequence table. The PAA motion sequence table can be as shown in Table 1:
[0109] Table 1 PAA motion sequence table
[0110] Each motion stage Motion duration Motion mode Motion parameters Motion stage 1 Motion duration 1 Motion mode 1 Motion parameters 1 Motion stage 2 Motion duration 2 Motion mode 2 Motion parameters 2 Motion stage 3 Motion duration 3 Motion mode 3 Motion parameters 3
[0111] The above Table 1 includes 3 motion stages, that is, according to the scene requirements of the twin, the twin passes through 3 motion stages, and the sequence of the 3 motion stages is to first pass through motion stage 1, then pass through motion stage 2, and finally pass through motion stage 3; the motion duration of motion stage 1 is motion duration 1, the motion duration of motion stage 2 is motion duration 2, and the motion duration of motion stage 3 is motion duration 3; the motion mode of motion stage 1 is motion mode 1, the motion mode of motion stage 2 is motion mode 2, and the motion mode of motion stage 3 is motion mode 3; the motion parameter of motion stage 1 is motion parameter 1, the motion parameter of motion stage 2 is motion parameter 2, and the motion parameter of motion stage 3 is motion parameter 3.
[0112] It should be noted that when the number of motion stages passed by the twin is greater than 1, such as when the motion stages passed by the twin are 2 or 3 or more, usually the respective motion modes corresponding to the multiple motion stages are different from each other, but it does not exclude the situation where 2 or several of the multiple motion stages are the same motion mode. In addition, usually the same motion mode corresponds to the same motion parameters, and different motion modes correspond to different motion parameters.
[0113] Before performing the spatio-temporal trajectory simulation of the twin, a motion pattern library of the twin can be pre-constructed as needed, that is, the motion patterns of the twin are independently stored in a library. The motion pattern library includes various motion patterns and their respective corresponding motion functions. Among them, the motion pattern library is used to select the corresponding motion function according to the motion pattern of the twin during the motion process of the twin; the number of motion patterns included in the motion pattern library can be only 1, or 2, or 3, or 4, or more. The embodiments of the present application do not limit it. It should be noted that the motion patterns included in the motion pattern library should at least cover the motion patterns corresponding to each motion stage in the PAA motion sequence list.
[0114] Before performing the spatio-temporal trajectory simulation of the twin, a motion time update function can be preset to update the time point of the twin after each motion in real time according to the reference time point of the twin, so that the twin can use this time point as the reference time point during the next motion, thereby realizing the time continuity of the spatio-temporal trajectory simulation of the twin.
[0115] In an example, the preset motion time update function can be in the form of update_Time = last_Time + Δt, where update_Time is used to record the time attribute during the motion process of the twin, which is equivalent to the time parameter of the twin, and also adopts the form of an N*N time matrix, such as a 4*4 time matrix; Δt represents the time difference matrix required for each frame operation of WebGL, and this time difference matrix is also in the form of an N*N time matrix, such as a 4*4 time matrix; last_Time is the time attribute of the twin before each frame update of WebGL. When it is the first frame of WebGL in the first motion stage of the twin, the value of last_Time is the above-mentioned base_Time (reference time point). In other words, update_Time is obtained by cumulative calculation frame by frame based on the reference time point (base_Time).
[0116] In the embodiment of the present application, by pre - constructing a twin coordinate system, not only can the space - time trajectory simulation be directly based on the coordinate system of the twin itself during the movement of the twin, so that there is no need to obtain values from the world coordinate system for spatial movement, but also, when calculating and updating the reference time point and reference spatial coordinates frame - by - frame during the movement of the twin subsequently, the operation result of the previous frame can be directly used as a parameter for the next - frame operation, thus realizing the space - time - continuous space - time trajectory simulation; by presetting the PAA motion sequence list and pre - constructing the motion pattern library, not only the decoupling of each motion stage of the twin and the decoupling of the motion parameters of the twin in each motion stage from the motion pattern library are realized, thus conforming to the true simulation of the motion of objects in the real world, but also the spatial coordinate points during the movement of the twin can be dynamically calculated according to the motion function and motion parameters in WebGL, thus greatly reducing the storage amount of spatial coordinate data.
[0117] In a possible implementation manner of the embodiment of the present application, the process of determining the reference spatial coordinate point of the twin may be: First, based on the WebGL three - dimensional world coordinate system and the vertex coordinate data of the twin, determine the coordinate control points of the twin; then, according to the perspective projection matrix and the coordinate control points of the twin, determine the coordinate system transformation matrix; then, according to the coordinate system transformation matrix and the WebGL three - dimensional world coordinate system, construct the twin coordinate system of the twin, and determine the origin of the twin coordinate system as the reference spatial coordinate point of the twin.
[0118] Since in the three - dimensional world constructed by WebGL, the coordinate system is the spatial rectangular coordinate system of the whole world, and the coordinate origin is located at the center point of the world, during the process of constructing the twin coordinate system of the twin, the coordinate system transformation matrix of the twin coordinate system of the twin can be constructed according to the vertex coordinate data of the twin to realize the conversion between the world coordinate system and the twin coordinate system, which is convenient for subsequent space - time trajectory simulation based on the twin coordinate system of the twin itself.
[0119] During the process of constructing the twin coordinate system, the coordinate control points of the twin can be first determined based on the WebGL three - dimensional world coordinate system and the vertex coordinate data of the twin, then the coordinate system transformation matrix can be determined according to the perspective projection matrix and the coordinate control points of the twin, and then the WebGL three - dimensional world coordinate system can be converted into the twin coordinate system according to the coordinate system transformation matrix.
[0120] In the process of determining the coordinate control points of the twin based on the vertex coordinate data of the WebGL three-dimensional world coordinate system and the twin, the following processing can be performed: First, based on the WebGL three-dimensional world coordinate system, construct a spherical bounding box of the twin according to the vertex coordinate data of the twin; then, obtain the center point of the spherical bounding box and determine it as the center point of the twin; then, add a fourth-dimensional data with a predetermined value to the center point of the twin, and determine the center point of the twin after adding the fourth-dimensional data as the coordinate control point.
[0121] After constructing the spherical bounding box of the twin according to the vertex coordinate data of the twin based on the WebGL three-dimensional world coordinate system, the center point of the spherical bounding box can be obtained as the center point of the twin, and this center point can be used as the center point of the twin's movement. At the same time, add a fourth dimension to this center point and set its value to a predetermined value (denoted as R), thereby forming a four-dimensional space vector (Px, Py, Pz, R), that is, obtaining the center point of the twin after adding the fourth-dimensional data. That is to say, the four-dimensional space vector (Px, Py, Pz, R) is the coordinate control point of the twin. Among them, Px, Py, and Pz respectively represent the coordinate values of the x-axis, y-axis, and z-axis of the twin in the WebGL world coordinate system; the predetermined value R can be values such as 1, 2, 3, etc., and the embodiments of the present application do not limit it. In one example, the predetermined value R is 1.0, and at this time the four-dimensional space vector is (Px, Py, Pz, 1.0).
[0122] After obtaining the coordinate control points of the twin, the coordinate transformation matrix can be determined according to the perspective projection matrix and the coordinate control points of the twin, and this coordinate transformation matrix can be a 4*4 matrix. In one example, the coordinate transformation matrix can be obtained in the following manner:
[0123]
[0124] Among them, space_Matrix represents the coordinate transformation matrix, n is the near-plane value in the Z-axis direction of the WebGL world, f is the far-plane value in the Z-axis direction, r is the positive distance value in the X-axis direction, and t is the distance plane in the Y-axis direction.
[0125] After obtaining the coordinate system transformation matrix, the twin coordinate system of the twin can be constructed based on the coordinate system transformation matrix and the WebGL three-dimensional world coordinate system. After constructing the twin coordinate system of the twin, the reference space coordinate point of the twin's movement becomes the origin (0, 0, 0, 0) of the twin coordinate system, that is, the origin of the twin coordinate system is determined as the reference space coordinate point of the twin. Subsequently, based on this reference space coordinate point, the first WebGL frame operation of the first movement stage of the twin is performed. Before each WebGL frame is updated, the coordinate value (i.e., the space coordinate point) of the twin in its own twin coordinate system can be denoted as last_Coord. After the operation of one WebGL frame, the updated coordinate value (i.e., the space coordinate point) can be denoted as update_Coord; for the first WebGL frame of the first movement stage, last_Coord is the above-mentioned reference space coordinate point (0, 0, 0, 0).
[0126] In a possible implementation manner of the embodiment of the present application, the movement mode may be at least one of a linear movement mode, a Hermite movement mode, or a Lagrange movement mode.
[0127] The movement mode of the twin may be a linear movement mode, or a Hermite movement mode, or a Lagrange movement mode. Of course, it may also be other movement modes other than the above three movement modes, which will not be listed one by one here.
[0128] In an example, assuming that the PAA movement sequence list of the twin includes 3 movement stages, in one case, the first movement stage (i.e., movement stage 1) may be a linear movement mode, the second movement stage (i.e., movement stage 2) may be a Hermite movement mode, and the third movement stage (i.e., movement stage 3) may be a Lagrange movement mode; in another case, the first movement stage (i.e., movement stage 1) may be a Hermite movement mode, the second movement stage (i.e., movement stage 2) may be a linear movement mode, and the third movement stage (i.e., movement stage 3) may be a Lagrange movement mode; in still another case, the first movement stage (i.e., movement stage 1) may be a Lagrange movement mode, the second movement stage (i.e., movement stage 2) may be a linear movement mode, and the third movement stage (i.e., movement stage 3) may be a Hermite movement mode, and so on.
[0129] It should be noted that the above examples are only for illustrative purposes and should not be used as conditions restricting other possible situations of the embodiments of the present application. In addition to the several possible motion patterns of the several motion stages listed in the above examples, there are other motion stages and other possible motion patterns, which will not be elaborated one by one here.
[0130] In one example, the PAA motion sequence table can be the case shown in Table 2:
[0131] Table 2 PAA motion sequence table
[0132] Each motion stage Motion duration Motion mode Motion parameters Motion stage 1 Motion duration 1 Linear motion mode Motion parameters 1 Motion stage 2 Motion duration 2 Hermite motion mode Motion parameters 2 Motion stage 3 Motion duration 3 Lagrange motion mode Motion parameters 3
[0133] Among them, when the twin is in a linear motion pattern, the twin moves at a constant speed, and there is a linear relationship between the moving distance and the moving time of the twin. In this motion pattern, the spatial motion vector introduced per unit time is (x Δ , y Δ , z Δ ), and this (x Δ , y Δ , z Δ ) is the motion parameter of the linear motion pattern, that is, motion parameter 1 in Table 2, which is used to calculate the updated value of the spatial coordinate point of the twin. The motion function corresponding to the linear motion pattern can be: update_Coord = last_Coord + (x Δ , y Δ , z Δ , 0), which is equivalent to the motion function of the WebGL frame of the twin in the linear motion pattern being update_Coord = last_Coord + (x Δ , y Δ , z Δ , 0).
[0134] When the twin is in the Hermite motion pattern, the Smoothstep of WebGL is a typical Hermite interpolation pattern, and the twin increases in speed near the middle value between the starting point and the ending point of the motion. The maximum spatial motion vector per unit time is This is the motion parameter of the Hermite motion pattern, that is, motion parameter 2 in Table 2. According to the twin time parameter update_Time, the interpolation parameter r = (update_Time - base_Time) / duration can be calculated, where duration is the motion duration, which is used to calculate the updated value of the spatial coordinate point of the twin. The motion function corresponding to the Hermite motion pattern can be: Correspondingly, the motion function of the twin in the Hermite motion mode for the WebGL frame is
[0135] When the twin is in the Lagrange motion mode, the twin exhibits accelerated motion in the typical Lagrange motion mode. In this motion mode, the partial derivative functions for the incoming x, y, and z axes are fn(x,t), fn(y,t), and fn(z,t) respectively. These fn(x,t), fn(y,t), and fn(z,t) are the motion parameters of the Lagrange motion mode, that is, the motion parameter 3 in Table 2, which are used to calculate the updated values of the spatial coordinate points of the twin. The motion function corresponding to the Lagrange motion mode (equivalent to the motion function of the twin in the Lagrange motion mode for the WebGL frame) can be:
[0136]
[0137]
[0138]
[0139] The motion duration of each motion stage in Table 2 can be set as needed. For example, the motion duration 1 of motion stage 1 can be 3 seconds, 5 seconds, 10 seconds, 20 seconds, etc. Also, for example, the motion duration 1 of motion stage 2 can be 3 seconds, 6 seconds, 10 seconds, 30 seconds, etc. And for example, the motion duration 1 of motion stage 3 can be 5 seconds, 10 seconds, 15 seconds, etc. Of course, the motion duration of each motion stage can also be other durations, and the embodiments of this application do not limit it. In one example, the motion duration 1 can be 5 seconds, the motion duration 2 can be 10 seconds, and the motion duration 3 can be 15 seconds.
[0140] In a possible implementation, based on WebGL, according to the reference spatial coordinate points, reference time points, the motion information corresponding to each motion stage included in the pre-set piecewise aggregation approximation PAA motion sequence table, the motion functions corresponding to each motion mode included in the pre-constructed motion mode library, and the pre-set motion time update function, simulate the spatio-temporal trajectory of the twin passing through each motion stage, including:
[0141] Step A: Based on the PAA motion sequence table, determine the current motion stage of the twin and the corresponding first motion duration, first motion mode, and first motion parameters of the current motion stage;
[0142] Step B: According to the motion mode library, determine the first motion function corresponding to the first motion mode;
[0143] Step C: Based on WebGL, determine the first reference spatial coordinate points of the current motion phase according to the reference spatial coordinate points and determine the first reference time points of the current motion phase according to the reference time points;
[0144] Step D: Based on WebGL, according to the first reference spatial coordinate points, the first reference time points, the pre-set motion time update function, the first motion duration, the first motion parameters, and the first motion function, simulate the spatio-temporal trajectory of the digital twin passing through the current motion phase;
[0145] When it is determined that the current motion phase ends based on the first motion duration, update the current motion phase to the next motion phase, and repeat Steps A to D until the spatio-temporal trajectory simulation of the digital twin passing through each motion phase included in the PAA motion sequence list is completed.
[0146] It should be noted that the above Steps A, B, and C are specifically written for the convenience of distinguishing each processing process and facilitating the description of subsequent loop processes. They are similar to an alias and do not represent the execution order. For example, Step A can be executed first, then Step B, and finally Step C; or Step B can be executed first, then Step A, and finally Step C; or Step C can be executed first, then Step B, and finally Step A. Of course, there can also be other possible execution orders, which will not be elaborated here one by one.
[0147] The following takes the order of first executing Step A, then Step B, and finally Step C as an example for specific illustration:
[0148] In an example, assume that the digital twin adopts the PAA motion sequence list shown in Table 2 according to requirements, that is, the first motion phase of the digital twin is Motion Phase 1, the second motion phase is Motion Phase 2, and the third motion phase is Motion Phase 3; and, the motion mode corresponding to Motion Phase 1 is the linear motion mode, the motion mode corresponding to Motion Phase 2 is the Hermite motion mode, and the motion mode corresponding to Motion Phase 3 is the Lagrange motion mode; at the same time, the motion duration 1 is 5 seconds, the motion duration 2 is 10 seconds, and the motion duration 3 is 15 seconds, then:
[0149] Step A, based on the PAA motion sequence table shown in Table 2, determine the current motion stage of the twin and the first motion duration, the first motion pattern, and the first motion parameters corresponding to the current motion stage: (1) If it is determined that the current motion stage of the twin is motion stage 1, then the first motion duration (i.e., motion duration 1) corresponding to the current motion stage is 5 seconds; (2) If it is determined that the current motion stage of the twin is motion stage 2, then the first motion duration (i.e., motion duration 2) corresponding to the current motion stage is 10 seconds; (3) If it is determined that the current motion stage of the twin is motion stage 3, then the first motion duration (i.e., motion duration 3) corresponding to the current motion stage is 15 seconds.
[0150] Step B, according to the motion pattern library, determine the first motion function corresponding to the first motion pattern: (1) Since the motion pattern corresponding to motion stage 1 is a linear motion pattern, if it is determined that the current motion stage is motion stage 1, then it can be determined that the first motion function corresponding to the first motion pattern of the current motion stage is update_Coord = last_Coord + (x Δ , y Δ , z Δ , 0); (2) Since the motion pattern corresponding to motion stage 2 is a Hermite motion pattern, if it is determined that the current motion stage is motion stage 2, then it can be determined that the first motion function corresponding to the first motion pattern of the current motion stage is (3) Since the motion pattern corresponding to motion stage 3 is a Lagrange motion pattern, if it is determined that the current motion stage is motion stage 3, then it can be determined that the first motion function corresponding to the first motion pattern of the current motion stage is:
[0151]
[0152]
[0153]
[0154] Step C, based on WebGL, determine the first reference spatial coordinate point of the current motion stage according to the reference spatial coordinate point and determine the first reference time point of the current motion stage according to the reference time point. The current motion stage may be the first motion stage in the motion process of the twin, or other motion stages in the motion process of the twin except the first motion stage, such as the second motion stage, the third motion stage, etc.
[0155] In the process of determining the first reference spatial coordinate point of the current motion stage based on WebGL according to the reference spatial coordinate points, if the current motion stage is the first motion stage in the PAA motion sequence list (as shown in Table 2) (such as motion stage 1 in Table 2), it can be determined that the first reference spatial coordinate point of the current motion stage is the reference spatial coordinate point (0, 0, 0, 0); if the current motion stage is not the first motion stage in the PAA motion sequence list (as shown in Table 2), for example, the current motion stage is the second motion stage or the third motion stage in the PAA motion sequence list (as shown in Table 2), it can be determined that the first reference spatial coordinate point of the current motion stage is the spatial coordinate point after the last frame of motion in WebGL of the previous motion stage of the current motion stage, where the spatial coordinate point after the last frame of motion in WebGL of the previous motion stage is calculated based on the motion function corresponding to the motion mode of the previous motion stage, according to the motion duration and motion parameters of the previous motion stage.
[0156] In the process of determining the first reference time point of the current motion stage based on WebGL according to the reference time point, if the current motion stage is the first motion stage in the PAA motion sequence list (as shown in Table 2) (such as motion stage 1 in Table 2), it can be determined that the first reference time point of the current motion stage is the reference time point (i.e., base_Time); if the current motion stage is not the first motion stage in the PAA motion sequence list (as shown in Table 2), for example, the current motion stage is the second motion stage or the third motion stage in the PAA motion sequence list (as shown in Table 2), it can be determined that the first reference time point of the current motion stage is the time point after the last frame of motion in WebGL of the previous motion stage of the current motion stage, where the time point after the last frame of motion in WebGL of the previous motion stage is calculated based on the preset motion time update function, according to the reference time point and motion duration of the previous motion stage.
[0157] Step D, based on WebGL, according to the first reference spatial coordinate point, the first reference time point, the preset motion time update function, the first motion duration, the first motion parameters, and the first motion function, simulate the spatio-temporal trajectory of the twin body passing through the current motion stage.
[0158] After performing the above steps A to D, it is detected whether the current motion stage has ended. During the detection process, it can be determined whether the current motion stage has ended based on the motion duration of the current motion stage. Suppose the current motion stage is motion stage 1 and the motion duration is 5 seconds. Then: it can be determined whether the current motion stage has ended based on the motion duration (5 seconds) of motion stage 1. Taking motion stage 1 with a motion duration of 5 seconds as an example, during the process of determining whether the current motion stage 1 has ended, the following processing can be performed: First, determine the time difference between the time point after the last frame of WebGL motion in the current motion stage (i.e., the time point update_Time after the last frame update of WebGL) and the reference time point (base_Time) of the first frame of WebGL; Then, compare the first motion duration with the time difference. In a feasible way, if it is determined that the time difference is equal to the first motion duration, it indicates that the current motion stage is determined to have ended, otherwise it indicates that the current motion stage has not ended. In another feasible way, if it is determined that the difference between the first motion duration and the time difference is less than the time required for the motion of one WebGL frame, that is, the difference between the two is not enough for the operation of one WebGL frame of the twin body, at this time, it can also be determined that the current motion stage has ended, otherwise it is determined that the current motion stage has not ended.
[0159] When it is determined that the current motion stage has ended, the current motion stage is updated to the next motion stage of the current motion stage. If the current motion stage is motion stage 1, then when motion stage 1 ends, motion stage 2 (i.e., the next motion stage of motion stage 1) is updated to the current motion stage, and the above steps A to D are repeatedly executed in turn, and the cycle continues until the spatio-temporal trajectory simulation of each motion stage included in the PAA motion sequence list (as shown in Table 2) of the twin body is completed.
[0160] In a possible implementation manner of the embodiment of the present application, the current motion stage includes multiple WebGL frames, where the number of included WebGL frames is related to the motion duration of the current motion stage. For example, when the current motion stage is motion stage 1 in Table 2 and the motion duration is 5 seconds, it is determined that the current motion stage includes 5 WebGL frames according to the motion duration. Another example is that when the current motion stage is motion stage 2 in Table 2 and the motion duration is 10 seconds, it is determined that the current motion stage includes 10 WebGL frames according to the motion duration. Another example is that when the current motion stage is motion stage 3 in Table 2 and the motion duration is 15 seconds, it is determined that the current motion stage includes 15 WebGL frames according to the motion duration, and so on.
[0161] For each motion stage, when simulating the spatio-temporal trajectory of the digital twin passing through the current motion stage based on WebGL according to the first reference spatial coordinate point, the first reference time point, the preset motion time update function, the first motion duration, the first motion parameter, and the first motion function, the following processing can be performed: Step E, determine the second reference spatial coordinate point of the current frame of WebGL in the current motion stage according to the first reference spatial coordinate point, and determine the second reference time point of the current frame of WebGL in the current motion stage according to the first reference time point; Step F, based on the first motion function, determine the spatial coordinate point after motion of the current frame of WebGL according to the second reference spatial coordinate point and the first motion parameter, and determine the spatial coordinate point after motion of the current frame of WebGL as the second reference spatial coordinate point of the next frame of WebGL, where the next frame of WebGL is the next WebGL frame of the current frame of WebGL; Step G, based on the preset motion time update function, determine the time point after motion of the current frame of WebGL according to the second reference time point and the time required for the motion of the current frame of WebGL, and determine the time point after motion of the current frame of WebGL as the second reference time point of the next frame of WebGL; when the motion of the current frame of WebGL ends, update the current frame of WebGL to the next WebGL frame of the current frame of WebGL, and repeat Step E to Step G until the spatio-temporal trajectory simulation of each WebGL frame included in the current motion stage is completed.
[0162] It should be noted that the above Step E and Step F are specifically written for the convenience of distinguishing each processing process and facilitating the description of subsequent loop processes, similar to an alias, and do not represent the execution order. For example, Step E can be executed first and then Step F, or Step F can be executed first and then Step E.
[0163] In the process of determining the second reference spatial coordinate point of the current frame of WebGL in the current motion stage according to the first reference spatial coordinate point, when the current frame of WebGL is the first frame of WebGL in the current motion stage, determine the second reference spatial coordinate point as the first reference spatial coordinate point; when the current frame of WebGL is not the first frame of WebGL in the current motion stage, determine the second reference spatial coordinate point as the spatial coordinate point after motion of the previous frame of WebGL, where the previous frame of WebGL is the previous WebGL frame of the current frame of WebGL.
[0164] In the process of determining the second reference time point of the current frame of WebGL in the current motion stage according to the first reference time point, when the current frame of WebGL is the first frame of WebGL in the current motion stage, determine the second reference time point as the first reference time point; when the current frame of WebGL is not the first frame of WebGL in the current motion stage, determine the second reference time point as the time point after motion of the previous frame of WebGL.
[0165] The following combines Figure 2 , and through specific examples, a detailed introduction is given to the spatio-temporal trajectory simulation of the twin in each motion stage of this application embodiment. Among them, before introducing the spatio-temporal trajectory simulation of the twin in each motion stage, it is necessary to pre-construct a twin coordinate system, a twin motion mode library, and a PAA motion sequence list, specifically as follows:
[0166] (1) Construct a twin coordinate system, including: twin vertex data (i.e., obtain twin vertex data), twin bounding box (i.e., generate a twin bounding box according to the twin vertex data), and coordinate system transformation matrix (i.e., construct a coordinate system transformation matrix according to the twin bounding box, and finally obtain the twin coordinate system according to the coordinate system transformation matrix). The specific process of constructing the twin coordinate system is as described above and will not be elaborated here.
[0167] (2) Twin motion mode library, where the twin motion mode library includes but is not limited to linear motion mode, Hermite motion mode, and Lagrange motion mode, as described above.
[0168] (3) Twin PAA motion sequence, that is, according to the current motion requirements, construct a PAA motion sequence list. The PAA motion sequence list includes each motion stage passed by the twin, the sequence of passing through each motion stage, the respective motion duration of each motion stage, the motion mode, and motion parameters, etc., as described above. Among them, the PAA motion sequence list in this example can be the PAA motion sequence list shown in Table 2.
[0169] In addition, Figure 2 the independent time parameters in are used to control the jump of each motion stage of the twin. For example, to determine whether to end motion stage 1 and enter motion stage 2, or to determine whether to end motion stage 2 and enter motion stage 3, etc. Among them, the independent time parameter is similar to the time difference described above (i.e., the time point after the last frame of WebGL motion in the current motion stage and the reference time point of the first frame of WebGL in the current motion stage).
[0170] In this example, assuming that it is determined that the current motion stage of the twin is motion stage 1 in Table 2, and the motion mode of motion stage 1 is linear motion mode, the motion duration of motion stage 1 is 5 seconds, and the motion parameters are (x Δ , y Δ , z Δ ); then, according to the motion mode library, the motion function of the linear motion mode of motion stage 1 can be determined as update_Coord = last_Coord + (x Δ , y Δ,z Δ , 0); Then, since the current motion stage of the twin is motion stage 1 in Table 2, and this motion stage 1 is the first motion stage of the twin, the first reference spatial coordinate point of the current motion stage is the reference spatial coordinate point (0, 0, 0, 0) mentioned above, and the first reference time point of the current motion stage is the reference time point base_Time mentioned above.
[0171] Since the spatio-temporal trajectory simulation of the twin in the current motion stage is achieved by simulating the spatio-temporal trajectories of multiple WebGL frames included in the current motion stage of the twin, and the spatio-temporal trajectory simulation of the twin in the current motion stage is completed in sequence from the first WebGL frame to the last WebGL frame, the twin first enters the motion of the first WebGL frame. Based on this, for the first WebGL frame of the twin in the current motion stage (i.e., the current WebGL frame of the current motion stage), it can be determined that the second reference spatial coordinate point of the first WebGL frame is the first reference spatial coordinate point (0, 0, 0, 0) of the current motion stage, and the second reference time point of the first WebGL frame is the first reference time point base_Time of the current motion stage. When the twin completes the motion of the first WebGL frame of the current motion stage, according to the motion function of the linear motion mode, the spatial coordinate point after the motion of the first WebGL frame can be determined as update_Coord_1_1 = (0, 0, 0, 0) + (x Δ ,y Δ ,z Δ , 0), and according to the pre-set motion time update function, the time point after the motion of the first WebGL frame can be determined as update_Time_1_1 = base_Time + Δt, where Δt represents the time difference matrix required for the operation of the first WebGL frame; subsequently, update_Coord_1_1 is determined as the second reference spatial coordinate point of the next WebGL frame (i.e., the second WebGL frame), and at the same time, update_Time_1_1 is determined as the second reference time point of the next WebGL frame (i.e., the second WebGL frame).
[0172] When the twin enters the motion of the second WebGL frame of the current motion stage, the spatial coordinate point after the motion of the second WebGL frame can be determined as update_Coord_1_2 = update_Coord_1_1 + (x Δ ,y Δ ,z Δ , 0), and the time point after the motion of the second WebGL frame can be determined as update_Time_1_2 = update_Time_1_1 + Δt, where Δt represents the time difference matrix required for the operation of the second WebGL frame.
[0173] And so on until the twin completes the last frame of WebGL motion in the current motion phase, that is, updating the spatial coordinate points and time points frame by frame. Suppose it is determined that the current motion phase includes 5 WebGL frames according to the motion duration of the current motion phase (such as 5 seconds), then the spatial coordinate point after the last frame of WebGL motion in the current motion phase is update_Coord_1_5 = update_Coord_1_4 + (x Δ , y Δ , z Δ , 0), and the time point after the last frame of WebGL motion in the current motion phase is update_Time_1_5 = update_Time_1_4 + Δt, where Δt represents the time difference matrix required for the last frame of WebGL operation.
[0174] After completing the spatio-temporal trajectory simulation of the twin in the current motion phase (i.e., motion phase 1), perform the spatio-temporal trajectory simulation of the twin in motion phase 2. When performing the spatio-temporal trajectory simulation of motion phase 2, motion phase 2 is the current motion phase of the twin. At this time, the reference spatial coordinate point of the current motion phase is the spatial coordinate point update_Coord_1_5 after the last frame of WebGL motion in the previous motion phase (i.e., motion phase 1) of the current motion phase, and the reference time point of the current motion phase is the time point update_Time_1_5 after the last frame of WebGL motion in the previous motion phase (i.e., motion phase 1) of the current motion phase, that is, the second reference spatial coordinate point of the first frame of WebGL in the current motion phase (motion phase 2) is update_Coord_1_5, and the second reference time point of the first frame of WebGL in the current motion phase (motion phase 2) is update_Time_1_5.
[0175] After the twin completes the motion of the first frame of WebGL in the current motion phase (i.e., motion phase 2), the spatial coordinate point after the motion of the first frame of WebGL can be determined according to the motion function of the linear motion mode as And the time point after the motion of the first frame of WebGL can be determined according to the pre-set motion time update function as update_Time_2_1 = update_Time_1_5 + Δt, where Δt represents the time difference matrix required for the first frame of WebGL operation; subsequently, update_Coord_2_1 is determined as the second reference spatial coordinate point of the next frame of WebGL (i.e., the second frame of WebGL), and at the same time, update_Time_2_1 is determined as the second reference time point of the next frame of WebGL (i.e., the second frame of WebGL).
[0176] When the twin enters the second WebGL frame movement of the current movement stage (i.e., movement stage 2), the spatial coordinate points after the second WebGL frame movement can be determined as And the time point after the second WebGL frame movement can be determined as update_Time_2_2 = update_Time_2_1 + Δt, where Δt represents the time difference matrix required for the second WebGL frame operation.
[0177] And so on until the twin completes the last WebGL frame movement of the current movement stage (i.e., movement stage 2), that is, the spatial coordinate points and time points are updated frame by frame. Suppose it is determined that the current movement stage includes 10 WebGL frames according to the movement duration of the current movement stage (such as 10 seconds), then the spatial coordinate points after the last WebGL frame movement of the current movement stage are The time point after the last WebGL frame movement of the current movement stage is update_Time_2_10 = update_Time_1_9 + Δt, where Δt represents the time difference matrix required for the last WebGL frame operation.
[0178] After completing the spatio-temporal trajectory simulation of the twin in the current movement stage (i.e., movement stage 2), the spatio-temporal trajectory simulation of the twin in movement stage 3 is carried out. When carrying out the spatio-temporal trajectory simulation in movement stage 3, this movement stage 3 is the current movement stage of the twin. At this time, the reference spatial coordinate points of the current movement stage are the spatial coordinate points update_Coord_2_10 after the last WebGL frame movement of the previous movement stage (i.e., movement stage 2) of the current movement stage, and the reference time point of the current movement stage is the time point update_Time_2_10 after the last WebGL frame movement of the previous movement stage (i.e., movement stage 2) of the current movement stage. That is, the second reference spatial coordinate points of the first WebGL frame of the current movement stage (movement stage 3) are update_Coord_2_10, and the second reference time point of the first WebGL frame of the current movement stage (movement stage 3) is update_Time_2_10.
[0179] Among them, the spatio-temporal trajectory simulation of the twin in movement stage 3 is similar to the above-mentioned spatio-temporal trajectory simulation of the twin in movement stage 1 and movement stage 2, which will not be elaborated here. After completing the spatio-temporal trajectory simulation of the twin in movement stage 1, movement stage 2 and movement stage 3, the spatio-temporal trajectory simulation of the twin's full life cycle can be obtained.
[0180] In the embodiments of the present application, by constructing the coordinate system of the twin itself, the time attribute and spatial coordinates are calculated and updated frame by frame during the movement of the twin, and the operation results of the previous frame are passed as parameters into the operation of the next frame, thereby realizing the simulation of spatio-temporal continuity; by means of the PAA sequence method, based on the motion function and parameters in WebGL, the spatial coordinates during the movement process of the twin are dynamically calculated, greatly reducing the storage amount of spatial coordinate data; by establishing a motion mode library for the twin, the motion mode is decoupled from the twin data, which is consistent with the real world.
[0181] Embodiments of the present application provide a spatio-temporal trajectory simulation device, as Figure 4 shown, the spatio-temporal trajectory simulation device 300 may include: a determination module 301 and a processing module 302, wherein,
[0182] According to another aspect of the embodiments of the present application, there is provided a spatio-temporal trajectory simulation device, the device includes:
[0183] A determination module 301, configured to determine the reference spatial coordinate point and reference time point of the twin, the reference spatial coordinate point being the origin of the pre-constructed coordinate system of the twin, and the reference time point being an N*N time matrix, where N is an integer greater than 1;
[0184] A processing module 302, configured to simulate the spatio-temporal trajectory of the twin passing through each motion stage based on WebGL, according to the reference spatial coordinate point, the reference time point, the motion information corresponding to each motion stage included in the pre-set piecewise aggregation approximation PAA motion sequence table, the motion function corresponding to each motion mode included in the pre-constructed motion mode library, and the pre-set motion time update function, wherein the motion information includes motion duration, motion mode, and motion parameters.
[0185] In a possible implementation manner, when determining the reference spatial coordinate point of the twin, the determination module is configured to:
[0186] Based on the WebGL three-dimensional world coordinate system and the vertex coordinate data of the twin, determine the coordinate control point of the twin;
[0187] According to the perspective projection matrix and the coordinate control point of the twin, determine the coordinate system conversion matrix;
[0188] According to the coordinate system conversion matrix and the WebGL three-dimensional world coordinate system, construct the coordinate system of the twin of the twin, and determine the origin of the coordinate system of the twin as the reference spatial coordinate point of the twin.
[0189] In a possible implementation manner, when determining the coordinate control point of the twin based on the WebGL three-dimensional world coordinate system and the vertex coordinate data of the twin, the determination module is configured to:
[0190] Based on the WebGL three-dimensional world coordinate system, construct a spherical bounding box for the twin according to the vertex coordinate data of the twin.
[0191] Obtain the center point of the spherical bounding box and determine it as the center point of the twin.
[0192] Add fourth-dimensional data with a predetermined value to the center point of the twin, and determine the center point of the twin after adding the fourth-dimensional data as the coordinate control point.
[0193] In a possible implementation, when the processing module simulates the spatio-temporal trajectory of the twin passing through each motion stage based on WebGL, according to the reference space coordinate point, reference time point, motion information corresponding to each motion stage included in the pre-set piecewise aggregation approximation (PAA) motion sequence list, motion functions corresponding to each motion pattern included in the pre-constructed motion pattern library, and the pre-set motion time update function, it is used for:
[0194] Step A: Based on the PAA motion sequence list, determine the current motion stage of the twin and the first motion duration, first motion pattern, and first motion parameters corresponding to the current motion stage.
[0195] Step B: According to the motion pattern library, determine the first motion function corresponding to the first motion pattern.
[0196] Step C: Based on WebGL, determine the first reference space coordinate point of the current motion stage according to the reference space coordinate point and determine the first reference time point of the current motion stage according to the reference time point.
[0197] Step D: Based on WebGL, simulate the spatio-temporal trajectory of the twin passing through the current motion stage according to the first reference space coordinate point, first reference time point, pre-set motion time update function, first motion duration, first motion parameters, and first motion function.
[0198] When it is determined that the current motion stage ends based on the first motion duration, update the current motion stage to the next motion stage, and repeat steps A to D until the simulation of the spatio-temporal trajectory of the twin passing through each motion stage included in the PAA motion sequence list is completed.
[0199] In a possible implementation, when the processing module determines the first reference space coordinate point of the current motion stage based on WebGL according to the reference space coordinate point, it is used for:
[0200] When the current motion stage is the first motion stage in the PAA motion sequence list, determine the first reference space coordinate point of the current motion stage as the reference space coordinate point.
[0201] When the current motion stage is not the first motion stage in the PAA motion sequence list, determine that the first reference spatial coordinate point of the current motion stage is the spatial coordinate point after the last frame of WebGL motion in the previous motion stage of the current motion stage. Among them, the spatial coordinate point after the last frame of WebGL motion in the previous motion stage is calculated based on the motion function corresponding to the motion mode of the previous motion stage, according to the motion duration and motion parameters of the previous motion stage.
[0202] In a possible implementation, when the processing module determines the first reference time point of the current motion stage based on WebGL according to the reference time point, it is used for:
[0203] When the current motion stage is the first motion stage in the PAA motion sequence list, determine that the first reference time point of the current motion stage is the reference time point;
[0204] When the current motion stage is not the first motion stage in the PAA motion sequence list, determine that the first reference time point of the current motion stage is the time point after the last frame of WebGL motion in the previous motion stage of the current motion stage. Among them, the time point after the last frame of WebGL motion in the previous motion stage is calculated based on the preset motion time update function, according to the reference time point and motion duration of the previous motion stage.
[0205] In a possible implementation, the processing module includes multiple WebGL frames in the current motion stage; based on WebGL, when simulating the spatio-temporal trajectory of the twin through the current motion stage according to the first reference spatial coordinate point, the first reference time point, the preset motion time update function, the first motion duration, the first motion parameters, and the first motion function, it is used for:
[0206] Step E, determine the second reference spatial coordinate point of the current WebGL frame of the current motion stage according to the first reference spatial coordinate point, and determine the second reference time point of the current WebGL frame of the current motion stage according to the first reference time point;
[0207] Step F, based on the first motion function, determine the spatial coordinate point after the current WebGL frame motion according to the second reference spatial coordinate point and the first motion parameters, and determine the spatial coordinate point after the current WebGL frame motion as the second reference spatial coordinate point of the next WebGL frame. The next WebGL frame is the next WebGL frame of the current WebGL frame;
[0208] Step G: Based on a preset motion time update function, determine the time point after the motion of the current WebGL frame according to the second reference time point and the time required for the motion of the current WebGL frame, and determine the time point after the motion of the current WebGL frame as the second reference time point of the next WebGL frame;
[0209] When the motion of the current WebGL frame ends, update the current WebGL frame to the next WebGL frame of the current WebGL frame, and repeat steps E to G until the spatio-temporal trajectory simulation of each WebGL frame included in the current motion phase is completed.
[0210] In a possible implementation, when the processing module determines the second reference spatial coordinate point of the current WebGL frame of the current motion phase according to the first reference spatial coordinate point, it is used for:
[0211] When the current WebGL frame is the first WebGL frame of the current motion phase, determine the second reference spatial coordinate point as the first reference spatial coordinate point;
[0212] When the current WebGL frame is not the first WebGL frame of the current motion phase, determine the second reference spatial coordinate point as the spatial coordinate point after the motion of the previous WebGL frame, where the previous WebGL frame is the previous WebGL frame of the current WebGL frame;
[0213] Determining the second reference time point of the current WebGL frame of the current motion phase according to the first reference time point includes:
[0214] When the current WebGL frame is the first WebGL frame of the current motion phase, determine the second reference time point as the first reference time point;
[0215] When the current WebGL frame is not the first WebGL frame of the current motion phase, determine the second reference time point as the time point after the motion of the previous WebGL frame.
[0216] In a possible implementation, when the processing module determines whether the current motion phase ends based on the first motion duration, it is used for:
[0217] Determine the time difference between the time point after the motion of the last WebGL frame of the current motion phase and the reference time point of the first WebGL frame;
[0218] Compare the first motion duration with the time difference. If it is determined that the time difference is equal to the first motion duration, or it is determined that the difference between the first motion duration and the time difference is less than the time required for the motion of one WebGL frame, determine that the current motion phase ends; otherwise, determine that the current motion phase has not ended.
[0219] In a possible implementation, the motion mode includes at least one of the following:
[0220] Linear motion mode; Hermite motion mode; Lagrange motion mode.
[0221] The space-time trajectory simulation device according to the embodiments of the present application can execute the space-time trajectory simulation method shown in the above embodiments of the present application, and its implementation principle is similar. The actions performed by each module in the device of each embodiment of the present application correspond to the steps in the method of each embodiment of the present application. For the detailed function description of each module of the device, reference can be specifically made to the description in the corresponding method shown in the foregoing text, and details are not described herein again.
[0222] In the embodiments of the present application, an electronic device is provided, including a memory, a processor, and a computer program stored on the memory. The processor executes the above computer program to implement the steps of the space-time trajectory simulation method. Compared with the prior art, it can be achieved that: by pre-constructing a twin coordinate system, not only can the space-time trajectory simulation be directly based on the coordinate system of the twin itself during the movement of the twin, so that there is no need to obtain values from the world coordinate system for spatial movement, but also, when calculating and updating the reference time point and reference spatial coordinates frame by frame during the movement of the twin subsequently, the operation result of the previous frame can be directly passed as a parameter into the next frame operation, thereby realizing the space-time continuous space-time trajectory simulation; by presetting the PAA motion sequence list and pre-constructing the motion mode library, not only the decoupling of each motion stage of the twin and the decoupling of the motion parameters of the twin in each motion stage from the motion mode library are realized, thus conforming to the true simulation of the movement of objects in the real world, but also the spatial coordinate points during the movement of the twin can be dynamically calculated according to the motion function and motion parameters in WebGL, thereby greatly reducing the storage amount of spatial coordinate data.
[0223] In an alternative embodiment, an electronic device is provided, as Figure 4 shown, Figure 4 The electronic device 4000 shown includes: a processor 4001 and a memory 4003. Among them, the processor 4001 and the memory 4003 are connected, such as connected through a bus 4002. Optionally, the electronic device 4000 may further include a transceiver 4004, and the transceiver 4004 can be used for data interaction between the electronic device and other electronic devices, such as data sending and / or data receiving, etc. It should be noted that in practical applications, the transceiver 4004 is not limited to one, and the structure of the electronic device 4000 does not constitute a limitation to the embodiments of the present application.
[0224] The processor 4001 may be a CPU (Central Processing Unit), a general-purpose processor, a DSP (Digital Signal Processor), an ASIC (Application Specific Integrated Circuit), an FPGA (Field Programmable Gate Array), or other programmable logic devices, transistor logic devices, hardware components, or any combination thereof. It can implement or execute various exemplary logic blocks, modules, and circuits described in connection with the disclosure of this application. The processor 4001 may also be a combination that implements computing functions, such as a combination of one or more microprocessors, a combination of a DSP and a microprocessor, etc.
[0225] The bus 4002 may include a path for transmitting information between the above components. The bus 4002 may be a PCI (Peripheral Component Interconnect) bus, an EISA (Extended Industry Standard Architecture) bus, or the like. The bus 4002 may be divided into an address bus, a data bus, a control bus, etc. For ease of representation, Figure 4 only a thick line is shown herein, but it does not mean that there is only one bus or one type of bus.
[0226] The memory 4003 may be a ROM (Read Only Memory) or other type of static storage device that can store static information and instructions, a RAM (Random Access Memory) or other type of dynamic storage device that can store information and instructions, or it may also be an EEPROM (Electrically Erasable Programmable Read Only Memory), a CD-ROM (Compact Disc Read Only Memory), or other optical disc storage, optical disc storage (including compact discs, laser discs, optical discs, digital versatile discs, Blu-ray discs, etc.), magnetic disk storage media, other magnetic storage devices, or any other medium that can be used to carry or store computer programs and can be read by a computer, which is not limited herein.
[0227] The memory 4003 is used to store the computer program for implementing the embodiments of the present application, and is controlled by the processor 4001 to execute. The processor 4001 is used to execute the computer program stored in the memory 4003 to implement the steps shown in the foregoing method embodiments.
[0228] The embodiments of the present application provide a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the steps and corresponding content of the foregoing method embodiments can be implemented.
[0229] The embodiments of the present application further provide a computer program product, including a computer program. When the computer program is executed by a processor, the steps and corresponding content of the foregoing method embodiments can be implemented.
[0230] It should be understood that although the flowchart of the embodiments of the present application indicates each operation step by an arrow, the execution order of these steps is not limited to the order indicated by the arrow. Unless there is a clear description in this article, in some implementation scenarios of the embodiments of the present application, the implementation steps in each flowchart can be executed in other orders according to requirements. In addition, some or all of the steps in each flowchart may include multiple sub-steps or multiple stages based on the actual implementation scenario. Some or all of these sub-steps or stages can be executed at the same time, and each sub-step or stage of these sub-steps or stages can also be executed at different times respectively. In the scenario where the execution times are different, the execution order of these sub-steps or stages can be flexibly configured according to requirements, and the embodiments of the present application do not limit this.
[0231] The above are only optional implementation manners of some implementation scenarios of the present application. It should be noted that for those of ordinary skill in the art, without departing from the technical concept of the solution of the present application, other similar implementation means based on the technical idea of the present application also belong to the protection scope of the embodiments of the present application.
Claims
1. A method for simulating spatio-temporal trajectories, characterized in that, Including: Determine the reference spatial coordinate point and reference time point of the twin. The reference spatial coordinate point is the origin of the pre-constructed twin coordinate system, and the reference time point is of the time matrix, where N is an integer greater than 1; Based on WebGL, according to the reference space coordinate points, the reference time point, the motion information corresponding to each motion stage included in the preset Piecewise Aggregate Approximation (PAA) motion sequence list, the motion functions corresponding to each motion pattern included in the pre-constructed motion pattern library, and the preset motion time update function, simulate the spatio-temporal trajectory of the twin through each motion stage, where the motion information includes motion duration, motion pattern, and motion parameters; The method of simulating the spatio-temporal trajectory of the twin through each motion stage based on WebGL, according to the reference space coordinate points, the reference time point, the motion information corresponding to each motion stage included in the preset Piecewise Aggregate Approximation (PAA) motion sequence list, the motion functions corresponding to each motion pattern included in the pre-constructed motion pattern library, and the preset motion time update function, includes: Step A: Based on the PAA motion sequence list, determine the current motion stage of the twin and the first motion duration, the first motion pattern, and the first motion parameters corresponding to the current motion stage; Step B: According to the motion pattern library, determine the first motion function corresponding to the first motion pattern; Step C: Based on WebGL, determine the first reference space coordinate point of the current motion stage according to the reference space coordinate points and determine the first reference time point of the current motion stage according to the reference time point; Step D: Based on WebGL, according to the first reference space coordinate point, the first reference time point, the preset motion time update function, the first motion duration, the first motion parameters, and the first motion function, simulate the spatio-temporal trajectory of the twin through the current motion stage; When it is determined that the current motion stage ends based on the first motion duration, update the current motion stage to the next motion stage of the current motion stage, and repeat Step A to Step D until the simulation of the spatio-temporal trajectory of the twin through each motion stage included in the PAA motion sequence list is completed; The method of determining the first reference space coordinate point of the current motion stage based on WebGL according to the reference space coordinate points includes: When the current motion stage is the first motion stage in the PAA motion sequence list, determine the first reference space coordinate point of the current motion stage as the reference space coordinate point; When the current motion stage is not the first motion stage in the PAA motion sequence list, determine the first reference space coordinate point of the current motion stage as the space coordinate point after the last frame of the WebGL motion of the previous motion stage of the current motion stage, where the space coordinate point after the last frame of the WebGL motion of the previous motion stage is calculated according to the motion function corresponding to the motion pattern of the previous motion stage, based on the motion duration and motion parameters of the previous motion stage.
2. The method according to claim 1, wherein The method of determining the reference space coordinate point of the twin includes: Based on the WebGL three-dimensional world coordinate system and the vertex coordinate data of the twin, determine the coordinate control points of the twin; Determine the coordinate system transformation matrix according to the perspective projection matrix and the coordinate control points of the twin; Construct the twin coordinate system of the twin according to the coordinate system transformation matrix and the WebGL three-dimensional world coordinate system, and determine the origin of the twin coordinate system as the reference space coordinate point of the twin.
3. The method according to claim 2, wherein The determining the coordinate control points of the twin based on the WebGL three-dimensional world coordinate system and the vertex coordinate data of the twin includes: Based on the WebGL three-dimensional world coordinate system, construct the sphere bounding box of the twin according to the vertex coordinate data of the twin; Obtain the center point of the sphere bounding box and determine it as the center point of the twin; Add fourth-dimensional data with a predetermined value to the center point of the twin, and determine the center point of the twin after adding the fourth-dimensional data as the coordinate control point.
4. The method according to claim 1, wherein The determining the first reference time point of the current motion stage based on WebGL according to the reference time point includes: When the current motion stage is the first motion stage in the PAA motion sequence list, determine the first reference time point of the current motion stage as the reference time point; When the current motion stage is not the first motion stage in the PAA motion sequence list, determine the first reference time point of the current motion stage as the time point after the last frame of motion in WebGL of the previous motion stage of the current motion stage, where the time point after the last frame of motion in WebGL of the previous motion stage is calculated based on the pre-set motion time update function according to the reference time point and the motion duration of the previous motion stage.
5. The method according to claim 1, wherein The current motion stage includes multiple WebGL frames; the simulating the spatio-temporal trajectory of the twin passing through the current motion stage based on WebGL according to the first reference space coordinate point, the first reference time point, the pre-set motion time update function, the first motion duration, the first motion parameter, and the first motion function includes: Step E, determine the second reference space coordinate point of the current WebGL frame of the current motion stage according to the first reference space coordinate point, and determine the second reference time point of the current WebGL frame of the current motion stage according to the first reference time point; Step F, based on the first motion function, determine the space coordinate point after the motion of the current WebGL frame according to the second reference space coordinate point and the first motion parameter, and determine the space coordinate point after the motion of the current WebGL frame as the second reference space coordinate point of the next WebGL frame, where the next WebGL frame is the next WebGL frame of the current WebGL frame; Step G: Based on the pre-set motion time update function, determine the time point after the motion of the current WebGL frame according to the second reference time point and the time required for the motion of the current WebGL frame, and determine the time point after the motion of the current WebGL frame as the second reference time point of the next WebGL frame of the current WebGL frame; When the motion of the current WebGL frame ends, update the current WebGL frame to the next WebGL frame of the current WebGL frame, and repeat Steps E to G until the spatio-temporal trajectory simulation of each WebGL frame included in the current motion phase is completed.
6. The method according to claim 5, characterized in that, The determination of the second reference spatial coordinate point of the current WebGL frame of the current motion phase according to the first reference spatial coordinate point includes: When the current WebGL frame is the first WebGL frame of the current motion phase, determine the second reference spatial coordinate point as the first reference spatial coordinate point; When the current WebGL frame is not the first WebGL frame of the current motion phase, determine the second reference spatial coordinate point as the spatial coordinate point after the motion of the previous WebGL frame, and the previous WebGL frame is the previous WebGL frame of the current WebGL frame; The determination of the second reference time point of the current WebGL frame of the current motion phase according to the first reference time point includes: When the current WebGL frame is the first WebGL frame of the current motion phase, determine the second reference time point as the first reference time point; When the current WebGL frame is not the first WebGL frame of the current motion phase, determine the second reference time point as the time point after the motion of the previous WebGL frame.
7. The method according to claim 1, characterized in that, Determining whether the current motion phase ends based on the first motion duration includes: Determine the time difference between the time point after the motion of the last WebGL frame of the current motion phase and the reference time point of the first WebGL frame; Compare the first motion duration with the time difference. If it is determined that the time difference is equal to the first motion duration, or it is determined that the difference between the first motion duration and the time difference is less than the time required for the motion of one WebGL frame, determine that the current motion phase ends; otherwise, determine that the current motion phase has not ended.
8. The method according to any one of claims 1-7, characterized in that, The motion mode includes at least one of the following: Linear motion mode; Hermite motion mode; Lagrange motion mode.
9. A spatio-temporal trajectory simulation device, characterized in that, It includes: A determination module, configured to determine a reference space coordinate point and a reference time point of the twin. The reference space coordinate point is the origin of a pre-constructed twin coordinate system, and the reference time point is a time matrix of, where N is an integer greater than 1; A processing module, configured to simulate the spatio-temporal trajectory of the twin through each motion phase based on WebGL according to the reference spatial coordinate point, the reference time point, the motion information corresponding to each motion phase included in the pre-set piecewise aggregate approximation (PAA) motion sequence table, the motion functions corresponding to each motion mode included in the pre-constructed motion mode library, and the pre-set motion time update function, where the motion information includes motion duration, motion mode, and motion parameters; When the processing module is used to simulate the spatio-temporal trajectory of the twin through each motion stage based on WebGL, according to the reference space coordinate points, the reference time points, the motion information corresponding to each motion stage included in the preset piecewise aggregate approximation (PAA) motion sequence list, the motion functions corresponding to each motion pattern included in the pre-constructed motion pattern library, and the preset motion time update function, it is specifically used for: Step A: Based on the PAA motion sequence list, determine the current motion stage of the twin, the first motion duration, the first motion pattern, and the first motion parameters corresponding to the current motion stage; Step B: According to the motion pattern library, determine the first motion function corresponding to the first motion pattern; Step C: Based on WebGL, determine the first reference space coordinate point of the current motion stage according to the reference space coordinate points and determine the first reference time point of the current motion stage according to the reference time points; Step D: Based on WebGL, simulate the spatio-temporal trajectory of the twin through the current motion stage according to the first reference space coordinate point, the first reference time point, the preset motion time update function, the first motion duration, the first motion parameters, and the first motion function; When it is determined that the current motion stage ends based on the first motion duration, update the current motion stage to the next motion stage of the current motion stage, and repeat Steps A to D until the spatio-temporal trajectory simulation of the twin through each motion stage included in the PAA motion sequence list is completed; When the processing module is used to determine the first reference space coordinate point of the current motion stage based on WebGL according to the reference space coordinate points, it is specifically used for: When the current motion stage is the first motion stage in the PAA motion sequence list, determine the first reference space coordinate point of the current motion stage as the reference space coordinate point; When the current motion stage is not the first motion stage in the PAA motion sequence list, determine the first reference space coordinate point of the current motion stage as the space coordinate point after the last frame of WebGL motion in the previous motion stage of the current motion stage, where the space coordinate point after the last frame of WebGL motion in the previous motion stage is calculated according to the motion function corresponding to the motion pattern of the previous motion stage, based on the motion duration and motion parameters of the previous motion stage.
10. An electronic device, comprising a memory, a processor, and a computer program stored on the memory, characterized in that, The processor executes the computer program to implement the method according to any one of claims 1-8.
11. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by the processor, it implements the method according to any one of claims 1-8.
12. A computer program product, comprising a computer program, characterized in that, When the computer program is executed by the processor, it implements the method according to any one of claims 1-8.
Citation Information
Patent Citations
Ship mutual-aid team rescue validity testing method based on track cluster
CN104571122A
Three-dimensional motion track simulation method and device, electronic device and storage medium
CN109559375A
Sand table deduction method and device based on digital twinning, equipment and storage medium
CN111611703A