Multi-thread-based model elevation information calculation method
By dividing the topography of the terrain model into multiple sub -planes and using multi -threaded calculation methods, combining the shooting trace line method to calculate the intersection coordinates, solve the problem of poor model information computing in existing technologies, and achieve efficient efficiency, and achieve efficient efficiency. Real -time calculation and visualization.
Patent Information
- Application Number
- CN202411568245.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-05
- Publication Date
- 2025-01-24
AI Technical Summary
The existing methods for calculating model elevation information have timeliness problems, and it is difficult to accurately calculate the elevation matching relationship between the model and the terrain in real-time scenarios.
A multi-thread-based calculation method is used to divide the surface element set of the terrain model into multiple sub-surface element sets, and assign independent sub-threads to each sub-surface element set. The shooting trace method is used to determine the rays and the sub-surface element sets of the terrain model. Whether to intersect, calculate the coordinates of the intersection to obtain the three-dimensional coordinate value of the elevation matching.
The calculation efficiency was improved, and the problem of poor timeliness caused by single -line computing was solved, and real -time calculation and visualization of the model's high -prime information were completed in a short period of time.
Smart Images

Figure CN119359524A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of multi-threaded parallel computing, and in particular to a multi-threaded based model elevation information computing method. Background Art
[0002] With the development of virtual reality technology, virtual scene construction and display technology are becoming more and more common in daily life. When a scene has terrain and there is a certain elevation difference, it is necessary to ensure that other models are displayed or moved on top of the terrain model, that is, the terrain height corresponding to the location of a certain model needs to be calculated in real time. Existing methods for calculating model elevation information have more or less computational timeliness issues.
[0003] Therefore, it is necessary to develop a multi-threaded model elevation information calculation method to solve the above problems. Summary of the invention
[0004] The purpose of the present invention is to design a multi-threaded model elevation information calculation method in order to solve the above problems.
[0005] The present invention achieves the above-mentioned purpose through the following technical solutions:
[0006] A multi-threaded model elevation information calculation method includes the following steps:
[0007] S1, dividing the face element set of the terrain model into n sub-face element sets;
[0008] S2, solving the minimum coordinate value of the scene model in the height direction in each body coordinate system, where the scene model is the model in the scene except the terrain model;
[0009] S3, allocate an independent sub-thread to each sub-facet set, and allocate an independent global flag bit to each sub-thread, the default value is true;
[0010] S4. Start all sub-threads in the main thread, and independently perform the following calculations in the sub-threads:
[0011] a. Assume that the horizontal coordinates of the scene model at a certain moment in the scene coordinate system are known. Based on the horizontal coordinates, set its height value at -10000m, take this point as the initial point, and establish a ray pointing vertically upwards;
[0012] b. Determine whether the corresponding flags of all child threads are true. If a flag is false, terminate the child thread.
[0013] c. Based on the established ray, use the shooting trace method to determine whether the ray intersects with the sub-surface set of the terrain model. If so, solve the intersection coordinates and set the corresponding flag of the sub-thread to false; if not, terminate the sub-thread;
[0014] S5. When all sub-threads are finished, the minimum coordinate value of the scene model in the height direction in the main coordinate system is subtracted from the coordinate value of the intersection point in the height direction to obtain the three-dimensional coordinate value matching the elevation of the scene model and the terrain model.
[0015] S6, repeating steps S4 and S5 to complete the three-dimensional coordinate values that match the elevation of all scene models with the terrain model;
[0016] S7. Repeat steps S4, S5 and S6 to obtain the three-dimensional coordinate values of all scene models that match the elevation of the terrain model along their respective movement directions on the time axis, and obtain the face element coordinates of the scene model in the scene coordinate system through coordinate transformation for real-time visualization of the three-dimensional scene display.
[0017] The beneficial effects of the present invention are:
[0018] 1. Introduce multi-threaded parallel computing technology into the model elevation calculation process to improve computing efficiency and solve the problem of poor timeliness caused by single-threaded computing.
[0019] 2. To adapt to multi-threaded computing, the face set of the terrain model is divided into multiple sub-face sets. An independent sub-thread is assigned to each sub-face set, and an independent global flag is assigned to each sub-thread, with the default value of true. All sub-threads are started in the main thread, and independent computing is performed in the sub-threads: when all global flags are true, vertical upward shooting traces are established based on the known horizontal coordinates of the scene model, and the shooting trace method is used to solve the intersection with the sub-face set of the terrain model. When the intersection is obtained, the global flag of the sub-thread is set to false; make full use of parallel computing resources to complete the model elevation information calculation in a shorter time. BRIEF DESCRIPTION OF THE DRAWINGS
[0020] Figure 1 It is a schematic diagram of the shooting trace;
[0021] Figure 2 It is a schematic diagram of the model elevation information calculation method of the present invention. DETAILED DESCRIPTION
[0022] In order to make the purpose, technical solutions and advantages of the embodiments of the present invention clearer, the technical solutions in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Generally, the components of the embodiments of the present invention described and shown in the drawings here can be arranged and designed in various different configurations.
[0023] Therefore, the following detailed description of the embodiments of the present invention provided in the accompanying drawings is not intended to limit the scope of the invention claimed for protection, but merely represents selected embodiments of the present invention. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0024] It should be noted that similar reference numerals and letters denote similar items in the following drawings, and therefore, once an item is defined in one drawing, further definition and explanation thereof is not required in subsequent drawings.
[0025] In the description of the present invention, it should be understood that the terms "upper", "lower", "inside", "outside", "left", "right", etc. indicate directions or positional relationships based on the directions or positional relationships shown in the accompanying drawings, or are directions or positional relationships in which the product of the invention is usually placed when in use, or are directions or positional relationships commonly understood by those skilled in the art. These directions or positional relationships are only for the convenience of describing the present invention and simplifying the description, and do not indicate or imply that the device or element referred to must have a specific direction, be constructed and operated in a specific direction, and therefore should not be understood as a limitation on the present invention.
[0026] Furthermore, the terms “first”, “second”, etc. are merely used for distinguishing descriptions and should not be understood as indicating or implying relative importance.
[0027] In the description of the present invention, it is also necessary to explain that, unless otherwise clearly specified and limited, the terms such as "setting" and "connection" should be understood in a broad sense. For example, "connection" can be a fixed connection, a detachable connection, or an integral connection; it can be a mechanical connection or an electrical connection; it can be a direct connection, or an indirect connection through an intermediate medium, or it can be the internal communication of two elements. For ordinary technicians in this field, the specific meanings of the above terms in the present invention can be understood according to specific circumstances.
[0028] The specific implementation modes of the present invention are described in detail below in conjunction with the accompanying drawings.
[0029] like Figure 2 As shown, a multi-threaded model elevation information calculation method includes the following steps:
[0030] S1, dividing the face element set of the terrain model into n sub-face element sets;
[0031] S2, solving the minimum coordinate value of the scene model in the height direction in each body coordinate system, where the scene model is the model in the scene except the terrain model;
[0032] S3, allocate an independent sub-thread to each sub-facet set, and allocate an independent global flag bit to each sub-thread, the default value is true;
[0033] S4. Start all sub-threads in the main thread, and independently perform the following calculations in the sub-threads:
[0034] a. Assume that the horizontal coordinates of the scene model at a certain moment in the scene coordinate system are known. Based on the horizontal coordinates, set its height value at -10000m, take this point as the initial point, and establish a ray pointing vertically upwards;
[0035] b. Determine whether the corresponding flags of all child threads are true. If a flag is false, terminate the child thread.
[0036] c. Based on the established ray, use the shooting trace method to determine whether the ray intersects with the sub-surface set of the terrain model. If so, solve the intersection coordinates and set the corresponding flag of the sub-thread to false; if not, terminate the sub-thread;
[0037] S5. When all sub-threads are finished, the minimum coordinate value of the scene model in the height direction in the main coordinate system is subtracted from the coordinate value of the intersection point in the height direction to obtain the three-dimensional coordinate value matching the elevation of the scene model and the terrain model.
[0038] S6, repeating steps S4 and S5 to complete the three-dimensional coordinate values that match the elevation of all scene models with the terrain model;
[0039] S7. Repeat steps S4, S5 and S6 to obtain the three-dimensional coordinate values of all scene models that match the elevation of the terrain model along their respective movement directions on the time axis, and obtain the face element coordinates of the scene model in the scene coordinate system through coordinate transformation for real-time visualization of the three-dimensional scene display.
[0040] like Figure 2 As shown, in some embodiments, a multi-threaded model elevation information calculation method includes:
[0041] S1, the scene coordinate system and the scene model coordinate system use the northeast celestial coordinate system, and the origin of the coordinate system is at the center of the scene and the scene model respectively. The method is divided into n sub-surface sets, and the method of dividing into two sub-surface sets is taken as an example, as shown in formula (1).
[0042] (1)
[0043] In the formula, is the number of triangles in the terrain model, is the number of triangular facets in facet set 1, is the number of triangle faces in face set 2.
[0044] S2. Find the minimum coordinate value of the height direction of each model (referred to as the scene model) in the scene except the terrain model in the scene coordinate system.
[0045] (2)
[0046] Where m is the number of triangle faces in the scene model. is the triangular face set of the scene model, is the maximum coordinate value of the scene model triangle element in the scene model coordinate system, It is the minimum coordinate value of the scene model triangle surface in the scene model coordinate system. It is the minimum coordinate value of the scene model in the height direction in the respective scene model coordinate system.
[0047] S3. Allocate an independent sub-thread to each sub-facet set, and allocate an independent global flag to each sub-thread, with the default value being true. Taking C# language as an example, the function statement for establishing a thread is:
[0048] public delegate void process1();
[0049] process1 p1;
[0050] bool flag1=true;
[0051] p1 = new process1(cal_fun1);
[0052] The above is a function statement for creating a single sub-thread. The same statement can be used to create multiple sub-threads. cal_fun1 is the calculation function corresponding to the sub-thread.
[0053] S4. Start all sub-threads in the main thread, start the calculation function in the sub-threads, and independently perform the following calculations:
[0054] a. Assume that the horizontal coordinates of the scene model at a certain moment in the scene coordinate system It is known that based on the horizontal plane coordinates, its altitude value is set at -10000m. As the initial point, establish a vertical ray pointing upward. Figure 1 shown.
[0055] b. Determine whether the corresponding flags of all child threads are true. If any flag is false, terminate the child thread.
[0056] c. Based on the established ray, the shooting trace method is used to determine whether the ray intersects with the sub-surface set of the terrain model.
[0057] The method for judging whether the ray intersects with a single triangle facet in the terrain model subfacet set by using the shooting trace method is as follows: As the initial point, The shooting speed is the shooting trajectory. The shooting trajectory is established. The time t when the shooting trajectory reaches the plane where the triangle surface element is located is calculated to determine whether the shooting trajectory intersects with the plane where the triangle surface element is located. The calculation formula of the arrival time t is shown in formula (3). If t is greater than or equal to zero, the shooting trajectory intersects with the plane where the triangle surface element is located. Then, the intersection point of the shooting trajectory and the plane is calculated. The calculation formula is shown in formula (4). Determine whether the intersection point is inside the triangle surface element. If the intersection point is inside the triangle surface element, it is considered that the ray intersects with the triangle surface element.
[0058] (3)
[0059] (4)
[0060] In the formula, is the coefficient of the equation of the plane where the triangle element is located, are the intersection coordinates.
[0061] The above method is used to traverse the sub-surface set of the terrain model. If they intersect, the intersection coordinates are solved and the corresponding flag of the sub-thread is set to false; if they do not intersect, the sub-thread is terminated.
[0062] S5. When all sub-threads are finished, the coordinates of the intersection points are obtained. The height direction coordinate value minus the minimum height direction coordinate value of the scene model in the body coordinate system , you can get the three-dimensional coordinate value that matches the elevation of the scene model and the terrain model The formula is shown in formula (5).
[0063] (5)
[0064] S6. Repeat steps S4 and S5 to complete the three-dimensional coordinate values that match the elevations of all scene models and terrain models.
[0065] S7, repeating steps S4, S5 and S6 can obtain the three-dimensional coordinate values of all scene models along their respective movement directions on the time axis that match the elevation of the terrain model. And through coordinate transformation, the surface element coordinates of the scene model in the scene coordinate system can be obtained for real-time visualization of the three-dimensional scene display.
[0066] The above is only a preferred embodiment of the present invention. It should be pointed out that for ordinary technicians in this technical field, several improvements and modifications can be made without departing from the technical principles of the present invention. These improvements and modifications should also be regarded as the scope of protection of the present invention.
Claims
1. A multi-threaded model elevation information calculation method, characterized in that: Includes steps: S1. Divide the surface element set of the terrain model into n A subfacet set; S2, solving the minimum coordinate value of the scene model in the height direction in each body coordinate system, where the scene model is the model in the scene except the terrain model; S3, allocate an independent sub-thread to each sub-facet set, and allocate an independent global flag bit to each sub-thread, the default value is true; S4. Start all sub-threads in the main thread, and independently perform the following calculations in the sub-threads: a. Assume that the horizontal coordinates of the scene model at a certain moment in the scene coordinate system are known. Based on the horizontal coordinates, set its height value at -10000m, take this point as the initial point, and establish a ray pointing vertically upwards; b. Determine whether the corresponding flags of all child threads are true. If a flag is false, terminate the child thread. c. Based on the established ray, use the shooting trace method to determine whether the ray intersects with the sub-surface set of the terrain model. If so, solve the intersection coordinates and set the corresponding flag bit of the sub-thread to false; If they do not intersect, terminate the child thread; S5. When all sub-threads are finished, the minimum coordinate value of the scene model in the height direction in the main coordinate system is subtracted from the coordinate value of the intersection point in the height direction to obtain the three-dimensional coordinate value matching the elevation of the scene model and the terrain model. S6, repeating steps S4 and S5 to complete the three-dimensional coordinate values that match the elevation of all scene models with the terrain model; S7. Repeat steps S4, S5 and S6 to obtain the three-dimensional coordinate values of all scene models that match the elevation of the terrain model along their respective movement directions on the time axis, and obtain the face element coordinates of the scene model in the scene coordinate system through coordinate transformation for real-time visualization of the three-dimensional scene display.