Method, device and electronic equipment for simulating planetary magnetic field in virtual scene
By obtaining planet size information and virtual storm direction, determining the magnetic field display parameters, and generating a magnetic field area composed of ellipses and tangents, the problem of inability to effectively simulate the planetary magnetic field in the existing technology is solved, real visual magnetic field simulation is realized, and the game experience is improved.
Patent Information
- Application Number
- CN202210802406.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-07-07
- Publication Date
- 2025-04-01
- Estimated Expiration
- 2042-07-07
AI Technical Summary
The prior art cannot effectively simulate the magnetic field effect of planets in virtual scenes, and the simulated magnetic field does not conform to the physical principles of the real world, reducing the player's gaming experience.
By obtaining the size information of the target planet and the relative direction of the virtual storm, the magnetic field display parameters are determined, including the size parameters and tangent parameters of the specified ellipse to generate the magnetic field area of the planet under the action of the virtual storm. This method can automatically adapt to the size of the planet, and through the magnetic field area composed of ellipse and tangent lines of the ellipse, the magnetic field effect of the planet is visualized in a virtual scene and conform to the physical magnetic field line effect of the real world.
It realizes the simulation of the planetary magnetic field in a virtual scene, improves the player's gaming experience and conforms to the physical principles of the real world.
Smart Images

