A method and device for indicating the orientation of a three-dimensional model
By converting the target position of the three-dimensional model to the target coordinate system and calculating the rotation angle to rotate the arrow indicator, the problem that users cannot determine the model orientation in AR/VR scenarios is solved, real-time indication of the model orientation is achieved, and user experience is improved.
Patent Information
- Application Number
- CN202010485954.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-06-01
- Publication Date
- 2025-02-21
- Estimated Expiration
- 2040-06-01
AI Technical Summary
In AR/VR scenarios, if the three-dimensional model is not rendered on the screen, the user cannot determine the orientation of the model, resulting in a decline in user experience.
By judging whether the three-dimensional model is rendered in the screen, if not, the coordinates of the model's target position in the world space coordinate system are converted to the target coordinate system, the rotation angle is calculated, and the rotation arrow indicator is rotated based on the angle included, Indicates the orientation of the model.
Real-time indication and tracking of the three-dimensional model's orientation on a two-dimensional screen is achieved. Even if the model is not rendered on the screen, the user can know its location, which significantly improves the user experience.
Smart Images

Figure CN113763520B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of computer technology, and in particular to a method and device for indicating the orientation of a three-dimensional model. Background Art
[0002] With the development of technology, simply experiencing the virtual world through the screen no longer meets the needs of users, so the application scenarios of augmented reality (AR) / virtual reality (VR) are becoming more and more extensive.
[0003] In the process of implementing the present invention, the inventors found that there are at least the following problems in the prior art:
[0004] In AR / VR scenarios, if the three-dimensional model is not rendered on the screen, the user will not be able to determine the orientation of the model, resulting in a decreased user experience. Summary of the invention
[0005] In view of this, an embodiment of the present invention provides a method and device for indicating the orientation of a three-dimensional model to solve the technical problem of being unable to determine the orientation of the model.
[0006] To achieve the above object, according to one aspect of an embodiment of the present invention, a method for indicating the orientation of a three-dimensional model is provided, comprising:
[0007] Determine whether the three-dimensional model is rendered in the screen; if not, convert the coordinates of the target position of the three-dimensional model in the world space coordinate system to the target coordinate system, thereby obtaining the coordinates of the target position in the target coordinate system;
[0008] Calculating a rotation angle according to the coordinates of the target position in the target coordinate system;
[0009] The arrow indicator is rotated based on the rotation angle to indicate the orientation of the three-dimensional model.
[0010] Optionally, converting the coordinates of the target position of the three-dimensional model in the world space coordinate system into the target coordinate system, thereby obtaining the coordinates of the target position in the target coordinate system, includes:
[0011] Convert the coordinates of the target position of the three-dimensional model in the world space coordinate system to the screen coordinate system;
[0012] The coordinates of the target position in the screen coordinate system are converted to the target coordinate system, thereby obtaining the coordinates of the target position in the target coordinate system.
[0013] Optionally, the screen coordinate system is a two-dimensional space coordinate system with the upper left corner of the screen as the origin, the horizontal right direction of the screen as the positive direction of the X axis, and the vertical downward direction of the screen as the positive direction of the Y axis;
[0014] The target coordinate system is a two-dimensional space coordinate system with the center of the screen as the origin, the horizontal right direction of the screen as the positive direction of the Y axis, and the vertical downward direction of the screen as the positive direction of the X axis.
[0015] Optionally, the target position of the three-dimensional model includes a center position of the three-dimensional model.
[0016] Optionally, converting the coordinates of the target position of the three-dimensional model in the world space coordinate system to the screen coordinate system includes:
[0017] Convert the coordinates of the target position of the three-dimensional model in the model space coordinate system to the world space coordinate system;
[0018] Convert the coordinates of the target position of the three-dimensional model in the world space coordinate system to the observation space coordinate system;
[0019] Convert the coordinates of the target position of the three-dimensional model in the observation space coordinate system to the clipping space coordinate system;
[0020] The coordinates of the target position of the three-dimensional model in the clipping space coordinate system are converted to the screen coordinate system.
[0021] Optionally, calculating the rotation angle according to the coordinates of the target position in the target coordinate system includes:
[0022] Calculate a target vector with the origin of the target coordinate system as a starting point and the coordinates of the target position in the target coordinate system as an end point;
[0023] The angle between the unit vector of the target vector and the unit vector of the reference direction of the target coordinate system is calculated to obtain a rotation angle.
[0024] Optionally, calculating the angle between the unit vector of the target vector and the unit vector of the reference direction of the target coordinate system includes:
[0025] Calculating the product of the unit vector of the target vector and the unit vector of the reference direction of the target coordinate system;
[0026] The arc cosine or arc tangent is solved for the product to obtain the angle between the target vector and the unit vector of the reference direction of the target coordinate system.
[0027] In addition, according to another aspect of an embodiment of the present invention, there is provided a device for indicating a position of a three-dimensional model, comprising:
[0028] A conversion module, used to determine whether the three-dimensional model is rendered in the screen; if not, convert the coordinates of the target position of the three-dimensional model in the world space coordinate system into the target coordinate system, so as to obtain the coordinates of the target position in the target coordinate system;
[0029] A calculation module, used for calculating a rotation angle according to the coordinates of the target position in the target coordinate system;
[0030] The indicating module is used to rotate the arrow indicator based on the rotation angle to indicate the orientation of the three-dimensional model.
[0031] Optionally, the conversion module is further used for:
[0032] Convert the coordinates of the target position of the three-dimensional model in the world space coordinate system to the screen coordinate system;
[0033] The coordinates of the target position in the screen coordinate system are converted to the target coordinate system, thereby obtaining the coordinates of the target position in the target coordinate system.
[0034] Optionally, the screen coordinate system is a two-dimensional space coordinate system with the upper left corner of the screen as the origin, the horizontal right direction of the screen as the positive direction of the X axis, and the vertical downward direction of the screen as the positive direction of the Y axis;
[0035] The target coordinate system is a two-dimensional space coordinate system with the center of the screen as the origin, the horizontal right direction of the screen as the positive direction of the Y axis, and the vertical downward direction of the screen as the positive direction of the X axis.
[0036] Optionally, the target position of the three-dimensional model includes a center position of the three-dimensional model.
[0037] Optionally, the conversion module is further used for:
[0038] Convert the coordinates of the target position of the three-dimensional model in the model space coordinate system to the world space coordinate system;
[0039] Convert the coordinates of the target position of the three-dimensional model in the world space coordinate system to the observation space coordinate system;
[0040] Convert the coordinates of the target position of the three-dimensional model in the observation space coordinate system to the clipping space coordinate system;
[0041] The coordinates of the target position of the three-dimensional model in the clipping space coordinate system are converted to the screen coordinate system.
[0042] Optionally, the calculation module is further used for:
[0043] Calculate a target vector with the origin of the target coordinate system as a starting point and the coordinates of the target position in the target coordinate system as an end point;
[0044] The angle between the unit vector of the target vector and the unit vector of the reference direction of the target coordinate system is calculated to obtain a rotation angle.
[0045] Optionally, the calculation module is further used for:
[0046] Calculating the product of the unit vector of the target vector and the unit vector of the reference direction of the target coordinate system;
[0047] The arc cosine or arc tangent is solved for the product to obtain the angle between the target vector and the unit vector of the reference direction of the target coordinate system.
[0048] According to another aspect of an embodiment of the present invention, there is further provided an electronic device, including:
[0049] one or more processors;
[0050] a storage device for storing one or more programs,
[0051] When the one or more programs are executed by the one or more processors, the one or more processors implement the method described in any one of the above embodiments.
[0052] According to another aspect of an embodiment of the present invention, a computer-readable medium is provided, on which a computer program is stored. When the program is executed by a processor, the method described in any one of the above embodiments is implemented.
[0053] One embodiment of the above invention has the following advantages or beneficial effects: because if the three-dimensional model is not rendered on the screen, the coordinates of the target position of the three-dimensional model in the world space coordinate system are converted to the target coordinate system, the rotation angle is calculated, and the arrow indicator is rotated, so the technical problem of the inability to determine the orientation of the model in the prior art is overcome. The embodiment of the present invention can indicate and track the orientation of the three-dimensional model in the world space on a two-dimensional screen in real time. Even if the three-dimensional model is not rendered on the screen, the user can know the orientation of the model, which significantly improves the user experience. Therefore, the embodiment of the present invention can indicate the orientation of the three-dimensional model on the screen in real time in AR / VR scenarios.
[0054] The further effects of the above-mentioned non-conventional optional manner will be described below in conjunction with the specific implementation manner. BRIEF DESCRIPTION OF THE DRAWINGS
[0055] The accompanying drawings are used to better understand the present invention and do not constitute an improper limitation of the present invention.
[0056] Figure 1 is a schematic diagram of the main process of the method for indicating the orientation of a three-dimensional model according to an embodiment of the present invention;
[0057] Figure 2 is a schematic diagram of a world space coordinate system according to an embodiment of the present invention;
[0058] Figure 3 is a schematic diagram of a screen coordinate system according to an embodiment of the present invention;
[0059] Figure 4 is a schematic diagram of a process of space transformation according to an embodiment of the present invention;
[0060] Figure 5 is a schematic diagram indicating the orientation of a three-dimensional model according to an embodiment of the present invention;
[0061] Figure 6 is a schematic diagram of the main process of a method for indicating the orientation of a three-dimensional model according to a reference embodiment of the present invention;
[0062] Figure 7 is a schematic diagram of main modules of a device for indicating the orientation of a three-dimensional model according to an embodiment of the present invention;
[0063] Figure 8 is an exemplary system architecture diagram to which embodiments of the present invention may be applied;
[0064] Fig. 9 It is a schematic diagram of the structure of a computer system of a terminal device or a server suitable for implementing an embodiment of the present invention. DETAILED DESCRIPTION
[0065] The following is a description of exemplary embodiments of the present invention in conjunction with the accompanying drawings, including various details of the embodiments of the present invention to facilitate understanding, which should be considered as merely exemplary. Therefore, it should be recognized by those of ordinary skill in the art that various changes and modifications may be made to the embodiments described herein without departing from the scope and spirit of the present invention. Similarly, for clarity and conciseness, the description of well-known functions and structures is omitted in the following description.
[0066] Figure 1 Schematic diagram of the main process of the method for indicating the orientation of a three-dimensional model according to an embodiment of the present invention. Figure 1 As shown, the method for indicating the orientation of the three-dimensional model may include:
[0067] Step 101, determining whether the three-dimensional model is rendered in the screen; if not, converting the coordinates of the target position of the three-dimensional model in the world space coordinate system to the target coordinate system, thereby obtaining the coordinates of the target position in the target coordinate system.
[0068] First, determine whether the 3D model is rendered on the screen. If yes, then end. If no, then convert the coordinates of the target position of the 3D model in the world space coordinate system to the target coordinate system, thereby obtaining the coordinates of the target position in the target coordinate system. In order to facilitate the calculation of the orientation of the 3D model, the target position of the 3D model includes the center position of the 3D model.
[0069] In order to indicate the orientation of the three-dimensional model on the screen, it is necessary to first convert the coordinates of the target position of the three-dimensional model in the world space coordinate system to the target coordinate system, thereby obtaining the coordinates of the target position in the target coordinate system. Figure 2 As shown, the world space coordinate system is a three-dimensional space coordinate system with the center of the screen as the origin, the horizontal right direction of the screen as the positive direction of the X axis, the vertical upward direction of the screen as the positive direction of the Y axis, and the horizontal inward direction (toward the user) as the positive direction of the Z axis. It should be pointed out that the target coordinate system is a two-dimensional space coordinate system, and a matching target coordinate system is usually constructed according to the actual situation of subsequent display and other functions, which can reduce some subsequent calculation and processing steps.
[0070] Optionally, converting the coordinates of the target position of the three-dimensional model in the world space coordinate system to the target coordinate system, thereby obtaining the coordinates of the target position in the target coordinate system, includes: converting the coordinates of the target position of the three-dimensional model in the world space coordinate system to the screen coordinate system; converting the coordinates of the target position in the screen coordinate system to the target coordinate system, thereby obtaining the coordinates of the target position in the target coordinate system. In an embodiment of the present invention, firstly, the coordinates of the target position of the three-dimensional model in the world space coordinate system are converted to the screen coordinate system, such as Figure 3 As shown, the screen coordinate system is a two-dimensional space coordinate system with the upper left corner of the screen as the origin, the horizontal right direction of the screen as the positive direction of the X axis, and the vertical downward direction of the screen as the positive direction of the Y axis. Then, the coordinates of the target position in the screen coordinate system are converted to the target coordinate system, thereby obtaining the coordinates of the target position in the target coordinate system. Optionally, the target coordinate system is a two-dimensional space coordinate system with the center of the screen as the origin, the horizontal right direction of the screen as the positive direction of the Y axis, and the vertical downward direction of the screen as the positive direction of the X axis.
[0071] Taking the center position of the three-dimensional model as an example, in order to calculate the rotation angle in step 102, it is necessary to know the coordinates (x m ,m,m), and then perform spatial transformation according to the three-dimensional coordinates of the model to obtain the coordinates B (xa ,y a ).
[0072] Next, the coordinates of the center position M of the 3D model in the screen coordinate system are:
[0073] B(x b ,b) Convert the coordinate system to the target coordinate system. After conversion, the coordinates A(x a ,y a ). Assuming the width of the screen is w and the height is h, then the coordinates of the center point of the target coordinate system in the screen coordinate system are O(x o ,y o )=(w / 2, h / 2. Then we can get the coordinate point A(x a ,a)=(y b -y o ,x b -x o ).
[0074] Alternatively, if Figure 4 As shown, the coordinates of the target position of the three-dimensional model in the world space coordinate system are converted to the screen coordinate system, including: converting the coordinates of the target position of the three-dimensional model in the model space coordinate system to the world space coordinate system; converting the coordinates of the target position of the three-dimensional model in the world space coordinate system to the observation space coordinate system; converting the coordinates of the target position of the three-dimensional model in the observation space coordinate system to the clipping space coordinate system; converting the coordinates of the target position of the three-dimensional model in the clipping space coordinate system to the screen coordinate system. Spatial transformation is also commonly referred to as vertex transformation, and 3D rendering engines basically support this. Usually, the model observation projection matrix is first used to transform the vertex coordinates from the model space to the clipping space, and then normalization (homogeneous division) and screen mapping are performed to complete the transformation from model space to screen space.
[0075] Step 102: Calculate the rotation angle according to the coordinates of the target position in the target coordinate system.
[0076] According to the coordinates of the target position of the three-dimensional model in the target coordinate system calculated in step 101, the rotation angle relative to the reference direction is calculated. Optionally, step 102 may include: calculating a target vector with the origin of the target coordinate system as the starting point and the coordinates of the target position in the target coordinate system as the end point; calculating the angle between the unit vector of the target vector and the unit vector of the reference direction of the target coordinate system, thereby obtaining the rotation angle. After obtaining the coordinates of the target position of the three-dimensional model in the target coordinate system, the target vector in the target coordinate system can be obtained, and then the angle between the target vector and the reference direction can be calculated to calculate the rotation angle.
[0077] Optionally, calculating the angle between the unit vector of the target vector and the unit vector of the reference direction of the target coordinate system includes: calculating the product of the unit vector of the target vector and the unit vector of the reference direction of the target coordinate system; solving the arccosine or arctangent of the product to obtain the angle between the target vector and the unit vector of the reference direction of the target coordinate system.
[0078] The coordinate point A(x a ,a)=(y b -y o ,x b -x o ) as an example, the target vector with the center point coordinate O as the starting point and the coordinate point A as the end point in the target coordinate system can be obtained.
[0079] Then, we can find the vector The unit vector The unit vector can be calculated by referring to the following formula (where a is any non-zero vector):
[0080]
[0081] Assuming that the positive direction of the X-axis of the target coordinate system is taken as the reference direction, the unit vector in this direction is
[0082] For unit vector and the unit vector Taking the dot product, we get Then we can get and The angle between two vectors:
[0083] 1) You can find the inverse cosine of V to get and The angle θ.
[0084]
[0085] 2) You can also calculate the inverse tangent of V to get and The angle θ.
[0086]
[0087] Step 103: Rotate the arrow indicator based on the rotation angle to indicate the orientation of the three-dimensional model.
[0088] like Figure 5 As shown, the arrow indicator starts to rotate from the reference direction (horizontally to the right), and the rotation angle of the arrow indicator is the rotation angle θ. The rotated arrow indicator is used to indicate the orientation of the three-dimensional model.
[0089] Since the position of the three-dimensional model needs to be indicated in real time, the embodiment of the present invention needs to be processed in each frame of the screen refresh of the mobile phone or other device with a screen.
[0090] It should be noted that if the user drags the model on the screen so that the model gradually enters the screen, the arrow indicator may disappear at this time.
[0091] According to the various embodiments described above, it can be seen that the embodiments of the present invention solve the technical problem of being unable to determine the orientation of the model in the prior art by converting the coordinates of the target position of the three-dimensional model in the world space coordinate system to the target coordinate system, calculating the rotation angle, and then rotating the arrow indicator if the three-dimensional model is not rendered on the screen. The embodiments of the present invention can indicate and track the orientation of the three-dimensional model in the world space on a two-dimensional screen in real time. Even if the three-dimensional model is not rendered on the screen, the user can know the orientation of the model, which significantly improves the user experience. Therefore, the embodiments of the present invention can indicate the orientation of the three-dimensional model on the screen in real time in AR / VR scenarios.
[0092] Figure 6 is a schematic diagram of the main process of a method for indicating the orientation of a three-dimensional model according to a reference embodiment of the present invention. As another embodiment of the present invention, Figure 6 As shown, the method for indicating the orientation of the three-dimensional model may include:
[0093] Step 601, determine whether the three-dimensional model is rendered on the screen; if so, execute step 602; if not, end.
[0094] Step 602: Convert the coordinates of the center position of the three-dimensional model in the world space coordinate system to the screen coordinate system.
[0095] First, determine whether the three-dimensional model is rendered in the screen, if yes, then end. If not, then convert the coordinates of the center position of the three-dimensional model in the world space coordinate system to the screen coordinate system.
[0096] Step 603: Convert the coordinates of the center position of the three-dimensional model in the screen coordinate system to the target coordinate system, thereby obtaining the coordinates of the center position in the target coordinate system.
[0097] In this embodiment, the screen coordinate system is a two-dimensional space coordinate system with the upper left corner of the screen as the origin, the horizontal right direction of the screen as the positive direction of the X-axis, and the vertical downward direction of the screen as the positive direction of the Y-axis; the target coordinate system is a two-dimensional space coordinate system with the center of the screen as the origin, the horizontal right direction of the screen as the positive direction of the Y-axis, and the vertical downward direction of the screen as the positive direction of the X-axis.
[0098] Step 604: Calculate a target vector starting from the origin of the target coordinate system and ending at the coordinates of the center position in the target coordinate system.
[0099] Step 605: Calculate the product of the unit vector of the target vector and the unit vector of the reference direction of the target coordinate system.
[0100] Step 606, solving the arccosine or arctangent for the product to obtain an angle θ between the target vector and a unit vector of a reference direction of the target coordinate system, that is, a rotation angle.
[0101] or
[0102] Step 607: Rotate the arrow indicator based on the rotation angle to indicate the orientation of the three-dimensional model.
[0103] The arrow indicator starts to rotate from a reference direction (horizontally to the right), and the rotation angle of the arrow indicator is the rotation angle θ. The rotated arrow indicator is used to indicate the orientation of the three-dimensional model.
[0104] In addition, the specific implementation content of the method for indicating the orientation of a three-dimensional model in a reference embodiment of the present invention has been described in detail in the method for indicating the orientation of a three-dimensional model described above, so the repeated content will not be described here.
[0105] Figure 7 is a schematic diagram of main modules of a device for indicating the orientation of a three-dimensional model according to an embodiment of the present invention, such as Figure 7As shown, the device 700 for indicating the orientation of a three-dimensional model includes a conversion module 701, a calculation module 702 and an indication module 703; the conversion module 701 is used to determine whether the three-dimensional model is rendered on the screen; if not, the coordinates of the target position of the three-dimensional model in the world space coordinate system are converted into the target coordinate system, so as to obtain the coordinates of the target position in the target coordinate system; the calculation module 702 is used to calculate the rotation angle according to the coordinates of the target position in the target coordinate system; the indication module 703 is used to rotate the arrow indicator based on the rotation angle to indicate the orientation of the three-dimensional model.
[0106] Optionally, the conversion module 701 is further used for:
[0107] Convert the coordinates of the target position of the three-dimensional model in the world space coordinate system to the screen coordinate system;
[0108] The coordinates of the target position in the screen coordinate system are converted to the target coordinate system, thereby obtaining the coordinates of the target position in the target coordinate system.
[0109] Optionally, the screen coordinate system is a two-dimensional space coordinate system with the upper left corner of the screen as the origin, the horizontal right direction of the screen as the positive direction of the X axis, and the vertical downward direction of the screen as the positive direction of the Y axis;
[0110] The target coordinate system is a two-dimensional space coordinate system with the center of the screen as the origin, the horizontal right direction of the screen as the positive direction of the Y axis, and the vertical downward direction of the screen as the positive direction of the X axis.
[0111] Optionally, the target position of the three-dimensional model includes a center position of the three-dimensional model.
[0112] Optionally, the conversion module 701 is further used for:
[0113] Convert the coordinates of the target position of the three-dimensional model in the model space coordinate system to the world space coordinate system;
[0114] Convert the coordinates of the target position of the three-dimensional model in the world space coordinate system to the observation space coordinate system;
[0115] Convert the coordinates of the target position of the three-dimensional model in the observation space coordinate system to the clipping space coordinate system;
[0116] The coordinates of the target position of the three-dimensional model in the clipping space coordinate system are converted to the screen coordinate system.
[0117] Optionally, the calculation module 702 is further used for:
[0118] Calculate a target vector with the origin of the target coordinate system as a starting point and the coordinates of the target position in the target coordinate system as an end point;
[0119] The angle between the unit vector of the target vector and the unit vector of the reference direction of the target coordinate system is calculated to obtain a rotation angle.
[0120] Optionally, the calculation module 702 is further used for:
[0121] Calculating the product of the unit vector of the target vector and the unit vector of the reference direction of the target coordinate system;
[0122] The arc cosine or arc tangent is solved for the product to obtain the angle between the target vector and the unit vector of the reference direction of the target coordinate system.
[0123] According to the various embodiments described above, it can be seen that the embodiments of the present invention solve the technical problem of being unable to determine the orientation of the model in the prior art by converting the coordinates of the target position of the three-dimensional model in the world space coordinate system to the target coordinate system, calculating the rotation angle, and then rotating the arrow indicator if the three-dimensional model is not rendered on the screen. The embodiments of the present invention can indicate and track the orientation of the three-dimensional model in the world space on a two-dimensional screen in real time. Even if the three-dimensional model is not rendered on the screen, the user can know the orientation of the model, which significantly improves the user experience. Therefore, the embodiments of the present invention can indicate the orientation of the three-dimensional model on the screen in real time in AR / VR scenarios.
[0124] It should be noted that the specific implementation content of the device for indicating the orientation of a three-dimensional model in the present invention has been described in detail in the method for indicating the orientation of a three-dimensional model described above, so the repeated content will not be described again here.
[0125] Figure 8 An exemplary system architecture 800 is shown to which the method for indicating the orientation of a three-dimensional model or the apparatus for indicating the orientation of a three-dimensional model according to the embodiments of the present invention can be applied.
[0126] like Figure 8 As shown, system architecture 800 may include terminal devices 801, 802, 803, a network 804, and a server 805. Network 804 is used to provide a medium for communication links between terminal devices 801, 802, 803 and server 805. Network 804 may include various connection types, such as wired, wireless communication links, or optical fiber cables, etc.
[0127] Users can use terminal devices 801, 802, and 803 to interact with server 805 through network 804 to receive or send messages, etc. Various communication client applications can be installed on terminal devices 801, 802, and 803, such as shopping applications, web browser applications, search applications, instant messaging tools, email clients, social platform software, etc. (only examples).
[0128] The terminal devices 801 , 802 , and 803 may be various electronic devices having a display screen and supporting web browsing, including but not limited to smart phones, tablet computers, laptop computers, desktop computers, and the like.
[0129] The server 805 may be a server that provides various services, such as a backend management server (only an example) that provides support for shopping websites browsed by users using the terminal devices 801, 802, and 803. The backend management server may analyze and process the received data such as the item information query request, and feed back the processing results (such as target push information, item information - only an example) to the terminal device.
[0130] It should be noted that the method for indicating the orientation of a three-dimensional model provided in the embodiment of the present invention is generally executed by the terminal devices 801 , 802 , and 803 . Accordingly, the device for indicating the orientation of a three-dimensional model is arranged in the terminal devices 801 , 802 , and 803 .
[0131] It should be understood that Figure 8 The number of terminal devices, networks and servers in the embodiment is only for illustration. Any number of terminal devices, networks and servers may be provided according to implementation requirements.
[0132] Reference below Fig. 9 , which shows a schematic diagram of the structure of a computer system 900 of a terminal device suitable for implementing an embodiment of the present invention. Fig. 9 The terminal device shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present invention.
[0133] like Fig. 9 As shown, the computer system 900 includes a central processing unit (CPU) 901, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 902 or a program loaded from a storage part 908 into a random access memory (RAM) 903. In the RAM 903, various programs and data required for the operation of the system 900 are also stored. The CPU 901, the ROM 902, and the RAM 903 are connected to each other via a bus 904. An input / output (I / O) interface 905 is also connected to the bus 904.
[0134] The following components are connected to the I / O interface 905: an input section 906 including a keyboard, a mouse, etc.; an output section 907 including a cathode ray tube (CRT), a liquid crystal display (LCD), etc., and a speaker, etc.; a storage section 908 including a hard disk, etc.; and a communication section 909 including a network interface card such as a LAN card, a modem, etc. The communication section 909 performs communication processing via a network such as the Internet. A drive 910 is also connected to the I / O interface 905 as needed. A removable medium 911, such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, etc., is installed on the drive 910 as needed, so that a computer program read therefrom is installed into the storage section 908 as needed.
[0135] In particular, according to the embodiments disclosed in the present invention, the process described above with reference to the flowchart can be implemented as a computer software program. For example, the embodiments disclosed in the present invention include a computer program, which includes a computer program carried on a computer-readable medium, and the computer program includes a program code for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from the network through the communication part 909, and / or installed from the removable medium 911. When the computer program is executed by the central processing unit (CPU) 901, the above-mentioned functions defined in the system of the present invention are executed.
[0136] It should be noted that the computer-readable medium shown in the present invention may be a computer-readable signal medium or a computer-readable storage medium or any combination of the above two. The computer-readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples of computer-readable storage media may include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In the present invention, a computer-readable storage medium may be any tangible medium containing or storing a program that can be used by or in combination with an instruction execution system, device or device. In the present invention, a computer-readable signal medium may include a data signal propagated in a baseband or as part of a carrier wave, which carries a computer-readable program code. This propagated data signal may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. Computer-readable signal media may also be any computer-readable medium other than computer-readable storage media, which may send, propagate or transmit a program for use by or in conjunction with an instruction execution system, apparatus or device. The program code contained on the computer-readable medium may be transmitted using any appropriate medium, including but not limited to: wireless, wire, optical cable, RF, etc., or any suitable combination of the above.
[0137] The flow chart and block diagram in the accompanying drawings illustrate the possible architecture, functions and operations of the system, method and computer program according to various embodiments of the present invention. In this regard, each box in the flow chart or block diagram can represent a module, a program segment, or a part of a code, and the above-mentioned module, program segment, or a part of a code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in a different order from the order marked in the accompanying drawings. For example, two boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram or flow chart, and the combination of the boxes in the block diagram or flow chart can be implemented with a dedicated hardware-based system that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.
[0138] The modules involved in the embodiments of the present invention may be implemented by software or hardware. The modules described may also be set in a processor, for example, it may be described as: a processor includes a conversion module, a calculation module and an indication module, wherein the names of these modules do not constitute a limitation on the modules themselves in some cases.
[0139] As another aspect, the present invention also provides a computer-readable medium, which may be included in the device described in the above embodiment; or it may exist independently without being assembled into the device. The above computer-readable medium carries one or more programs, and when the above one or more programs are executed by a device, the device implements the following method: determining whether the three-dimensional model is rendered on the screen; if not, converting the coordinates of the target position of the three-dimensional model in the world space coordinate system to the target coordinate system, thereby obtaining the coordinates of the target position in the target coordinate system; calculating the rotation angle according to the coordinates of the target position in the target coordinate system; rotating the arrow indicator based on the rotation angle to indicate the orientation of the three-dimensional model.
[0140] According to the technical solution of the embodiment of the present invention, because if the three-dimensional model is not rendered on the screen, the coordinates of the target position of the three-dimensional model in the world space coordinate system are converted to the target coordinate system, the rotation angle is calculated, and the arrow indicator is rotated, the technical problem of the inability to determine the orientation of the model in the prior art is overcome. The embodiment of the present invention can indicate and track the orientation of the three-dimensional model in the world space on a two-dimensional screen in real time. Even if the three-dimensional model is not rendered on the screen, the user can know the orientation of the model, which significantly improves the user experience. Therefore, the embodiment of the present invention can indicate the orientation of the three-dimensional model on the screen in real time in AR / VR scenarios.
[0141] The above specific implementations do not constitute a limitation on the protection scope of the present invention. It should be understood by those skilled in the art that various modifications, combinations, sub-combinations and substitutions may occur depending on design requirements and other factors. Any modification, equivalent substitution and improvement made within the spirit and principle of the present invention shall be included in the protection scope of the present invention.
Claims
1. A method for indicating the orientation of a three-dimensional model, characterized in that: include: Determine whether the 3D model is rendered on the screen; If not, converting the coordinates of the target position of the three-dimensional model in the world space coordinate system into the target coordinate system, thereby obtaining the coordinates of the target position in the target coordinate system; Calculating a rotation angle according to the coordinates of the target position in the target coordinate system; Rotating the arrow indicator based on the rotation angle to indicate the orientation of the three-dimensional model; Converting the coordinates of the target position of the three-dimensional model in the world space coordinate system to the target coordinate system, thereby obtaining the coordinates of the target position in the target coordinate system, includes: Convert the coordinates of the target position of the three-dimensional model in the world space coordinate system to the screen coordinate system; Converting the coordinates of the target position in the screen coordinate system to the target coordinate system, thereby obtaining the coordinates of the target position in the target coordinate system; The screen coordinate system is a two-dimensional space coordinate system with the upper left corner of the screen as the origin, the horizontal right direction of the screen as the positive direction of the X axis, and the vertical downward direction of the screen as the positive direction of the Y axis; The target coordinate system is a two-dimensional space coordinate system with the center of the screen as the origin, the horizontal right direction of the screen as the positive direction of the Y axis, and the vertical downward direction of the screen as the positive direction of the X axis; Converting the coordinates of the target position of the three-dimensional model in the world space coordinate system to the screen coordinate system includes: Convert the coordinates of the target position of the three-dimensional model in the model space coordinate system to the world space coordinate system; Convert the coordinates of the target position of the three-dimensional model in the world space coordinate system to the observation space coordinate system; Convert the coordinates of the target position of the three-dimensional model in the observation space coordinate system to the clipping space coordinate system; The coordinates of the target position of the three-dimensional model in the clipping space coordinate system are converted to the screen coordinate system.
2. The method according to claim 1, characterized in that The target position of the three-dimensional model includes the center position of the three-dimensional model.
3. The method according to claim 1, characterized in that Calculating a rotation angle according to the coordinates of the target position in the target coordinate system includes: Calculate a target vector with the origin of the target coordinate system as a starting point and the coordinates of the target position in the target coordinate system as an end point; The angle between the unit vector of the target vector and the unit vector of the reference direction of the target coordinate system is calculated to obtain a rotation angle.
4. The method according to claim 3, characterized in that Calculating the angle between the unit vector of the target vector and the unit vector of the reference direction of the target coordinate system includes: Calculating the product of the unit vector of the target vector and the unit vector of the reference direction of the target coordinate system; The arc cosine or arc tangent is solved for the product to obtain the angle between the target vector and the unit vector of the reference direction of the target coordinate system.
5. A device for indicating the orientation of a three-dimensional model, characterized in that: include: A conversion module, used to determine whether the 3D model is rendered on the screen; If not, converting the coordinates of the target position of the three-dimensional model in the world space coordinate system into the target coordinate system, thereby obtaining the coordinates of the target position in the target coordinate system; A calculation module, used for calculating a rotation angle according to the coordinates of the target position in the target coordinate system; An indication module, configured to rotate the arrow indicator based on the rotation angle to indicate the orientation of the three-dimensional model; The conversion module is also used for: Convert the coordinates of the target position of the three-dimensional model in the world space coordinate system to the screen coordinate system; Converting the coordinates of the target position in the screen coordinate system to the target coordinate system, thereby obtaining the coordinates of the target position in the target coordinate system; The screen coordinate system is a two-dimensional space coordinate system with the upper left corner of the screen as the origin, the horizontal right direction of the screen as the positive direction of the X axis, and the vertical downward direction of the screen as the positive direction of the Y axis; The target coordinate system is a two-dimensional space coordinate system with the center of the screen as the origin, the horizontal right direction of the screen as the positive direction of the Y axis, and the vertical downward direction of the screen as the positive direction of the X axis; The conversion module is also used for: Convert the coordinates of the target position of the three-dimensional model in the model space coordinate system to the world space coordinate system; Convert the coordinates of the target position of the three-dimensional model in the world space coordinate system to the observation space coordinate system; Convert the coordinates of the target position of the three-dimensional model in the observation space coordinate system to the clipping space coordinate system; The coordinates of the target position of the three-dimensional model in the clipping space coordinate system are converted to the screen coordinate system.
6. An electronic device, characterized in that: include: one or more processors; a storage device for storing one or more programs, When the one or more programs are executed by the one or more processors, the one or more processors implement the method according to any one of claims 1 to 4.
7. A computer readable medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, the method according to any one of claims 1 to 4 is implemented.
Citation Information
Patent Citations
Data-driving-based demonstration method of three-dimensional situation map of ship
CN107705361A
Method and apparatus for presenting location information on augmented reality
KR1020120017783A
Three-dimensional window displaying apparatus and mehtod thereof
US20020080182A1