Object processing method and apparatus, electronic device, storage medium, and program product
Patent Information
- Application Number
- CN202510495975.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-04-18
- Publication Date
- 2026-10-23
AI Technical Summary
[0004]本公开提供了一种对象处理方法、装置、电子设备、存储介质以及程序产品,以解决相关技术中多对象旋转性能消耗较高且难以应对多变场景的技术问题,实现了多对象的协同旋转,确保相对姿态的动态稳定性
[0019]本公开实施例的技术方案,通过接收针对目标空间中第一对象的旋转请求,根据所述旋转请求将所述第一对象由第一姿态旋转至第二姿态,能够实现对第一对象的呈现姿态的灵活调整,以适配差异化的对象旋转需求;通过响应于所述目标空间中存在第二对象的事件,获取所述第一姿态下的第一向量以及所述第二姿态下与所述第一向量对应的第二向量,根据所述第一向量和所述第二向量确定与所述旋转请求对应的旋转四元数,通过捕捉旋转前后的向量变化,直接推导出描述该旋转的旋转四元数,可确保任意角度旋转下相对姿态的严格守恒,并避免传统矩阵变换的累积误差;由于所述第二对象与所述第一对象以预期相对姿态呈现,通过根据所述旋转四元数对所述第二对象执行姿态旋转操作,以使所述第一对象和所述第二对象继续以所述预期相对姿态呈现,通过共享第一对象的旋转四元数,确保与第二对象相对姿态的动态稳定性,降低计算复杂度,而且通过记录旋转前后的向量对应关系,即使第二对象因遮挡、延迟等原因暂时不可见,仍能基于历史旋转四元数数据恢复其正确姿态,避免依赖实时坐标反馈的脆弱性,同时支持非连续旋转指令的瞬时响应,无姿态振荡风险,实现了多对象旋转的处理效率以及动态适应性的统一。
Smart Images

