Ray equidistant collision method and device, computer equipment and storage medium
By obtaining and converting the coordinates of the rays under the camera coordinate system, determining the collision point and intersection point on the projection plane, and calculating the direction vector and velocity ratio of the rays, the problem of difficult to ensure the accuracy of the ray collision is solved, and more stable and accurate interactive operation is achieved.
Patent Information
- Application Number
- CN202510261873.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-03-06
- Publication Date
- 2025-06-03
AI Technical Summary
In scenarios such as immersive game experience, virtual display interaction and industrial design simulation, the accuracy of ray collision is difficult to ensure, and collision deviations or collision failures are prone to decrease, resulting in a decrease in the accuracy and stability of interaction operations.
By obtaining the coordinates of the first and second emission sources under the camera coordinate system and converting them to the projection plane, determining the collision point coordinates and intersection coordinates, the direction vector and velocity ratio of the ray are calculated to achieve accurate collision of the ray.
Improves the stability and accuracy of ray collisions, and can successfully make ray collisions even when the position or direction of the emission source changes, and improves the stability and reliability of interactive operations.
Smart Images

Figure CN120088371A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of virtual three-dimensional interaction technology, and in particular to a method, device, computer device and storage medium for equidistant ray collision. Background Art
[0002] In scenarios such as immersive game experiences, virtual display interactions, and industrial design simulations, ray collisions are used to achieve user interaction with the virtual environment. In complex interaction scenarios, due to the influence of the position and direction of the ray emission source and environmental factors, it is difficult to ensure the accuracy of ray collisions, and situations such as collision deviation or collision failure are likely to occur, resulting in a decrease in the accuracy and stability of interaction operations and a reduction in the user experience. Summary of the Invention
[0003] The purpose of the present invention is to overcome the deficiencies of the prior art and provide a method, device, computer device and storage medium for equidistant ray collision.
[0004] To solve the above technical problems, the present invention adopts the following technical solutions:
[0005] The present invention is achieved through the following technical solutions:
[0006] In a first aspect, the present embodiment provides a method for equidistant ray collision, including the following steps:
[0007] Obtain the first coordinate and the second coordinate of the first emission source and the second emission source in the camera coordinate system;
[0008] Based on the projection plane, respectively transform the first coordinate and the second coordinate into a third coordinate and a fourth coordinate;
[0009] Based on the third coordinate and the fourth coordinate, determine the collision point coordinate in the projection plane;
[0010] Based on the collision point coordinate, determine the intersection point coordinate;
[0011] Based on the intersection point coordinate, determine the direction vector and speed ratio of the ray of the second emission source.
[0012] Further, the step of obtaining the first coordinate and the second coordinate of the first emission source and the second emission source in the camera coordinate system includes:
[0013] Based on the position and direction of the camera in space, construct a camera coordinate system;
[0014] Respectively obtain the fifth coordinate and the sixth coordinate of the first emission source and the second emission source in the space;
[0015] Based on the camera coordinate system, convert the fifth coordinate and the sixth coordinate into the first coordinate and the second coordinate respectively.
[0016] Further, the step of converting the first coordinate and the second coordinate into the third coordinate and the fourth coordinate respectively based on the projection plane includes:
[0017] Determine projection parameters based on the positional relationship between the camera coordinate system and the projection plane;
[0018] Based on the projection parameters, convert the first coordinate and the second coordinate into the third coordinate and the fourth coordinate respectively.
[0019] Further, the step of determining projection parameters based on the positional relationship between the camera coordinate system and the projection plane includes:
[0020] Obtain the relative position of the origin of the camera coordinate system and the projection plane;
[0021] Determine the normal vector of the projection plane based on the relative position;
[0022] Determine the center point coordinates of the projection plane based on the normal vector;
[0023] Determine projection parameters based on the center point coordinates and the normal vector.
[0024] Further, the step of determining the impact point coordinates on the projection plane based on the third coordinate and the fourth coordinate includes:
[0025] Obtain the midpoint of the line connecting the third coordinate and the fourth coordinate;
[0026] Construct a dot product equation based on the midpoint of the line connection;
[0027] Solve the dot product equation based on preset conditions to generate impact point coordinates.
[0028] Further, the step of determining the intersection point coordinates based on the impact point coordinates includes:
[0029] Construct a first ray equation based on the third coordinate and the impact point coordinates;
[0030] Construct a second ray equation based on the fourth coordinate and the impact point coordinates;
[0031] Construct a system of equations for the first ray equation and the second ray equation;
[0032] Solve the system of equations based on preset conditions to obtain intersection point coordinates.
[0033] Further, the step of determining the direction vector and velocity ratio of the ray of the second emission source based on the intersection coordinates includes:
[0034] Determine an initial vector according to the intersection coordinates and the fourth coordinate;
[0035] Normalize the initial vector to obtain the direction vector of the ray of the second emission source;
[0036] Determine a first distance according to the third coordinate and the intersection coordinates;
[0037] Determine a second distance according to the fourth coordinate and the intersection coordinates;
[0038] Obtain the velocity ratio according to the first distance and the second distance.
[0039] In a second aspect, this embodiment provides a ray equidistant collision device, including: an acquisition unit, a first conversion unit, a second conversion unit, a third conversion unit, and an execution unit;
[0040] The acquisition unit is configured to acquire the first coordinate and the second coordinate of the first emission source and the second emission source in the camera coordinate system;
[0041] The first conversion unit is configured to respectively convert the first coordinate and the second coordinate into a third coordinate and a fourth coordinate based on the projection plane;
[0042] The second conversion unit is configured to determine the collision point coordinates on the projection plane based on the third coordinate and the fourth coordinate;
[0043] The third conversion unit is configured to determine the intersection coordinates based on the collision point coordinates;
[0044] The execution unit is configured to determine the direction vector and velocity ratio of the ray of the second emission source based on the intersection coordinates to achieve precise collision of the rays.
[0045] In a third aspect, this embodiment provides a computer device, which includes a memory and a processor, and a computer program is stored on the processor. When the processor executes the computer program, the ray equidistant collision method described above is implemented.
[0046] In a fourth aspect, this embodiment provides a storage medium, which stores a computer program. The computer program includes program instructions, and when the program instructions are executed by the processor, the ray equidistant collision method described above can be implemented.
[0047] The beneficial effects of the present invention compared with the prior art are as follows: The coordinates of the first emission source and the second emission source are respectively transformed onto the projection plane, and the collision point coordinates are determined, avoiding the phenomenon of collision deviation due to environmental factors. Based on the determined intersection point coordinates, the direction vector and velocity ratio of the ray are calculated, enabling the stability of the ray collision process. Even when the position or direction of the emission source changes, the ray collision can still be successful, improving the stability and reliability of the interaction operation.
[0048] The above description is only an overview of the technical solution of the present invention. In order to be able to more clearly understand the technical means of the present invention, it can be implemented in accordance with the content of the specification. And in order to make the above and other purposes, features and advantages of the present invention more obvious and understandable, the following preferred embodiments are specifically described in detail as follows. BRIEF DESCRIPTION OF THE DRAWINGS
[0049] Figure 1 It is a schematic flowchart of the ray equidistant collision method provided by an embodiment of the present invention;
[0050] Figure 2 It is a schematic flowchart of performing step S1 in the ray equidistant collision method provided by an embodiment of the present invention;
[0051] Figure 3 It is a schematic flowchart of performing step S2 in the ray equidistant collision method provided by an embodiment of the present invention;
[0052] Figure 4 It is a schematic flowchart of performing step S21 in the ray equidistant collision method provided by an embodiment of the present invention;
[0053] Figure 5 It is a schematic flowchart of performing step S3 in the ray equidistant collision method provided by an embodiment of the present invention;
[0054] Figure 6 It is a schematic flowchart of performing step S4 in the ray equidistant collision method provided by an embodiment of the present invention;
[0055] Figure 7 It is a schematic flowchart of performing step S5 in the ray equidistant collision method provided by an embodiment of the present invention;
[0056] Figure 8 It is a schematic block diagram of the ray equidistant collision device provided by an embodiment of the present invention;
[0057] Figure 9 It is a schematic block diagram of the computer device provided by an embodiment of the present invention. DETAILED DESCRIPTION OF THE EMBODIMENTS
[0058] Next, the technical solutions in the embodiments of the present invention will be clearly and completely described in conjunction with the accompanying drawings in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, rather than all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those of ordinary skill in the art without creative efforts shall fall within the protection scope of the present invention.
[0059] It should be understood that when used in this specification and the appended claims, the terms "comprises" and "comprising" indicate the presence of the described features, wholes, steps, operations, elements, and / or components, but do not preclude the presence or addition of one or more other features, wholes, steps, operations, elements, components, and / or their combinations.
[0060] It should also be understood that the terms used in this specification of the present invention are only for the purpose of describing specific embodiments and are not intended to limit the present invention. As used in this specification of the present invention and the appended claims, unless the context clearly indicates otherwise, the singular forms "a", "an", and "the" are intended to include the plural forms.
[0061] It should be further understood that the term " / and" as used in this specification of the present invention and the appended claims refers to any combination and all possible combinations of one or more of the associated listed items, and includes these combinations.
[0062] Please refer to Figure 1 the specific embodiments shown. The present invention discloses a ray equidistant collision method, including the following steps:
[0063] Step S1, obtaining the first coordinate and the second coordinate of the first emission source and the second emission source in the camera coordinate system;
[0064] It can be understood that the positions of different emission sources will affect the result of ray collision. Obtaining the coordinates of the first emission source and the second emission source in the camera coordinate system provides basic data for calculating ray collision. The camera coordinate system is a reference framework that can incorporate emission sources at different positions into the same spatial position for calculation. When the user uses an interactive device to emit a virtual ray to trigger special effects, the emission source is the position of the user's operating device, and the exhibit or special effect trigger point can be regarded as the target point. Obtaining the emission source coordinates ensures that the virtual ray accurately hits the target and realizes precise interaction.
[0065] Through the above steps, by obtaining the coordinates of the emission source in the camera coordinate system, the coherence and stability of the subsequent ray collision calculation can be ensured, the collision deviation caused by uncertain initial positions can be reduced, and the accuracy of ray collision can be improved.
[0066] Step S2, based on the projection plane, convert the first coordinate and the second coordinate into a third coordinate and a fourth coordinate respectively;
[0067] It can be understood that in a complex interaction scenario, directly calculating the collision point of a ray in the camera coordinate system may be interfered by various factors, such as light refraction, reflection, etc. Therefore, directly using the first coordinate and the second coordinate in the camera coordinate system cannot be directly used to determine the ray collision point. As a conversion medium, the projection plane converts the coordinates in three-dimensional space into a two-dimensional plane relationship, reducing the computational complexity while retaining the key information required for ray collision.
[0068] Through the above steps, converting the three-dimensional coordinates into two-dimensional coordinates reduces the computational dimension, and converts the vector operation and spatial geometric relationship judgment in three-dimensional space into the calculation of point-line relationships on a two-dimensional plane, improving the computational efficiency.
[0069] Step S3, based on the third coordinate and the fourth coordinate, determine the collision point coordinates on the projection plane;
[0070] It can be understood that the third coordinate and the fourth coordinate obtained through the conversion of the projection plane provide a data basis for determining the collision point coordinates. On the projection plane, the third coordinate and the fourth coordinate represent the position information of the ray in two-dimensional space. By analyzing and calculating them, the intersection point of the two rays, that is, the collision point coordinates, can be directly found.
[0071] Through the above steps, determining the collision point coordinates on the projection plane based on the third coordinate and the fourth coordinate can determine the intersection position of the ray on the two-dimensional plane to determine the positioning of the ray collision point coordinates.
[0072] Step S4, based on the collision point coordinates, determine the intersection point coordinates;
[0073] It can be understood that the collision point coordinates are only the intersection position of the ray on the projection plane, while the intersection point coordinates are the intersection points of the rays in three-dimensional space. After determining the collision point coordinates, further deriving the intersection point coordinates, the spatial position relationship of ray collision expands the two-dimensional plane analysis to three-dimensional space, thus realizing equidistant collision of rays. Converting the collision point coordinates on the projection plane into the intersection point coordinates in the actual space for ray collision calculation in three-dimensional space. The collision point coordinates are two-dimensional coordinates on the projection plane, while the intersection point coordinates are the actual positions obtained by converting these two-dimensional coordinates back to three-dimensional space.
[0074] Through the above steps, determining the intersection point coordinates based on the collision point coordinates expands the collision analysis from the two-dimensional projection plane to the three-dimensional real space, realizing the precise positioning of the ray intersection point in three-dimensional space.
[0075] Step S5: Determine the direction vector and velocity ratio of the ray of the second emission source based on the intersection coordinates.
[0076] It can be understood that the intersection coordinates determine the intersection point of the rays in three-dimensional space. Based on this, the direction vector and velocity ratio of the ray of the second emission source are obtained to quantify the motion characteristics of the ray. The direction vector clarifies the traveling direction of the ray, and the velocity ratio reflects the relative relationship between the velocities of the two rays. By controlling the emission direction and velocity of the rays, precise control of the collision point can be achieved.
[0077] Through the above steps, the direction vector and velocity ratio of the ray of the second emission source are determined based on the intersection coordinates, and the emission direction and velocity ratio of the ray are controlled to ensure that the collision point of the rays in three-dimensional space coincides with the collision point on the projection plane, avoiding the occurrence of collision deviation or collision failure, achieving precise collision of the rays in space, and improving the accuracy and stability of the interaction operation.
[0078] Through steps S1 to S5, the coordinates of the first emission source and the second emission source are respectively transformed onto the projection plane, and the collision point coordinates are determined, avoiding the phenomenon of collision deviation due to environmental factors. Based on the determined intersection coordinates, the direction vector and velocity ratio of the ray are calculated, enhancing the stability of the ray collision process. Even when the position or direction of the emission source changes, the ray collision can still succeed, improving the stability and reliability of the interaction operation.
[0079] In one embodiment, refer to Figure 2 The step of obtaining the first coordinate and the second coordinate of the first emission source and the second emission source in the camera coordinate system includes:
[0080] Step S11: Construct a camera coordinate system based on the position and direction of the camera in space;
[0081] Step S12: Respectively obtain the fifth coordinate and the sixth coordinate of the first emission source and the second emission source in the space;
[0082] Step S13: Based on the camera coordinate system, transform the fifth coordinate and the sixth coordinate into the first coordinate and the second coordinate respectively.
[0083] Through steps S11 to S13, a camera coordinate system is constructed and the coordinates of the first emission source and the second emission source are obtained, transforming the spatial coordinates of the emission source into the camera coordinate system to ensure that subsequent collision calculations are carried out within a framework, thereby improving the accuracy of the ray collision. In complex interaction scenarios, it can effectively eliminate the uncertainty of environmental factors and the position and direction of the emission source, avoid the occurrence of collision deviation and collision failure, ensure the accuracy and stability of the collision, and thus improve the accuracy and stability of the interaction operation.
[0084] In one embodiment, please refer to Figure 3 , the steps of converting the first coordinate and the second coordinate into a third coordinate and a fourth coordinate respectively based on the projection plane include:
[0085] Step S21, determining projection parameters based on the positional relationship between the camera coordinate system and the projection plane;
[0086] Step S22, converting the first coordinate and the second coordinate into the third coordinate and the fourth coordinate respectively based on the projection parameters.
[0087] Through steps S21 to S22, in a complex spatial environment, as long as the position and orientation of the camera are determined, the camera coordinate system can be constructed, and the position information of the emission source can be converted into this coordinate system, simplifying the calculation of the collision point and the determination of the ray emission direction and speed, and improving the response speed of the interactive operation.
[0088] In one embodiment, please refer to Figure 4 , the steps of determining projection parameters based on the positional relationship between the camera coordinate system and the projection plane include:
[0089] Step S211, obtaining the relative position between the origin of the camera coordinate system and the projection plane;
[0090] Step S212, determining the normal vector of the projection plane based on the relative position;
[0091] Step S213, determining the center point coordinates of the projection plane based on the normal vector;
[0092] Step S214, determining projection parameters based on the center point coordinates and the normal vector.
[0093] Through steps S211 to S214, based on the relative position between the camera coordinate system and the projection plane, accurate projection of the ray on the projection plane is achieved, thereby improving the accuracy of ray collision, avoiding the phenomenon of collision deviation or collision failure, and improving the accuracy and stability of the interactive operation.
[0094] In one embodiment, please refer to Figure 5 , the steps of determining the collision point coordinates on the projection plane based on the third coordinate and the fourth coordinate include:
[0095] Step S31, obtaining the midpoint of the line connecting the third coordinate and the fourth coordinate;
[0096] Step S32, constructing a dot product equation based on the midpoint of the line connection;
[0097] Step S33, solving the dot product equation based on preset conditions to generate the collision point coordinates.
[0098] Through steps S31 to S33, by obtaining the midpoint of the line connecting the third coordinate and the fourth coordinate and constructing a dot product equation based on this midpoint to obtain the collision point coordinates, the calculation accuracy of the collision point coordinates is improved. Moreover, the preset conditions are set according to the actual ray collision physical model or application requirements. By solving the dot product equation, the collision point coordinates can be obtained to accurately find the intersection point of the rays, thereby improving the accuracy of ray collision.
[0099] In one embodiment, please refer to Figure 6 , the step of determining the intersection point coordinates based on the collision point coordinates includes:
[0100] Step S41, constructing a first ray equation based on the third coordinate and the collision point coordinates;
[0101] Step S42, constructing a second ray equation based on the fourth coordinate and the collision point coordinates;
[0102] Step S43, constructing a system of equations for the first ray equation and the second ray equation;
[0103] Step S44, solving the system of equations based on preset conditions to obtain the intersection point coordinates.
[0104] Through steps S41 to S44, by constructing ray equations and solving the system of equations, the intersection point coordinates of two rays in three-dimensional space can be calculated, thereby improving the accuracy and stability of the collision; converting the ray equations into a system of equations can utilize mathematical methods for solution, simplifying the calculation process and improving the calculation efficiency; calculating the intersection point coordinates can avoid the phenomena of collision deviation and collision failure, ensuring the accuracy and stability of ray collision.
[0105] In one embodiment, please refer to Figure 7 , the step of determining the direction vector and velocity ratio of the ray of the second emission source based on the intersection point coordinates includes:
[0106] Step S51, determining an initial vector according to the intersection point coordinates and the fourth coordinate;
[0107] Step S52, normalizing the initial vector to obtain the direction vector of the ray of the second emission source;
[0108] Step S53, obtaining a first distance according to the third coordinate and the intersection point coordinates;
[0109] Step S54, obtaining a second distance according to the fourth coordinate and the intersection point coordinates;
[0110] Step S55, obtaining the velocity ratio according to the first distance and the second distance.
[0111] Through steps S51 to S55, by determining the initial vector according to the intersection coordinates and the fourth coordinate and normalizing it, the ray direction vector of the second emission source is obtained, thereby ensuring the correct emission direction of the ray. Based on the first distance and the second distance, the speed ratio is obtained, and the ray speed of the second emission source is controlled, thereby ensuring the speed matching during the collision of the rays and avoiding the phenomena of collision deviation and collision failure.
[0112] Please refer to Figure 8 , the present invention also discloses a ray equidistant collision device, including: an acquisition unit 10, a first conversion unit 20, a second conversion unit 20, a third conversion unit 40, and an execution unit 50;
[0113] The acquisition unit 10 is configured to acquire the first coordinate and the second coordinate of the first emission source and the second emission source in the camera coordinate system;
[0114] The first conversion unit 20 is configured to respectively convert the first coordinate and the second coordinate into a third coordinate and a fourth coordinate based on the projection plane;
[0115] The second conversion unit 30 is configured to determine the collision point coordinates on the projection plane based on the third coordinate and the fourth coordinate;
[0116] The third conversion unit 40 is configured to determine the intersection coordinates based on the collision point coordinates;
[0117] The execution unit 50 is configured to determine the direction vector and the speed ratio of the ray of the second emission source based on the intersection coordinates.
[0118] It should be noted that those skilled in the art can clearly understand the specific implementation processes of the above resolution map format conversion device and each unit. They can refer to the corresponding descriptions in the foregoing method embodiments. For the sake of convenience and brevity of description, they will not be elaborated here.
[0119] The above can be implemented in the form of a computer program, and the computer program can run on a computer device as shown in Figure 8 shown.
[0120] Please refer to Figure 9 , Figure 9 is a schematic block diagram of a computer device provided by an embodiment of the present application; the computer device 500 can be a terminal or a server. Among them, the terminal can be an electronic device with a communication function such as a smart phone, a tablet computer, a notebook computer, a desktop computer, a personal digital assistant, and a wearable device. The server can be an independent server or a server cluster composed of multiple servers.
[0121] Refer to Figure 9, the computer device 500 includes a processor 502, a memory, and a network interface 505 connected via a system bus 501. Among them, the memory may include a non-volatile storage medium 503 and an internal memory 504.
[0122] The non-volatile storage medium 503 can store an operating system 5031 and a computer program 5032. The computer program 5032 includes program instructions that, when executed, enable the processor 502 to execute a ray equidistant collision method, including the following steps: obtaining the first coordinate and the second coordinate of a first emission source and a second emission source in a camera coordinate system; based on a projection plane, respectively converting the first coordinate and the second coordinate into a third coordinate and a fourth coordinate; determining a collision point coordinate on the projection plane based on the third coordinate and the fourth coordinate; determining an intersection point coordinate based on the collision point coordinate; determining a direction vector and a speed ratio of the ray of the second emission source based on the intersection point coordinate.
[0123] The processor 502 is used to provide computing and control capabilities to support the operation of the entire computer device 500.
[0124] The internal memory 504 provides an environment for the operation of the computer program 5032 in the non-volatile storage medium 503. When the computer program 5032 is executed by the processor 502, it enables the processor 502 to execute a ray equidistant collision method.
[0125] The network interface 505 is used for network communication with other devices. Those skilled in the art can understand that Figure 8 the structure shown in is only a block diagram of some structures related to the solution of this application, and does not constitute a limitation on the computer device 500 to which the solution of this application is applied. The specific computer device 500 may include more or fewer components than those shown in the figure, or combine certain components, or have a different component layout.
[0126] Among them, the processor 502 is used to run the computer program 5032 stored in the memory to implement the following steps:
[0127] Step S1, obtaining the first coordinate and the second coordinate of a first emission source and a second emission source in a camera coordinate system;
[0128] Step S2, respectively converting the first coordinate and the second coordinate into a third coordinate and a fourth coordinate based on a projection plane;
[0129] Step S3, determining a collision point coordinate on the projection plane based on the third coordinate and the fourth coordinate;
[0130] Step S4, determining an intersection point coordinate based on the collision point coordinate;
[0131] Step S5, determine the direction vector and velocity ratio of the ray of the second emission source based on the intersection point coordinates.
[0132] It should be understood that in the embodiments of the present application, the processor 502 may be a central processing unit (CPU), and the processor 502 may also be other general-purpose processors, digital signal processors (DSPs), application specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. Among them, the general-purpose processor may be a microprocessor or the processor may also be any conventional processor, etc.
[0133] Those of ordinary skill in the art can understand that all or part of the processes in the methods of the above embodiments can be completed by instructing relevant hardware through a computer program. The computer program includes program instructions, and the computer program can be stored in a storage medium, and the storage medium is a computer-readable storage medium. The program instructions are executed by at least one processor in the computer system to implement the process steps of the embodiments of the above methods.
[0134] Therefore, the present invention also provides a storage medium. The storage medium may be a computer-readable storage medium. The storage medium stores a computer program, where the computer program includes program instructions, and the program instructions can implement the above-mentioned ray equidistant collision method when executed by a processor. The storage medium stores a computer program, the computer program includes program instructions, and the program instructions can implement the above method when executed by a processor. The program instructions include the following steps:
[0135] Step S1, obtain the first coordinate and the second coordinate of the first emission source and the second emission source in the camera coordinate system;
[0136] Step S2, based on the projection plane, convert the first coordinate and the second coordinate into a third coordinate and a fourth coordinate respectively;
[0137] Step S3, determine the collision point coordinates on the projection plane based on the third coordinate and the fourth coordinate;
[0138] Step S4, determine the intersection point coordinates based on the collision point coordinates;
[0139] Step S5, determine the direction vector and velocity ratio of the ray of the second emission source based on the intersection point coordinates.
[0140] The storage medium may be a variety of computer-readable storage media such as a USB flash drive, a portable hard drive, a read-only memory (ROM), a magnetic disk, or an optical disc, etc., which can store program codes.
[0141] Those of ordinary skill in the art can realize that the units and algorithm steps of each example described in combination with the embodiments disclosed herein can be implemented by electronic hardware, computer software, or a combination of the two. To clearly illustrate the interchangeability of hardware and software, the composition and steps of each example have been generally described according to functions in the above description. Whether these functions are executed in a hardware or software manner depends on the specific application and design constraints of the technical solution. Professional technicians can use different methods to implement the described functions for each specific application, but such implementation should not be considered to exceed the scope of the present invention.
[0142] In several embodiments provided by the present invention, it should be understood that the disclosed devices and methods can be implemented in other ways. For example, the device embodiments described above are merely illustrative. For example, the division of each unit is only a logical function division, and there may be other division methods in actual implementation. For example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed.
[0143] The steps in the method embodiments of the present invention can be adjusted, combined, and deleted according to actual needs. The units in the device embodiments of the present invention can be combined, divided, and deleted according to actual needs. In addition, the functional units in each embodiment of the present invention can be integrated into one processing unit, or each unit can exist physically alone, or two or more units can be integrated into one unit.
[0144] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a storage medium. Based on such an understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art, or all or 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 and includes several instructions for causing a computer device (which can be a personal computer, a terminal, or a network device, etc.) to execute all or part of the steps of the methods described in each embodiment of the present invention.
[0145] The above embodiments are preferred implementation solutions of the present invention. In addition, the present invention can be implemented in other ways. Any obvious replacement without departing from the concept of the present technical solution is within the protection scope of the present invention.
Claims
1. The ray equidistant collision method is characterized in that: The following steps are involved: Obtaining first coordinates and second coordinates of the first emission source and the second emission source in the camera coordinate system; Convert the first coordinate and the second coordinate into a third coordinate and a fourth coordinate respectively based on the projection plane; Determine the collision point coordinates on the projection plane based on the third coordinate and the fourth coordinate; Determining the intersection point coordinates based on the collision point coordinates; The direction vector and the speed ratio of the ray of the second emission source are determined based on the intersection point coordinates.
2. The ray equidistant collision method according to claim 1, characterized in that: The step of obtaining the first coordinates and the second coordinates of the first emission source and the second emission source in the camera coordinate system comprises: Construct a camera coordinate system based on the position and orientation of the camera in space; Respectively obtaining fifth coordinates and sixth coordinates of the first emission source and the second emission source in the space; Based on the camera coordinate system, the fifth coordinate and the sixth coordinate are converted into the first coordinate and the second coordinate respectively.
3. The ray equidistant collision method according to claim 1, characterized in that: The step of converting the first coordinate and the second coordinate into a third coordinate and a fourth coordinate respectively based on the projection plane comprises: Determining projection parameters based on a positional relationship between the camera coordinate system and the projection plane; The first coordinate and the second coordinate are converted into the third coordinate and the fourth coordinate respectively based on the projection parameters.
4. The ray equidistant collision method according to claim 3, characterized in that: The step of determining projection parameters based on the positional relationship between the camera coordinate system and the projection plane comprises: Obtaining the relative position of the origin of the camera coordinate system and the projection plane; determining a normal vector of the projection plane based on the relative position; Determine the coordinates of the center point of the projection plane based on the normal vector; Projection parameters are determined based on the center point coordinates and the normal vector.
5. The ray equidistant collision method according to claim 1, characterized in that: The step of determining the collision point coordinates on the projection plane based on the third coordinate and the fourth coordinate comprises: Obtaining the midpoint of the line connecting the third coordinate and the fourth coordinate; Constructing a dot product equation based on the midpoints of the connecting line; Solve the dot product equation based on preset conditions to generate the collision point coordinates.
6. The ray equidistant collision method according to claim 1, characterized in that: The step of determining the intersection point coordinates based on the collision point coordinates comprises: Constructing a first ray equation based on the third coordinate and the collision point coordinate; Constructing a second ray equation based on the fourth coordinate and the left side of the collision point; constructing an equation group for the first ray equation and the second ray equation; The system of equations is solved based on preset conditions to obtain the coordinates of the intersection point.
7. The ray equidistant collision method according to claim 1, characterized in that: The step of determining the direction vector and speed ratio of the ray of the second emission source based on the intersection coordinates comprises: Determine an initial vector according to the intersection coordinates and the fourth coordinates; Normalizing the initial vector to obtain a direction vector of the ray of the second emission source; Obtaining a first distance according to the third coordinate and the intersection coordinate; Obtaining a second distance according to the fourth coordinate and the intersection coordinate; The speed ratio is obtained according to the first distance and the second distance.
8. The ray equidistant collision device is characterized in that: include: An acquisition unit, a first conversion unit, a second conversion unit, a third conversion unit and an execution unit; The acquisition unit is used to acquire the first coordinates and the second coordinates of the first emission source and the second emission source in the camera coordinate system; The first conversion unit is used to convert the first coordinate and the second coordinate into a third coordinate and a fourth coordinate respectively based on the projection plane; The second conversion unit is used to determine the collision point coordinates on the projection plane based on the third coordinate and the fourth coordinate; The third conversion unit is used to determine the intersection point coordinates based on the collision point coordinates; The execution unit is used to determine the direction vector and speed ratio of the ray of the second emission source based on the intersection coordinates.
9. A computer device, characterized in that: The computer device includes a memory and a processor, a computer program is stored on the processor, and when the processor executes the computer program, the ray equidistant collision method according to any one of claims 1 to 7 is implemented.
10. A storage medium, characterized in that: The storage medium stores a computer program, which includes program instructions. When the program instructions are executed by a processor, the ray equidistant collision method according to any one of claims 1 to 7 can be implemented.