Data processing method, home design method, device, and storage medium
By using virtual rays in home decoration design software to determine the target points of model objects, the problem of unrealistic model object placement was solved, improving design efficiency and effectiveness.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- MEIPING MEIWU (SHANGHAI) TECH CO LTD
- Filing Date
- 2021-12-29
- Publication Date
- 2026-05-15
AI Technical Summary
In home decoration design software, adjusting the position and orientation of model objects is time-consuming and labor-intensive. Existing adsorption solutions result in model objects being placed in a way that does not conform to reality, affecting design efficiency and effectiveness.
By determining the vector of the movement operation on the user interface, the target point of the model object is determined in three-dimensional space using virtual rays, avoiding ray reliance on mouse points and ensuring accurate positioning of the model object in three-dimensional space.
It improves the accuracy of placing model objects in three-dimensional space, thereby enhancing user design efficiency and effectiveness.
Smart Images

Figure CN114756919B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of computer technology, and in particular to a data processing method, home decoration design method, device and storage medium. Background Technology
[0002] With the rapid development of technology, the home decoration industry is undergoing tremendous changes, and virtual home decoration design has become a trend. Designers can use home decoration design software or cloud design platforms to recreate apartment layouts according to their own needs and scenarios, and place various furniture, kitchen and bathroom appliances, and decorative items within the space to showcase their design effects.
[0003] Currently, apartment layouts are becoming increasingly complex, and a plethora of model objects are emerging for home decoration design. This forces designers to spend a significant amount of time and effort adjusting the position and orientation of these model objects during the design process. Summary of the Invention
[0004] In view of the above problems, this application is made to provide a data processing method, home decoration design method, device and storage medium that solves or at least partially solves the above problems.
[0005] Therefore, in one embodiment of this application, a data processing method is provided. The method includes:
[0006] In response to a user's movement operation on a first object in three-dimensional space on the user interface, determine the movement vector of the movement operation on the user interface;
[0007] Based on the movement vector, determine the first two-dimensional coordinates on the operation interface corresponding to the target point on the first object after the movement;
[0008] In the three-dimensional space, a first virtual ray is created; the first virtual ray passes through the virtual camera viewpoint corresponding to the three-dimensional space and the point where the first two-dimensional coordinates are located on the operation interface;
[0009] Based on the first virtual ray, determine the three-dimensional coordinates of the target point on the first object in the three-dimensional space after movement.
[0010] In another embodiment of this application, a home decoration design method is provided. The method includes:
[0011] In response to a user's movement operation on the first object in the three-dimensional space to be decorated on the operation interface, determine the movement vector of the movement operation on the operation interface;
[0012] Based on the movement vector, determine the first two-dimensional coordinates on the operation interface corresponding to the target point on the first item object after the movement;
[0013] In the three-dimensional space to be decorated, a first virtual ray is created; the first virtual ray passes through the virtual camera viewpoint corresponding to the three-dimensional space to be decorated and the point where the first two-dimensional coordinates are located on the operation interface;
[0014] Based on the first virtual ray, determine the three-dimensional coordinates of the target point on the first object in the three-dimensional space to be decorated after the movement.
[0015] In another embodiment of this application, an electronic device is provided. The electronic device includes: a memory and a processor, wherein,
[0016] The memory is used to store programs;
[0017] The processor, coupled to the memory, is used to execute the program stored in the memory to implement the data processing method or home decoration design method described above.
[0018] In another embodiment of this application, a computer-readable storage medium storing a computer program is provided, which, when executed by a computer, can implement the data processing method or home decoration design method described above.
[0019] In the technical solution provided by this application embodiment, when a user performs a movement operation on a first object in three-dimensional space on the operation interface, a movement vector corresponding to the movement operation is determined. Based on the movement vector, the target point on the first object after movement is determined to correspond to a first two-dimensional coordinate on the operation interface. Subsequently, a ray is drawn from the point where the first two-dimensional coordinate on the operation interface is located to determine the position of the first object in three-dimensional space after movement, instead of drawing a ray by clicking with the mouse as in the prior art. In this way, even if the offset of the first object is inconsistent with the movement of the operation point due to the snapping scheme, the placement behavior of the first object will not be inconsistent with reality. It can be seen that the technical solution provided by this application embodiment can place model objects in three-dimensional space more accurately, thereby improving the user's design efficiency and design effect. Attached Figure Description
[0020] To more clearly illustrate the technical solutions in the embodiments of this application or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0021] Figure 1a A schematic flowchart illustrating a data processing method provided in an embodiment of this application;
[0022] Figure 1b A schematic flowchart illustrating a data processing method provided in yet another embodiment of this application;
[0023] Figure 2 A schematic flowchart illustrating a home decoration design method provided in an embodiment of this application;
[0024] Figure 3 A schematic flowchart illustrating a data processing method provided in yet another embodiment of this application;
[0025] Figure 4 This is a structural block diagram of an electronic device provided in an embodiment of this application. Detailed Implementation
[0026] Currently, in most home decoration design software or cloud platforms, when users move objects in the 3D space to be decorated on the screen, they use the current mouse click to draw a ray to find the desired position of the object. However, to improve design efficiency and effect, most home decoration design software provides a snapping feature, which automatically adjusts the position and orientation of objects during movement. This results in a discrepancy between the model's position offset and the mouse movement (for example, the relative position between the mouse and the model object changes after dragging it for a while). In some scenarios, the placement of objects may not be realistic. For example, when dragging an ornament along the edge of a table, most of the ornament is still on the table, meaning its center of gravity is still on the tabletop. Due to the snapping feature, the ray drawn by the current mouse click may have already intersected with the ground, causing the ornament to be placed on the ground, which is clearly unreasonable.
[0027] To address or partially address the aforementioned technical problems, this application provides a data processing method: when a user performs a movement operation on a first object in three-dimensional space on an interface, a movement vector corresponding to the movement operation is determined; based on the movement vector, the target point on the first object after movement is determined to correspond to a first two-dimensional coordinate on the interface. Subsequently, a ray is drawn from the point where this first two-dimensional coordinate is located on the interface to determine the position of the first object in three-dimensional space after movement, instead of drawing a ray with a mouse click as in the prior art. This way, even if the first object's offset is inconsistent with the movement of the operation point due to the adsorption scheme, the placement of the first object will not be inconsistent with reality. Therefore, the technical solution provided by this application can more accurately place model objects in three-dimensional space, thereby improving the user's design efficiency and design effect.
[0028] Terminology Explanation:
[0029] Adsorption: One object (i.e., target) adheres to another object, with their surfaces in contact or embedded in each other. For example, a cabinet against a wall can be seen as the cabinet adsorbing onto the wall; a window on a wall can be seen as the window adsorbing onto the wall; a bed cannot be off the ground and can be seen as the bed adsorbing onto the ground.
[0030] Ray: A ray is an infinitely long line that originates from a point in a three-dimensional world (or three-dimensional space) and travels in one direction. The ray stops tracing its path once it collides with a model object that has had a collider applied. Rays can be used to implement functions such as picking up objects with a mouse click.
[0031] World coordinate system: In WebGL, the world coordinate system has its origin at the center of the screen (0, 0, 0) and remains constant. When the user is facing the screen, the right side is the positive x-axis, the top is the positive y-axis, and the direction the screen points towards the user is the positive z-axis.
[0032] Screen coordinate system: The origin is (0, 0) at the top left corner of the screen, the positive x-axis is to the right, and the positive y-axis is downward.
[0033] To enable those skilled in the art to better understand the present application, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are merely some embodiments of the present application, and not all embodiments. All other embodiments obtained by those skilled in the art based on the embodiments of the present application without creative effort are within the scope of protection of the present application.
[0034] Furthermore, some processes described in the specification, claims, and accompanying drawings of this application include multiple operations that appear in a specific order. These operations may be performed out of order or in parallel. Operation numbers such as 101, 102, etc., are merely used to distinguish different operations and do not represent any execution order. Additionally, these processes may include more or fewer operations, and these operations may be performed sequentially or in parallel. It should be noted that the terms "first," "second," etc., used herein are used to distinguish different messages, devices, modules, etc., and do not represent a sequential order, nor do they limit "first" and "second" to different types.
[0035] Figure 1aThis illustration shows a flowchart of a data processing method provided in an embodiment of this application. The execution entity of this method can be a client or a server. The client can be hardware with embedded programs integrated on a terminal, application software installed on the terminal, or utility software embedded in the terminal's operating system, etc., and this embodiment does not limit its scope. The terminal can be any terminal device, including mobile phones, tablets, and in-vehicle terminal devices. The server can be a conventional server, a cloud server, or a virtual server, etc., and this embodiment does not specifically limit its scope. Figure 1a As shown, the method includes:
[0036] 101. In response to a user's movement operation on a first object in three-dimensional space on the operation interface, determine the movement vector of the movement operation on the operation interface.
[0037] 102. Based on the movement vector, determine the first two-dimensional coordinates on the operation interface corresponding to the target point on the first object after the movement.
[0038] 103. In the three-dimensional space, a first virtual ray is created; the first virtual ray passes through the virtual camera viewpoint corresponding to the three-dimensional space and the point where the first two-dimensional coordinates are located on the operation interface.
[0039] 104. Based on the first virtual ray, determine the three-dimensional coordinates of the target point on the first object in the three-dimensional space after the movement.
[0040] In the above 101, the aforementioned three-dimensional space can specifically be a three-dimensional space to be decorated, a game three-dimensional space, etc. When the three-dimensional space is a three-dimensional space to be decorated, the objects within it can specifically be item objects, such as furniture objects, appliance objects, decoration objects, etc. When the three-dimensional space is a game three-dimensional space, the objects within it can specifically be game character objects, game environment objects, etc. The three-dimensional space can specifically be a virtual three-dimensional space.
[0041] Users can perform movement operations, or drag operations, on a first object in 3D space using the user interface. During this movement operation, the movement vector on the user interface is determined. Specifically, the movement vector refers to the movement vector of the operation point on the user interface. This operation point can be a mouse point or a touchscreen interaction point. In one example, the user can perform a movement operation on the first object in 3D space using the mouse; the corresponding movement vector is the movement vector of the mouse point on the user interface. In another example, the user interface is a touchscreen interface; the user can perform a movement operation on the first object in 3D space using their finger or stylus; the corresponding movement vector is the movement vector of the finger or stylus relative to the touchscreen interaction point on the user interface.
[0042] Typically, the duration of a user's movement operation on a first object in three-dimensional space is relatively long. In order to improve the real-time visual effect, in one feasible solution, during the process of the user performing a movement operation on the first object in three-dimensional space on the operation interface, the movement vector of the movement operation on the operation interface is determined once at a preset time interval, and the movement vector determined each time is the movement vector of the movement operation within the corresponding preset time interval.
[0043] The aforementioned preset time interval can be set according to actual needs, and this application embodiment does not impose specific limitations on it. Generally, the smaller the aforementioned preset time interval, the better the real-time visual effect, but the computational load will increase.
[0044] Specifically, the movement vector can be in a two-dimensional screen coordinate system.
[0045] In the above 102, in one instance, the target point on the first object can be any point on the first object.
[0046] In section 103 above, a three-dimensional space is displayed on the user interface. The virtual camera viewpoint corresponding to this three-dimensional space display can be understood as the position of the virtual camera in the three-dimensional space when capturing the image of the three-dimensional space currently displayed on the user interface. The image of the three-dimensional space captured by the virtual camera varies depending on its location within the three-dimensional space; that is, different virtual camera viewpoints result in different images of the three-dimensional space displayed on the user interface. Users can manually change the virtual camera viewpoint corresponding to the three-dimensional space display on the user interface.
[0047] The direction of the first virtual ray can be the direction from the virtual camera viewpoint corresponding to the 3D space display to the point where the first 2D coordinates are located on the operation interface. Specifically, a first virtual ray can be created in the 3D space, starting from the virtual camera viewpoint corresponding to the 3D space display and passing through the point where the first 2D coordinates are located on the operation interface. Step 103 above is that the first virtual ray is created in the world coordinate system where the 3D space is located. Here, the world coordinate system is a 3D coordinate system.
[0048] In step 104 above, the intersection position between the first virtual ray and the second object in the three-dimensional space is determined; based on the intersection position, the three-dimensional coordinates of the target point on the first object in the three-dimensional space after movement are determined. These three-dimensional coordinates can be in the world coordinate system where the three-dimensional space is located.
[0049] Taking the direction of the first virtual ray as the direction from the virtual camera viewpoint to the first two-dimensional coordinate point on the operation plane as an example, the first object encountered by the first virtual ray after passing through the first object can be taken as the second object mentioned above, and the three-dimensional coordinates of the intersection point of the first virtual ray and the bounding box of the second object towards the bounding surface of the first object can be taken as the three-dimensional coordinates of the target point on the first object in three-dimensional space after movement.
[0050] After determining the three-dimensional coordinates of the target point on the first object in three-dimensional space after the movement, the first object can be moved in three-dimensional space so that the target point on the first object is located at the three-dimensional coordinates.
[0051] In the technical solution provided by this application embodiment, when a user performs a movement operation on a first object in three-dimensional space on the operation interface, a movement vector corresponding to the movement operation is determined. Based on the movement vector, the target point on the first object after movement is determined to correspond to a first two-dimensional coordinate on the operation interface. Subsequently, a ray is drawn from the point where the first two-dimensional coordinate on the operation interface is located to determine the position of the first object in three-dimensional space after movement, instead of drawing a ray by clicking with the mouse as in the prior art. In this way, even if the offset of the first object is inconsistent with the movement of the operation point due to the snapping scheme, the placement behavior of the first object will not be inconsistent with reality. It can be seen that the technical solution provided by this application embodiment can place model objects in three-dimensional space more accurately, thereby improving the user's design efficiency and design effect.
[0052] Optionally, the step 102 above, "determining the first two-dimensional coordinates on the operation interface corresponding to the target point on the first object after movement based on the movement vector," can be achieved using the following steps:
[0053] 1021. Determine the second two-dimensional coordinates on the operation interface corresponding to the target point on the first object before the movement.
[0054] 1022. Based on the second two-dimensional coordinates and the movement vector, determine the first two-dimensional coordinates on the operation interface corresponding to the target point on the first object after the movement.
[0055] In the above 1022, the second two-dimensional coordinates and the movement vector can be summed to obtain the first two-dimensional coordinates of the target point on the first object on the operation interface after the movement.
[0056] For example: before moving, the target point on the first object has two-dimensional coordinates (x, y) on the operation interface, and the movement vector is (a, b). After moving, the target point on the first object has two-dimensional coordinates (x+a, y+b) on the operation interface.
[0057] Note: In the embodiments of this application, "before moving" and "after moving" are relative to the movement vector. "Before moving" refers to before moving the first object in three-dimensional space based on the movement vector, and "after moving" refers to after moving the first object in three-dimensional space based on the movement vector.
[0058] Optionally, the method for confirming the target point on the first object may include at least one of the following:
[0059] Method 1: Determine the center point of the specified bounding surface of the bounding box of the first object as the target point on the first object.
[0060] Wherein, the designated bounding surface is the bounding surface of the bounding box of the first object, with the normal vector pointing toward the ground in the three-dimensional space.
[0061] In Method 1, the target point on the first object is set at the center of the bounding box whose normal vector points towards the ground in the three-dimensional space. This takes into account the influence of gravity. Gravity is a common factor in home decoration scenarios. For example, books on a table will not fall if most of them are on the table, but will fall if most of them are suspended in the air. Therefore, setting the target point according to Method 1 makes the placement of objects in three-dimensional space more logical.
[0062] Method 2: Determine the target point on the first object based on the user's specified operation.
[0063] In Method Two, to meet diverse design needs, users can manually specify target points on the first object. Specifically, a settings interface can be provided where users can perform specified operations.
[0064] Method 3: Determine the target point on the first object based on the scene type in the three-dimensional space.
[0065] In Method 3, the scene type can be set according to actual needs, and this application embodiment does not specifically limit it. For example, the scene type may include: home decoration type, rail transit type, etc. When the scene type in the three-dimensional space is home decoration type, the center point of the bounding box of the first object whose normal vector points towards the ground in the three-dimensional space can be used as the target point on the first object. When the scene type in the three-dimensional space is rail transit type, a point on the tail of the first object can be used as the target point on the first object. For example, if the first object is a rail vehicle, a point on the tail of the rail vehicle can be used as the target point on the first object. In this way, as long as the tail of the rail vehicle is still on the air track, the rail vehicle will not fall down.
[0066] In practical applications, in order to improve design efficiency and design effect, after moving the first object in three-dimensional space, it is also possible to determine the target object that the first object can be attracted to in three-dimensional space after the movement; according to the target object, the position and / or orientation of the first object are adjusted so that the first object is attracted to the target object.
[0067] In one feasible implementation, the above method may further include:
[0068] 105. Based on the adsorption type of the first object, determine the target object that the first object can adsorb in the three-dimensional space after moving.
[0069] 106. Based on the product type to which the first object belongs and the target object, adjust the position and / or orientation of the first object in the three-dimensional space so that the first object is attached to the target object.
[0070] In step 105 above, configuration information of the first object can be obtained; based on the configuration information, the adsorption type of the first object can be determined.
[0071] Taking home decoration scenarios as an example, the adsorption types can include, but are not limited to: floor adsorption type, downward adsorption type, ceiling adsorption type, upward adsorption type, wall adsorption type, horizontal adsorption type, floor and wall adsorption type, and ceiling and wall adsorption type. Here, "upward" refers to the ground facing upward in vertical three-dimensional space, and "downward" refers to the top facing downward in vertical three-dimensional space. In practical applications, different adsorption type values can be set for different adsorption types to facilitate computer recognition. For example: the adsorption type value for floor adsorption is 100, for wall adsorption is 200, for ceiling adsorption is 300, for floor and wall adsorption is 400, for horizontal adsorption is 500, for downward adsorption is 600, for upward adsorption is 700, and for ceiling and wall adsorption is 800. For example, chairs, tables, and carpets can be configured to adhere to the floor; murals can be configured to adhere to the wall; chandeliers can be configured to adhere to the ceiling; beds, sofas, cabinets, and computer desks can be configured to adhere to both the floor and walls; ornaments and decorations can be configured to adhere to objects downwards; and so on. In practical applications, the configuration can be adjusted according to actual needs, and this application embodiment does not impose specific limitations on this.
[0072] Among the 106 items mentioned above, taking home decoration scenarios as an example, product types include, but are not limited to: beds, sofas, dining tables, chairs, air conditioning vents, sockets, chandeliers, downlights, doors, windows, murals, floor drains, water pipes, electrical conduits, cabinets, etc.
[0073] In practical applications, taking beds and dining tables as examples, both can be configured as either wall-mounted or attached to the floor. However, beds are generally positioned with one side of the headboard against a wall, while dining tables can be positioned with either side against a wall. Similarly, doors, windows, and wall art can all be configured as wall-mounted devices. However, doors and windows are typically embedded in the wall, while wall art is affixed to the wall surface. Likewise, chairs and floor drains can both be configured as floor-mounted devices. However, chairs are typically attached to the floor surface, while floor drains are embedded in the floor.
[0074] Therefore, in order to improve the versatility and reusability of adsorption schemes, product types are introduced to adjust adsorption rules or adsorption strategies.
[0075] In one feasible implementation, the phrase "adjusting the position of the first object in the three-dimensional space according to the product type to which the first object belongs and the target object" in step 106 above includes:
[0076] 1061. Determine the embedding status of the first object when it adsorbs the target object, based on the product type to which the first object belongs.
[0077] 1062. Based on the embedding situation and the target object, adjust the position of the first object in the three-dimensional space.
[0078] In the above 1061, the embedding situation can be determined according to the actual scenario for different product types. The embedding situation includes at least two of the following: no embedding, semi-embedded, and fully embedded.
[0079] For example, when attaching objects such as beds, sofas, dining tables, chairs, chandeliers, wall paintings, and cabinets, the embedding status is not embedded; when attaching objects such as air conditioner vents, sockets, floor drains, and downlights, the embedding status is semi-embedded; and when attaching objects such as doors, windows, water pipes, and electrical conduits, the embedding status is fully embedded. In addition, water pipes and electrical conduits need to be hidden after being attached.
[0080] Specifically, in 1062 above, the three-dimensional movement vector of the first object in the three-dimensional space can be determined according to the embedding situation and the intersection position of the target object and the second virtual ray; and the first object is moved in the three-dimensional space according to the three-dimensional movement vector.
[0081] When the embedding is semi-embedded, it is also necessary to combine the size and shape of the first object to determine the three-dimensional movement vector of the first object in three-dimensional space.
[0082] In another feasible implementation, the phrase "adjusting the orientation of the first object in the three-dimensional space according to the product type to which the first object belongs and the target object" in step 106 above includes:
[0083] 1063. Based on the product type to which the first object belongs, determine the desired relationship between the orientation of the first object and the orientation of the target object, and the orientation of the object face of the first object.
[0084] 1064. Adjust the orientation of the first object in the three-dimensional space according to the orientation of the target object's object face, the orientation of the first object, and the desired relationship.
[0085] For ease of description, in the above 1063, taking a bed as an example, the orientation of the bed can be defined as the orientation of the surface where the headboard is located. The desired relationship between the orientation of the bed and the orientation of the wall is that they are parallel and opposite. Similarly, taking a dining table as an example, the orientation of the dining table and the orientation of the wall can be defined as the orientation of the dining table. The desired relationship between the orientation of the dining table and the orientation of the wall is that they are parallel and opposite.
[0086] In the above 1064, the orientation of the first object in the three-dimensional space is adjusted so that the relationship between the orientation of the first object and the orientation of the target object and the orientation of the object face of the first object satisfies the desired relationship.
[0087] Optionally, the step 105 above, "determining the target object that the first object can adsorb in the three-dimensional space after moving, based on the adsorption type of the first object," can be implemented using the following steps:
[0088] 1051. Determine the direction of the second virtual ray used to locate the target object based on the adsorption type of the first object.
[0089] 1052. In the three-dimensional space, create a second virtual ray that is emitted from the target point on the first object after it has been moved, along the direction.
[0090] 1053. Identify other objects in the three-dimensional space that intersect with the second virtual ray.
[0091] 1054. Based on the adsorption type of the first object, among other objects in the three-dimensional space that intersect with the second virtual ray, determine the target object that the first object can adsorb in the three-dimensional space after moving.
[0092] For example, in the above 1051, "determining the direction of the second virtual ray used to locate the target object according to the adsorption type to which the first object belongs" includes:
[0093] When the adsorption type of the first object is an adsorption floor type or a downward adsorption object type, the direction of the second virtual ray is determined to be vertical and towards the ground in the three-dimensional space;
[0094] When the adsorption type of the first object is the type of adsorption of roof or the type of adsorption of objects upward, the direction of the second virtual ray is determined to be vertical and towards the top surface in the three-dimensional space;
[0095] When the adsorption type of the first object is an adsorption wall type, the direction of the second virtual ray is determined to be perpendicular and towards the wall in the three-dimensional space;
[0096] When the adsorption type of the first object is the horizontal adsorption object type, the direction of the second virtual ray is determined to be the orthogonal direction of the first object along the horizontal direction;
[0097] When the first object belongs to the adsorption type of adsorption floor and wall, the direction of the second virtual ray is determined to include: a direction perpendicular to and toward the wall in the three-dimensional space and a direction perpendicular to and toward the ground in the three-dimensional space;
[0098] When the adsorption type of the first object is the adsorption type of roof and wall, the direction of the second virtual ray is determined to include: a direction perpendicular to and toward the wall in the three-dimensional space and a direction perpendicular to and toward the top in the three-dimensional space.
[0099] It should be noted that the number of second virtual rays used to locate the target object can be one or more. When there are multiple second virtual rays, the directions of these multiple second virtual rays are different.
[0100] The orthogonal direction along the horizontal direction of the first object can be understood as the normal vector (or orientation) of the bounding surface of the first object whose normal vector is in the horizontal direction (the horizontal direction in three-dimensional space, i.e., parallel to the ground) within the bounding box of the first object. There are four bounding surfaces in the first object whose normal vector is in the horizontal direction. The normal vectors of two opposite bounding surfaces are parallel. Therefore, the directions of any two orthogonal normal vectors from the four bounding surfaces can be selected as the directions of two different second virtual rays.
[0101] For example, if the first object is a bed, and the bed's corresponding adsorption type is the ground and wall type, then we can determine that the direction of a second virtual ray is perpendicular to the ground in the three-dimensional space, and the direction of another second virtual ray is perpendicular to the wall in the three-dimensional space. In other words, multiple different second virtual rays will be determined, each with a different direction.
[0102] In the above 1052, in the three-dimensional space, a second virtual ray is created on the target point of the first object after it has been moved and emitted along the direction.
[0103] In the above 1053, the number of other objects in the three-dimensional space that intersect with the second virtual ray can be at least one, that is, one or more.
[0104] In step 1054 above, based on the adsorption type of the first object, among other objects in the three-dimensional space that intersect with the second virtual ray, the target object that the first object can adsorb in the three-dimensional space after moving is determined.
[0105] Specifically, based on the adsorption type, it can be determined whether at least one other object exists that has a product type of the same as the product type specified by the adsorption type. For example, if the adsorption type is an adsorption flooring type, then the specified product type is flooring. If it exists, the target object can be determined from the objects of the same product type specified by the adsorption type, for example, by selecting the object closest to the first object from the objects of the same product type specified by the adsorption type as the target object.
[0106] For example:
[0107] 1. Snap to the floor: Create a second virtual ray starting from the height of the ceiling (i.e., the top surface), passing through the target point of the first object after it has been moved, and following a direction perpendicular to the ground in three-dimensional space. Based on this second virtual ray, find the target object.
[0108] 2. Attach to the roof (including suspended ceiling): Create a target point of the first object that starts from the ground level, moves through the object, and then uses a second virtual ray that is perpendicular to the top surface in three-dimensional space to locate the target object.
[0109] 3. Adsorbed onto the wall:
[0110] In a 2D canvas, the wall closest to the model on the horizontal plane is used to perform a collision between the bounding box of the first object and the bounding box of the wall, with a preset offset added around the first object. The shortest overlapping vector is found, which is the vector that the first object needs to move.
[0111] In the 3D canvas, create a second virtual ray perpendicular to the wall, originating from the target point of the first object after it has been moved. Select the nearest wall that intersects with the second virtual ray as the target object.
[0112] Specifically, the intersection point of the target object's orientation towards the first object's target adsorption surface and the second virtual ray can be found. After adjusting the orientation of the first object in three-dimensional space, the target point on the object surface of the first object used for adsorption with the target adsorption surface is determined. The line connecting this target point and the intersection point is perpendicular to the target adsorption surface. The vector between these two points is the vector that the first object needs to move.
[0113] 4. Adsorbed onto the surface of an object:
[0114] Under 2D canvas:
[0115] To achieve downward snapping, create a second virtual ray starting from the ceiling height, passing through the target point of the first object after movement, and following a direction perpendicular to and towards the ground in 3D space; find the highest valid object that intersects with the second virtual ray to serve as the target object.
[0116] To achieve upward adsorption, create a second virtual ray starting from ground level, passing through the target point of the first object after movement, and following a direction perpendicular to and towards the top surface in 3D space; find the lowest valid object that intersects with the second virtual ray to serve as the target object.
[0117] To find the object to be snapped to horizontally, on the horizontal plane, cast a second virtual ray along the orthogonal direction of the first object (that is, the direction perpendicular to the x-axis and y-axis of the first object) to find the nearest valid object that intersects with it, and use it as the target object (such as snapping a decorative painting to a custom background wall).
[0118] Under the 3D canvas:
[0119] To achieve downward snapping, create a second virtual ray starting from the bottom height of the first object, extending vertically towards the ground in 3D space; find the highest valid object that intersects with the second virtual ray, and use it as the target object. The second virtual ray passes through, or its reverse extension passes through, the target point of the moved first object.
[0120] To achieve upward snapping, create a second virtual ray starting from the top height of the first object, perpendicular to the top surface in 3D space; find the lowest valid object that intersects with the second virtual ray as the target object. The second virtual ray passes through, or its reverse extension passes through, the target point of the moved first object.
[0121] To find the surface to be attached horizontally, on the horizontal plane, cast a second virtual ray along the orthogonal direction of the first object to find the nearest valid object that intersects with it, and use it as the target object (e.g., attaching a decorative painting to a custom background wall).
[0122] Optionally, the step 106 above, "adjusting the position and / or orientation of the first object in the three-dimensional space according to the product type to which the first object belongs and the target object, so that the first object is attached to the target object," can be achieved by the following steps:
[0123] 1061a. When the distance between the first object and the target object in the three-dimensional space after the first object is moved meets the adsorption condition, the position and / or orientation of the first object in the three-dimensional space are adjusted according to the product type to which the first object belongs and the target object, so that the first object is adsorbed onto the target object.
[0124] In the above-mentioned 1061a, the bounding box of the moved first object can be magnified in three-dimensional space according to a preset magnification size to obtain an magnified bounding box; it is then determined whether the magnified bounding box intersects with the bounding box of the target object. If they intersect, it is determined that the distance between the moved first object and the target object in the three-dimensional space meets the adsorption condition; if they do not intersect, it is determined that the distance between the moved first object and the target object in the three-dimensional space does not meet the adsorption condition. Specifically, collision detection is performed based on the magnified bounding box and the bounding box of the target object to which the target adsorption surface belongs to determine whether the two intersect. The specific collision detection process can be found in the prior art and will not be detailed here.
[0125] Specifically, the bounding box of the moved first object is enlarged according to the preset enlargement size to obtain the enlarged bounding box. Specifically, the two ends of the length of the bounding box of the moved first object are increased by the preset enlargement size, the two ends of the width of the bounding box of the moved first object are increased by the preset enlargement size, and the two ends of the height of the bounding box of the moved first object are increased by the preset enlargement size to obtain the enlarged bounding box.
[0126] In practical applications, if the distance between the first object and the target object in the three-dimensional space after movement does not meet the adsorption conditions, there is no need to adjust the position and / or orientation of the first object in the three-dimensional space.
[0127] In practical applications, steps 1063 and 1064 can be executed first, followed by steps 1061 and 1062. That is, rotate first and then move the position. This can avoid the abnormal phenomenon of the object embedding into the target adsorption surface during rotation in some cases.
[0128] Figure 1b This illustration shows a flowchart of a data processing method according to another embodiment of this application. The execution entity of this method can be a client or a server. The client can be hardware with embedded programs integrated on a terminal, application software installed on the terminal, or utility software embedded in the terminal's operating system, etc., and this application embodiment does not limit its scope. The terminal can be any terminal device, including mobile phones, tablets, and in-vehicle terminal devices. The server can be a conventional server, a cloud server, or a virtual server, etc., and this application embodiment does not specifically limit its scope. Figure 1b As shown, the method includes:
[0129] 1001. In response to a user's movement operation on a first object in a three-dimensional space on an operating interface, the first object is moved in the three-dimensional space.
[0130] 1002. Based on the adsorption type of the first object, determine the target object that the first object can adsorb in the three-dimensional space after moving.
[0131] 1002. Based on the product type of the first object and the target object, adjust the position and / or orientation of the first object in the three-dimensional space so that the first object is attached to the target object.
[0132] In the above 1001, the three-dimensional coordinates of the first object in the three-dimensional space after movement can be determined according to the method provided by the prior art, and then the first object is moved to the three-dimensional coordinates in the three-dimensional space; or, the three-dimensional coordinates of the target point of the first object in the three-dimensional space after movement can be determined according to the method provided by the above embodiments of this application, and the first object is moved in the three-dimensional space so that the target point on the first object is located at the three-dimensional coordinates.
[0133] The specific implementation of steps 1002 and 1003 above can be found in the corresponding contents of the above embodiments, and will not be repeated here.
[0134] In the adsorption scheme provided in this application embodiment, the product type of the first object is introduced to adjust or optimize the adsorption method, which can not only improve the rationality of the adsorption scheme, but also improve the versatility of the adsorption scheme.
[0135] Optionally, the step 1002 above, "adjusting the position of the first object in the three-dimensional space according to the product type of the first object in the three-dimensional space and the target object," can be implemented using the following steps:
[0136] S11. Determine the embedding status of the first object when it adsorbs the target object based on the product type to which the first object belongs.
[0137] S12. Adjust the position of the first object in the three-dimensional space according to the embedding situation and the target object.
[0138] The specific implementation of steps S11 and S12 can be found in the corresponding contents of the above embodiments, and will not be repeated here.
[0139] Optionally, the step 1002 above, "adjusting the orientation of the first object in the three-dimensional space according to the product type of the first object and the target object," can be implemented using the following steps:
[0140] S21. Determine the desired orientation relationship between the first object and the target object based on the product type to which the first object belongs.
[0141] S22. Adjust the orientation of the first object in the three-dimensional space according to the orientation of the target object, the orientation of the first object, and the desired orientation relationship.
[0142] The specific implementation of steps S21 and S22 can be found in the corresponding contents of the above embodiments, and will not be repeated here.
[0143] It should be noted that any steps in the method provided in this application that are not described in detail can be found in the corresponding content of the above embodiments, and will not be repeated here. Furthermore, the method provided in this application may include other parts or all of the steps in the above embodiments in addition to the steps described above; for details, please refer to the corresponding content of the above embodiments, and will not be repeated here.
[0144] Figure 2 This illustration shows a flowchart of a home decoration design method according to another embodiment of this application. The execution entity of this method can be a client or a server. The client can be hardware with embedded programs integrated on a terminal, application software installed on the terminal, or utility software embedded in the terminal's operating system, etc., and this application embodiment does not limit its scope. The terminal can be any terminal device, including mobile phones, tablets, and in-vehicle terminal devices. The server can be a conventional server, a cloud server, or a virtual server, etc., and this application embodiment does not specifically limit its scope. Figure 2 As shown, the method includes:
[0145] 201. In response to a user's movement operation performed on a first object in the three-dimensional space to be decorated on the operation interface, determine the movement vector of the movement operation on the operation interface.
[0146] 202. Based on the movement vector, determine the first two-dimensional coordinates on the operation interface corresponding to the target point on the first item object after the movement.
[0147] 203. In the three-dimensional space to be decorated, create a first virtual ray; the first virtual ray passes through the virtual camera viewpoint corresponding to the three-dimensional space to be decorated and the point where the first two-dimensional coordinates are located on the operation interface.
[0148] 204. Based on the first virtual ray, determine the three-dimensional coordinates of the target point on the first object in the three-dimensional space to be decorated after the movement.
[0149] In the technical solution provided by this application embodiment, when a user performs a movement operation on a first object in the three-dimensional space to be decorated on the operation interface, a movement vector corresponding to the movement operation is determined. Based on the movement vector, the target point on the first object after movement is determined to correspond to the first two-dimensional coordinates on the operation interface. Subsequently, a ray is drawn from the point where the first two-dimensional coordinates on the operation interface are located to determine the three-dimensional coordinates of the first object in the three-dimensional space to be decorated after movement, instead of drawing a ray by clicking with the mouse as in the prior art. In this way, even if the offset of the first object is inconsistent with the movement of the operation point due to the adsorption scheme, the placement behavior of the first object will not be inconsistent with reality. It can be seen that the technical solution provided by this application embodiment can place model objects more accurately in the three-dimensional space to be decorated, thereby improving the user's design efficiency and design effect.
[0150] It should be noted that any steps in the method provided in this application that are not described in detail can be found in the corresponding content of the above embodiments, and will not be repeated here. Furthermore, the method provided in this application may include other parts or all of the steps in the above embodiments in addition to the steps described above; for details, please refer to the corresponding content of the above embodiments, and will not be repeated here.
[0151] The following will combine Figure 3 The technical solutions provided in the embodiments of this application are described below:
[0152] 301. Select the first object in three-dimensional space using the mouse.
[0153] Users can select the first object in 3D space by clicking on it with the mouse. Once selected, the user can drag the first object. The following steps can be performed while dragging the first object.
[0154] 302. Determine the movement vector of the mouse point on the operation interface.
[0155] 303. Based on the movement vector of the mouse on the operation interface, determine the first two-dimensional coordinates of the target point on the first object on the operation interface after the movement.
[0156] 304. In the three-dimensional space, create a first virtual ray that originates from the virtual camera viewpoint corresponding to the three-dimensional space display and passes through the point where the first two-dimensional coordinates are located on the operation interface.
[0157] 305. Based on the first virtual ray, determine the three-dimensional coordinates of the target point on the first object in the three-dimensional space after the movement.
[0158] 306. Move the first object in three-dimensional space so that the target point on the first object is located at the three-dimensional coordinates.
[0159] 307. Based on the adsorption type of the first object, determine whether there is a target object that can be adsorbed by the first object in the three-dimensional space after the first object is moved.
[0160] If it exists, proceed to step 308; otherwise, the process ends.
[0161] 308. Adjust the position and / or orientation of the first object in the three-dimensional space according to the product type to which the first object belongs and the target object, so that the first object is attached to the target object.
[0162] After adjustments, the process is complete.
[0163] In practical applications, 3D virtual home decoration scenes are displayed on a 2D screen (i.e., the user interface), and the orientation and position of furniture models are controlled by the mouse. Placing furniture models on a 2D screen using the mouse is prone to errors when observed visually, and adjustments to the model's orientation and position can be mutually influential; for example, adjusting the orientation may prevent moving the model, and vice versa. Furthermore, due to the varying lengths and widths of the models, there's a chance that adjusting orientation or moving them will result in phenomena that wouldn't occur in real-world furniture placement, such as rotating a sofa causing part of it to sink into the wall, or dragging a bed leaving it suspended in mid-air. Adding to this, the imprecision of mouse operation makes accurate and reasonable model placement in 3D design tools difficult, potentially requiring constant view switching and adjustments, impacting efficiency. Therefore, defining model placement and snapping behavior, and providing corresponding algorithms for different types of models to calculate their optimal position and orientation, has become a pressing issue.
[0164] In the existing solution, when moving the first item object, a virtual ray is created in the world coordinate system of the virtual home decoration scene, originating from the virtual camera viewpoint corresponding to the virtual home decoration scene and passing through the moved mouse point. The position of the first item object in the world coordinate system of the virtual home decoration scene is determined based on the intersection of this virtual ray with other item objects in the virtual home decoration scene. However, due to the influence of the snapping scheme, the position offset of the first item object is inconsistent with the mouse movement, and in some scenarios, the model's behavior may not conform to reality.
[0165] In other words, using the existing drag-and-drop solution will prevent users from moving items according to their own wishes in certain scenarios, and will also increase the complexity of operation.
[0166] To address the issue of illogical or inaccurate item placement in home decoration and 3D cloud design platform software, the technical solution provided in this application can automatically adjust the placement of items based on their category, size, and room layout, resulting in more rational and precise placement and reducing the need for users to fine-tune model positions in 2D and 3D canvases (views). This allows users, such as designers, to place items flexibly and quickly, and to rapidly correct item orientation based on the characteristics of the current room layout and model category. Specifically, the technical solution provided in this application offers adsorption rules and algorithms to accurately and quickly correct items to positions consistent with the actual scene.
[0167] In the technical solutions provided in this application, different movement strategies and adsorption algorithms are adopted when moving objects, depending on whether the object is on a 2D canvas or a 3D canvas.
[0168] The movement strategy employed in the 3D canvas is as described above and will not be repeated here.
[0169] In a 2D canvas, as the user performs a movement operation on the first object in the three-dimensional space through the operation plane, the movement vector corresponding to the movement operation is determined; based on the movement vector, the position of the first object after movement in the three-dimensional space can be directly determined.
[0170] In summary, the technical solution provided in this application adjusts the strategy for ray casting and calculating the model's position. Target points on the object are used as ray casting points to obtain the model's movement position, ensuring the accuracy of placement. To ensure synchronization between model movement and mouse movement, the mouse movement offset is converted into an offset of the target point on the object. Using the offset target point for ray casting ensures consistency between mouse movement and model movement. Therefore, this solution avoids unreasonable phenomena when moving objects. It is evident that this solution abandons the traditional use of mouse points as ray casting points and instead uses target points on the object as ray casting points. Furthermore, the objects are categorized by their adsorption type and further subdivided according to the model's product type, utilizing various adsorption rule algorithms to correct and adjust the model's direction and position.
[0171] Figure 4 A schematic diagram of the structure of an electronic device according to an embodiment of this application is shown. Figure 4As shown, the electronic device includes a memory 1101 and a processor 1102. The memory 1101 can be configured to store various other data to support operation on the electronic device. Examples of such data include instructions for any application or method used to operate on the electronic device. The memory 1101 can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic storage, flash memory, magnetic disk, or optical disk.
[0172] The memory 1101 is used to store programs;
[0173] The processor 1102 is coupled to the memory 1101 and is used to execute the program stored in the memory 1101 to implement the data processing method and home decoration design method provided in the above method embodiments.
[0174] Furthermore, such as Figure 4 As shown, the electronic device also includes: communication component 1103, display 1104, power supply component 1105, audio component 1106, and other components. Figure 4 The diagram only shows some components and does not mean that the electronic device includes only these components. Figure 4 The components shown.
[0175] Accordingly, embodiments of this application also provide a computer-readable storage medium storing a computer program, which, when executed by a computer, can implement the steps or functions of the data processing method and home decoration design method provided in the above-described method embodiments.
[0176] The device embodiments described above are merely illustrative. The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the modules can be selected to achieve the purpose of this embodiment according to actual needs. Those skilled in the art can understand and implement this without any creative effort.
[0177] Through the above description of the embodiments, those skilled in the art can clearly understand that each embodiment can be implemented by means of software plus necessary general-purpose hardware platforms, and of course, it can also be implemented by hardware. Based on this understanding, the above technical solutions, in essence or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, magnetic disk, optical disk, etc., and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute the methods described in the various embodiments or some parts of the embodiments.
[0178] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of this application, and are not intended to limit them. Although this application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features. Such modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of this application.
Claims
1. A data processing method, wherein, include: In response to a user's movement operation on a first object in three-dimensional space on the user interface, determine the movement vector of the movement operation on the user interface; Determine the second two-dimensional coordinates on the operation interface corresponding to the target point on the first object before movement; Based on the second two-dimensional coordinates and the movement vector, the target point on the first object after movement corresponds to the first two-dimensional coordinates on the operation interface; In the three-dimensional space, a first virtual ray is created; the first virtual ray passes through the virtual camera viewpoint corresponding to the three-dimensional space and the point where the first two-dimensional coordinates are located on the operation interface; Based on the first virtual ray, determine the three-dimensional coordinates of the target point on the first object in the three-dimensional space after the movement; Based on the adsorption type of the first object, determine the direction of the second virtual ray used to locate the target object; In the three-dimensional space, a second virtual ray is created that is emitted from the target point on the first object after it has been moved, along the direction. Identify other objects in the three-dimensional space that intersect with the second virtual ray; Based on the adsorption type of the first object, among other objects in the three-dimensional space that intersect with the second virtual ray, determine the target object that the first object can adsorb in the three-dimensional space after moving; Based on the product type to which the first object belongs and the target object, adjust the position and / or orientation of the first object in the three-dimensional space so that the first object is attached to the target object.
2. The method according to claim 1, wherein, The methods for confirming the target point on the first object include at least one of the following: The center point of the target bounding surface of the bounding box of the first object is determined as the target point on the first object; wherein, the target bounding surface is the bounding surface of the bounding box of the first object whose normal vector points toward the ground in the three-dimensional space; Determine the target point on the first object based on the user's specified operation; Based on the scene type in the three-dimensional space, the target point on the first object is determined.
3. The method according to claim 1 or 2, wherein, Adjusting the position of the first object in the three-dimensional space according to the product type to which the first object belongs and the target object includes: The embedding status of the first object when it adsorbs the target object is determined based on the product type to which the first object belongs; Based on the embedding situation and the target object, the position of the first object in the three-dimensional space is adjusted.
4. The method according to claim 1 or 2, wherein, Adjusting the orientation of the first object in the three-dimensional space according to the product type to which the first object belongs and the target object includes: Based on the product type to which the first object belongs, determine the desired relationship between the orientation of the first object and the orientation of the target object, and the orientation of the object face of the first object; Based on the orientation of the target object towards the object face of the first object, the orientation of the first object, and the desired relationship, adjust the orientation of the first object in the three-dimensional space.
5. The method according to claim 1 or 2, wherein, Based on the adsorption type of the first object, the direction of the second virtual ray used to locate the target object is determined, including: When the adsorption type of the first object is an adsorption floor type or a downward adsorption object type, the direction of the second virtual ray is determined to be vertical and towards the ground in the three-dimensional space; When the adsorption type of the first object is the type of adsorption of roof or the type of adsorption of objects upward, the direction of the second virtual ray is determined to be vertical and towards the top surface in the three-dimensional space; When the adsorption type of the first object is an adsorption wall type, the direction of the second virtual ray is determined to be perpendicular and towards the wall in the three-dimensional space; When the adsorption type of the first object is the horizontal adsorption object type, the direction of the second virtual ray is determined to be the orthogonal direction of the first object along the horizontal direction.
6. A home decoration design method, wherein, include: In response to a user's movement operation performed on a first object in the three-dimensional space to be decorated on the operation interface, the movement vector of the movement operation on the operation interface is determined. Determine the second two-dimensional coordinates on the operation interface corresponding to the target point on the first object before movement; Based on the second two-dimensional coordinates and the movement vector, the target point on the first object after movement corresponds to the first two-dimensional coordinates on the operation interface; In the three-dimensional space to be decorated, a first virtual ray is created; the first virtual ray passes through the virtual camera viewpoint corresponding to the three-dimensional space to be decorated and the point where the first two-dimensional coordinates are located on the operation interface; Based on the first virtual ray, determine the three-dimensional coordinates of the target point on the first object in the three-dimensional space to be decorated after the movement; Based on the adsorption type of the first object, determine the direction of the second virtual ray used to locate the target object; In the three-dimensional space, a second virtual ray is created that is emitted from the target point on the first object after it has been moved, along the direction. Identify other objects in the three-dimensional space that intersect with the second virtual ray; Based on the adsorption type of the first object, among other objects in the three-dimensional space that intersect with the second virtual ray, determine the target object that the first object can adsorb in the three-dimensional space after moving; Based on the product type to which the first object belongs and the target object, adjust the position and / or orientation of the first object in the three-dimensional space so that the first object is attached to the target object.
7. An electronic device, wherein, include: Memory and processor, among which, The memory is used to store programs; The processor, coupled to the memory, is used to execute the program stored in the memory to implement the data processing method of any one of claims 1 to 5 or the home decoration design method of claim 6.
8. A computer-readable storage medium storing a computer program, wherein, When the computer program is executed by a computer, it can implement the data processing method of any one of claims 1 to 5 or the home decoration design method of claim 6.