Figure CN115317905B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of scene simulation, and in particular to a method, device and electronic equipment for simulating a planetary magnetic field in a virtual scene. Background Art
[0002] In the real world, due to the eruption of solar storms, planets will be hit by storms, but due to the protection of the planet's own magnetic field, there is a safe zone in the outer layer of the planet's atmosphere and in the shade of the planet. This safe zone can avoid the impact of solar storms.
[0003] In relevant game scenes, the safe zone of a planet can be used by the virtual character controlled by the player to stay and avoid being hit by a solar storm. Specifically, a number of solid-color fan-shaped models are placed in the game scene to simulate the magnetic field effect of a planet hit by a solar storm, and the safe zone of the planet is indicated by the magnetic field effect. However, this method cannot reflect the magnetic field effect of a single planet, and the magnetic field effect does not conform to the physical principles in the real world, which reduces the player's gaming experience. Summary of the invention
[0004] The purpose of the present invention is to provide a method, device and electronic device for simulating the magnetic field of a planet in a virtual scene, so as to simulate the magnetic field effect of a planet under a solar storm in a virtual scene. The magnetic field effect can reflect the magnetic field effect of a single planet, and the magnetic field effect conforms to the physical principles in the real world to enhance the player's gaming experience.
[0005] In a first aspect, the present invention provides a method for simulating a planetary magnetic field in a virtual scene, the method comprising: obtaining size information of a target planet and a relative direction between a virtual storm and the target planet; determining magnetic field display parameters of the target planet based on the size information of the target planet; wherein the magnetic field display parameters comprise: size parameters of a specified ellipse and / or tangent parameters of a specified ellipse for generating a magnetic field region of the target planet; and generating a magnetic field region of the target planet under the action of a virtual storm according to the magnetic field display parameters and the relative direction.
[0006] In an optional embodiment, the step of determining the magnetic field display parameters of the target planet based on the size information of the target planet includes: searching for magnetic field display parameters that match the size information of the target planet from a preset database; wherein the preset database stores multiple size parameters of the planet and the magnetic field display parameters corresponding to each size parameter.
[0007] In an optional embodiment, the magnetic field region of the target planet includes: a first magnetic field region in the direction of the virtual storm facing the target planet, and a second magnetic field region generated by the target planet blocking the virtual storm; the step of generating the magnetic field region of the target planet under the action of the virtual storm according to the magnetic field display parameters and the relative direction includes: generating the first magnetic field region in the direction of the virtual storm facing the target planet based on the size parameters of the specified ellipse included in the magnetic field display parameters; generating the second magnetic field region generated by the target planet blocking the virtual storm based on the size parameters of the specified ellipse and the tangent parameters of the specified ellipse included in the magnetic field display parameters; combining the first magnetic field region and the second magnetic field region according to the relative direction to obtain the magnetic field region of the target planet under the action of the virtual storm.
[0008] In an optional embodiment, the magnetic field display parameters also include a first number of magnetic field lines contained in the first magnetic field region; the size parameters of the specified ellipse in the magnetic field display parameters include: the minor axis radius and major axis radius of the specified ellipse corresponding to each magnetic field line in the first magnetic field region; the step of generating the first magnetic field region of the target planet facing the virtual storm direction based on the size parameters of the specified ellipse included in the magnetic field display parameters includes: for each magnetic field line in the first magnetic field region, generating the current magnetic field line according to the minor axis radius and major axis radius of the specified ellipse corresponding to the current magnetic field line; combining the generated first number of magnetic field lines to obtain the first magnetic field region; wherein the magnetic field radius of the magnetic field lines in the first magnetic field region increases from the inside to the outside, and the magnetic field radius matches the major axis radius of the specified ellipse corresponding to the magnetic field line.
[0009] In an optional embodiment, the step of generating the current magnetic field line according to the minor axis radius and major axis radius of the specified ellipse corresponding to the current magnetic field line includes: obtaining the minor axis radius and major axis radius of the specified ellipse corresponding to the current magnetic field line, constructing a first ellipse with a major axis radius of a first value and a minor axis radius of a second value, and constructing a second ellipse with a major axis radius of the first value and a minor axis radius of a third value; selecting a semi-ellipse of the first ellipse and a semi-ellipse of the second ellipse, and combining the semi-ellipses of the first ellipse and the semi-ellipses of the second ellipse into a closed combined ellipse; respectively setting the color and transparency inside and outside the combined ellipse, and determining the set combined ellipse as the current magnetic field line in the first magnetic field region.
[0010] In an optional embodiment, the above-mentioned steps of respectively setting the color and transparency inside and outside the combined ellipse include: setting the color inside the combined ellipse to a first color, setting the color outside the combined ellipse to a second color, and setting the transparency inside the combined ellipse to a preset value; wherein the transparency inside the combined ellipse is used to indicate the magnetic field strength, and as the radius of the major axis of the combined ellipse increases, the value of the transparency setting inside the combined ellipse becomes smaller.
[0011] In an optional embodiment, after the step of selecting the semi-ellipse of the first ellipse and the semi-ellipse of the second ellipse, and combining the semi-ellipse of the first ellipse and the semi-ellipse of the second ellipse into a closed combined ellipse, the method further includes: stroking the combined ellipse to obtain an edge contour with a specified width around the combined ellipse; and setting the edge contour to a third color.
[0012] In an optional embodiment, the above-mentioned step of stroking the combined ellipse to obtain an edge contour with a specified width around the combined ellipse includes: adding the first value to the first threshold to obtain a fourth value; adding the second value to the second threshold to obtain a fifth value; adding the third value to the third threshold to obtain a sixth value; constructing a third ellipse with a major axis radius of the fourth value and a minor axis radius of the fifth value, and constructing a fourth ellipse with a major axis radius of the fourth value and a minor axis radius of the sixth value; selecting a semi-ellipse of the third ellipse and a semi-ellipse of the fourth ellipse, and combining the semi-ellipse of the third ellipse and the semi-ellipse of the fourth ellipse into a closed combined ellipse; combining the semi-ellipse of the third ellipse and the semi-ellipse of the fourth ellipse into a closed combined ellipse, subtracting the combined ellipse formed by the semi-ellipse of the first ellipse and the semi-ellipse of the second ellipse, to obtain an edge contour with a specified width corresponding to the combined ellipse formed by the semi-ellipse of the first ellipse and the semi-ellipse of the second ellipse.
[0013] In an optional embodiment, the second magnetic field region includes a near magnetic field region generated by the target planet blocking the virtual storm, and an infinite magnetic field region generated by the target planet blocking the virtual storm; the magnetic field display parameters also include: a second number of closed magnetic field lines contained in the near magnetic field region, and a third number of open magnetic field lines contained in the infinite magnetic field region; the size parameters of the specified ellipse in the magnetic field display parameters include: the size parameters of the specified ellipse corresponding to each closed magnetic field line, the size parameters of the specified ellipse corresponding to each open magnetic field line, and the tangent parameters of the specified ellipse; the step of generating the second magnetic field region generated by the target planet blocking the virtual storm based on the size parameters of the specified ellipse and the tangent parameters of the specified ellipse included in the magnetic field display parameters includes: For each closed magnetic field line in the near magnetic field region, the current closed magnetic field line is generated based on the size parameters of the specified ellipse corresponding to the current closed magnetic field line; the generated second number of closed magnetic field lines are combined to obtain the near magnetic field region; wherein the magnetic field radius of the closed magnetic field line in the near magnetic field region increases from the inside to the outside, and the magnetic field radius matches the size of the specified ellipse corresponding to the closed magnetic field line; for each open magnetic field line in the infinite magnetic field region, the current open magnetic field line is generated according to the size parameters and tangent parameters of the specified ellipse corresponding to the current open magnetic field line; the generated third number of open magnetic field lines are combined to obtain the infinite magnetic field region; wherein the opening width of the open magnetic field line in the infinite magnetic field region increases from the inside to the outside.
[0014] In an optional embodiment, the step of generating the current closed magnetic field line based on the size parameters of the specified ellipse corresponding to the current closed magnetic field line includes: obtaining a target ellipse according to the size parameters of the specified ellipse corresponding to the current closed magnetic field line; scaling the target ellipse to obtain a shear ellipse; setting the color and transparency inside the shear ellipse, and setting the color outside the shear ellipse, and determining the set shear ellipse as the current closed magnetic field line.
[0015] In an optional embodiment, the step of scaling the target ellipse to obtain the shear ellipse includes: enlarging the horizontal coordinate value of the target ellipse as the vertical coordinate value increases, and determining the enlarged ellipse as the shear ellipse.
[0016] In an optional embodiment, the above-mentioned steps of setting the color and transparency within the shear ellipse, and setting the color outside the shear ellipse, include: setting the color within the shear ellipse to a first color, setting the color outside the shear ellipse to a second color, and setting the transparency within the shear ellipse to a preset value; wherein the transparency within the shear ellipse is used to indicate the magnetic field strength, and as the size of the shear ellipse increases, the value of the transparency setting within the shear ellipse becomes smaller.
[0017] In an optional embodiment, after the step of scaling the target ellipse to obtain the sheared ellipse, the method further includes: stroking the sheared ellipse to obtain an edge contour with a specified width around the sheared ellipse; and setting the edge contour to a third color.
[0018] In an optional embodiment, the step of generating the current opening magnetic field line according to the size parameters and tangent parameters of the specified ellipse corresponding to the current opening magnetic field line includes: obtaining the specified ellipse according to the size parameters of the specified ellipse; determining two tangents of the specified ellipse according to the tangent parameters, and making the two tangents tangent to the specified ellipse; determining two tangent points between the specified ellipse and the two tangents, and forming an opening arc with the tangents above the two tangent points and the part of the specified ellipse below the two tangent points; setting the upper part of the opening arc to a first color, setting the lower part of the opening arc to a second color, and setting the transparency of the upper part of the opening arc to a preset value, and determining the set opening arc as an opening magnetic field line; wherein the transparency is used to indicate the magnetic field strength, and as the opening width of the opening magnetic field line increases, the value of the transparency setting becomes smaller.
[0019] In an optional embodiment, after the step of forming an open arc from the tangent lines above the two tangent points and the portion of the specified ellipse below the two tangent points, the method further includes: stroking the open arc to obtain an edge contour with a specified width around the open arc; and setting the edge contour to a third color.
[0020] In an optional embodiment, the virtual storm is caused by a star; before the step of obtaining the size information of the target planet and the relative direction of the virtual storm and the target planet, the method further includes: obtaining the position information of the target planet; constructing a local coordinate system with the position of the target planet as the origin, the direction of the line connecting the position of the target planet and the star as the longitudinal axis, and the direction perpendicular to the longitudinal axis as the transverse axis; determining the angle between the longitudinal axis of the local coordinate system and the longitudinal axis of the world coordinate system of the star; multiplying the angle by a preset rotation matrix to obtain the coordinate value of the pixel point in the virtual scene in the local coordinate system, so as to obtain the magnetic field area of the target planet under the action of the virtual storm in the local coordinate system.
[0021] In a second aspect, the present invention provides a device for simulating a planetary magnetic field in a virtual scene, the device comprising: an information acquisition module for acquiring size information of a target planet and the relative direction between a virtual storm and the target planet; a parameter determination module for determining magnetic field display parameters of the target planet based on the size information of the target planet; wherein the magnetic field display parameters comprise: size parameters of a specified ellipse and / or tangent parameters of a specified ellipse for generating a magnetic field region of the target planet; and a magnetic field generation module for generating a magnetic field region of the target planet under the action of a virtual storm according to the magnetic field display parameters and the relative direction.
[0022] In a third aspect, the present invention provides an electronic device comprising a processor and a memory, wherein the memory stores machine executable instructions that can be executed by the processor, and the processor executes the machine executable instructions to implement a method for simulating a planetary magnetic field in the above-mentioned virtual scene.
[0023] In a fourth aspect, the present invention provides a computer-readable storage medium storing computer-executable instructions. When the computer-executable instructions are called and executed by a processor, the computer-executable instructions prompt the processor to implement a method for simulating the planetary magnetic field in the above-mentioned virtual scene.
[0024] The embodiments of the present invention bring the following beneficial effects:
[0025] The present invention provides a method, device and electronic device for simulating the magnetic field of a planet in a virtual scene. First, the size information of the target planet and the relative direction between the virtual storm and the target planet are obtained; then, based on the size information of the target planet, the magnetic field display parameters of the target planet are determined, and the magnetic field display parameters include the size parameters of a specified ellipse and / or the tangent parameters of a specified ellipse for generating the magnetic field area of the target planet; then, according to the magnetic field display parameters and the relative direction, the magnetic field area of the target planet under the action of the virtual storm is generated. This method can automatically adapt to the size of the planet, obtain the magnetic field display parameters of the planet, and then generate a magnetic field area composed of an ellipse and the tangent of the ellipse according to the magnetic field display parameters, so that the magnetic field effect of the planet under the action of the virtual storm can be visualized; at the same time, the magnetic field is characterized by an ellipse to conform to the physical magnetic field line effect in the real world, so that the planetary magnetic field in the virtual scene can be simulated more realistically, and the player's gaming experience can be improved.
[0026] Other features and advantages of the present invention will be set forth in the following description, or some features and advantages may be inferred or unambiguously determined from the description, or may be learned by implementing the above-mentioned technology of the present invention.
[0027] In order to make the above-mentioned objects, features and advantages of the present invention more obvious and easy to understand, preferred embodiments are specifically listed below and described in detail with reference to the attached drawings. BRIEF DESCRIPTION OF THE DRAWINGS
[0028] In order to more clearly illustrate the specific implementation methods of the present invention or the technical solutions in the prior art, the drawings required for use in the specific implementation methods or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are some implementation methods of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0029] Figure 1 The magnetic field effect of a planet after being impacted by a solar storm simulated in the prior art provided by the embodiment of the present invention;
[0030] Figure 2 A flowchart of a method for simulating a planetary magnetic field in a virtual scene provided by an embodiment of the present invention;
[0031] Figure 3 A flowchart of another method for simulating a planetary magnetic field in a virtual scene provided by an embodiment of the present invention;
[0032] Figure 4 A schematic diagram of a combined ellipse provided in an embodiment of the present invention;
[0033] Figure 5 A schematic diagram of a combined ellipse after stroke provided by an embodiment of the present invention;
[0034] Figure 6 A schematic diagram of a first magnetic field region including three magnetic field lines provided in an embodiment of the present invention;
[0035] Figure 7 A schematic diagram of a shear ellipse provided in an embodiment of the present invention;
[0036] Figure 8 A schematic diagram of a near magnetic field region including two closed magnetic field lines provided for an embodiment of the present invention;
[0037] Fig. 9 A schematic diagram of an open circular arc provided by an embodiment of the present invention;
[0038] Fig.10 A schematic diagram of the magnetic field region of a target planet under the action of a virtual storm provided by an embodiment of the present invention;
[0039] Fig.11 A flowchart of another method for simulating a planetary magnetic field in a virtual scene provided by an embodiment of the present invention;
[0040] Fig.12 A schematic diagram of the structure of a device for simulating a planetary magnetic field in a virtual scene provided by an embodiment of the present invention;
[0041] Fig.13 A schematic diagram of the structure of an electronic device provided by an embodiment of the present invention. DETAILED DESCRIPTION
[0042] 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.
[0043] 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.
[0044] In the real world, due to the outbreak of solar storms, planets will be hit by storms, but due to the protection of the planet's own magnetic field, there is a safe zone in the outer layer of the planet's atmosphere and in the shade of the planet. It can also be understood that due to the blocking of solar storms by the planet's magnetic field, there is a certain safe zone on the head and back of the planet. This safe zone can avoid the impact of solar storms.
[0045] In relevant game scenes, the safe zone of the planet can be used for the virtual character controlled by the player to stay and avoid the impact of the solar storm. Specifically, in the game scene, by placing several solid color fan-shaped models (such as Figure 1 The shaded area shown in the figure is used to simulate the magnetic field effect of a planet after being impacted by a solar storm, and the magnetic field effect is used to indicate the safe zone of the planet, such as Figure 1 The figure shows the magnetic field effect of a planet after being impacted by a solar storm, simulated in the prior art. Figure 1 The two circles in the figure represent two planets. However, this simulation method does not visualize the planetary magnetic field, and the magnetic field effect does not conform to the physical magnetic field in the real world. In the real physical magnetic field, the magnetic field between the planet and the star should be a protruding ellipse. Figure 1 The magnetic fields of the two planets facing the stars are concave; at the same time, simulating the safe zone only with a solid-color fan-shaped area can easily cause misunderstanding among players, making them unclear about the significance of the safe zone. This weakens the expression of the game's worldview and easily reduces the player's gaming experience.
[0046] Based on the above problems, the embodiments of the present invention provide a method, device and electronic device for simulating the magnetic field of a planet in a virtual scene. The technology can be applied to the simulation scene of the magnetic field effect of a planet in a virtual scene. In order to facilitate the understanding of the embodiments of the present invention, the simulation method of the magnetic field of a planet in a virtual scene disclosed in the embodiments of the present invention is first described in detail. Figure 2 As shown, the method comprises the following specific steps:
[0047] Step S202, obtaining the size information of the target planet and the relative direction between the virtual storm and the target planet.
[0048] The size information may include the radius, diameter or other size parameters of the target planet. The virtual storm may be a solar storm or a storm caused by other stars. Under the action of the virtual storm, the planet may generate a magnetic field safety zone according to its original magnetic field. In a specific implementation, the size information of the target planet may be input by a user through an electronic device, and the relative direction of the virtual storm and the target planet may be determined according to the position of the target planet.
[0049] Step S204, determining the magnetic field display parameters of the target planet based on the size information of the target planet; wherein the magnetic field display parameters include: size parameters of a specified ellipse and / or tangent parameters of a specified ellipse for generating the magnetic field region of the target planet.
[0050] Generally, the larger the size of the target planet, the more ellipses will be specified in the magnetic field display parameters of the target planet, and the size of the specified ellipses will be relatively larger. At the same time, the number of tangents of the specified ellipse will also be more, and the inclination angle of the tangent to the ellipse will be larger. Among them, the size parameters of the specified ellipse include the size of the minor axis radius and the major axis radius of the ellipse, and the tangent parameters of the specified ellipse include the coordinates of the tangent point position of the ellipse.
[0051] In a specific implementation, the magnetic field display parameters of the target planet may include only the size parameters of the specified ellipse, may include both the tangent parameters of the specified ellipse, or may include only the size parameters of the specified ellipse and the tangent parameters of the specified ellipse. Specifically, according to the size parameters of the specified ellipse, an ellipse may be obtained, which may represent the magnetic field lines of the magnetic field region and may also characterize the size of the magnetic field region; according to the tangent parameters of the specified ellipse, the tangent of the ellipse may be obtained, which may be used to characterize the magnetic field lines of the magnetic field region.
[0052] Step S206, generating a magnetic field region of the target planet under the action of a virtual storm according to the magnetic field display parameters and the relative direction.
[0053] In specific implementation, based on the magnetic field display parameters, the first magnetic field area of the target planet facing the direction of the virtual storm and the second magnetic field area generated by the target planet shielding the virtual storm can be generated. The first magnetic field area and the second magnetic field area here are both safe areas under the virtual storm. The first magnetic field area and the second magnetic field area are usually composed of a specified ellipse and a tangent of the specified ellipse, so that the magnetic field area of the target planet under the action of the virtual storm can be intuitively seen, and the magnetic field effect of the target planet can be visualized in the virtual scene, thereby improving the richness of the game screen; at the same time, the magnetic field effect is expressed through the ellipse and the tangent of the ellipse, which is consistent with the physical magnetic field effect in the real world.
[0054] The embodiment of the present invention provides a method for simulating the magnetic field of a planet in a virtual scene. First, the size information of the target planet and the relative direction between the virtual storm and the target planet are obtained; then, based on the size information of the target planet, the magnetic field display parameters of the target planet are determined, and the magnetic field display parameters include the size parameters of a specified ellipse and / or the tangent parameters of a specified ellipse for generating the magnetic field area of the target planet; then, according to the magnetic field display parameters and the relative direction, the magnetic field area of the target planet under the action of the virtual storm is generated. This method can automatically adapt to the size of the planet, obtain the magnetic field display parameters of the planet, and then generate a magnetic field area composed of an ellipse and the tangent of the ellipse according to the magnetic field display parameters, so that the magnetic field effect of the planet under the action of the virtual storm can be visualized; at the same time, the ellipse is used to characterize the magnetic field in accordance with the physical magnetic field line effect in the real world, so that the planetary magnetic field in the virtual scene can be simulated more realistically, and the player's gaming experience can be improved.
[0055] The embodiment of the present invention also provides another method for simulating the magnetic field of a planet in a virtual scene. The method is implemented on the basis of the above embodiment. The method focuses on describing the specific process of determining the magnetic field display parameters of the target planet based on the size information of the target planet (specifically implemented by the following step S304), and the specific process of generating the magnetic field area of the target planet under the action of the virtual storm according to the magnetic field display parameters and the relative direction (specifically implemented by the following steps S306-S310); Figure 3 As shown, the method comprises the following specific steps:
[0056] Step S302, obtaining the size information of the target planet and the relative direction between the virtual storm and the target planet.
[0057] Step S304, searching for magnetic field display parameters that match the size information of the target planet from a preset database; wherein the magnetic field display parameters include: size parameters of a specified ellipse and tangent parameters of the specified ellipse for generating the magnetic field area of the target planet; the magnetic field area of the target planet includes: a first magnetic field area of the target planet facing the direction of the virtual storm, and a second magnetic field area generated by the target planet shielding the virtual storm.
[0058] In the specific implementation, the preset database is pre-set by the R&D personnel, and the preset database stores multiple size parameters of the planet and the magnetic field display parameters corresponding to each size parameter. Specifically, the size parameter can be the radius of the planet, and the magnetic field display parameter can be parameters such as the magnetic field radius, opening width, and number of magnetic field lines, where the radius of the magnetic field corresponds to the size parameter of the specified ellipse, and the opening width corresponds to the tangent parameter of the specified ellipse. Generally, the larger the radius of the planet, the larger the magnetic field radius and opening width, and the more magnetic field lines there are.
[0059] Step S306: generating a first magnetic field region of the target planet facing the direction of the virtual storm based on the size parameters of the designated ellipse included in the magnetic field display parameters.
[0060] In the specific implementation, multiple ellipses with different eccentricities can be obtained according to the size parameters of the ellipse specified in the magnetic field display parameters. By combining multiple ellipses with different eccentricities, multiple magnetic field lines (also called magnetic flux lines) of the planet can be simulated, and then the first magnetic field area of the target planet facing the direction of the virtual storm can be obtained.
[0061] In practical applications, the magnetic field display parameters further include the first number of magnetic field lines included in the first magnetic field region; the size parameters of the specified ellipse in the magnetic field display parameters include: the minor axis radius and the major axis radius of the specified ellipse corresponding to each magnetic field line in the magnetic field lines included in the first magnetic field region; based on this, the above step S306 can be implemented by the following steps 10-11:
[0062] Step 10: for each magnetic field line in the first magnetic field region, generate a current magnetic field line according to the minor axis radius and the major axis radius of the specified ellipse corresponding to the current magnetic field line.
[0063] The magnetic field display parameters include the first number of magnetic field lines set in the first magnetic field region, and the size of the minor axis radius and the major axis radius of the specified ellipse required to generate each magnetic field line. In specific implementation, each of the first number of magnetic field lines included in the first magnetic field region can be used as the current magnetic field line in turn, and then the current magnetic field line is generated through the following steps 20-22:
[0064] Step 20, obtain the minor axis radius and major axis radius of the specified ellipse corresponding to the current magnetic field line, construct a first ellipse with a major axis radius of a first value and a minor axis radius of a second value, and construct a second ellipse with a major axis radius of the first value and a minor axis radius of a third value.
[0065] When the planet is not affected by the virtual storm, the magnetic field lines of the planet are elliptical, but under the influence of the virtual storm, the ellipses corresponding to the magnetic field lines in the first magnetic field region of the planet will be compressed. The present invention uses two semi-ellipses with different minor axis radii to combine to reflect this compression phenomenon. Therefore, each magnetic field line in the first magnetic field region needs to be composed of two ellipses, so that the magnetic field display parameters include: two ellipses corresponding to each magnetic field line, and the size of the major axis radius and the minor axis radius corresponding to each ellipse.
[0066] Specifically, by obtaining the sizes of the major axis radius and the minor axis radius of the two ellipses corresponding to the current magnetic field lines from the magnetic field display parameters, the first ellipse and the second ellipse can be obtained, wherein the first ellipse and the second ellipse have the same major axis radius and different minor axis radii, which is beneficial for the subsequent splicing of the semi-ellipse of the first ellipse and the semi-ellipse of the second ellipse, and can reflect the compression phenomenon of the magnetic field lines.
[0067] Step 21, select the semi-ellipse of the first ellipse and the semi-ellipse of the second ellipse, and combine the semi-ellipse of the first ellipse and the semi-ellipse of the second ellipse into a closed combined ellipse.
[0068] In specific implementation, the Y axis (equivalent to the vertical axis) of the first ellipse and the second ellipse is used as the dividing line. The upper half of the first ellipse and the lower half of the second ellipse can be selected, or the lower half of the first ellipse and the upper half of the second ellipse can be selected. The specific determination is based on research and development needs. Then the selected half ellipse of the first ellipse and the half ellipse of the second ellipse are spliced with the Y axis as the splicing line to obtain a closed combined ellipse. Figure 4 FIG. 1 is a schematic diagram of a combined ellipse provided by an embodiment of the present invention. Figure 4The upper half ellipse is the half ellipse of the first ellipse, and the lower half ellipse is the half ellipse of the second ellipse, wherein the major axis radius of the first ellipse and the second ellipse is a (equivalent to the above-mentioned first value), the minor axis radius of the first ellipse is b1 (equivalent to the above-mentioned second value), and the minor axis radius of the second ellipse is b2 (equivalent to the above-mentioned third value).
[0069] In practical applications, after selecting the semi-ellipse of the first ellipse and the semi-ellipse of the second ellipse, and combining the semi-ellipse of the first ellipse and the semi-ellipse of the second ellipse into a closed combined ellipse, it is also necessary to stroke the combined ellipse to obtain an edge contour with a specified width around the combined ellipse; then set the edge contour to a third color. The above-mentioned specified width can be set according to research and development requirements, for example, it can be set to 10cm or 5cm, etc., and the specific color of the above-mentioned third color can also be set according to research and development requirements. Figure 5 The figure shows a schematic diagram of a stroked combined ellipse provided in an embodiment of the present invention. The combined ellipse can be used to characterize the magnetic field lines. Stroke the combined ellipse can further distinguish the boundaries of each magnetic field line. After stroking the combined ellipse, the preliminary shape of the magnetic field line can be obtained.
[0070] In specific implementation, the stroke can be a combined ellipse that is repeatedly generated, except that the major axis radius is slightly enlarged to obtain a slightly larger ellipse, and finally the small ellipse is subtracted from the large ellipse to obtain the edge effect. Specifically, the specific process of stroking the combined ellipse to obtain an edge contour with a specified width around the combined ellipse includes: adding the first value to the first threshold to obtain a fourth value; adding the second value to the second threshold to obtain a fifth value; adding the third value to the third threshold to obtain a sixth value; constructing a third ellipse with a major axis radius of the fourth value and a minor axis radius of the fifth value, and constructing a fourth ellipse with a major axis radius of the fourth value and a minor axis radius of the sixth value; selecting the semi-ellipse of the third ellipse and the semi-ellipse of the fourth ellipse, and combining the semi-ellipse of the third ellipse and the semi-ellipse of the fourth ellipse into a closed combined ellipse; combining the semi-ellipse of the third ellipse and the semi-ellipse of the fourth ellipse into a closed combined ellipse, subtracting the combined ellipse formed by the semi-ellipse of the first ellipse and the semi-ellipse of the second ellipse, and obtaining the edge contour with a specified width corresponding to the combined ellipse formed by the semi-ellipse of the first ellipse and the semi-ellipse of the second ellipse.
[0071] The first threshold, the second threshold and the third threshold can be set according to research and development requirements. Generally, the larger the threshold is set, the thicker the stroke is.
[0072] Step 22, respectively setting the color and transparency inside and outside the combined ellipse, and determining the set combined ellipse as the current magnetic field line in the first magnetic field region.
[0073] In a specific implementation, the color inside the combined ellipse can be set to the first color, the color outside the combined ellipse can be set to the second color, and the transparency inside the combined ellipse can be set to a preset value; wherein the transparency inside the combined ellipse is used to indicate the magnetic field strength, and as the major axis radius of the combined ellipse increases, the value of the transparency setting inside the combined ellipse becomes smaller.
[0074] The first color, second color and preset value can be the default value set according to the research and development requirements, or can be the specific value input by the user according to the requirements. Specifically, the larger the radius of the major axis of the combined ellipse, that is, the larger the magnetic field radius of the magnetic field line, the smaller the value of the transparency setting in the combined ellipse. Generally, the smaller the value of the transparency setting, the more transparent it is, which can also be understood as the lighter the color here; at the same time, the smaller the value of the transparency setting, the smaller the magnetic field strength.
[0075] Step 11, combining the generated first number of magnetic field lines to obtain a first magnetic field region; wherein the magnetic field radius of the magnetic field lines in the first magnetic field region increases from inside to outside, and the magnetic field radius matches the major axis radius of the specified ellipse corresponding to the magnetic field line.
[0076] In a specific implementation, the location of the target planet is taken as the combination center, and in the relative direction between the target planet and the virtual storm, a first number of magnetic field lines are combined in order from the magnetic field radius of the magnetic field line to the largest to obtain a first magnetic field region. Figure 6 FIG. 1 is a schematic diagram of a first magnetic field region including three magnetic field lines. Figure 3 The location where the three magnetic field lines intersect is the center of the target planet.
[0077] Step S308, based on the size parameters of the designated ellipse and the tangent parameters of the designated ellipse included in the magnetic field display parameters, a second magnetic field region generated by the target planet blocking the virtual storm is generated.
[0078] In the specific implementation, according to the size and tangent parameters of the ellipse specified in the magnetic field display parameters, multiple ellipses with different eccentricities and tangents of some of the multiple ellipses can be obtained. Then, by combining the ellipses and tangents, multiple closed magnetic field lines and multiple open magnetic field lines of the planet can be simulated, and then the second magnetic field region generated by the target planet blocking the virtual storm can be obtained. The second magnetic field region can also be understood as the magnetic field region behind the target planet.
[0079] In practical applications, the second magnetic field region includes a near magnetic field region generated by the target planet blocking the virtual storm, and an infinite magnetic field region generated by the target planet blocking the virtual storm, wherein the near magnetic field region contains closed magnetic field lines, the shape of which can be a closed ellipse-like shape, and the infinite magnetic field region contains open magnetic field lines, which are open and composed of a semi-ellipse and a tangent. Based on this, the magnetic field display parameters also include: the second number of closed magnetic field lines contained in the near magnetic field region, and the third number of open magnetic field lines contained in the infinite magnetic field region; the size parameters of the specified ellipse in the magnetic field display parameters include: the size parameters of the specified ellipse corresponding to each closed magnetic field line, the size parameters of the specified ellipse corresponding to each open magnetic field line, and the tangent parameters of the specified ellipse.
[0080] Based on the above description, the above step S308 can be implemented by the following steps 30-33:
[0081] Step 30 , for each closed magnetic field line in the near magnetic field region, generating a current closed magnetic field line based on the size parameters of the specified ellipse corresponding to the current closed magnetic field line.
[0082] The magnetic field display parameters include the second number of closed magnetic field lines set in the near magnetic field area, and the size of the minor axis radius and the major axis radius of the specified ellipse required for generating each closed magnetic field line. In a specific implementation, each of the second number of closed magnetic field lines included in the near magnetic field area can be used as the current closed magnetic field line in sequence, and then the current closed magnetic field line is generated through the following steps 40-42:
[0083] Step 40, obtaining a target ellipse according to the size parameters of the designated ellipse corresponding to the current closed magnetic field line.
[0084] The size parameters of the designated ellipse corresponding to the current closed magnetic field line include: the size of the major axis radius and the minor axis radius of the ellipse; according to the size of the major axis radius and the minor axis radius of the ellipse, an ellipse can be obtained.
[0085] Step 41, scaling the target ellipse to obtain a sheared ellipse.
[0086] Scaling the target ellipse can also be understood as deforming the target ellipse. In order to meet the actual magnetic field effect, the horizontal coordinate value on the ellipse is usually scaled in the vertical axis direction as the vertical coordinate value of the target ellipse increases. Specifically, the horizontal coordinate value of the target ellipse is enlarged as the vertical coordinate value increases, and the ellipse after the enlargement operation is determined as the shear ellipse, such as Figure 7 FIG. 1 is a schematic diagram of a shear ellipse provided in an embodiment of the present invention. Figure 7The ellipse in the middle is the target ellipse, and the teardrop-shaped ellipse outside the target ellipse is the shear ellipse.
[0087] In practical applications, after scaling the target ellipse to obtain the shear ellipse, the shear ellipse needs to be stroked to obtain an edge contour with a specified width around the shear ellipse; then the edge contour is set to a third color. The above-mentioned specified width can be set according to research and development requirements, for example, it can be set to 10cm or 15cm, etc., and the specific color of the above-mentioned third color can also be set according to research and development requirements. The shear ellipse can be used to characterize the closed magnetic field lines. Stroke the shear ellipse can further distinguish the boundaries of each closed magnetic field line. After stroking the shear ellipse, the preliminary shape of the closed magnetic field line can be obtained.
[0088] In a specific implementation, the stroke process can be to repeatedly generate a shear ellipse, except that the major axis radius of the target ellipse is slightly enlarged to obtain a slightly larger shear ellipse, and then the smaller shear ellipse is subtracted from the larger shear ellipse to obtain the stroked shear ellipse.
[0089] Step 42, setting the color and transparency inside the shear ellipse, and setting the color outside the shear ellipse, and determining the set shear ellipse as the current closed magnetic field line.
[0090] In a specific implementation, the color inside the shear ellipse can be set to the first color, the color outside the shear ellipse can be set to the second color, and the transparency inside the shear ellipse can be set to a preset value; wherein the transparency inside the shear ellipse is used to indicate the magnetic field strength, and as the size of the shear ellipse increases, the value of the transparency setting inside the shear ellipse becomes smaller.
[0091] The first color, the second color and the preset value can be the default values set according to the research and development requirements, or they can be the specific values input by the user according to the requirements. Specifically, the larger the size of the shear ellipse, the smaller the value of the transparency setting in the shear ellipse. Generally, the smaller the value of the transparency setting, the more transparent it is, which can also be understood as the lighter the color here; at the same time, the smaller the value of the transparency setting, the smaller the magnetic field strength.
[0092] Step 31, combining the generated second number of closed magnetic field lines to obtain a near magnetic field region; wherein the magnetic field radius of the closed magnetic field lines in the near magnetic field region increases from inside to outside, and the magnetic field radius matches the size of the specified ellipse corresponding to the closed magnetic field line.
[0093] In a specific implementation, the position of the target planet is taken as the combination center, and in the direction where the target planet shields the virtual storm, the second number of closed magnetic field lines are combined in order from the magnetic field radius of the closed magnetic field line to the largest, to obtain the nearby magnetic field area. Figure 8The figure shows a schematic diagram of the nearby magnetic field region containing two closed magnetic field lines. Figure 8 The position where the two closed magnetic field lines intersect is the center position of the target planet.
[0094] Step 32 : for each opening magnetic field line in the infinite magnetic field region, generate the current opening magnetic field line according to the size parameters and tangent parameters of the specified ellipse corresponding to the current opening magnetic field line.
[0095] In the specific implementation, according to the size parameters of the ellipse and the tangent parameters of the specified ellipse in the magnetic field display parameters, multiple ellipses with different eccentricities and two tangents corresponding to each ellipse can be obtained. By combining the ellipses and the tangents of the ellipses, multiple open magnetic field lines of the planet can be simulated, and then the infinite magnetic field area in the direction of the virtual storm shielded by the target planet can be obtained.
[0096] The above magnetic field display parameters include the third number of open magnetic field lines set in the infinite magnetic field region, the size of the short axis radius and the long axis radius of the specified ellipse required to generate each open magnetic field line, and the parameters for generating the tangent corresponding to each specified ellipse. In specific implementation, each of the third number of open magnetic field lines contained in the infinite magnetic field region can be used as the current open magnetic field line in sequence, and then the current open magnetic field line is generated through the following steps 50-53:
[0097] Step 50, obtaining the designated ellipse according to the size parameters of the designated ellipse.
[0098] The size parameters of the designated ellipse corresponding to the open magnetic field line include: the size of the major axis radius and the minor axis radius of the ellipse; according to the size of the major axis radius and the minor axis radius of the ellipse, a designated ellipse can be obtained.
[0099] Step 51, determining two tangent lines of the designated ellipse according to the tangent line parameters, and making the two tangent lines tangent to the designated ellipse.
[0100] The above tangent parameters include the position coordinates of two tangent points on the specified ellipse, and then the two tangent lines of the specified ellipse can be generated using the tangent equation.
[0101] Step 52, determining two tangent points between the designated ellipse and the two tangent lines, and combining the tangent lines above the two tangent points and the portion of the designated ellipse below the two tangent points into an open arc.
[0102] like Fig. 9 The diagram shows a schematic diagram of an open circular arc, which is composed of tangent lines above two tangent points and a portion below the two tangent points in a specified ellipse.
[0103] In practical applications, after obtaining the open circular arc, it is also necessary to stroke the open circular arc to obtain an edge contour with a specified width around the open circular arc; then the edge contour is set to a third color. The above-mentioned specified width can be set according to research and development requirements, and the specific color of the above-mentioned third color can also be set according to research and development requirements. The open circular arc can be used to characterize the open magnetic field lines. Stroke the open circular arc to further distinguish the boundaries of each open magnetic field line. After stroking the open circular arc, the preliminary shape of the open magnetic field line can be obtained.
[0104] In a specific implementation, the stroke can be an open arc that is repeatedly generated, except that the radius of the major axis of the specified ellipse is slightly enlarged to obtain a slightly larger open arc, and then the smaller open arc is subtracted from the larger open arc to obtain the stroked open arc.
[0105] Step 53, setting the upper part of the opening arc to the first color, setting the lower part of the opening arc to the second color, and setting the transparency of the upper part of the opening arc to a preset value, and determining the set opening arc as an opening magnetic field line; wherein the transparency is used to indicate the magnetic field strength, and as the opening width of the opening magnetic field line increases, the value of the transparency setting becomes smaller.
[0106] The first color, the second color and the preset value can be the default values set according to the research and development requirements, or they can be the specific values input by the user according to the requirements. Specifically, the larger the opening width of the opening magnetic field line, that is, the larger the opening width of the opening arc, the smaller the value of the transparency setting in the opening arc. Generally, the smaller the value of the transparency setting, the more transparent it is, which can also be understood as the lighter the color here; at the same time, the smaller the value of the transparency setting, the smaller the magnetic field strength.
[0107] Step 33, combining the generated third number of open magnetic field lines to obtain an infinite magnetic field region; wherein the opening widths of the open magnetic field lines in the infinite magnetic field region increase from inside to outside.
[0108] In the specific implementation, the position of the target planet is taken as the combination center, and in the direction where the target planet shields the virtual storm, the third number of open magnetic field lines are combined in sequence from the opening width of the open magnetic field lines small to large to obtain an infinite magnetic field region.
[0109] Step S310, combining the first magnetic field region and the second magnetic field region according to the relative directions to obtain the magnetic field region of the target planet under the action of the virtual storm.
[0110] In specific implementation, with the location of the target planet as the center, a first magnetic field region is set in the relative direction between the target planet and the virtual storm, and a third magnetic field region is set in the direction where the target planet shields the virtual storm, to obtain the magnetic field region of the target planet under the action of the virtual storm. Fig.10 Shown is a schematic diagram of the magnetic field region of the target planet under the influence of the virtual storm.
[0111] The simulation method of the planetary magnetic field in the above virtual scene can use a combination of several ellipses with different eccentricities to generate the magnetic field area of the planet facing the virtual storm; use a combination of semi-ellipses and shear ellipses to generate the near magnetic field area behind the planet; use a combination of semi-ellipses and semi-ellipse tangents to generate an infinite magnetic field area with an opening. This method quickly generates the magnetic field of the planet under the influence of the virtual storm in the virtual scene based on the size information of the planet. At the same time, this method visualizes the magnetic field of a single planet, which improves the richness of the game screen.
[0112] The embodiment of the present invention also provides another method for simulating the magnetic field of a planet in a virtual scene. The method is implemented on the basis of the above embodiment. The method focuses on describing the specific process of simulating the magnetic field effect of the planet under the action of the virtual storm of the star in the local coordinate system corresponding to the target planet; Fig.11 As shown, the method comprises the following specific steps:
[0113] Step S402, obtaining the position information and size information of the target planet.
[0114] Step S402, constructing a local coordinate system with the position of the target planet as the origin, the direction of the line connecting the position of the target planet and the star as the vertical axis direction, and the direction perpendicular to the vertical axis direction as the horizontal axis direction.
[0115] In the specific implementation, since there are multiple planets in the virtual scene, in order to quickly obtain the magnetic field effect corresponding to each planet, each planet is required to take itself as the origin, the direction of the line connecting the star and the planet as the vertical axis, and the left side of the vertical axis as the horizontal axis to construct the local coordinate system corresponding to the planet.
[0116] Step S406, determining the angle between the longitudinal axis of the local coordinate system and the longitudinal axis of the world coordinate system where the star is located.
[0117] Step S408: multiply the angle by a preset rotation matrix to obtain the coordinate value of the pixel point in the virtual scene in the local coordinate system.
[0118] Since the planets and stars are initially set in the world coordinate system, that is, each pixel in the virtual scene is also set in the world coordinate system, by substituting the angle into the preset rotation matrix, the coordinate value of each pixel in the virtual scene in the local coordinate system can be calculated, so that the magnetic field area of the target planet under the influence of the virtual storm can be obtained in the local coordinate system later.
[0119] Step S410, determining the relative direction between the virtual storm caused by the star and the target planet according to the position information of the target planet.
[0120] Step S412: determining the magnetic field display parameters of the target planet based on the size information of the target planet.
[0121] The above-mentioned magnetic field display parameters may include: a first number of magnetic field lines contained in a first magnetic field region of the target planet facing the direction of the virtual storm, a second number of nearby magnetic field regions generated by the target planet blocking the virtual storm, and a third number of infinitely far magnetic field regions generated by the target planet blocking the virtual storm, as well as size parameters of a specified ellipse used to generate the magnetic field region of the target planet and tangent parameters of the specified ellipse.
[0122] Step S414, obtaining the magnetic field region of the target planet under the virtual storm according to the magnetic field display parameters, the relative direction and the coordinate values of the pixel points in the virtual scene in the local coordinate system.
[0123] For the first magnetic field region of the target planet facing the direction of the virtual storm: first, two ellipses are determined according to the coordinate values of the pixel points in the virtual scene in the local coordinate system and the major axis radius and minor axis radius of the specified ellipse; then, with the Y axis as the dividing line, 1 / 2 of each ellipse is taken to form a combined ellipse; then, the combined ellipse is stroked to obtain a stroked combined ellipse (one combined ellipse corresponds to one magnetic flux line); the above operation is repeated to generate a first number of stroked combined ellipses, and the stroke color of each combined ellipse and the color inside the ellipse (that is, the color of the pixel point) are set, and then the first number of color-set combined ellipses are merged to obtain the first magnetic field region.
[0124] For the infinite magnetic field region generated by the target planet blocking the virtual storm: first generate an ellipse, then use the tangent equation to generate two tangents of the ellipse, set the part above the tangent and inside the ellipse to white, and the part below the tangent and the ellipse to black; then stroke the part above the tangent point of the tangent and the part below the ellipse to obtain the stroked magnetic field lines. Repeat the above steps to obtain the third number of open magnetic field lines, and combine the third number of open magnetic field lines to obtain the infinite magnetic field region.
[0125] For the near magnetic field region generated by the target planet blocking the virtual storm: first, construct the target ellipse according to the ellipse size parameters, and then in the Y-axis direction, as the y value increases, enlarge the coordinates of the target ellipse in the X-axis direction to obtain the shear ellipse; repeat the above steps to obtain a second number of shear ellipses of different sizes, combine and stroke the second number of shear ellipses to obtain the near magnetic field region, where one shear ellipse corresponds to a magnetic field line.
[0126] Finally, by combining the above three magnetic field regions, we can obtain the magnetic field effect of the target planet under the influence of the virtual storm.
[0127] The simulation method of the planetary magnetic field in the above virtual scene visualizes the planetary magnetic field. At the same time, it uses layers of gradient colors to further accurately express the concepts of safe zones and magnetic fields. At the same time, this method produces logical planetary safe zone effects according to the real physical phenomena of the planetary magnetic field, which is conducive to improving the player's gaming experience.
[0128] Corresponding to the above method embodiment, the embodiment of the present invention provides a simulation device for the planetary magnetic field in a virtual scene, such as Fig.12 As shown, the device comprises:
[0129] The information acquisition module 51 is used to obtain the size information of the target planet and the relative direction between the virtual storm and the target planet.
[0130] The parameter determination module 52 is used to determine the magnetic field display parameters of the target planet based on the size information of the target planet; wherein the magnetic field display parameters include: size parameters of a specified ellipse and / or tangent parameters of a specified ellipse used to generate the magnetic field region of the target planet.
[0131] The magnetic field generating module 53 is used to generate the magnetic field area of the target planet under the action of the virtual storm according to the magnetic field display parameters and the relative direction.
[0132] The device for simulating the planetary magnetic field in the above virtual scene first obtains the size information of the target planet and the relative direction between the virtual storm and the target planet; then, based on the size information of the target planet, the magnetic field display parameters of the target planet are determined, and the magnetic field display parameters include the size parameters of the specified ellipse and / or the tangent parameters of the specified ellipse used to generate the magnetic field area of the target planet; then, according to the magnetic field display parameters and the relative direction, the magnetic field area of the target planet under the action of the virtual storm is generated. This method can automatically adapt to the size of the planet, obtain the magnetic field display parameters of the planet, and then generate a magnetic field area composed of an ellipse and the tangent of the ellipse according to the magnetic field display parameters, so that the magnetic field effect of the planet under the action of the virtual storm can be visualized; at the same time, the ellipse is used to characterize the magnetic field in accordance with the physical magnetic field line effect in the real world, so that the planetary magnetic field in the virtual scene can be simulated more realistically, and the player's gaming experience can be enhanced.
[0133] Specifically, the information acquisition module 51 is also used to search for magnetic field display parameters that match the size information of the target planet from a preset database; wherein the preset database stores multiple size parameters of the planet and the magnetic field display parameters corresponding to each size parameter.
[0134] In a specific implementation, the magnetic field region of the target planet includes: a first magnetic field region in which the target planet faces the direction of the virtual storm, and a second magnetic field region generated by the target planet blocking the virtual storm; the magnetic field generation module 53 includes: a first region generation module, which is used to generate the first magnetic field region in which the target planet faces the direction of the virtual storm based on the size parameters of the specified ellipse included in the magnetic field display parameters; a second region generation module, which is used to generate the second magnetic field region generated by the target planet blocking the virtual storm based on the size parameters of the specified ellipse and the tangent parameters of the specified ellipse included in the magnetic field display parameters; and a region combination module, which is used to combine the first magnetic field region and the second magnetic field region according to the relative direction to obtain the magnetic field region of the target planet under the action of the virtual storm.
[0135] Furthermore, the magnetic field display parameters also include a first number of magnetic field lines contained in the first magnetic field region; the size parameters of the specified ellipse in the magnetic field display parameters include: the minor axis radius and major axis radius of the specified ellipse corresponding to each magnetic field line in the first magnetic field region; the first region generation module is also used to: for each magnetic field line in the first magnetic field region, generate the current magnetic field line according to the minor axis radius and major axis radius of the specified ellipse corresponding to the current magnetic field line; combine the generated first number of magnetic field lines to obtain the first magnetic field region; wherein the magnetic field radius of the magnetic field lines in the first magnetic field region increases from the inside to the outside, and the magnetic field radius matches the major axis radius of the specified ellipse corresponding to the magnetic field line.
[0136] Specifically, the above-mentioned first area generation module is also used to: obtain the minor axis radius and major axis radius of the specified ellipse corresponding to the current magnetic field line, construct a first ellipse with a major axis radius of a first value and a minor axis radius of a second value, and construct a second ellipse with a major axis radius of the first value and a minor axis radius of a third value; select the semi-ellipse of the first ellipse and the semi-ellipse of the second ellipse, and combine the semi-ellipses of the first ellipse and the semi-ellipses of the second ellipse into a closed combined ellipse; respectively set the color and transparency inside and outside the combined ellipse, and determine the set combined ellipse as the current magnetic field line in the first magnetic field area.
[0137] Specifically, the above-mentioned first area generation module is also used to: set the color inside the combined ellipse to the first color, set the color outside the combined ellipse to the second color, and set the transparency inside the combined ellipse to a preset value; wherein the transparency inside the combined ellipse is used to indicate the magnetic field strength, and as the major axis radius of the combined ellipse increases, the value of the transparency setting inside the combined ellipse becomes smaller.
[0138] Furthermore, the above-mentioned device also includes a first stroking module, which is used to: after selecting the semi-ellipse of the first ellipse and the semi-ellipse of the second ellipse, and combining the semi-ellipse of the first ellipse and the semi-ellipse of the second ellipse into a closed combined ellipse, stroke the combined ellipse to obtain an edge contour with a specified width around the combined ellipse; and set the edge contour to a third color.
[0139] Specifically, the above-mentioned first stroke module is also used to: add the first value to the first threshold to obtain a fourth value; add the second value to the second threshold to obtain a fifth value; add the third value to the third threshold to obtain a sixth value; construct a third ellipse with a major axis radius of the fourth value and a minor axis radius of the fifth value, and construct a fourth ellipse with a major axis radius of the fourth value and a minor axis radius of the sixth value; select the semi-ellipse of the third ellipse and the semi-ellipse of the fourth ellipse, and combine the semi-ellipse of the third ellipse and the semi-ellipse of the fourth ellipse into a closed combined ellipse; combine the semi-ellipse of the third ellipse and the semi-ellipse of the fourth ellipse into a closed combined ellipse, subtract the combined ellipse formed by the semi-ellipse of the first ellipse and the semi-ellipse of the second ellipse, and obtain the edge contour with a specified width corresponding to the combined ellipse formed by the semi-ellipse of the first ellipse and the semi-ellipse of the second ellipse.
[0140] Furthermore, the second magnetic field region includes a near magnetic field region generated by the target planet blocking the virtual storm, and an infinite magnetic field region generated by the target planet blocking the virtual storm; the magnetic field display parameters also include: a second number of closed magnetic field lines contained in the near magnetic field region, and a third number of open magnetic field lines contained in the infinite magnetic field region; the size parameters of the specified ellipse in the magnetic field display parameters include: the size parameters of the specified ellipse corresponding to each closed magnetic field line, the size parameters of the specified ellipse corresponding to each open magnetic field line, and the tangent parameters of the specified ellipse; the second region generation module is also used to: for each closed magnetic field line in the near magnetic field region, based on the current closed magnetic field The current closed magnetic field line is generated according to the size parameters of the specified ellipse corresponding to the line; the generated second number of closed magnetic field lines are combined to obtain a near magnetic field region; wherein the magnetic field radius of the closed magnetic field line in the near magnetic field region increases from the inside to the outside, and the magnetic field radius matches the size of the specified ellipse corresponding to the closed magnetic field line; for each open magnetic field line in the infinite magnetic field region, the current open magnetic field line is generated according to the size parameters and tangent parameters of the specified ellipse corresponding to the current open magnetic field line; the generated third number of open magnetic field lines are combined to obtain an infinite magnetic field region; wherein the opening width of the open magnetic field lines in the infinite magnetic field region increases from the inside to the outside.
[0141] Specifically, the above-mentioned second area generation module is also used to: obtain the target ellipse according to the size parameters of the specified ellipse corresponding to the current open magnetic field line; scale the target ellipse to obtain the shear ellipse; set the color and transparency inside the shear ellipse, and set the color outside the shear ellipse, and determine the set shear ellipse as the current closed magnetic field line.
[0142] Specifically, the second region generating module is further used to: enlarge the horizontal coordinate value of the target ellipse as the vertical coordinate value increases, and determine the ellipse after the enlargement operation as the shear ellipse.
[0143] In a specific implementation, the above-mentioned second area generation module is also used to: set the color inside the shear ellipse to the first color, set the color outside the shear ellipse to the second color, and set the transparency inside the shear ellipse to a preset value; wherein the transparency inside the shear ellipse is used to indicate the magnetic field strength, and as the size of the shear ellipse increases, the value of the transparency setting inside the shear ellipse becomes smaller.
[0144] The device also includes a second stroke module, which is used to: after scaling the target ellipse to obtain a sheared ellipse, stroke the sheared ellipse to obtain an edge contour with a specified width around the sheared ellipse; and set the edge contour to a third color.
[0145] Furthermore, the above-mentioned second area generation module is also used to: obtain a specified ellipse according to the size parameters of the specified ellipse; determine two tangents of the specified ellipse according to the tangent parameters, and make the two tangents tangent to the specified ellipse; determine two tangent points between the specified ellipse and the two tangents, and form an open arc with the tangents above the two tangent points and the part of the specified ellipse below the two tangent points; set the upper part of the opening arc to the first color, set the lower part of the opening arc to the second color, and set the transparency of the upper part of the opening arc to a preset value, and determine the set opening arc as an opening magnetic field line; wherein the transparency is used to indicate the magnetic field strength, and as the opening width of the opening magnetic field line increases, the value of the transparency setting becomes smaller.
[0146] Specifically, the above-mentioned device also includes a third stroke module, which is used to: after the tangents above the two tangent points and the parts below the two tangent points in the specified ellipse form open magnetic field lines, stroke the open arc to obtain an edge contour with a specified width around the open arc; set the edge contour to a third color.
[0147] Furthermore, the above-mentioned virtual storm is caused by a star, and the above-mentioned device also includes a coordinate conversion module, which is used to: obtain the position information of the target planet before obtaining the size information of the target planet and the relative direction of the virtual storm and the target planet; construct a local coordinate system with the position of the target planet as the origin, the direction of the line connecting the position of the target planet and the star as the longitudinal axis direction, and the direction perpendicular to the longitudinal axis direction as the transverse axis direction; determine the angle between the longitudinal axis of the local coordinate system and the longitudinal axis of the world coordinate system where the star is located; multiply the angle by a preset rotation matrix to obtain the coordinate value of the pixel point in the virtual scene in the local coordinate system, so as to obtain the magnetic field area of the target planet under the action of the virtual storm in the local coordinate system.
[0148] The device for simulating the planetary magnetic field in a virtual scene provided in an embodiment of the present invention has the same implementation principle and technical effects as those of the aforementioned method embodiment. For the sake of brief description, for matters not mentioned in the device embodiment, reference may be made to the corresponding contents in the aforementioned method embodiment.
[0149] The embodiment of the present invention further provides an electronic device, such as Fig.13 As shown, the electronic device includes a processor and a memory, the memory stores machine executable instructions that can be executed by the processor, and the processor executes the machine executable instructions to implement the simulation method of the planetary magnetic field in the above virtual scene.
[0150] Specifically, the simulation method of the planetary magnetic field in the virtual scene includes: obtaining the size information of the target planet and the relative direction between the virtual storm and the target planet; determining the magnetic field display parameters of the target planet based on the size information of the target planet; wherein the magnetic field display parameters include: size parameters of a specified ellipse and / or tangent parameters of the specified ellipse for generating the magnetic field area of the target planet; and generating the magnetic field area of the target planet under the action of the virtual storm according to the magnetic field display parameters and the relative direction.
[0151] The above method can automatically adapt to the size of the planet, obtain the magnetic field display parameters of the planet, and then generate a magnetic field area composed of an ellipse and the tangent of the ellipse according to the magnetic field display parameters, so that the magnetic field effect of the planet under the action of the virtual storm can be visualized; at the same time, the use of an ellipse to characterize the magnetic field is consistent with the physical magnetic field line effect in the real world, so that the planetary magnetic field in the virtual scene can be simulated more realistically, thereby enhancing the player's gaming experience.
[0152] In an optional embodiment, the step of determining the magnetic field display parameters of the target planet based on the size information of the target planet includes: searching for magnetic field display parameters that match the size information of the target planet from a preset database; wherein the preset database stores multiple size parameters of the planet and the magnetic field display parameters corresponding to each size parameter.
[0153] In an optional embodiment, the magnetic field region of the target planet includes: a first magnetic field region in the direction of the virtual storm facing the target planet, and a second magnetic field region generated by the target planet blocking the virtual storm; the step of generating the magnetic field region of the target planet under the action of the virtual storm according to the magnetic field display parameters and the relative direction includes: generating the first magnetic field region in the direction of the virtual storm facing the target planet based on the size parameters of the specified ellipse included in the magnetic field display parameters; generating the second magnetic field region generated by the target planet blocking the virtual storm based on the size parameters of the specified ellipse and the tangent parameters of the specified ellipse included in the magnetic field display parameters; combining the first magnetic field region and the second magnetic field region according to the relative direction to obtain the magnetic field region of the target planet under the action of the virtual storm.
[0154] In an optional embodiment, the magnetic field display parameters also include a first number of magnetic field lines contained in the first magnetic field region; the size parameters of the specified ellipse in the magnetic field display parameters include: the minor axis radius and major axis radius of the specified ellipse corresponding to each magnetic field line in the first magnetic field region; the step of generating the first magnetic field region of the target planet facing the virtual storm direction based on the size parameters of the specified ellipse included in the magnetic field display parameters includes: for each magnetic field line in the first magnetic field region, generating the current magnetic field line according to the minor axis radius and major axis radius of the specified ellipse corresponding to the current magnetic field line; combining the generated first number of magnetic field lines to obtain the first magnetic field region; wherein the magnetic field radius of the magnetic field lines in the first magnetic field region increases from the inside to the outside, and the magnetic field radius matches the major axis radius of the specified ellipse corresponding to the magnetic field line.
[0155] In an optional embodiment, the step of generating the current magnetic field line according to the minor axis radius and major axis radius of the specified ellipse corresponding to the current magnetic field line includes: obtaining the minor axis radius and major axis radius of the specified ellipse corresponding to the current magnetic field line, constructing a first ellipse with a major axis radius of a first value and a minor axis radius of a second value, and constructing a second ellipse with a major axis radius of the first value and a minor axis radius of a third value; selecting a semi-ellipse of the first ellipse and a semi-ellipse of the second ellipse, and combining the semi-ellipses of the first ellipse and the semi-ellipses of the second ellipse into a closed combined ellipse; respectively setting the color and transparency inside and outside the combined ellipse, and determining the set combined ellipse as the current magnetic field line in the first magnetic field region.
[0156] In an optional embodiment, the above-mentioned steps of respectively setting the color and transparency inside and outside the combined ellipse include: setting the color inside the combined ellipse to a first color, setting the color outside the combined ellipse to a second color, and setting the transparency inside the combined ellipse to a preset value; wherein the transparency inside the combined ellipse is used to indicate the magnetic field strength, and as the radius of the major axis of the combined ellipse increases, the value of the transparency setting inside the combined ellipse becomes smaller.
[0157] In an optional embodiment, after the step of selecting the semi-ellipse of the first ellipse and the semi-ellipse of the second ellipse, and combining the semi-ellipse of the first ellipse and the semi-ellipse of the second ellipse into a closed combined ellipse, the method further includes: stroking the combined ellipse to obtain an edge contour with a specified width around the combined ellipse; and setting the edge contour to a third color.
[0158] In an optional embodiment, the above-mentioned step of stroking the combined ellipse to obtain an edge contour with a specified width around the combined ellipse includes: adding the first value to the first threshold to obtain a fourth value; adding the second value to the second threshold to obtain a fifth value; adding the third value to the third threshold to obtain a sixth value; constructing a third ellipse with a major axis radius of the fourth value and a minor axis radius of the fifth value, and constructing a fourth ellipse with a major axis radius of the fourth value and a minor axis radius of the sixth value; selecting a semi-ellipse of the third ellipse and a semi-ellipse of the fourth ellipse, and combining the semi-ellipse of the third ellipse and the semi-ellipse of the fourth ellipse into a closed combined ellipse; combining the semi-ellipse of the third ellipse and the semi-ellipse of the fourth ellipse into a closed combined ellipse, subtracting the combined ellipse formed by the semi-ellipse of the first ellipse and the semi-ellipse of the second ellipse, to obtain an edge contour with a specified width corresponding to the combined ellipse formed by the semi-ellipse of the first ellipse and the semi-ellipse of the second ellipse.
[0159] In an optional embodiment, the second magnetic field region includes a near magnetic field region generated by the target planet blocking the virtual storm, and an infinite magnetic field region generated by the target planet blocking the virtual storm; the magnetic field display parameters also include: a second number of closed magnetic field lines contained in the near magnetic field region, and a third number of open magnetic field lines contained in the infinite magnetic field region; the size parameters of the specified ellipse in the magnetic field display parameters include: the size parameters of the specified ellipse corresponding to each closed magnetic field line, the size parameters of the specified ellipse corresponding to each open magnetic field line, and the tangent parameters of the specified ellipse; the step of generating the second magnetic field region generated by the target planet blocking the virtual storm based on the size parameters of the specified ellipse and the tangent parameters of the specified ellipse included in the magnetic field display parameters includes: For each closed magnetic field line in the near magnetic field region, the current closed magnetic field line is generated based on the size parameters of the specified ellipse corresponding to the current closed magnetic field line; the generated second number of closed magnetic field lines are combined to obtain the near magnetic field region; wherein the magnetic field radius of the closed magnetic field line in the near magnetic field region increases from the inside to the outside, and the magnetic field radius matches the size of the specified ellipse corresponding to the closed magnetic field line; for each open magnetic field line in the infinite magnetic field region, the current open magnetic field line is generated according to the size parameters and tangent parameters of the specified ellipse corresponding to the current open magnetic field line; the generated third number of open magnetic field lines are combined to obtain the infinite magnetic field region; wherein the opening width of the open magnetic field line in the infinite magnetic field region increases from the inside to the outside.
[0160] In an optional embodiment, the step of generating the current closed magnetic field line based on the size parameters of the specified ellipse corresponding to the current closed magnetic field line includes: obtaining a target ellipse according to the size parameters of the specified ellipse corresponding to the current closed magnetic field line; scaling the target ellipse to obtain a shear ellipse; setting the color and transparency inside the shear ellipse, and setting the color outside the shear ellipse, and determining the set shear ellipse as the current closed magnetic field line.
[0161] In an optional embodiment, the step of scaling the target ellipse to obtain the shear ellipse includes: enlarging the horizontal coordinate value of the target ellipse as the vertical coordinate value increases, and determining the enlarged ellipse as the shear ellipse.
[0162] In an optional embodiment, the above-mentioned steps of setting the color and transparency within the shear ellipse, and setting the color outside the shear ellipse, include: setting the color within the shear ellipse to a first color, setting the color outside the shear ellipse to a second color, and setting the transparency within the shear ellipse to a preset value; wherein the transparency within the shear ellipse is used to indicate the magnetic field strength, and as the size of the shear ellipse increases, the value of the transparency setting within the shear ellipse becomes smaller.
[0163] In an optional embodiment, after the step of scaling the target ellipse to obtain the sheared ellipse, the method further includes: stroking the sheared ellipse to obtain an edge contour with a specified width around the sheared ellipse; and setting the edge contour to a third color.
[0164] In an optional embodiment, the step of generating the current opening magnetic field line according to the size parameters and tangent parameters of the specified ellipse corresponding to the current opening magnetic field line includes: obtaining the specified ellipse according to the size parameters of the specified ellipse; determining two tangents of the specified ellipse according to the tangent parameters, and making the two tangents tangent to the specified ellipse; determining two tangent points between the specified ellipse and the two tangents, and forming an opening arc with the tangents above the two tangent points and the part of the specified ellipse below the two tangent points; setting the upper part of the opening arc to a first color, setting the lower part of the opening arc to a second color, and setting the transparency of the upper part of the opening arc to a preset value, and determining the set opening arc as an opening magnetic field line; wherein the transparency is used to indicate the magnetic field strength, and as the opening width of the opening magnetic field line increases, the value of the transparency setting becomes smaller.
[0165] In an optional embodiment, after the step of forming an open arc from the tangent lines above the two tangent points and the portion of the specified ellipse below the two tangent points, the method further includes: stroking the open arc to obtain an edge contour with a specified width around the open arc; and setting the edge contour to a third color.
[0166] In an optional embodiment, the virtual storm is caused by a star; before the step of obtaining the size information of the target planet and the relative direction of the virtual storm and the target planet, the method further includes: obtaining the position information of the target planet; constructing a local coordinate system with the position of the target planet as the origin, the direction of the line connecting the position of the target planet and the star as the longitudinal axis, and the direction perpendicular to the longitudinal axis as the transverse axis; determining the angle between the longitudinal axis of the local coordinate system and the longitudinal axis of the world coordinate system of the star; multiplying the angle by a preset rotation matrix to obtain the coordinate value of the pixel point in the virtual scene in the local coordinate system, so as to obtain the magnetic field area of the target planet under the action of the virtual storm in the local coordinate system.
[0167] Further, Fig.13 The electronic device shown further includes a bus 102 and a communication interface 103 , and the processor 101 , the communication interface 103 and the memory 100 are connected via the bus 102 .
[0168] The memory 100 may include a high-speed random access memory (RAM), and may also include a non-volatile memory (non-volatile memory), such as at least one disk storage. The communication connection between the system network element and at least one other network element is realized through at least one communication interface 103 (which may be wired or wireless), and the Internet, wide area network, local area network, metropolitan area network, etc. may be used. The bus 102 may be an ISA bus, a PCI bus, or an EISA bus, etc. The bus may be divided into an address bus, a data bus, a control bus, etc. For ease of representation, Fig.13 Only one bidirectional arrow is used in the diagram, but this does not mean that there is only one bus or only one type of bus.
[0169] The processor 101 may be an integrated circuit chip with signal processing capabilities. In the implementation process, each step of the above method can be completed by the hardware integrated logic circuit or software instructions in the processor 101. The above processor 101 can be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), etc.; it can also be a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field-programmable gate array (FPGA) or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components. The methods, steps and logic block diagrams disclosed in the embodiments of the present invention can be implemented or executed. The general processor can be a microprocessor or the processor can also be any conventional processor, etc. The steps of the method disclosed in the embodiment of the present invention can be directly embodied as a hardware decoding processor for execution, or a combination of hardware and software modules in the decoding processor for execution. The software module may be located in a storage medium mature in the art, such as a random access memory, a flash memory, a read-only memory, a programmable read-only memory, or an electrically erasable programmable memory, a register, etc. The storage medium is located in the memory 100, and the processor 101 reads the information in the memory 100 and completes the steps of the method of the above embodiment in combination with its hardware.
[0170] An embodiment of the present invention further provides a computer-readable storage medium, which stores computer-executable instructions. When the computer-executable instructions are called and executed by a processor, the computer-executable instructions prompt the processor to implement a method for simulating the planetary magnetic field in the above-mentioned virtual scene. For specific implementation, please refer to the method embodiment, which will not be repeated here.
[0171] Specifically, the simulation method of the planetary magnetic field in the virtual scene includes: obtaining the size information of the target planet and the relative direction between the virtual storm and the target planet; determining the magnetic field display parameters of the target planet based on the size information of the target planet; wherein the magnetic field display parameters include: size parameters of a specified ellipse and / or tangent parameters of the specified ellipse for generating the magnetic field area of the target planet; and generating the magnetic field area of the target planet under the action of the virtual storm according to the magnetic field display parameters and the relative direction.
[0172] The above method can automatically adapt to the size of the planet, obtain the magnetic field display parameters of the planet, and then generate a magnetic field area composed of an ellipse and the tangent of the ellipse according to the magnetic field display parameters, so that the magnetic field effect of the planet under the action of the virtual storm can be visualized; at the same time, the use of an ellipse to characterize the magnetic field is consistent with the physical magnetic field line effect in the real world, so that the planetary magnetic field in the virtual scene can be simulated more realistically, thereby enhancing the player's gaming experience.
[0173] In an optional embodiment, the step of determining the magnetic field display parameters of the target planet based on the size information of the target planet includes: searching for magnetic field display parameters that match the size information of the target planet from a preset database; wherein the preset database stores multiple size parameters of the planet and the magnetic field display parameters corresponding to each size parameter.
[0174] In an optional embodiment, the magnetic field region of the target planet includes: a first magnetic field region in the direction of the virtual storm facing the target planet, and a second magnetic field region generated by the target planet blocking the virtual storm; the step of generating the magnetic field region of the target planet under the action of the virtual storm according to the magnetic field display parameters and the relative direction includes: generating the first magnetic field region in the direction of the virtual storm facing the target planet based on the size parameters of the specified ellipse included in the magnetic field display parameters; generating the second magnetic field region generated by the target planet blocking the virtual storm based on the size parameters of the specified ellipse and the tangent parameters of the specified ellipse included in the magnetic field display parameters; combining the first magnetic field region and the second magnetic field region according to the relative direction to obtain the magnetic field region of the target planet under the action of the virtual storm.
[0175] In an optional embodiment, the magnetic field display parameters also include a first number of magnetic field lines contained in the first magnetic field region; the size parameters of the specified ellipse in the magnetic field display parameters include: the minor axis radius and major axis radius of the specified ellipse corresponding to each magnetic field line in the first magnetic field region; the step of generating the first magnetic field region of the target planet facing the virtual storm direction based on the size parameters of the specified ellipse included in the magnetic field display parameters includes: for each magnetic field line in the first magnetic field region, generating the current magnetic field line according to the minor axis radius and major axis radius of the specified ellipse corresponding to the current magnetic field line; combining the generated first number of magnetic field lines to obtain the first magnetic field region; wherein the magnetic field radius of the magnetic field lines in the first magnetic field region increases from the inside to the outside, and the magnetic field radius matches the major axis radius of the specified ellipse corresponding to the magnetic field line.
[0176] In an optional embodiment, the step of generating the current magnetic field line according to the minor axis radius and major axis radius of the specified ellipse corresponding to the current magnetic field line includes: obtaining the minor axis radius and major axis radius of the specified ellipse corresponding to the current magnetic field line, constructing a first ellipse with a major axis radius of a first value and a minor axis radius of a second value, and constructing a second ellipse with a major axis radius of the first value and a minor axis radius of a third value; selecting a semi-ellipse of the first ellipse and a semi-ellipse of the second ellipse, and combining the semi-ellipses of the first ellipse and the semi-ellipses of the second ellipse into a closed combined ellipse; respectively setting the color and transparency inside and outside the combined ellipse, and determining the set combined ellipse as the current magnetic field line in the first magnetic field region.
[0177] In an optional embodiment, the above-mentioned steps of respectively setting the color and transparency inside and outside the combined ellipse include: setting the color inside the combined ellipse to a first color, setting the color outside the combined ellipse to a second color, and setting the transparency inside the combined ellipse to a preset value; wherein the transparency inside the combined ellipse is used to indicate the magnetic field strength, and as the radius of the major axis of the combined ellipse increases, the value of the transparency setting inside the combined ellipse becomes smaller.
[0178] In an optional embodiment, after the step of selecting the semi-ellipse of the first ellipse and the semi-ellipse of the second ellipse, and combining the semi-ellipse of the first ellipse and the semi-ellipse of the second ellipse into a closed combined ellipse, the method further includes: stroking the combined ellipse to obtain an edge contour with a specified width around the combined ellipse; and setting the edge contour to a third color.
[0179] In an optional embodiment, the above-mentioned step of stroking the combined ellipse to obtain an edge contour with a specified width around the combined ellipse includes: adding the first value to the first threshold to obtain a fourth value; adding the second value to the second threshold to obtain a fifth value; adding the third value to the third threshold to obtain a sixth value; constructing a third ellipse with a major axis radius of the fourth value and a minor axis radius of the fifth value, and constructing a fourth ellipse with a major axis radius of the fourth value and a minor axis radius of the sixth value; selecting a semi-ellipse of the third ellipse and a semi-ellipse of the fourth ellipse, and combining the semi-ellipse of the third ellipse and the semi-ellipse of the fourth ellipse into a closed combined ellipse; combining the semi-ellipse of the third ellipse and the semi-ellipse of the fourth ellipse into a closed combined ellipse, subtracting the combined ellipse formed by the semi-ellipse of the first ellipse and the semi-ellipse of the second ellipse, to obtain an edge contour with a specified width corresponding to the combined ellipse formed by the semi-ellipse of the first ellipse and the semi-ellipse of the second ellipse.
[0180] In an optional embodiment, the second magnetic field region includes a near magnetic field region generated by the target planet blocking the virtual storm, and an infinite magnetic field region generated by the target planet blocking the virtual storm; the magnetic field display parameters also include: a second number of closed magnetic field lines contained in the near magnetic field region, and a third number of open magnetic field lines contained in the infinite magnetic field region; the size parameters of the specified ellipse in the magnetic field display parameters include: the size parameters of the specified ellipse corresponding to each closed magnetic field line, the size parameters of the specified ellipse corresponding to each open magnetic field line, and the tangent parameters of the specified ellipse; the step of generating the second magnetic field region generated by the target planet blocking the virtual storm based on the size parameters of the specified ellipse and the tangent parameters of the specified ellipse included in the magnetic field display parameters includes: For each closed magnetic field line in the near magnetic field region, the current closed magnetic field line is generated based on the size parameters of the specified ellipse corresponding to the current closed magnetic field line; the generated second number of closed magnetic field lines are combined to obtain the near magnetic field region; wherein the magnetic field radius of the closed magnetic field line in the near magnetic field region increases from the inside to the outside, and the magnetic field radius matches the size of the specified ellipse corresponding to the closed magnetic field line; for each open magnetic field line in the infinite magnetic field region, the current open magnetic field line is generated according to the size parameters and tangent parameters of the specified ellipse corresponding to the current open magnetic field line; the generated third number of open magnetic field lines are combined to obtain the infinite magnetic field region; wherein the opening width of the open magnetic field line in the infinite magnetic field region increases from the inside to the outside.
[0181] In an optional embodiment, the step of generating the current closed magnetic field line based on the size parameters of the specified ellipse corresponding to the current closed magnetic field line includes: obtaining a target ellipse according to the size parameters of the specified ellipse corresponding to the current closed magnetic field line; scaling the target ellipse to obtain a shear ellipse; setting the color and transparency inside the shear ellipse, and setting the color outside the shear ellipse, and determining the set shear ellipse as the current closed magnetic field line.
[0182] In an optional embodiment, the step of scaling the target ellipse to obtain the shear ellipse includes: enlarging the horizontal coordinate value of the target ellipse as the vertical coordinate value increases, and determining the enlarged ellipse as the shear ellipse.
[0183] In an optional embodiment, the above-mentioned steps of setting the color and transparency within the shear ellipse, and setting the color outside the shear ellipse, include: setting the color within the shear ellipse to a first color, setting the color outside the shear ellipse to a second color, and setting the transparency within the shear ellipse to a preset value; wherein the transparency within the shear ellipse is used to indicate the magnetic field strength, and as the size of the shear ellipse increases, the value of the transparency setting within the shear ellipse becomes smaller.
[0184] In an optional embodiment, after the step of scaling the target ellipse to obtain the sheared ellipse, the method further includes: stroking the sheared ellipse to obtain an edge contour with a specified width around the sheared ellipse; and setting the edge contour to a third color.
[0185] In an optional embodiment, the step of generating the current opening magnetic field line according to the size parameters and tangent parameters of the specified ellipse corresponding to the current opening magnetic field line includes: obtaining the specified ellipse according to the size parameters of the specified ellipse; determining two tangents of the specified ellipse according to the tangent parameters, and making the two tangents tangent to the specified ellipse; determining two tangent points between the specified ellipse and the two tangents, and forming an opening arc with the tangents above the two tangent points and the part of the specified ellipse below the two tangent points; setting the upper part of the opening arc to a first color, setting the lower part of the opening arc to a second color, and setting the transparency of the upper part of the opening arc to a preset value, and determining the set opening arc as an opening magnetic field line; wherein the transparency is used to indicate the magnetic field strength, and as the opening width of the opening magnetic field line increases, the value of the transparency setting becomes smaller.
[0186] In an optional embodiment, after the step of forming an open arc from the tangent lines above the two tangent points and the portion of the specified ellipse below the two tangent points, the method further includes: stroking the open arc to obtain an edge contour with a specified width around the open arc; and setting the edge contour to a third color.
[0187] In an optional embodiment, the virtual storm is caused by a star; before the step of obtaining the size information of the target planet and the relative direction of the virtual storm and the target planet, the method further includes: obtaining the position information of the target planet; constructing a local coordinate system with the position of the target planet as the origin, the direction of the line connecting the position of the target planet and the star as the longitudinal axis, and the direction perpendicular to the longitudinal axis as the transverse axis; determining the angle between the longitudinal axis of the local coordinate system and the longitudinal axis of the world coordinate system of the star; multiplying the angle by a preset rotation matrix to obtain the coordinate value of the pixel point in the virtual scene in the local coordinate system, so as to obtain the magnetic field area of the target planet under the action of the virtual storm in the local coordinate system.
[0188] If the functions are implemented in the form of software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, or the part that contributes to the prior art or the part of the technical solution, can be embodied in the form of a software product. The computer software product is stored in a storage medium, including several instructions for a computer device (which can be a personal computer, a terminal device, or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present invention. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), disk or optical disk and other media that can store program codes.
[0189] In the description of the present invention, it should be noted that the terms "center", "upper", "lower", "left", "right", "vertical", "horizontal", "inner", "outer", etc., indicating the orientation or positional relationship, are based on the orientation or positional relationship shown in the drawings, and are only for the convenience of describing the present invention and simplifying the description, rather than indicating or implying that the device or element referred to must have a specific orientation, be constructed and operated in a specific orientation, and therefore cannot be understood as limiting the present invention. In addition, the terms "first", "second", and "third" are used for descriptive purposes only, and cannot be understood as indicating or implying relative importance.
[0190] Finally, it should be noted that the above-described embodiments are only specific implementations of the present invention, which are used to illustrate the technical solutions of the present invention, rather than to limit them. The protection scope of the present invention is not limited thereto. Although the present invention is described in detail with reference to the above-described embodiments, ordinary technicians in the field should understand that any technician familiar with the technical field can still modify the technical solutions recorded in the above-described embodiments within the technical scope disclosed by the present invention, or can easily think of changes, or make equivalent replacements for some of the technical features therein; and these modifications, changes or replacements do not make the essence of the corresponding technical solutions deviate from the spirit and scope of the technical solutions of the embodiments of the present invention, and should be included in the protection scope of the present invention. Therefore, the protection scope of the present invention shall be subject to the protection scope of the claims.
Claims
1. A method for simulating a planetary magnetic field in a virtual scene, characterized in that: The method comprises: Acquiring size information of a target planet and a relative direction between the virtual storm and the target planet; Based on the size information of the target planet, determining the magnetic field display parameters of the target planet; wherein the magnetic field display parameters include: size parameters of a specified ellipse and / or tangent parameters of a specified ellipse for generating the magnetic field region of the target planet; generating a magnetic field region of the target planet under the action of the virtual storm according to the magnetic field display parameter and the relative direction; The magnetic field region of the target planet includes: a first magnetic field region of the target planet facing the direction of the virtual storm, and a second magnetic field region generated by the target planet shielding the virtual storm; the step of generating the magnetic field region of the target planet under the action of the virtual storm according to the magnetic field display parameters and the relative direction includes: Based on the size parameters of the designated ellipse included in the magnetic field display parameters, generating a first magnetic field region of the target planet facing the direction of the virtual storm; Based on the size parameters of the designated ellipse and the tangent parameters of the designated ellipse included in the magnetic field display parameters, generating a second magnetic field region generated by the target planet shielding the virtual storm; The first magnetic field region and the second magnetic field region are combined according to the relative direction to obtain the magnetic field region of the target planet under the action of the virtual storm.
2. The method according to claim 1, characterized in that: The step of determining the magnetic field display parameters of the target planet based on the size information of the target planet comprises: From a preset database, search for magnetic field display parameters that match the size information of the target planet; wherein the preset database stores multiple size parameters of the planet and magnetic field display parameters corresponding to each size parameter.
3. The method according to claim 1, characterized in that The magnetic field display parameters also include a first number of magnetic field lines included in the first magnetic field region; the size parameters of the specified ellipse in the magnetic field display parameters include: the minor axis radius and the major axis radius of the specified ellipse corresponding to each of the magnetic field lines included in the first magnetic field region; The step of generating a first magnetic field region of the target planet facing the direction of the virtual storm based on the size parameters of the designated ellipse included in the magnetic field display parameters comprises: For each magnetic field line in the first magnetic field region, generating the current magnetic field line according to the minor axis radius and the major axis radius of the specified ellipse corresponding to the current magnetic field line; The generated first number of magnetic field lines are combined to obtain the first magnetic field region; wherein the magnetic field radius of the magnetic field lines in the first magnetic field region increases from inside to outside, and the magnetic field radius matches the major axis radius of the specified ellipse corresponding to the magnetic field line.
4. The method according to claim 3, characterized in that The step of generating the current magnetic field line according to the minor axis radius and the major axis radius of the specified ellipse corresponding to the current magnetic field line comprises: Obtain the minor axis radius and the major axis radius of the specified ellipse corresponding to the current magnetic field line, construct a first ellipse whose major axis radius is a first value and whose minor axis radius is a second value, and construct a second ellipse whose major axis radius is the first value and whose minor axis radius is a third value; Selecting a semi-ellipse of the first ellipse and a semi-ellipse of the second ellipse, and combining the semi-ellipse of the first ellipse and the semi-ellipse of the second ellipse into a closed combined ellipse; The colors and transparency inside and outside the combined ellipse are set respectively, and the set combined ellipse is determined as the current magnetic field line in the first magnetic field region.
5. The method according to claim 4, characterized in that The step of respectively setting the color and transparency of the inside and outside of the combined ellipse comprises: The color inside the combined ellipse is set to a first color, the color outside the combined ellipse is set to a second color, and the transparency inside the combined ellipse is set to a preset value; wherein the transparency inside the combined ellipse is used to indicate the magnetic field strength, and as the major axis radius of the combined ellipse increases, the value of the transparency setting inside the combined ellipse becomes smaller.
6. The method according to claim 4, characterized in that After the step of selecting the semi-ellipse of the first ellipse and the semi-ellipse of the second ellipse, and combining the semi-ellipse of the first ellipse and the semi-ellipse of the second ellipse into a closed combined ellipse, the method further comprises: Performing a stroke process on the combined ellipse to obtain an edge contour with a specified width around the combined ellipse; Set the edge outline to a third color.
7. The method according to claim 6, characterized in that The step of performing stroke processing on the combined ellipse to obtain an edge contour with a specified width around the combined ellipse includes: Add the first value to the first threshold to obtain a fourth value; add the second value to the second threshold to obtain a fifth value; add the third value to the third threshold to obtain a sixth value; constructing a third ellipse whose major axis radius is a fourth value and whose minor axis radius is a fifth value, and constructing a fourth ellipse whose major axis radius is the fourth value and whose minor axis radius is a sixth value; Selecting a semi-ellipse of the third ellipse and a semi-ellipse of the fourth ellipse, and combining the semi-ellipse of the third ellipse and the semi-ellipse of the fourth ellipse into a closed combined ellipse; Combine the semi-ellipse of the third ellipse and the semi-ellipse of the fourth ellipse into a closed combined ellipse, subtract the combined ellipse formed by the semi-ellipse of the first ellipse and the semi-ellipse of the second ellipse, and obtain the edge contour with a specified width corresponding to the combined ellipse formed by the semi-ellipse of the first ellipse and the semi-ellipse of the second ellipse.
8. The method according to claim 1, characterized in that The second magnetic field region includes a near magnetic field region generated by the target planet shielding the virtual storm, and an infinite magnetic field region generated by the target planet shielding the virtual storm; The magnetic field display parameters also include: a second number of closed magnetic field lines included in the near magnetic field region, and a third number of open magnetic field lines included in the infinite magnetic field region; the size parameters of the specified ellipse in the magnetic field display parameters include: size parameters of the specified ellipse corresponding to each of the closed magnetic field lines, size parameters of the specified ellipse corresponding to each of the open magnetic field lines, and tangent parameters of the specified ellipse; the step of generating the second magnetic field region generated by the target planet shielding the virtual storm based on the size parameters of the specified ellipse and the tangent parameters of the specified ellipse included in the magnetic field display parameters includes: For each closed magnetic field line in the near magnetic field region, generating the current closed magnetic field line based on the size parameters of the specified ellipse corresponding to the current closed magnetic field line; The generated second number of closed magnetic field lines are combined to obtain the near magnetic field region; wherein the magnetic field radius of the closed magnetic field lines in the near magnetic field region increases from inside to outside, and the magnetic field radius matches the size of the specified ellipse corresponding to the closed magnetic field line; For each opening magnetic field line in the infinite magnetic field region, generating the current opening magnetic field line according to the size parameters and tangent parameters of the specified ellipse corresponding to the current opening magnetic field line; The generated third number of open magnetic field lines are combined to obtain the infinite magnetic field region; wherein the opening widths of the open magnetic field lines in the infinite magnetic field region increase from inside to outside.
9. The method according to claim 8, characterized in that The step of generating the current closed magnetic field line based on the size parameters of the specified ellipse corresponding to the current closed magnetic field line comprises: Obtaining a target ellipse according to size parameters of a designated ellipse corresponding to the current closed magnetic field line; Scaling the target ellipse to obtain a shear ellipse; The color and transparency inside the shear ellipse are set, and the color outside the shear ellipse is set, and the set shear ellipse is determined as the current closed magnetic field line.
10. The method according to claim 9, characterized in that The step of scaling the target ellipse to obtain a shear ellipse comprises: The abscissa value of the target ellipse is enlarged as the ordinate value increases, and the ellipse after the enlargement operation is determined as the shear ellipse.
11. The method according to claim 9, characterized in that The step of setting the color and transparency within the shear ellipse and setting the color outside the shear ellipse comprises: The color inside the shear ellipse is set to a first color, the color outside the shear ellipse is set to a second color, and the transparency inside the shear ellipse is set to a preset value; wherein the transparency inside the shear ellipse is used to indicate the magnetic field strength, and as the size of the shear ellipse increases, the value of the transparency setting inside the shear ellipse becomes smaller.
12. The method according to claim 9, characterized in that After the step of scaling the target ellipse to obtain a shear ellipse, the method further includes: Performing a stroke process on the shear ellipse to obtain an edge contour with a specified width around the shear ellipse; Set the edge outline to a third color.
13. The method according to claim 8, characterized in that The step of generating the current opening magnetic field line according to the size parameters and tangent parameters of the specified ellipse corresponding to the current opening magnetic field line comprises: According to the size parameters of the specified ellipse, a specified ellipse is obtained; Determine two tangent lines of the specified ellipse according to the tangent line parameters, and make the two tangent lines tangent to the specified ellipse; Determine two tangent points between the designated ellipse and the two tangent lines, and form an open arc with the tangent lines above the two tangent points and the portion of the designated ellipse below the two tangent points; The upper part of the opening arc is set to a first color, the lower part of the opening arc is set to a second color, and the transparency of the upper part of the opening arc is set to a preset value, and the set opening arc is determined as an opening magnetic field line; wherein the transparency is used to indicate the magnetic field strength, and as the opening width of the opening magnetic field line increases, the value of the transparency setting becomes smaller.
14. The method according to claim 13, characterized in that After the step of forming an open arc with the tangent line above the two tangent points and the portion of the specified ellipse below the two tangent points, the method further comprises: Performing a stroke process on the opening circular arc to obtain an edge contour with a specified width around the opening circular arc; Set the edge outline to a third color.
15. The method according to claim 1, characterized in that The virtual storm is caused by a star; before the step of obtaining the size information of the target planet and the relative direction between the virtual storm and the target planet, the method further includes: Acquiring position information of the target planet; Constructing a local coordinate system with the position of the target planet as the origin, the direction of the line connecting the position of the target planet and the star as the longitudinal axis direction, and the direction perpendicular to the longitudinal axis direction as the transverse axis direction; Determine the angle between the longitudinal axis of the local coordinate system and the longitudinal axis of the world coordinate system where the star is located; The angle is multiplied by a preset rotation matrix to obtain coordinate values of the pixel points in the virtual scene in the local coordinate system, so that the magnetic field area of the target planet under the action of the virtual storm is obtained in the local coordinate system.
16. A device for simulating a planetary magnetic field in a virtual scene, characterized in that: The device comprises: An information acquisition module, used to acquire the size information of the target planet and the relative direction between the virtual storm and the target planet; A parameter determination module, configured to determine the magnetic field display parameters of the target planet based on the size information of the target planet; wherein the magnetic field display parameters include: size parameters of a specified ellipse and / or tangent parameters of a specified ellipse for generating the magnetic field region of the target planet; A magnetic field generating module, used for generating a magnetic field region of the target planet under the action of the virtual storm according to the magnetic field display parameters and the relative direction; The magnetic field region of the target planet includes: a first magnetic field region of the target planet facing the direction of the virtual storm, and a second magnetic field region generated by the target planet blocking the virtual storm; the magnetic field generating module is used to: generate the first magnetic field region of the target planet facing the direction of the virtual storm based on the size parameters of the specified ellipse included in the magnetic field display parameters; generate the second magnetic field region generated by the target planet blocking the virtual storm based on the size parameters of the specified ellipse and the tangent parameters of the specified ellipse included in the magnetic field display parameters; and combine the first magnetic field region and the second magnetic field region according to the relative direction to obtain the magnetic field region of the target planet under the action of the virtual storm.
17. An electronic device, characterized in that: It comprises a processor and a memory, wherein the memory stores machine executable instructions that can be executed by the processor, and the processor executes the machine executable instructions to implement the method for simulating a planetary magnetic field in a virtual scene as described in any one of claims 1 to 15.
18. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer-executable instructions, and when the computer-executable instructions are called and executed by a processor, the computer-executable instructions prompt the processor to implement the method for simulating a planetary magnetic field in a virtual scene as described in any one of claims 1 to 15.
Citation Information
Patent Citations
Method for simulating signal of alternating magnetic field of magnetism guiding well drilling
CN103835703A
Quick and high-precision numerical simulation method for two-dimensional magnetic field of strong magnetic body
CN108197389A