Figure CN122966709A_ABST
Abstract
Description
Technical Field
[0001] This disclosure relates to the field of computer processing technology, and more particularly to an object processing method, apparatus, electronic device, storage medium, and program product. Background Technology
[0002] In object posture control in three-dimensional space, multi-object cooperative rotation is a core requirement in fields such as industrial robotics, virtual reality, and game animation. For example, the end effector of a robotic arm needs to adjust synchronously with the rotation of the main body's joints, or the equipment of a virtual character needs to maintain consistency with the movement of the skeleton. Such scenarios require that the associated objects can maintain a fixed relative posture (such as parallel, perpendicular, or preset offset) after dynamic rotation, but related technologies struggle to balance accuracy, efficiency, and robustness.
[0003] The relevant methods mainly rely on hierarchical coordinate system binding or Euler angle rotation. While this hierarchical binding simplifies calculations, it cannot adapt to non-rigid association requirements, and Euler angles are prone to gimbal lock, leading to attitude distortion during large-angle rotations. In addition, calculating the rotation matrix of each object independently incurs excessive computational overhead in complex systems and is difficult to handle dynamic occlusion or abrupt rotation commands. Summary of the Invention
[0004] This disclosure provides an object processing method, apparatus, electronic device, storage medium, and program product to solve the technical problems of high performance consumption and difficulty in coping with changing scenarios in the related art, thereby realizing the cooperative rotation of multiple objects and ensuring the dynamic stability of their relative postures.
[0005] In a first aspect, embodiments of this disclosure provide an object processing method, the method comprising:
[0006] Receive a rotation request for a first object in the target space, and rotate the first object from a first pose to a second pose according to the rotation request;
[0007] In response to an event that a second object exists in the target space, a first vector in the first pose and a second vector corresponding to the first vector in the second pose are obtained, and a rotation quaternion corresponding to the rotation request is determined based on the first vector and the second vector; wherein the second object and the first object are presented in the expected relative pose;
[0008] Perform a pose rotation operation on the second object according to the rotation quaternion so that the first object and the second object continue to be presented in the expected relative pose.
[0009] Secondly, embodiments of this disclosure also provide an object processing apparatus, the apparatus comprising:
[0010] A rotation request module is used to receive a rotation request for a first object in the target space, and rotate the first object from a first posture to a second posture according to the rotation request.
[0011] An object recognition module is used to respond to an event that a second object exists in the target space, obtain a first vector in the first posture and a second vector corresponding to the first vector in the second posture, and determine a rotation quaternion corresponding to the rotation request based on the first vector and the second vector; wherein the second object and the first object are presented in a expected relative posture;
[0012] The attitude rotation module is used to perform an attitude rotation operation on the second object according to the rotation quaternion, so that the first object and the second object continue to be presented in the expected relative attitude.
[0013] Thirdly, embodiments of this disclosure also provide an electronic device, the electronic device comprising:
[0014] One or more processors;
[0015] Storage device for storing one or more programs.
[0016] When the one or more programs are executed by the one or more processors, the one or more processors implement the object processing method as described in any of the embodiments of this disclosure.
[0017] Fourthly, embodiments of this disclosure also provide a storage medium containing computer-executable instructions, which, when executed by a computer processor, are used to perform the object processing method as described in any of the embodiments of this disclosure.
[0018] Fifthly, embodiments of this disclosure also provide a computer program product, including a computer program that, when executed by a processor, implements the object processing method as described in any of the embodiments of this disclosure.
[0019] The technical solution of this disclosure, by receiving a rotation request for a first object in a target space and rotating the first object from a first pose to a second pose according to the rotation request, can flexibly adjust the presentation pose of the first object to adapt to different object rotation requirements; by responding to an event that a second object exists in the target space, obtaining a first vector in the first pose and a second vector corresponding to the first vector in the second pose, determining a rotation quaternion corresponding to the rotation request based on the first vector and the second vector, and directly deriving the rotation quaternion describing the rotation by capturing the vector changes before and after the rotation, it can ensure strict conservation of relative pose under arbitrary angle rotation and avoid the accumulation of traditional matrix transformations. Product error; Since the second object and the first object are presented in the expected relative posture, the posture rotation operation of the second object is performed according to the rotation quaternion so that the first object and the second object continue to be presented in the expected relative posture. By sharing the rotation quaternion of the first object, the dynamic stability of the relative posture with the second object is ensured, the computational complexity is reduced, and by recording the vector correspondence before and after the rotation, even if the second object is temporarily invisible due to occlusion, delay or other reasons, its correct posture can still be restored based on the historical rotation quaternion data, avoiding the vulnerability of relying on real-time coordinate feedback. At the same time, it supports instantaneous response to discontinuous rotation commands, without the risk of posture oscillation, and achieves the unity of processing efficiency and dynamic adaptability of multi-object rotation. Attached Figure Description
[0020] The above and other features, advantages, and aspects of the embodiments of this disclosure will become more apparent from the accompanying drawings and the following detailed description. Throughout the drawings, the same or similar reference numerals denote the same or similar elements. It should be understood that the drawings are schematic, and the originals and elements are not necessarily drawn to scale.
[0021] Figure 1 A flowchart illustrating an object processing method provided in an embodiment of this disclosure;
[0022] Figure 2 A flowchart illustrating another object processing method provided in an embodiment of this disclosure;
[0023] Figure 3 This is a schematic diagram of the structure of an object processing apparatus provided in an embodiment of the present disclosure;
[0024] Figure 4 This is a schematic diagram of the structure of an electronic device for implementing an embodiment of the present disclosure. Detailed Implementation
[0025] Embodiments of this disclosure will now be described in more detail with reference to the accompanying drawings. While some embodiments of this disclosure are shown in the drawings, it should be understood that this disclosure can be implemented in various forms and should not be construed as limited to the embodiments set forth herein. Rather, these embodiments are provided to provide a more thorough and complete understanding of this disclosure. It should be understood that the accompanying drawings and embodiments of this disclosure are for illustrative purposes only and are not intended to limit the scope of protection of this disclosure.
[0026] It should be understood that the steps described in the method embodiments of this disclosure may be performed in different orders and / or in parallel. Furthermore, the method embodiments may include additional steps and / or omit the steps shown. The scope of this disclosure is not limited in this respect.
[0027] The term "comprising" and its variations as used herein are open-ended inclusions, meaning "including but not limited to". The term "based on" means "at least partially based on". The term "one embodiment" means "at least one embodiment"; the term "another embodiment" means "at least one additional embodiment"; the term "some embodiments" means "at least some embodiments". Definitions of other terms will be given in the description below.
[0028] It should be noted that the concepts of "first" and "second" mentioned in this disclosure are used only to distinguish different devices, modules or units, and are not used to limit the order of functions performed by these devices, modules or units or their interdependencies.
[0029] It should be noted that the terms "a" and "a plurality of" used in this disclosure are illustrative rather than restrictive, and those skilled in the art should understand that, unless otherwise expressly indicated in the context, they should be understood as "one or more".
[0030] The names of messages or information exchanged between multiple devices in the embodiments of this disclosure are for illustrative purposes only and are not intended to limit the scope of such messages or information.
[0031] It is understood that before using the technical solutions disclosed in the various embodiments of this disclosure, users should be informed of the types, scope of use, and usage scenarios of the personal information involved in this disclosure in an appropriate manner in accordance with relevant laws and regulations, and user authorization should be obtained.
[0032] For example, upon receiving a user's active request, a prompt message is sent to the user to explicitly inform them that the requested operation will require the acquisition and use of the user's personal information. This allows the user to independently choose whether to provide personal information to the software or hardware, such as the electronic device, application, server, or storage medium performing the operations of this disclosed technical solution, based on the prompt message.
[0033] As an optional but non-limiting implementation, in response to a user's active request, sending a prompt message to the user can be done via a pop-up window, where the prompt message can be presented in text format. Furthermore, the pop-up window can also include a selection control allowing the user to choose "agree" or "disagree" to provide personal information to the electronic device.
[0034] It is understood that the above notification and user authorization process are merely illustrative and do not constitute a limitation on the implementation of this disclosure. Other methods that comply with relevant laws and regulations may also be applied to the implementation of this disclosure.
[0035] It is understood that the data involved in this technical solution (including but not limited to the data itself, the acquisition or use of the data) shall comply with the requirements of relevant laws, regulations and related provisions.
[0036] Figure 1 This is a flowchart illustrating an object processing method provided in an embodiment of this disclosure. This embodiment is applicable to scenarios involving the collaborative rotation of multiple objects, particularly those with high real-time requirements. The method can be executed by an object processing device, which can be implemented in software and / or hardware, optionally through an electronic device such as a mobile terminal, PC, or server. Figure 1 As shown, the method in this embodiment may specifically include:
[0037] S110. Receive a rotation request for a first object in the target space, and rotate the first object from a first posture to a second posture according to the rotation request.
[0038] In this embodiment, the target space can be understood as a mathematical abstract space containing all operable objects. The target space can be described using three-dimensional Euclidean space. The target space can be a virtual reality space, an augmented reality space, or a mixed reality space combining virtual reality and augmented reality. It should be noted that the target space can differ in different application scenarios. In other words, the target space is associated with the control logic and application scenario of the first object.
[0039] In a robot control scenario, assuming the primary object is the robotic arm of a picking robot or one or more joints on that arm, the target space can include the picking robot's physical workspace and / or logical control space. The physical workspace is the physical range accessible to the robot's robotic arm in three-dimensional Euclidean space. The boundaries of the physical workspace are determined by joint lengths and rotation angles, and are typically modeled as: a spherical coordinate system (radius less than or equal to the total length of the robotic arm) and / or Cartesian space constraints (such as a cuboid region defined by shelf dimensions). The logical control space can be an abstract space containing one or more of the following elements: item coordinates (spatial positions provided by the vision system), obstacle positions (dynamically updated point cloud data), and safety buffer zones (virtual boundaries at distances to obstacles greater than or equal to preset values).
[0040] In an animated scene, assuming the first object is the arm of an animated or game character, the target space can include a skeletal local space and / or an animation blending space. The skeletal local space can be established based on a hierarchical coordinate system with the character's root node as the origin. In the skeletal local space, the transformation of the arm joints is based on the forward kinematic parameters of the skeletal chain and / or skinning weights (range of influence). The animation blending space can be understood as an abstract space containing multiple superimposed animation layers, which can achieve complex dynamic effects through layered fusion. The animation layers that can be fused in the animation blending space can include, but are not limited to, at least one of the following: basic action layers (such as arm swinging while running), additional action layers (such as the inverse kinematic target point for aiming a gun), and physical simulation layers (cloth / hair collision volume). Basic actions are the underlying templates for character behavior, such as periodic actions like running and jumping. Essentially, they are pre-baked animation clips that drive the movement of model vertices through the skeleton. Additional action layers are used to dynamically extend interactive behaviors; specifically, joint angles can be calculated through mathematical constraints (such as the pseudo-inverse of the Jacobian matrix) to ensure that the limb extremities (such as the hand) accurately reach the target position. The physics simulation layer is used to enhance the realism of animations, specifically for collision volume modeling.
[0041] The first object can be understood as a subject object in the target space that can be directly controlled, whose posture changes will drive other related objects. Simply put, the first object can be understood as an interactive or manipulable object. For example, the first object can be an end effector in an industrial robot or the root node of a character's skeleton in a game engine. The first object can also be a pre-created virtual object in a virtual reality space, etc. In this embodiment, no specific limitation is made on which objects are the first object. Specifically, the first object can be understood as an object in the target space whose posture changes in accordance with the changes in its posture.
[0042] A rotation request is used to request the execution of an operation to rotate a first object in a target space. In one scenario, the rotation request can be used to trigger the first object to rotate multiple times around a preset rotation axis at the same angle. There are various ways to initiate a rotation request. For example, receiving a rotation request for a first object in the target space may include at least one of the following operations: receiving a rotation request input from a physical controller (such as a handle or joystick) for the first object in the target space; receiving a trigger action (such as a touch gesture, eye-tracking data, or voice command) for the first object in the target space, and generating a rotation request based on the trigger action; generating a rotation request input for the first object in the target space in response to environmental data (such as collision data, illumination data, temperature data, humidity data, or pressure data) meeting a preset condition; receiving a motion planning operation for the first object in the target space, and generating a rotation request corresponding to the first object based on the motion planning operation.
[0043] It is understood that the first pose and the second pose are used to represent the pose of the first object before and after rotation, respectively. In other words, the second pose can be understood as the pose exhibited after performing a rotation of the expected angle under the first pose. The pose of the first object is typically associated with the position and orientation of one or more feature points of the first object.
[0044] As an optional implementation of this disclosure, rotating the first object from a first pose to a second pose according to the rotation request may specifically include: determining a first vector of the first object in the first pose according to the rotation request, rotating the first vector into a second vector according to a preset rotation method, and adjusting the first object to the second pose according to the second vector; wherein, the preset rotation method includes rotation based on Euler angles or rotation based on a preset rotation matrix. In this technical solution, the rigidity of the pose transformation is ensured through the strict mapping between the first vector and the second vector, ensuring that the internal structure of the object remains unchanged before and after rotation (such as the relative angles of the robotic arm joints), avoiding the cumulative errors of traditional hierarchical transformations, and achieving accurate adjustment of the pose of the first object.
[0045] Here, the first vector and the second vector represent the first pose and the second pose exhibited by the first object, respectively. The second vector can be understood as the expected vector obtained after performing a pose rotation operation on the first vector. In short, the second vector is obtained by rotating the first vector. That is, the second vector is obtained by rotating the first vector.
[0046] In one embodiment, determining the first vector of the first object in the first posture based on the rotation request may include: determining a reference vector with directional characteristics on the first object in the first posture, such as the end effector normal vector of a robotic arm or the axial direction of a virtual character's skeleton. The reference vector may be pre-set. The reference vector may correspond to the object type of the first object.
[0047] In another alternative implementation, one or more feature points of the first object can be determined, and the line connecting multiple feature points in the first pose can be determined as a first vector in the first pose; or, the origin of the spatial coordinate system corresponding to the target space can be determined, and the line connecting the origin and the feature points can be determined as a first vector in the first pose.
[0048] In another embodiment, a first vector under the first posture is also determined based on the received vector setting operation corresponding to the rotation request. This technical solution allows for flexible setting of the first vector to ensure that the posture of the first object after rotation is the expected posture.
[0049] As described above, as an optional technical solution in this embodiment, rotating the first vector into a second vector according to a preset rotation method includes: rotating the first vector into a second vector according to Euler angles. Specifically, the preset rotation request is decomposed into three independent angular components (such as pitch angle, yaw angle, and roll angle), and the rotations are performed sequentially according to a preset axis order. That is, each angle corresponds to a rotation around a single coordinate axis, and the coordinate system resulting from the previous rotation is used as the reference for the next rotation. For example, first, rotate around the Z-axis: keeping the Z-axis unchanged, the vector direction is adjusted by angle in the XY plane. Then, rotate around the new Y-axis: based on the coordinate system after the previous rotation, the projection of the vector in the XZ plane is adjusted. Finally, rotate around the new X-axis: the final direction calibration is completed in the YZ plane, forming the second vector. After each rotation, the local coordinate system direction is updated to ensure that the subsequent rotation axis is always aligned with the current object's attitude. If the angle combination triggers gimbal lock (such as a pitch angle of 90°), redundant degrees of freedom are automatically locked and a warning is triggered.
[0050] As another optional technical solution in this disclosure embodiment, rotating the first vector into a second vector according to a preset rotation method includes: rotating the first vector into a second vector according to a preset rotation matrix. Specifically, an orthogonal matrix of a preset size (e.g., 3x3) can be generated according to a preset rotation rule (e.g., rotating around a specific axis by a specified angle), ensuring that each column vector is of unit length and mutually perpendicular. Schmitt orthogonalization can also be used to correct calculation errors, ensuring that the matrix satisfies the rotation characteristic (determinant value is 1). The first vector is treated as point coordinates in three-dimensional space, and a linear transformation operation is performed with the rotation matrix. Each row of the matrix is multiplied by the vector dot product to obtain three new coordinate components, which are combined to form the second vector.
[0051] After obtaining the second vector, the first vector is adjusted to the second vector, thus presenting the first object in the second pose.
[0052] S120. In response to an event that a second object exists in the target space, obtain a first vector in the first posture and a second vector corresponding to the first vector in the second posture, and determine a rotation quaternion corresponding to the rotation request based on the first vector and the second vector; wherein the second object and the first object are presented in a desired relative posture.
[0053] In this embodiment, the target space includes a three-dimensional abstract coordinate system of a first object and a second object, and all pose calculations are based on this space. The second object can be understood as an object that needs to present a preset relative pose with the first object, that is, the first object and the second object need to maintain a fixed spatial relationship. Alternatively, the second object can be understood as an object that needs to rotate following the rotation of the first object.
[0054] As an optional implementation of this disclosure, specifically, the second object corresponding to the first object in the target space can be determined based on the object identifier of the first object and the association relationship between the first object and the second object. Further, the association relationship between the first object and the second object can be pre-set or set based on a received relationship establishment operation. For example, in response to an association object setting operation for the first object, the second object corresponding to the first object can be determined based on the association object setting operation. The association object setting operation is used to instruct the first object and the second object to maintain a fixed relative posture, that is, the relative posture of the first object and the second object remains unchanged during subsequent display.
[0055] As mentioned earlier, the first vector and the second vector are used to represent the first pose and the second pose exhibited by the first object, respectively. The second vector can be understood as the expected vector obtained after performing a pose rotation operation on the first vector. In short, the second vector is obtained by rotating the first vector. That is, the second vector is the vector obtained by rotating the first vector.
[0056] Optionally, obtaining the first vector in the first posture and the second vector corresponding to the first vector in the second posture includes: determining the first vector in the first posture and the second vector corresponding to the first vector in the second posture based on the received vector setting operation corresponding to the rotation request. This technical solution supports flexible setting of the first vector, is applicable to various object rotation scenarios, meets differentiated object rotation needs, expands the applicable scenarios of object rotation, and enriches the object presentation effects.
[0057] The vector setting operation can be understood as setting a first vector. For example, determining the first vector in the first pose based on the received vector setting operation corresponding to the rotation request may include: receiving a vector drawing operation to draw a first vector on the first object, and determining the first vector of the first pose in the first pose based on the vector drawing operation; and / or, receiving a point setting operation to select at least one reference point on the first object, and determining the first vector of the first pose in the first pose based on the point setting operation. Further, the point setting operation includes point marking operations and point selection operations, etc. For example, in response to a vector marking trigger operation, multiple optional points corresponding to the first object are displayed; in response to a point selection operation for at least one of the optional points, the first vector of the first pose in the first pose is determined based on the point selection operation. Optional points can be understood as selectable points in or around the first object. The multiple optional points corresponding to the first object may be points at preset positions of the first object. The multiple optional points corresponding to the first object can be obtained by performing feature detection on the first object. The specific points that can be selected can be set according to actual needs; that is, they can be set as needed, and no specific restrictions are made here.
[0058] Specifically, after obtaining the first vector in the first posture, a second vector corresponding to the first vector in the second posture can be determined based on the first vector. For example, a drag operation (rotation operation) is received on the first vector, and the second vector corresponding to the first vector is determined based on the drag operation.
[0059] In this embodiment of the disclosure, since there is a second object corresponding to the first object, the rotation quaternion corresponding to the rotation request is determined based on the first vector and the second vector, and the rotation quaternion of the first object can be accurately determined. Then, the second object is rotated by sharing the rotation quaternion of the first object.
[0060] S130. Perform a pose rotation operation on the second object according to the rotation quaternion so that the first object and the second object continue to be presented in the expected relative pose.
[0061] Specifically, a third vector of the second object can be determined, and the third vector is multiplied left by a rotation quaternion and then right by the inverse of the rotation quaternion to obtain a rotated fourth vector. This fourth vector is then used to adjust the second object, ensuring that the first and second objects continue to present themselves in the expected relative posture. That is, when the first object rotates, the posture adjustment of the second object is driven by the same rotation quaternion, ensuring that the relative postures (such as distance, angle, etc.) of both are strictly consistent with the initial state (expected relative posture).
[0062] The technical solution of this disclosure, by receiving a rotation request for a first object in a target space and rotating the first object from a first pose to a second pose according to the rotation request, can flexibly adjust the presentation pose of the first object to adapt to different object rotation requirements; by responding to an event that a second object exists in the target space, obtaining a first vector in the first pose and a second vector corresponding to the first vector in the second pose, determining a rotation quaternion corresponding to the rotation request based on the first vector and the second vector, and directly deriving the rotation quaternion describing the rotation by capturing the vector changes before and after the rotation, it can ensure strict conservation of relative pose under arbitrary angle rotation and avoid the accumulation of traditional matrix transformations. Product error; Since the second object and the first object are presented in the expected relative posture, the posture rotation operation of the second object is performed according to the rotation quaternion so that the first object and the second object continue to be presented in the expected relative posture. By sharing the rotation quaternion of the first object, the dynamic stability of the relative posture with the second object is ensured, the computational complexity is reduced, and by recording the vector correspondence before and after the rotation, even if the second object is temporarily invisible due to occlusion, delay or other reasons, its correct posture can still be restored based on the historical rotation quaternion data, avoiding the vulnerability of relying on real-time coordinate feedback. At the same time, it supports instantaneous response to discontinuous rotation commands, without the risk of posture oscillation, and achieves the unity of processing efficiency and dynamic adaptability of multi-object rotation.
[0063] Figure 2This is a flowchart illustrating another object processing method provided in this embodiment. Based on the above embodiments, the technical solution of this embodiment further refines the method for determining the rotation quaternion. Optionally, determining the rotation quaternion corresponding to the rotation request based on the first vector and the second vector includes: determining the rotation quaternion corresponding to the rotation request based on the first vector, the second vector, and a pre-constructed first model; wherein, the first model is a model for solving the rotation quaternion constructed based on the inner and outer products of the two vectors before and after rotation. For detailed implementation, please refer to the description of this embodiment. Technical features that are the same as or similar to those in the foregoing embodiments will not be repeated here. Figure 2 As shown, the method in this embodiment may specifically include:
[0064] S210. Receive a rotation request for a first object in the target space, and rotate the first object from a first posture to a second posture according to the rotation request.
[0065] S220. In response to an event that a second object exists in the target space, obtain a first vector in the first posture and a second vector corresponding to the first vector in the second posture.
[0066] S230. Determine the rotation quaternion corresponding to the rotation request based on the first vector, the second vector, and the pre-constructed first model; wherein, the first model is a model for solving the rotation quaternion based on the inner product and outer product of the two vectors before and after rotation.
[0067] Taking vectors a and b as examples before and after rotation, the rotation quaternion is used to describe the rotation from vector a to vector b, or in other words, rotating vector a into vector b. In this embodiment, since the first model is a model for solving the rotation quaternion based on the inner and outer products of the two vectors before and after rotation, the rotation quaternion can be determined by the inner and outer products of the vectors before and after rotation in a single rotation. This greatly improves the efficiency of determining the rotation quaternion, and thus improves the processing efficiency of object rotation.
[0068] Specifically, the first model is an operational model obtained by transforming the trigonometric function operations in the second model into operations between two vectors before and after rotation; the second model is a model for solving the rotation quaternion constructed based on the rotation axis of the vector and the rotation angle of the vector relative to the rotation axis. In other words, the rotation quaternion can be constructed first based on the rotation axis of the vector and the rotation angle of the vector relative to the rotation axis, and then the trigonometric function operations in the second model can be transformed into operations between two vectors before and after rotation to obtain the first model. In this technical solution, the first model replaces the trigonometric function operations in the second model with operations between two vectors. Compared with the rotation quaternion determination method in related technologies, there is no need to perform inverse trigonometric function operations, which can ensure the accurate solution of the rotation quaternion, greatly save the solution time of the rotation quaternion, improve the operation efficiency, save the memory occupation of object rotation processing, reduce performance consumption, and improve the user experience of multi-object rotation processing.
[0069] Optionally, the rotation quaternion is constructed based on the rotation axis of the vector and the rotation angle of the vector relative to the rotation axis. Specifically, this includes: obtaining the rotation axis by the cross product (vector product or outer product) of the two vectors before and after rotation; and obtaining the angle between the two vectors by calculating the inverse trigonometric function after the dot product (inner product) of the two vectors before and after rotation, and then constructing the rotation quaternion according to a preset rotation quaternion construction formula based on the rotation axis and the angle. In the rotation quaternion construction formula, the real part of the rotation quaternion is represented by the cosine of half the rotation angle, and the imaginary part of the rotation quaternion is represented by the product of the sine of half the rotation angle and the rotation axis.
[0070] Optionally, the trigonometric function operations in the second model are transformed into operations between two vectors before and after rotation to obtain the first model. Specifically, this includes transforming the trigonometric function operations in the second model into operations between two vectors before and after rotation through one or more operation methods such as double-angle formulas, half-angle formulas, Lagrange identities, and trigonometric identities (the sum of the square of the sine value of the same angle and the square of the cosine value is one), thereby obtaining the first model.
[0071] As an optional technical solution in this disclosure, determining the rotation quaternion corresponding to the rotation request based on the first vector, the second vector, and a pre-constructed first model may specifically include: determining the inner product and outer product of the first vector and the second vector, determining the real part of the rotation quaternion based on the inner product and the outer product, and determining the imaginary part of the rotation quaternion based on the inner product. This technical solution visually avoids the need for angle display calculations, achieving a lossless mapping from rotation parameters to quaternions. It significantly improves the computational efficiency, numerical stability, and geometric correctness of the rotation quaternion, enabling a more accurate description of the rotation of the first object using this rotation quaternion. Furthermore, by sharing this rotation quaternion, the second object can also accurately present the expected posture.
[0072] In this embodiment, different rotation quaternion solution models can be set based on whether the magnitudes of the first vector and the second vector are both one. As an optional technical solution in this embodiment, specifically, determining the rotation quaternion corresponding to the rotation request based on the first vector, the second vector, and a pre-built first model includes: determining the first magnitude of the first vector and the second magnitude of the second vector; and, in response to an event where the first magnitude or the second magnitude is not a value of one, determining the rotation quaternion corresponding to the rotation request based on the first vector, the second vector, and the pre-built first model. Using this technical solution, the magnitudes of the first vector and the second vector can be distinguished, and a suitable model can be selected based on their magnitudes to determine the rotation quaternion; in the case where the models of the first vector and the second vector are not both one, the first vector and the second vector are operated on using the operational relationship between the two vectors before and after rotation in the pre-built first model, so as to quickly solve for the pre-built first model.
[0073] Specifically, in the first model, the real part of the rotation quaternion is represented by the sum of the product of the inner product of the two vectors before and after rotation and the product of the magnitudes of the two vectors, and the imaginary part of the rotation quaternion is represented by the outer product of the two vectors before and after rotation. That is, by using the sum of the product of the inner product of the first vector and the second vector and the product of the first magnitude and the second magnitude as the real part of the rotation quaternion corresponding to the first object, and using the outer product of the first vector and the second vector as the imaginary part of the rotation quaternion corresponding to the first object, the quaternion required for the rotation of the second object can be quickly constructed.
[0074] In one embodiment, after determining the first modulus of the first vector and the second modulus of the second vector, the method further includes: in response to an event that both the first modulus and the second modulus are numerically one, determining a rotation quaternion corresponding to the rotation request based on the first vector, the second vector, and a pre-constructed third model; wherein the third model is obtained by substituting the first modulus and the second modulus into the first model for calculation. This technical solution enables the rapid and convenient determination of rotation quaternions for vector rotation scenarios with unit modulus, further improving data processing efficiency, saving memory usage, and enhancing data processing performance.
[0075] Specifically, in the third model, the real part of the rotation quaternion is represented by the sum of the inner product of the two vectors before and after rotation and the value one, and the imaginary part is represented by the outer product of the two vectors before and after rotation. That is, the real part of the rotation quaternion corresponding to the first object is taken as the sum of the inner product of the first vector and the second vector and the value one, and the imaginary part of the rotation quaternion corresponding to the first object is taken as the outer product of the first vector and the second vector. Without any other redundant calculations, the quaternion required for the rotation of the second object can be quickly constructed.
[0076] In a specific scenario, if the value of the rotation quaternion is 0 or the difference between it and 0 is less than a preset value, it indicates that the first vector and the second vector may be two vectors with opposite directions. In this case, the perpendicular vector to the first vector and the second vector can be determined as the rotation axis, and 180 degrees can be taken as the rotation angle. Then, a rotation quaternion can be constructed based on the rotation axis and the rotation angle to eliminate the reverse singularity.
[0077] S240. Perform a pose rotation operation on the second object according to the rotation quaternion so that the first object and the second object continue to be presented in the expected relative pose.
[0078] In numerous motion simulation scenarios, each frame involves an object rotating to move a point A on its surface to point B. This rotational motion needs a smooth transition in the rendering, which means solving for the rotation quaternion formed by the two vectors from the object's center to points A and B. Then, spherical interpolation or normalized linear interpolation with non-constant angular velocity is applied to this rotation quaternion to describe the object's rotational motion. The more objects in a frame, the more significant the computational savings from optimizing this rotation quaternion become.
[0079] In scenes involving smooth camera movement transitions, the camera has a specific orientation. To achieve a smooth rotation transition between the camera's initial and final orientations, let's consider an initial orientation of 'a' and an final orientation of 'b'. To smoothly transition from pointing to 'a' to pointing to 'b' over a certain period, we need to solve for the rotation quaternion formed by vectors a and b. Applying spherical interpolation or normalized linear interpolation with non-invariant angular velocity to this rotation quaternion and then using it for camera rotation achieves a smooth camera movement transition. In offline rendering scenarios, the more cameras that need to calculate camera rotation quaternions within a frame, the more significant the computational savings from optimization become.
[0080] Furthermore, spherical interpolation of quaternions is performed in four-dimensional space, which corresponds to twisting and warping in three-dimensional space, and will not perfectly fit the plane formed. If it is necessary to perfectly fit the plane formed by the two vectors before and after rotation, spherical interpolation of vectors a and b is required. Then, for each frame, the spherically interpolated vector and the starting vector a are used to calculate the rotation quaternion, and the quaternion is applied to the object to realize the rotation of the object. In this case, it is necessary to calculate the rotation quaternion based on the spherically interpolated vector and the starting vector a in each frame and apply it to the object. The more times this calculation is required in a frame, the more significant the performance optimization of rotation quaternions will be in improving the execution efficiency.
[0081] The technical solution of this disclosure, by determining the rotation quaternion corresponding to the rotation request based on the first vector, the second vector, and a pre-constructed first model, can conveniently and quickly determine the rotation quaternion that rotates the first vector into the second vector. Moreover, and more importantly, in this disclosure, the first model is a model for solving the rotation quaternion based on the inner and outer products of the two vectors before and after rotation, without needing to perform inverse trigonometric function operations in related technologies, which greatly improves the efficiency of solving the quaternion, thereby improving the efficiency of object posture processing and enhancing the real-time performance and smoothness of posture processing in object rotation scenarios.
[0082] Figure 3 This is a schematic diagram of the structure of an object processing apparatus provided in an embodiment of the present disclosure, as shown below. Figure 3As shown, the object processing device includes a rotation request module 310, an object recognition module 320, and a posture rotation module 330. The rotation request module 310 is used to receive a rotation request for a first object in a target space, and rotate the first object from a first posture to a second posture according to the rotation request. The object recognition module 320 is used to, in response to an event that a second object exists in the target space, obtain a first vector in the first posture and a second vector corresponding to the first vector in the second posture, and determine a rotation quaternion corresponding to the rotation request based on the first vector and the second vector; wherein the second object and the first object are presented in a desired relative posture. The posture rotation module 330 is used to perform a posture rotation operation on the second object according to the rotation quaternion, so that the first object and the second object continue to be presented in the desired relative posture.
[0083] The technical solution of this disclosure embodiment receives a rotation request for a first object in a target space through a rotation request module 310, and rotates the first object from a first posture to a second posture according to the rotation request. This enables flexible adjustment of the presentation posture of the first object to adapt to different object rotation requirements. In response to the event of the presence of a second object in the target space, an object recognition module 320 obtains a first vector in the first posture and a second vector corresponding to the first vector in the second posture. Based on the first and second vectors, a rotation quaternion corresponding to the rotation request is determined. By capturing the vector changes before and after the rotation, the rotation quaternion describing the rotation is directly derived, ensuring strict conservation of relative posture under arbitrary angle rotation and avoiding the limitations of traditional methods. The cumulative error of the array transformation; since the second object and the first object are presented in the expected relative posture, the posture rotation module 330 performs a posture rotation operation on the second object according to the rotation quaternion, so that the first object and the second object continue to be presented in the expected relative posture. By sharing the rotation quaternion of the first object, the dynamic stability of the relative posture with the second object is ensured, the computational complexity is reduced, and by recording the vector correspondence before and after the rotation, even if the second object is temporarily invisible due to occlusion, delay or other reasons, its correct posture can still be restored based on the historical rotation quaternion data, avoiding the vulnerability of relying on real-time coordinate feedback. At the same time, it supports the instantaneous response of non-continuous rotation commands, without the risk of posture oscillation, and realizes the unity of processing efficiency and dynamic adaptability of multi-object rotation.
[0084] Based on any optional technical solution in the embodiments of this disclosure, optionally, the rotation request module 310 is specifically used to determine the first vector of the first object in the first posture according to the rotation request, rotate the first vector into a second vector according to a preset rotation method, and adjust the first object to a second posture according to the second vector; wherein, the preset rotation method includes rotation according to Euler angles or rotation according to a preset rotation matrix.
[0085] Based on any optional technical solution in the embodiments of this disclosure, the object recognition module 320 is optionally used to determine the rotation quaternion corresponding to the rotation request based on the first vector, the second vector and the pre-constructed first model; wherein, the first model is a model for solving the rotation quaternion based on the inner product and outer product of the two vectors before and after rotation.
[0086] Based on any optional technical solution in the embodiments of this disclosure, optionally, the first model is an operational model obtained by transforming the trigonometric function operation in the second model into an operation between two vectors before and after rotation; the second model is a model for solving the rotation quaternion constructed based on the rotation axis of the vector and the rotation angle of the vector relative to the rotation axis.
[0087] Based on any optional technical solution in the embodiments of this disclosure, the object recognition module 320 is optionally configured to: determine the inner product and outer product of the first vector and the second vector, determine the real part of the rotated quaternion based on the inner product and the outer product, and determine the imaginary part of the rotated quaternion based on the inner product.
[0088] Based on any optional technical solution in the embodiments of this disclosure, the object recognition module 320 optionally includes a modulus determination unit and a rotation quaternion determination unit. The modulus determination unit is used to determine the first modulus of the first vector and the second modulus of the second vector; the rotation quaternion determination unit is used to determine the rotation quaternion corresponding to the rotation request based on the first vector, the second vector, and a pre-constructed first model, in response to an event where the first modulus or the second modulus is not a value of one.
[0089] Based on any optional technical solution in the embodiments of this disclosure, the rotation quaternion determining unit is optionally further configured to, after determining the first modulus of the first vector and the second modulus of the second vector, in response to an event that both the first modulus and the second modulus are numerically one, determine the rotation quaternion corresponding to the rotation request based on the first vector, the second vector, and a pre-constructed third model; wherein the third model is obtained by substituting the first modulus and the second modulus into the first model for calculation.
[0090] Based on any optional technical solution in the embodiments of this disclosure, optionally, in the third model, the real part of the rotated quaternion is represented by the sum of the inner product of the two vectors before and after rotation and the value one, and the imaginary part of the rotated quaternion is represented by the outer product of the two vectors before and after rotation.
[0091] Based on any optional technical solution in the embodiments of this disclosure, the object recognition module is optionally configured to determine a first vector in the first posture and a second vector corresponding to the first vector in the second posture according to the received vector setting operation corresponding to the rotation request.
[0092] The object processing apparatus provided in this disclosure can execute the object processing method provided in any embodiment of this disclosure, and has the corresponding functional modules and beneficial effects for executing the object processing method.
[0093] It is worth noting that the various units and modules included in the above-mentioned device are only divided according to functional logic, but are not limited to the above division, as long as the corresponding functions can be realized; in addition, the specific names of each functional unit are only for easy differentiation and are not used to limit the protection scope of the embodiments of this disclosure.
[0094] The following is for reference. Figure 4 The diagram illustrates a structural schematic of an electronic device (e.g., a terminal device or a server) 400 suitable for implementing embodiments of the present disclosure. The terminal device in the embodiments of the present disclosure may include, but is not limited to, mobile terminals such as mobile phones, laptops, digital broadcast receivers, PDAs (personal digital assistants), PADs (tablet computers), PMPs (portable multimedia players), in-vehicle terminals (e.g., in-vehicle navigation terminals), and fixed terminals such as digital TVs and desktop computers. Figure 4 The electronic device shown is merely an example and should not be construed as limiting the functionality and scope of the embodiments disclosed herein.
[0095] like Figure 4 As shown, electronic device 400 may include a processing device (e.g., a central processing unit, a graphics processor, etc.) 401, which can perform various appropriate actions and processes according to a program stored in read-only memory (ROM) 402 or a program loaded from storage device 408 into random access memory (RAM) 403. RAM 403 also stores various programs and data required for the operation of electronic device 400. Processing device 401, ROM 402, and RAM 403 are interconnected via bus 404. Input / output (I / O) interface 405 is also connected to bus 404.
[0096] Typically, the following devices can be connected to I / O interface 405: input devices 406 including, for example, touchscreens, touchpads, keyboards, mice, cameras, microphones, accelerometers, gyroscopes, etc.; output devices 407 including, for example, liquid crystal displays (LCDs), speakers, vibrators, etc.; storage devices 408 including, for example, magnetic tapes, hard disks, etc.; and communication devices 409. Communication device 409 allows electronic device 400 to communicate wirelessly or wiredly with other devices to exchange data. Although Figure 4 An electronic device 400 with various devices is shown; however, it should be understood that it is not required to implement or possess all of the devices shown. More or fewer devices may be implemented or possessed alternatively.
[0097] In particular, according to embodiments of this disclosure, the processes described above with reference to the flowcharts can be implemented as computer software programs. For example, embodiments of this disclosure include a computer program product comprising a computer program carried on a non-transitory computer-readable medium, the computer program containing program code for performing the methods shown in the flowcharts. In such embodiments, the computer program can be downloaded and installed from a network via communication device 409, or installed from storage device 408, or installed from ROM 402. When the computer program is executed by processing device 401, it performs the functions defined in the methods of embodiments of this disclosure.
[0098] The names of messages or information exchanged between multiple devices in the embodiments of this disclosure are for illustrative purposes only and are not intended to limit the scope of such messages or information.
[0099] The electronic device provided in this disclosure and the object processing method provided in the above embodiments belong to the same inventive concept. Technical details not described in detail in this disclosure can be found in the above embodiments, and this embodiment has the same beneficial effects as the above embodiments.
[0100] This disclosure provides a computer storage medium storing a computer program that, when executed by a processor, implements the object processing method provided in the above embodiments.
[0101] It should be noted that the computer-readable medium described in this disclosure can be a computer-readable signal medium or a computer-readable storage medium, or any combination thereof. A computer-readable storage medium can be, for example,—but not limited to—an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination thereof. More specific examples of a computer-readable storage medium may include, but are not limited to: an electrical connection having one or more wires, a portable computer disk, a hard disk, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage device, magnetic storage device, or any suitable combination thereof. In this disclosure, a computer-readable storage medium can be any tangible medium containing or storing a program that can be used by or in connection with an instruction execution system, apparatus, or device. In this disclosure, a computer-readable signal medium can include a data signal propagated in baseband or as part of a carrier wave, carrying computer-readable program code. Such propagated data signals can take various forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination thereof. A computer-readable signal medium can be any computer-readable medium other than a computer-readable storage medium, which can send, propagate, or transmit a program for use by or in connection with an instruction execution system, apparatus, or device. The program code contained on the computer-readable medium can be transmitted using any suitable medium, including but not limited to: wires, optical fibers, RF (radio frequency), etc., or any suitable combination thereof.
[0102] According to one or more embodiments of this disclosure, [Example 1] provides an object processing method, including: receiving a rotation request for a first object in a target space; rotating the first object from a first pose to a second pose according to the rotation request; in response to an event that a second object exists in the target space, obtaining a first vector in the first pose and a second vector corresponding to the first vector in the second pose; determining a rotation quaternion corresponding to the rotation request based on the first vector and the second vector; wherein the second object and the first object are presented in a desired relative pose; performing a pose rotation operation on the second object according to the rotation quaternion, so that the first object and the second object continue to be presented in the desired relative pose.
[0103] According to one or more embodiments of this disclosure, [Example 2] provides the method of Example 1, which further includes: optionally, rotating the first object from a first pose to a second pose according to the rotation request includes: determining a first vector of the first object in the first pose according to the rotation request, rotating the first vector into a second vector according to a preset rotation method, and adjusting the first object to a second pose according to the second vector; wherein, the preset rotation method includes rotation according to Euler angles or rotation according to a preset rotation matrix.
[0104] According to one or more embodiments of this disclosure, Example 3 provides the method of Example 1, which further includes: Optionally, determining the rotation quaternion corresponding to the rotation request based on the first vector and the second vector includes: determining the rotation quaternion corresponding to the rotation request based on the first vector, the second vector and a pre-constructed first model; wherein the first model is a model for solving the rotation quaternion based on the inner product and outer product of the two vectors before and after rotation.
[0105] According to one or more embodiments of this disclosure, [Example 4] provides the method of Example 3, which further includes: optionally, the first model is an operational model obtained by converting the trigonometric function operation in the second model into an operation between two vectors before and after rotation; the second model is a model for solving the rotation quaternion constructed based on the rotation axis of the vector and the rotation angle of the vector relative to the rotation axis.
[0106] According to one or more embodiments of this disclosure, Example 5 provides the method of Example 3, which further includes: optionally, determining a rotation quaternion corresponding to the rotation request based on the first vector, the second vector, and a pre-constructed first model, including: determining the inner product and the outer product of the first vector and the second vector, determining the real part of the rotation quaternion based on the inner product and the outer product, and determining the imaginary part of the rotation quaternion based on the inner product.
[0107] According to one or more embodiments of this disclosure, Example Six provides the method of Example Three, which further includes: optionally, determining the rotation quaternion corresponding to the rotation request based on the first vector, the second vector, and the pre-constructed first model includes: determining a first modulus of the first vector and a second modulus of the second vector; in response to an event that the first modulus or the second modulus is not a value of one, determining the rotation quaternion corresponding to the rotation request based on the first vector, the second vector, and the pre-constructed first model.
[0108] According to one or more embodiments of this disclosure, Example 7 provides the method of Example 6, which further includes: optionally, after determining the first modulus of the first vector and the second modulus of the second vector, the method further includes: in response to an event that both the first modulus and the second modulus are numerically one, determining a rotation quaternion corresponding to the rotation request based on the first vector, the second vector, and a pre-constructed third model; wherein the third model is obtained by substituting the first modulus and the second modulus into the first model for calculation.
[0109] According to one or more embodiments of this disclosure, Example 8 provides the method of Example 7, which further includes: optionally, the real part of the rotated quaternion is represented by the sum of the inner product of the two vectors before and after rotation and the value one in the third model, and the imaginary part of the rotated quaternion is represented by the outer product of the two vectors before and after rotation.
[0110] According to one or more embodiments of this disclosure, [Example Nine] provides the method of Example One, which further includes: optionally, obtaining the first vector in the first posture and the second vector corresponding to the first vector in the second posture includes: determining the first vector in the first posture and the second vector corresponding to the first vector in the second posture based on the received vector setting operation corresponding to the rotation request.
[0111] According to one or more embodiments of this disclosure, [Example 10] provides an object processing apparatus, including: a rotation request module, configured to receive a rotation request for a first object in a target space, and rotate the first object from a first pose to a second pose according to the rotation request; an object recognition module, configured to, in response to an event that a second object exists in the target space, acquire a first vector in the first pose and a second vector corresponding to the first vector in the second pose, and determine a rotation quaternion corresponding to the rotation request based on the first vector and the second vector; wherein the second object and the first object are presented in a desired relative pose; and a pose rotation module, configured to perform a pose rotation operation on the second object according to the rotation quaternion, so that the first object and the second object continue to be presented in the desired relative pose.
[0112] In some implementations, clients and servers can communicate using any currently known or future-developed network protocol such as HTTP (Hypertext Transfer Protocol) and can interconnect with digital data communication (e.g., communication networks) of any form or medium. Examples of communication networks include local area networks (“LANs”), wide area networks (“WANs”), the Internet (e.g., the Internet of Things), and peer-to-peer networks (e.g., ad hoc peer-to-peer networks), as well as any currently known or future-developed networks.
[0113] The aforementioned computer-readable medium may be included in the aforementioned electronic device; or it may exist independently and not assembled into the electronic device.
[0114] The aforementioned computer-readable medium carries one or more programs that, when executed by the electronic device, cause the electronic device to: receive a rotation request for a first object in a target space; rotate the first object from a first posture to a second posture according to the rotation request; in response to an event that a second object exists in the target space, acquire a first vector in the first posture and a second vector corresponding to the first vector in the second posture; determine a rotation quaternion corresponding to the rotation request based on the first vector and the second vector; wherein the second object and the first object are presented in a desired relative posture; and perform a posture rotation operation on the second object according to the rotation quaternion so that the first object and the second object continue to be presented in the desired relative posture.
[0115] Computer program code for performing the operations of this disclosure can be written in one or more programming languages or a combination thereof, including but not limited to object-oriented programming languages such as Java, Smalltalk, and C++, as well as conventional procedural programming languages such as the "C" language or similar programming languages. The program code can be executed entirely on the user's computer, partially on the user's computer, as a standalone software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In cases involving remote computers, the remote computer can be connected to the user's computer via any type of network—including a local area network (LAN) or a wide area network (WAN)—or can be connected to an external computer (e.g., via the Internet using an Internet service provider).
[0116] The flowcharts and block diagrams in the accompanying drawings illustrate the architecture, functionality, and operation of possible implementations of systems, methods, and computer program products according to various embodiments of this disclosure. In this regard, each block in a flowchart or block diagram may represent a module, segment, or portion of code containing one or more executable instructions for implementing a specified logical function. It should also be noted that in some alternative implementations, the functions indicated in the blocks may occur in a different order than those indicated in the drawings. For example, two consecutively indicated blocks may actually be executed substantially in parallel, and they may sometimes be executed in reverse order, depending on the functions involved. It should also be noted that each block in the block diagrams and / or flowcharts, and combinations of blocks in the block diagrams and / or flowcharts, can be implemented using a dedicated hardware-based system that performs the specified function or operation, or using a combination of dedicated hardware and computer instructions.
[0117] The units described in the embodiments of this disclosure can be implemented in software or in hardware. The names of the units are not necessarily limiting in certain circumstances; for example, a modulus determining unit can also be described as "a unit for determining the modulus of the first vector and the second vector".
[0118] The functions described above in this document can be performed, at least in part, by one or more hardware logic components. For example, exemplary types of hardware logic components that can be used, without limitation, include: Field Programmable Gate Arrays (FPGAs), Application-Specific Integrated Circuits (ASICs), Application Standard Products (ASSPs), System-on-Chip (SoCs), Complex Programmable Logic Devices (CPLDs), and so on.
[0119] In the context of this disclosure, a machine-readable medium can be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, apparatus, or device. A machine-readable medium can be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium can be, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, apparatus, or devices, or any suitable combination of the foregoing. More specific examples of machine-readable storage media include electrical connections based on one or more wires, portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination of the foregoing.
[0120] The above description is merely a preferred embodiment of this disclosure and an explanation of the technical principles employed. Those skilled in the art should understand that the scope of this disclosure is not limited to technical solutions formed by specific combinations of the above-described technical features, but should also cover other technical solutions formed by arbitrary combinations of the above-described technical features or their equivalents without departing from the above-described concept. For example, technical solutions formed by substituting the above features with (but not limited to) technical features disclosed in this disclosure that have similar functions.
[0121] Furthermore, while the operations are described in a specific order, this should not be construed as requiring these operations to be performed in the specific order shown or in a sequential order. In certain environments, multitasking and parallel processing may be advantageous. Similarly, while several specific implementation details are included in the above discussion, these should not be construed as limiting the scope of this disclosure. Certain features described in the context of individual embodiments may also be implemented in combination in a single embodiment. Conversely, various features described in the context of a single embodiment may also be implemented individually or in any suitable sub-combination in multiple embodiments.
[0122] Although the subject matter has been described using language specific to structural features and / or methodological logic, it should be understood that the subject matter defined in the appended claims is not necessarily limited to the specific features or actions described above. Rather, the specific features and actions described above are merely illustrative examples of implementing the claims.
Claims
1. An object processing method, characterized in that, include: Receive a rotation request for a first object in the target space, and rotate the first object from a first pose to a second pose according to the rotation request; In response to an event that a second object exists in the target space, a first vector in the first pose and a second vector corresponding to the first vector in the second pose are obtained, and a rotation quaternion corresponding to the rotation request is determined based on the first vector and the second vector; wherein the second object and the first object are presented in the expected relative pose; Perform a pose rotation operation on the second object according to the rotation quaternion so that the first object and the second object continue to be presented in the expected relative pose.
2. The object processing method according to claim 1, characterized in that, The step of rotating the first object from the first pose to the second pose according to the rotation request includes: The rotation request determines a first vector of the first object in the first pose, the first vector is rotated into a second vector according to a preset rotation method, and the first object is adjusted to a second pose according to the second vector; wherein, the preset rotation method includes rotation according to Euler angles or rotation according to a preset rotation matrix.
3. The object processing method according to claim 1, characterized in that, Determining the rotation quaternion corresponding to the rotation request based on the first vector and the second vector includes: The rotation quaternion corresponding to the rotation request is determined based on the first vector, the second vector, and the pre-constructed first model; wherein, the first model is a model for solving the rotation quaternion based on the inner product and outer product of the two vectors before and after rotation.
4. The object processing method according to claim 3, characterized in that, The first model is an operational model obtained by transforming the trigonometric function operations in the second model into operations between two vectors before and after rotation; the second model is a model for solving the rotation quaternion constructed based on the rotation axis of the vector and the rotation angle of the vector relative to the rotation axis.
5. The object processing method according to claim 3, characterized in that, Determining the rotation quaternion corresponding to the rotation request based on the first vector, the second vector, and the pre-constructed first model includes: Determine the inner product and outer product of the first vector and the second vector, determine the real part of the rotated quaternion based on the inner product and the outer product, and determine the imaginary part of the rotated quaternion based on the inner product.
6. The object processing method according to claim 3, characterized in that, The step of determining the rotation quaternion corresponding to the rotation request based on the first vector, the second vector, and the pre-constructed first model includes: Determine the first modulus of the first vector and the second modulus of the second vector; In response to an event that the first or second modulus is not a value of one, a rotation quaternion corresponding to the rotation request is determined based on the first vector, the second vector, and the pre-constructed first model.
7. The object processing method according to claim 6, characterized in that, After determining the first modulus of the first vector and the second modulus of the second vector, the method further includes: In response to an event where both the first modulus and the second modulus are a value of one, a rotation quaternion corresponding to the rotation request is determined based on the first vector, the second vector, and a pre-constructed third model; wherein the third model is obtained by substituting the first modulus and the second modulus into the first model for calculation.
8. The object processing method according to claim 7, characterized in that, In the third model, the real part of the rotated quaternion is represented by the sum of the inner product of the two vectors before and after rotation and the value one, and the imaginary part of the rotated quaternion is represented by the outer product of the two vectors before and after rotation.
9. The object processing method according to claim 1, characterized in that, The step of obtaining the first vector in the first posture and the second vector corresponding to the first vector in the second posture includes: The first vector in the first posture and the second vector corresponding to the first vector in the second posture are determined based on the received vector setting operation corresponding to the rotation request.
10. An object processing apparatus, characterized in that, include: A rotation request module is used to receive a rotation request for a first object in the target space, and rotate the first object from a first posture to a second posture according to the rotation request. An object recognition module is used to respond to an event that a second object exists in the target space, obtain a first vector in the first posture and a second vector corresponding to the first vector in the second posture, and determine a rotation quaternion corresponding to the rotation request based on the first vector and the second vector; wherein the second object and the first object are presented in a expected relative posture; The attitude rotation module is used to perform an attitude rotation operation on the second object according to the rotation quaternion, so that the first object and the second object continue to be presented in the expected relative attitude.
11. An electronic device, characterized in that, The electronic device includes: One or more processors; 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 object processing method as described in any one of claims 1-9.
12. A storage medium containing computer-executable instructions, characterized in that, The computer-executable instructions, when executed by a computer processor, are used to perform the object processing method as described in any one of claims 1-9.
13. A computer program product, comprising a computer program, characterized in that, When the computer program is executed by a processor, it implements the object processing method as described in any one of claims 1-9.