Three-dimensional object interaction point coordinate mapping method and device, equipment and medium
By obtaining the two-dimensional layer and preset conversion matrix in a three-dimensional object, combining the ray intersection results, determining the relative coordinates of the interaction points and obtaining mapping coordinates, the problem of low accuracy of the interaction points of the three-dimensional object is solved, and the accuracy of interaction control is improved.
Patent Information
- Application Number
- CN202311670990.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-12-06
- Publication Date
- 2025-06-06
AI Technical Summary
In the prior art, the mapping accuracy of the interaction points of three-dimensional objects is low, resulting in inaccurate interaction between the smart wearable device and the three-dimensional object.
By obtaining at least one two-dimensional layer of a three-dimensional object, and obtaining the target layer in the three-dimensional space based on the preset transformation matrix, the relative coordinates of the intersection point are determined using the intersecting result of the ray and the layer, and the mapping coordinates of the interaction point to be mapped are obtained in combination with the layer coordinates.
It improves the accuracy of the mapping of interactive points in three-dimensional objects, ensures that the geometric relationship between interactive points remains unchanged, and enhances the interactive control capabilities between smart wearable devices and three-dimensional objects.
Smart Images

Figure CN120107452A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of image processing technology, and in particular to a coordinate mapping method, device, computer equipment and storage medium for interaction points of a three-dimensional object. Background Art
[0002] In the field of computer graphics and three-dimensional modeling, accurately mapping points in three-dimensional space to two-dimensional planes is a key issue. The interaction between smart wearable devices and three-dimensional objects includes gesture interaction, etc. The smart wearable device receives gesture instructions issued by the user, and controls the three-dimensional object to make the corresponding response results of the instructions according to the interaction relationship. For example, the user determines the virtual button in the display screen of the smart wearable device through gesture operation, and realizes the control of the three-dimensional object through the interaction relationship between the virtual button and the button on the three-dimensional object. When using a smart wearable device (such as AR (Augmented Reality) glasses) for interaction, the environment and the intersection of sight lines change with the user's actions and position changes. The content fed back to the user by AR glasses changes dynamically according to the environment, sight focus and other conditions. Therefore, it is necessary to accurately map the points on the three-dimensional object to the screen of the smart wearable device (i.e., the two-dimensional plane), determine the interaction relationship between the smart wearable device and the three-dimensional object, and then accurately control the three-dimensional object to perform corresponding operations through the determined interaction relationship. In the related art, various mathematical models and algorithms are often used for approximate mapping, and the accuracy of the mapping results is low. Therefore, how to improve the accuracy of the mapping of interaction points in three-dimensional objects has become an urgent problem to be solved. Summary of the invention
[0003] The present application provides a coordinate mapping method, device, computer equipment and storage medium for interaction points of a three-dimensional object to improve the accuracy of mapping interaction points in a three-dimensional object.
[0004] In a first aspect, the present application provides a coordinate mapping method for interaction points of a three-dimensional object, the method comprising:
[0005] Acquire at least one two-dimensional layer of a three-dimensional object and an interaction point to be mapped on the three-dimensional object, and obtain a first target layer in the three-dimensional space based on a preset transformation matrix and the two-dimensional layer;
[0006] Intersecting the first target layer based on a preset ray to obtain an intersection result;
[0007] When the intersection result indicates that there is an intersection point, based on the intersection result, determining the layer where the intersection point is located in the first target layer as the intersection layer, and obtaining the relative coordinates of the intersection point relative to the intersection layer;
[0008] Based on the relative coordinates and the layer coordinates of the intersecting layers, the mapping coordinates of the to-be-mapped interaction point are obtained.
[0009] In a second aspect, the present application further provides a coordinate mapping device for interaction points of a three-dimensional object, the device comprising:
[0010] A first target layer acquisition module, used to acquire at least one two-dimensional layer of a three-dimensional object and an interaction point to be mapped on the three-dimensional object, and acquire a first target layer in a three-dimensional space based on a preset conversion matrix and the two-dimensional layer;
[0011] An intersection result obtaining module, used for intersecting the first target layer based on a preset ray to obtain an intersection result;
[0012] A relative coordinate acquisition module, used for, when the intersection result indicates that there is an intersection point, determining, based on the intersection result, a layer where the intersection point is located in the first target layer as an intersection layer, and obtaining the relative coordinates of the intersection point relative to the intersection layer;
[0013] The mapping coordinate obtaining module is used to obtain the mapping coordinates of the to-be-mapped interaction point based on the relative coordinates and the layer coordinates of the intersecting layers.
[0014] In a third aspect, the present application also provides a computer device, comprising a memory and a processor; the memory is used to store a computer program; the processor is used to execute the computer program and implement the coordinate mapping method of the interaction points of three-dimensional objects as described above when executing the computer program.
[0015] In a fourth aspect, the present application further provides a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the processor implements the coordinate mapping method of interaction points of three-dimensional objects as described above.
[0016] The present application discloses a coordinate mapping method, device, computer equipment and storage medium for interaction points of a three-dimensional object. The method comprises the following steps: obtaining at least one two-dimensional layer of a three-dimensional object and an interaction point to be mapped on the three-dimensional object, obtaining a first target layer in a three-dimensional space based on a preset transformation matrix and the two-dimensional layer; intersecting the first target layer based on a preset ray to obtain an intersection result; when the intersection result shows that an intersection point exists, determining the layer where the intersection point is located in the first target layer as an intersection layer based on the intersection result, and obtaining the relative coordinates of the intersection point relative to the intersection layer; and obtaining the mapping coordinates of the interaction point to be mapped based on the relative coordinates and the layer coordinates of the intersection layer. The method obtains at least one two-dimensional layer of the three-dimensional object, and obtains a first target layer in the three-dimensional space according to the two-dimensional layer and a preset transformation matrix, so that the intersection of the ray and the layer occurs in the three-dimensional space, avoiding the coordinate influence caused by the spatial change when the interactive point to be mapped is mapped from the three-dimensional space to the two-dimensional space, and ensuring that the geometric relationship of each interactive point to be mapped on the three-dimensional object before and after mapping remains unchanged; when there is an intersection between the preset ray and the first target layer, the relative coordinates of the intersection are obtained based on the intersection result, and the mapping coordinates of the interactive point to be mapped are obtained by combining the relative coordinates of the intersection with the layer coordinates of the intersection layer, avoiding the coordinate influence caused by the spatial change of the layer, further ensuring that the geometric relationship of the interactive point to be mapped before and after mapping remains unchanged, thereby improving the mapping accuracy of the interactive point in the three-dimensional object. BRIEF DESCRIPTION OF THE DRAWINGS
[0017] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.
[0018] Figure 1 is a schematic flow chart of a first embodiment of a coordinate mapping method for interaction points of a three-dimensional object provided by an embodiment of the present application;
[0019] Figure 2 It is a schematic diagram of layer expansion of a coordinate mapping method of a three-dimensional object interaction point provided in an embodiment of the present application;
[0020] Figure 3 It is a schematic diagram of ray intersection of a coordinate mapping method of a three-dimensional object interaction point provided by an embodiment of the present application;
[0021] Figure 4 is a schematic flow chart of a second embodiment of a coordinate mapping method for interaction points of a three-dimensional object provided in an embodiment of the present application;
[0022] Figure 5 A schematic block diagram of a coordinate mapping device for interaction points of a three-dimensional object provided in an embodiment of the present application;
[0023] Figure 6 A schematic block diagram of the structure of a computer device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0024] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.
[0025] The flowcharts shown in the accompanying drawings are only examples and do not necessarily include all the contents and operations / steps, nor must they be executed in the order described. For example, some operations / steps may also be decomposed, combined or partially merged, so the actual execution order may change according to actual conditions.
[0026] It should be understood that the terms used in this application specification are only for the purpose of describing specific embodiments and are not intended to limit the application. As used in this application specification and the appended claims, unless the context clearly indicates otherwise, the singular forms "a", "an" and "the" are intended to include plural forms.
[0027] It should also be understood that the term “and / or” used in the specification and appended claims refers to any and all possible combinations of one or more of the associated listed items, and includes these combinations.
[0028] The embodiments of the present application provide a coordinate mapping method, device, computer equipment and storage medium for interaction points of a three-dimensional object. The coordinate mapping method for interaction points of a three-dimensional object can be applied to servers and smart wearable devices. By combining the relative coordinates of the intersection points and the layer coordinates of the intersecting layers, the geometric relationship between the mapped interaction points is ensured to remain unchanged, thereby improving the accuracy of interaction point mapping in the three-dimensional object. The server can be an independent server or a server cluster; the smart wearable device can be smart glasses, smart bracelets, etc.
[0029] In conjunction with the accompanying drawings, some embodiments of the present application are described in detail below. In the absence of conflict, the following embodiments and features in the embodiments can be combined with each other.
[0030] See also Figure 1 , Figure 1The present invention is a schematic flow chart of a coordinate mapping method for a three-dimensional object interaction point provided by an embodiment of the present application. The coordinate mapping method for a three-dimensional object interaction point can be applied to a server and a smart wearable device, and is used to ensure that the geometric relationship between the mapped interaction points remains unchanged by combining the relative coordinates of the intersection points and the layer coordinates of the intersecting layers, thereby improving the mapping accuracy of the interaction points in the three-dimensional object.
[0031] like Figure 1 As shown, the coordinate mapping method of the three-dimensional object interaction point specifically includes steps S101 to S104.
[0032] S101, obtaining at least one two-dimensional layer of a three-dimensional object and an interaction point to be mapped on the three-dimensional object, and obtaining a first target layer in a three-dimensional space based on a preset transformation matrix and the two-dimensional layer.
[0033] In one embodiment, the interactive point to be mapped on the three-dimensional object is determined, for example, the power button on the computer host. The determination of the interactive point to be mapped can be determined by the interactive buttons corresponding to each object pre-stored in the smart wearable device; or the smart wearable device can obtain relevant information of the three-dimensional object by scanning the three-dimensional object and then determine the interactive button on the three-dimensional object. For example, the user wears AR glasses to scan the three-dimensional object in the three-dimensional environment where the user is located, and matches the three-dimensional object information obtained by the scan in the information library to determine the category (such as a computer display), model, etc. of the three-dimensional object, and then obtain the interactive button on the three-dimensional object. It can be understood that the interactive button on the three-dimensional object can be a physical button on the surface of the three-dimensional object, such as the power button, volume adjustment button, brightness adjustment button, etc. of the computer display; it can also be a virtual button in the display screen of the three-dimensional object, such as the close button, start menu button, application button, etc. in the computer display interface.
[0034] In one embodiment, a three-dimensional object with an interactive button is determined through the scanning result of the smart wearable device, and the three-dimensional object is used as a three-dimensional object that needs to be mapped with interactive points. All two-dimensional planes of the three-dimensional object that needs to be mapped with interactive points are obtained as two-dimensional layers, such as layer one, layer two, and layer three.
[0035] In one embodiment, a layer in a two-dimensional space is converted into a layer in a three-dimensional space by a preset conversion matrix to obtain a first target layer. Among them, the preset conversion matrix can be a Matrix4 matrix, or it can be other matrices that can realize the conversion of a two-dimensional space into a three-dimensional space. Matrix4 is a 4x4 matrix, a matrix class in Flutter (Flutter is Google's mobile UI (User Interface, software interface design) framework that can quickly build high-quality native user interfaces), used for 3D transformation and 2D transformation. By modifying the values of each element of Matrix4, 3D transformations and 2D transformations such as translation, rotation, scaling, stretching, and perspective can be achieved.
[0036] In a specific embodiment, all the obtained two-dimensional layers are unfolded and placed in the same layer to obtain a second target layer, and the second target layer is converted into a layer in a three-dimensional space through a conversion matrix to obtain a first target layer.
[0037] Furthermore, before the intersection result is obtained by intersecting the preset ray with the first target layer, it also includes: determining the ray direction based on the position of the interaction point to be mapped in the first target layer; and generating the ray based on the ray starting point and the ray direction.
[0038] In one embodiment, the position of the interaction point to be mapped is determined in the first target layer according to the position of the interaction point to be mapped on the two-dimensional layer of the original three-dimensional object. For example, if a certain interaction point to be mapped is in layer two, the position of the interaction point to be mapped is determined in layer two of the first target layer.
[0039] In one embodiment, the ray direction is determined according to the position of the interaction point to be mapped, and the ray generation module is called to initiate the ray from the ray starting point according to the above ray direction. Among them, the ray generation module can be a module stored in the smart wearable device itself, or it can be an external device connected to the smart wearable device through a wired connection or a wireless connection, which is used to generate and emit rays and obtain the intersection results of rays and layers. The rays are generated by the direction of the human eye's gaze point, or by the rotation and movement of the ring. For example, when a user wears smart glasses to interact with a three-dimensional object, the human eye's gaze point is the interaction point to be mapped on the three-dimensional object, then the ray starting point is the position of the smart glasses, and the ray direction is the direction of the human eye's gaze point.
[0040] Furthermore, after obtaining at least one two-dimensional layer of the three-dimensional object, the method further includes: recording layer coordinates of each of the two-dimensional layers, so as to obtain the layer coordinates of the intersecting layers when determining the intersecting layers.
[0041] In one embodiment, when scanning a three-dimensional object, the smart wearable device can measure the size of the three-dimensional object, obtain information such as the length, height, and width of the three-dimensional object, and establish a three-dimensional coordinate system based on the three-dimensional object. The coordinate system of each two-dimensional layer can be established with a vertex of the three-dimensional object as the origin, and the coordinates of the vertex of each two-dimensional layer can be obtained by combining the length, height, width, and other information of the object. When the user determines to use the coordinates of a certain point to represent the coordinates of the layer, the smart wearable device can measure the distance between the point and the origin, and then calculate the coordinates of the point according to the distance formula.
[0042] In one embodiment, the layer coordinates of the two-dimensional layer can be represented by a certain point in the two-dimensional layer as required by the user, for example, the coordinates of the two-dimensional layer can be represented by a certain vertex among the four vertices of the two-dimensional layer or the center point of the layer.
[0043] In one embodiment, the layer coordinates of all two-dimensional layers are recorded, for example, the coordinates of layer 1, layer 2, and layer 3 are (x1, y1), (x2, y2), and (x3, y3), respectively. When the intersecting layer corresponding to the intersection point is determined and the layer coordinates of the intersecting layer need to be obtained, the layer coordinates can be directly obtained from the record.
[0044] Furthermore, obtaining a first target layer in three-dimensional space based on a preset conversion matrix and the two-dimensional layer includes: generating a second target layer based on at least one of the two-dimensional layers; and converting the second target layer into a layer in three-dimensional space as the first target layer based on the conversion matrix.
[0045] In one embodiment, Figure 2 As shown, all the two-dimensional layers corresponding to the three-dimensional object (such as layer 1, layer 2, and layer 3) are unfolded and placed in the same layer to obtain the second target layer, and the relationship between the original coordinates of the two-dimensional layer and the coordinates in the second target layer is kept unchanged. For example, a three-dimensional object contains four two-dimensional layers, namely layer 1, layer 2, layer 3, and layer 4. The faces of the three-dimensional object are not in the same plane. The three-dimensional object is unfolded to place all the two-dimensional layers on the same plane to obtain the second target layer. Assuming that the coordinates of layer 1, layer 2, layer 3, and layer 4 are (x1, y1), (x2, y2), (x3, y3), and (x4, y4), respectively, the coordinates of layer 1, layer 2, layer 3, and layer 4 in the second target layer are also (x1, y1), (x2, y2), (x3, y3), and (x4, y4).
[0046] S102: Intersect the first target layer based on a preset ray to obtain an intersection result.
[0047] In one embodiment, Figure 3As shown, the preset ray is intersected with the first target layer, and the intersection result is returned after the intersection is completed.
[0048] In one embodiment, after the smart wearable device calls the ray generation module to generate and emit rays, the ray generation module will automatically generate an intersection result based on the intersection situation for the smart wearable device to obtain. For example, when the ray intersects with the first target layer, the ray generation module will automatically determine the intersection point, determine the distance between the ray starting point and the intersection point, and generate the intersection result based on the intersection point and the distance between the ray starting point and the intersection point. When the smart wearable device needs to calculate the relative coordinates of the intersection point, it obtains the intersection result from the ray generation module, and calculates the relative coordinates of the intersection point based on the data in the intersection result. It can be understood that the intersection result includes whether the ray intersects with the first target layer, that is, whether there is an intersection point. When there is an intersection point, the intersection result also includes the layer where the intersection point is located and the distance between the intersection point and the ray starting point; when there is no intersection point, the intersection result also includes the current ray direction and the layer where the interactive point to be mapped is located.
[0049] Furthermore, after the intersection result is obtained by intersecting the preset ray with the first target layer, it also includes: when the intersection result is that there is no intersection, based on the direction of the ray and the layer corresponding to the interaction point to be mapped, generating prompt information to remind the user that the ray and the layer corresponding to the interaction point to be mapped do not intersect.
[0050] In one embodiment, when the ray has no intersection with any layer in the first target layer, a non-intersection prompt is generated according to the ray direction in the intersection result and the layer where the interactive point to be mapped is located. For example, assuming that the ray direction in the intersection result is the first direction and the layer where the interactive point to be mapped is located is layer 2, a prompt message "the ray in the current first direction does not intersect with layer 2" is generated.
[0051] S103. When the intersection result indicates that there is an intersection point, based on the intersection result, determine in the first target layer the layer where the intersection point is located as the intersection layer, and obtain the relative coordinates of the intersection point relative to the intersection layer.
[0052] In one embodiment, when there is an intersection point, the intersection result also includes the layer where the intersection point is located and the distance between the intersection point and the starting point of the ray, that is, the ray length.
[0053] In one embodiment, a triangle can be generated by the starting point of the ray, the vertex of the intersecting layer and the intersection point. Combining the ray direction, the ray length and the line segment between the starting point of the ray and the vertex, the two sides of the triangle and the angle between the two sides can be obtained, and then the length of the third side of the triangle can be obtained according to the cosine theorem, that is, the relative distance between the intersection point and the vertex of the intersecting layer.
[0054] In one embodiment, after respectively obtaining the relative distances between the four vertices of the intersecting layers and the intersection point, the specific coordinates of the intersection point are calculated in combination with the vertex coordinates to obtain the relative coordinates of the intersection point.
[0055] In a specific embodiment, four circles and equations of the four circles are obtained by taking four vertices as origins and the relative distances between the intersection point and the four vertices as radii, and the four equations are combined to obtain a system of equations, which is solved to obtain the coordinates of the intersection point.
[0056] In another embodiment, the vertex coordinates and the relative distance between the intersection point and the vertex are known, and then according to the distance formula between the two points The intersection coordinates can be obtained.
[0057] Wherein, L is the distance between two points. In this embodiment, L is the relative distance between the intersection point and the vertex of the intersecting layer. (x, y) is the coordinate of the intersection point. (x 1 ,y 1 )、(x 2 ,y 2 )、(x 3 ,y 3 )、(x 4 ,y 4 ) are the vertex coordinates of the intersecting layers.
[0058] S104: Obtain mapping coordinates of the to-be-mapped interaction point based on the relative coordinates and the layer coordinates of the intersecting layers.
[0059] In one embodiment, the mapping coordinates are the coordinates of the to-be-mapped interactive points of the three-dimensional object mapped on the display interface of the smart wearable device. According to the mapping coordinates, the interactive buttons of the three-dimensional object can be displayed on the display interface, thereby realizing the interaction between the smart wearable device and the three-dimensional object. For example, the switch button of the TV is mapped to the display interface of the smart glasses. When the user wears the smart glasses, the switch button on the display interface is determined by gesture operation, and the physical switch button of the TV is controlled by the switch button.
[0060] In one embodiment, the mapping coordinates of the interactive point to be mapped are obtained by adding the relative coordinates to the original two-dimensional coordinates (i.e., layer coordinates) of the intersecting layer. For example, the intersecting layer is layer 1, the layer 1 coordinates are (x1, y1), and the relative coordinates of the intersection point relative to the two-dimensional layer are (x, y). Then, the mapping coordinates of the interactive point to be mapped are (x1, y1) + (x, y).
[0061] The above-mentioned embodiment provides a coordinate mapping method, device, computer equipment and storage medium for interaction points of a three-dimensional object. By acquiring at least one two-dimensional layer of the three-dimensional object, and obtaining a first target layer in the three-dimensional space according to the two-dimensional layer and a preset transformation matrix, the intersection of the ray and the layer occurs in the three-dimensional space, avoiding the coordinate influence caused by the spatial change when the interaction point to be mapped is mapped from the three-dimensional space to the two-dimensional space, and ensuring that the geometric relationship of each interaction point to be mapped on the three-dimensional object before and after mapping remains unchanged; when there is an intersection between the preset ray and the first target layer, the relative coordinates of the intersection are obtained based on the intersection result, and the relative coordinates of the intersection are combined with the layer coordinates of the intersection layer to obtain the mapping coordinates of the interaction point to be mapped, avoiding the coordinate influence caused by the spatial change of the layer, further ensuring that the geometric relationship of the interaction point to be mapped before and after mapping remains unchanged, thereby improving the mapping accuracy of the interaction point in the three-dimensional object.
[0062] See also Figure 4 , Figure 4 The present invention is a schematic flow chart of a coordinate mapping method for a three-dimensional object interaction point provided by an embodiment of the present application. The coordinate mapping method for a three-dimensional object interaction point can be applied to a server and a smart wearable device, and is used to ensure that the geometric relationship between the mapped interaction points remains unchanged by combining the relative coordinates of the intersection points and the layer coordinates of the intersecting layers, thereby improving the mapping accuracy of the interaction points in the three-dimensional object.
[0063] like Figure 4 As shown, the coordinate mapping method of the three-dimensional object interaction point specifically includes steps S201 to S204.
[0064] S201, based on the intersection result, determine an intersection point, and determine in the first target layer the layer where the intersection point is located as the intersection layer;
[0065] S202, obtaining the distance between the starting point of the ray and the intersection point as the ray length;
[0066] S203, obtaining vertex coordinates of the intersecting layers;
[0067] S204: Obtain the relative coordinates of the intersection point based on the ray direction, the ray length and the vertex coordinates.
[0068] In one embodiment, after the smart wearable device calls the ray generation module to generate and emit rays, the ray generation module will automatically generate an intersection result according to the intersection situation, so that the smart wearable device can obtain the intersection result and calculate the relative coordinates of the intersection point. Among them, the ray generation module can be a module stored in the smart wearable device itself, or it can be an external device connected to the smart wearable device through a wired connection or a wireless connection, which is used to generate and emit rays and obtain the intersection result of the ray and the layer. For example, when the ray intersects with the first target layer, the ray generation module will automatically determine the intersection point, determine the distance between the ray starting point and the intersection point, and generate the intersection result according to the intersection point, the distance between the ray starting point and the intersection point. When the smart wearable device needs to calculate the relative coordinates of the intersection point, the intersection result is obtained from the ray generation module, and the relative coordinates of the intersection point are calculated based on the data in the intersection result. After the smart wearable device obtains the intersection result, it obtains the intersection point of the ray and the first target layer from the intersection result, determines the layer where the intersection point is located in the first target layer, and uses the layer as the intersection layer. It can be understood that the first target layer contains a layer converted from multiple two-dimensional layers corresponding to a three-dimensional object, and when there is only one ray, it only intersects with one of the layers. There may be multiple rays.
[0069] In one embodiment, if the ray intersects with the first target layer, the intersection result includes the distance between the ray starting point and the intersection point, and the distance is obtained from the intersection result and used as the ray length.
[0070] In one embodiment, the vertex coordinates of the layer can be recorded together with the layer coordinates of each two-dimensional layer when obtaining the two-dimensional layer of the three-dimensional object, and directly obtained from the record when needed. It is understandable that the layer coordinates of the two-dimensional layer can be represented by a certain vertex coordinate, or it can be any point specified by the user. Exemplarily, the user specifies the vertex at the upper right corner of the two-dimensional layer to represent the layer coordinates of the two-dimensional layer, or specifies the center point of the two-dimensional layer to represent the layer coordinates of the two-dimensional layer.
[0071] In one embodiment, a triangle can be generated by the starting point of the ray, the vertex of the intersecting layer and the intersection point. Combining the ray direction, the ray length and the line segment between the starting point of the ray and the vertex, the two sides of the triangle and the angle between the two sides can be obtained, and then the length of the third side of the triangle can be obtained according to the cosine theorem, that is, the relative distance between the intersection point and the vertex of the intersecting layer.
[0072] In one embodiment, after respectively obtaining the relative distances between the four vertices of the intersecting layers and the intersection point, the relative coordinates of the intersection point are calculated in combination with the vertex coordinates to obtain the relative coordinates of the intersection point.
[0073] In a specific embodiment, four circles and equations of the four circles are obtained by taking the four vertices as the origin and the relative distances between the intersection and the four vertices as the radius. The four equations are combined to obtain an equation system, which is solved to obtain the coordinates of the intersection. For example, assuming that the relative coordinates of the intersection are (x, y), the coordinates of the four vertices are (x 1 ,y 1 )、(x 2 ,y 2 )、(x 3 ,y 3 )、(x 4 ,y 4 ), the relative distances between the intersection point and the vertex are L 1 , L 2 , L 3 , L 4 , then the equations of the circle are:
[0074] (x-x1) 2 +(y-y1) 2 =L1 2
[0075] (x-x2) 2 +(y-y2) 2 =L2 2
[0076] (x-x3) 2 +(y-y3) 2 =L3 2
[0077] (x-x4) 2 +(y-y4) 2 =L4 2
[0078] Combining the equations of the four circles gives the following system of equations:
[0079]
[0080] Solve the above equations to obtain the values of x and y, which are the relative coordinates of the intersection point.
[0081] In another embodiment, the vertex coordinates and the relative distance between the intersection point and the vertex are known, and then according to the distance formula between the two points The relative coordinates of the intersection point can be obtained.
[0082] Where L is the distance between the two points; (x, y) is the coordinate of one of the two points, which is an unknown coordinate; (x 1 ,y 1) is the coordinate of another point, which is a known coordinate. In this embodiment, L is the relative distance between the intersection point and the vertex of the intersecting layer, (x, y) is the relative coordinate of the intersection point, (x 1 ,y 1 ) are the vertex coordinates of the intersecting layers. For example, assuming that the relative coordinates of the intersection point are (x, y), the coordinates of the four vertices are (x 1 ,y 1 )、(x 2 ,y 2 )、(x 3 ,y 3 )、(x 4 ,y 4 ), the relative distances between the intersection point and the vertex are L 1 , L 2 , L 3 , L 4 , then according to the distance formula we get
[0083]
[0084] Solve the above equations to obtain the values of x and y, which are the relative coordinates of the intersection point.
[0085] Furthermore, obtaining the relative coordinates of the intersection point based on the ray direction, the ray length and the vertex coordinates includes: obtaining the relative distance between the vertex of the intersecting layer and the intersection point based on the ray direction, the ray length and the vertex coordinates; obtaining the relative coordinates of the intersection point based on the relative distance and the vertex coordinates.
[0086] In one embodiment, the line segment between the ray starting point and the vertex can be obtained through the ray starting point and the vertex coordinates. The angles between the ray and the line segment between the four vertex coordinates of the intersecting layer and the ray starting point can be obtained through the ray direction.
[0087] In one embodiment, the starting point of the ray and the vertex coordinates of the intersecting layer and the intersection point can form a triangle, wherein the line segment between the starting point of the ray and the intersection point and the line segment between the starting point of the ray and the vertex of the intersecting layer are two sides of the above triangle, and the angle between the line segment between the vertex coordinates of the intersecting layer and the starting point of the ray and the ray is an internal angle of the triangle, and the relative distance between the intersection point and the vertex can be obtained through the cosine theorem.
[0088] In one embodiment, after the relative distances between the intersection point and the four vertices of the intersecting layer are obtained, the relative coordinates of the intersection point with respect to the intersecting layer can be obtained according to the vertex coordinates of the four vertices.
[0089] In a specific embodiment, four circles and equations of the four circles are obtained by taking the four vertices as the origin and the relative distances between the intersection and the four vertices as the radius. The four equations are combined to obtain an equation system, which is solved to obtain the coordinates of the intersection. For example, assuming that the relative coordinates of the intersection are (x, y), the coordinates of the four vertices are (x 1 ,y 1 )、(x 2 ,y 2 )、(x 3 ,y 3 )、(x 4 ,y 4 ), the relative distances between the intersection point and the vertex are L 1 , L 2 , L 3 , L 4 , then the equations of the circle are
[0090] (x-x1) 2 +(y-y1) 2 =L1 2
[0091] (x-x2) 2 +(y-y2) 2 =L2 2
[0092] (x-x3) 2 +(y-y3) 2 =L3 2
[0093] (x-x4) 2 +(y-y4) 2 =L4 2
[0094] Combining the equations of the four circles gives the following system of equations:
[0095]
[0096] Solve the above equations to obtain the values of x and y, which are the relative coordinates of the intersection point.
[0097] In another embodiment, the vertex coordinates and the relative distance between the intersection point and the vertex are known, and then according to the distance formula between the two points The relative coordinates of the intersection point can be obtained.
[0098] Where L is the distance between the two points; (x, y) is the coordinate of one of the two points, which is an unknown coordinate; (x 1 ,y 1) is the coordinate of another point, which is a known coordinate. In this embodiment, L is the relative distance between the intersection point and the vertex of the intersecting layer, (x, y) is the relative coordinate of the intersection point, (x 1 ,y 1 ) are the vertex coordinates of the intersecting layers. For example, assuming that the relative coordinates of the intersection point are (x, y), the coordinates of the four vertices are (x 1 ,y 1 )、(x 2 ,y 2 )、(x 3 ,y 3 )、(x 4 ,y 4 ), the relative distances between the intersection point and the vertex are L 1 , L 2 , L 3 , L 4 , then according to the distance formula we get:
[0099]
[0100] Solve the above equations to obtain the values of x and y, which are the relative coordinates of the intersection point.
[0101] The above-mentioned embodiment provides a coordinate mapping method, device, computer equipment and storage medium for interaction points of three-dimensional objects. The relative distance between the intersection point and the vertex is calculated by obtaining the ray length and the vertex coordinates of the intersecting layer, and then the relative coordinates of the intersection point relative to the intersecting layer are calculated based on the relative distance and the vertex coordinates. The ray length is automatically generated when the rays intersect, and the vertex coordinates of the intersecting layer are obtained by the smart wearable device during scanning. No manual measurement is required, and the data accuracy is high. In addition, the calculated coordinates are used as the relative coordinates of the interaction point to be mapped rather than the mapping coordinates, which facilitates the subsequent combination of the relative coordinates and the layer coordinates to obtain the mapping coordinates to avoid the influence of the spatial changes of the layer, ensures that the geometric relationship of the interaction point to be mapped before and after mapping remains unchanged, and improves the accuracy of interaction point mapping in three-dimensional objects.
[0102] See also Figure 5 , Figure 5 The embodiment of the present application provides a schematic block diagram of a coordinate mapping device for a three-dimensional object interaction point, which is used to execute the coordinate mapping method for the three-dimensional object interaction point described above. The coordinate mapping device for the three-dimensional object interaction point can be configured on a server or a smart wearable device.
[0103] like Figure 5 As shown, the coordinate mapping device 300 of the interaction point of the three-dimensional object includes:
[0104] A first target layer acquisition module 301 is used to acquire at least one two-dimensional layer of a three-dimensional object and an interaction point to be mapped on the three-dimensional object, and acquire a first target layer in a three-dimensional space based on a preset conversion matrix and the two-dimensional layer;
[0105] An intersection result obtaining module 302 is used to obtain an intersection result by intersecting the first target layer based on a preset ray;
[0106] A relative coordinate obtaining module 303 is used for, when the intersection result indicates that there is an intersection point, determining, based on the intersection result, a layer where the intersection point is located in the first target layer as an intersection layer, and obtaining the relative coordinates of the intersection point relative to the intersection layer;
[0107] The mapping coordinate obtaining module 304 is used to obtain the mapping coordinates of the to-be-mapped interaction point based on the relative coordinates and the layer coordinates of the intersecting layers.
[0108] Furthermore, the coordinate mapping device 300 of the interaction point of the three-dimensional object further includes: a ray generation module, the ray generation module includes:
[0109] A ray direction determining unit, configured to determine a ray direction based on a position of the to-be-mapped interaction point in the first target layer;
[0110] The ray generating unit is used to generate the ray based on the ray starting point and the ray direction.
[0111] Furthermore, the relative coordinate obtaining module 303 includes:
[0112] An intersection layer determination unit, configured to determine an intersection point based on the intersection result, and determine a layer where the intersection point is located in the first target layer as an intersection layer;
[0113] A ray length acquisition unit, used to acquire the distance between the starting point of the ray and the intersection point as the ray length;
[0114] A vertex coordinate acquisition unit, used to acquire the vertex coordinates of the intersecting layers;
[0115] The relative coordinate obtaining unit is used to obtain the relative coordinates of the intersection point based on the ray direction, the ray length and the vertex coordinates.
[0116] Furthermore, the relative coordinate obtaining unit includes:
[0117] A relative distance obtaining subunit, used for obtaining the relative distance between the vertex of the intersecting layer and the intersection point based on the ray direction, the ray length and the vertex coordinates;
[0118] A relative coordinate obtaining unit is used to obtain the relative coordinates of the intersection point based on the relative distance and the vertex coordinates.
[0119] Furthermore, the first target layer obtaining module 301 includes:
[0120] A second target layer generating unit, configured to generate a second target layer based on at least one of the two-dimensional layers;
[0121] The target layer conversion unit is used to convert the second target layer into a layer in a three-dimensional space as the first target layer based on the conversion matrix.
[0122] Furthermore, the coordinate mapping device 300 of the three-dimensional object interaction point further includes:
[0123] The layer coordinate recording module is used to record the layer coordinates of each of the two-dimensional layers so as to obtain the layer coordinates of the intersecting layers when determining the intersecting layers.
[0124] Furthermore, the coordinate mapping device 300 of the three-dimensional object interaction point further includes:
[0125] The prompt information generating module is used to generate prompt information based on the direction of the ray and the layer corresponding to the interaction point to be mapped when the intersection result is that there is no intersection, so as to remind the user that the ray and the layer corresponding to the interaction point to be mapped do not intersect.
[0126] It should be noted that those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working process of the above-described device and each module can refer to the corresponding process in the aforementioned method embodiment, and will not be repeated here.
[0127] The above-mentioned device can be implemented in the form of a computer program. Figure 6 Runs on the computer device shown.
[0128] See also Figure 6 , Figure 6 1 is a schematic block diagram of a computer device provided in an embodiment of the present application. The computer device may be a server or a smart wearable device.
[0129] See also Figure 6 The computer device includes a processor, a memory and a network interface connected through a system bus, wherein the memory may include a non-volatile storage medium and an internal memory.
[0130] The non-volatile storage medium can store an operating system and a computer program. The computer program includes program instructions, and when the program instructions are executed, the processor can execute any coordinate mapping method of the interaction point of a three-dimensional object.
[0131] The processor is used to provide computing and control capabilities and support the operation of the entire computer equipment.
[0132] The internal memory provides an environment for the operation of the computer program in the non-volatile storage medium. When the computer program is executed by the processor, the processor can execute any coordinate mapping method of the interaction point of the three-dimensional object.
[0133] The network interface is used for network communication, such as sending assigned tasks, etc. Those skilled in the art will understand that Figure 6 The structure shown in the figure is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.
[0134] It should be understood that the processor may be a central processing unit (CPU), and the processor may also be other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. Among them, the general-purpose processor may be a microprocessor or the processor may also be any conventional processor, etc.
[0135] In one embodiment, the processor is used to run a computer program stored in the memory to implement the following steps:
[0136] Acquire at least one two-dimensional layer of a three-dimensional object and an interaction point to be mapped on the three-dimensional object, and obtain a first target layer in the three-dimensional space based on a preset transformation matrix and the two-dimensional layer;
[0137] Intersecting the first target layer based on a preset ray to obtain an intersection result;
[0138] When the intersection result indicates that there is an intersection point, based on the intersection result, determining the layer where the intersection point is located in the first target layer as the intersection layer, and obtaining the relative coordinates of the intersection point relative to the intersection layer;
[0139] Based on the relative coordinates and the layer coordinates of the intersecting layers, the mapping coordinates of the to-be-mapped interaction point are obtained.
[0140] In one embodiment, before the processor intersects the first target layer based on a preset ray and obtains an intersection result, it is further configured to implement:
[0141] Determining a ray direction based on a position of the to-be-mapped interaction point in the first target layer;
[0142] The ray is generated based on the ray starting point and the ray direction.
[0143] In one embodiment, when the intersection result is that there is an intersection point, the processor determines, based on the intersection result, a layer where the intersection point is located in the first target layer as an intersection layer, and obtains the relative coordinates of the intersection point relative to the intersection layer, to implement:
[0144] Based on the intersection result, determine the intersection point, and determine the layer where the intersection point is located in the first target layer as the intersection layer;
[0145] Obtaining the distance between the starting point of the ray and the intersection point as the ray length;
[0146] Obtaining the vertex coordinates of the intersecting layers;
[0147] Based on the ray direction, the ray length and the vertex coordinates, the relative coordinates of the intersection point are obtained.
[0148] In one embodiment, when the processor obtains the relative coordinates of the intersection point based on the ray direction, the ray length, and the vertex coordinates, the processor is used to implement:
[0149] Based on the ray direction, the ray length and the vertex coordinates, obtaining the relative distance between the vertex of the intersecting layer and the intersection point;
[0150] Based on the relative distance and the vertex coordinates, the relative coordinates of the intersection point are obtained.
[0151] In one embodiment, when the processor obtains the first target layer in the three-dimensional space based on the preset conversion matrix and the two-dimensional layer, it is used to implement:
[0152] Based on at least one of the two-dimensional layers, generating a second target layer;
[0153] Based on the conversion matrix, the second target layer is converted into a layer in a three-dimensional space as the first target layer.
[0154] In one embodiment, after acquiring at least one two-dimensional layer of the three-dimensional object, the processor is further configured to:
[0155] The layer coordinates of each of the two-dimensional layers are recorded so as to obtain the layer coordinates of the intersecting layers when determining the intersecting layers.
[0156] In one embodiment, after the processor intersects the first target layer based on a preset ray and obtains an intersection result, the processor is further configured to implement:
[0157] When the intersection result is that there is no intersection, prompt information is generated based on the direction of the ray and the layer corresponding to the to-be-mapped interaction point to remind the user that the ray and the layer corresponding to the to-be-mapped interaction point do not intersect.
[0158] A computer-readable storage medium is also provided in an embodiment of the present application, wherein the computer-readable storage medium stores a computer program, wherein the computer program includes program instructions, and the processor executes the program instructions to implement any coordinate mapping method of a three-dimensional object interaction point provided in an embodiment of the present application.
[0159] The computer-readable storage medium may be an internal storage unit of the computer device described in the foregoing embodiment, such as a hard disk or memory of the computer device. The computer-readable storage medium may also be an external storage device of the computer device, such as a plug-in hard disk, a smart memory card (SmartMedia Card, SMC), a secure digital (Secure Digital, SD) card, a flash card (Flash Card), etc., equipped on the computer device.
[0160] The above is only a specific implementation of the present application, but the protection scope of the present application is not limited thereto. Any technician familiar with the technical field can easily think of various equivalent modifications or replacements within the technical scope disclosed in the present application, and these modifications or replacements should be included in the protection scope of the present application. Therefore, the protection scope of the present application shall be based on the protection scope of the claims.
Claims
1. A coordinate mapping method for interaction points of three-dimensional objects, It is characterized in that include: Acquire at least one two-dimensional layer of a three-dimensional object and an interaction point to be mapped on the three-dimensional object, and obtain a first target layer in the three-dimensional space based on a preset transformation matrix and the two-dimensional layer; Intersecting the first target layer based on a preset ray to obtain an intersection result; When the intersection result indicates that there is an intersection point, based on the intersection result, determining the layer where the intersection point is located in the first target layer as the intersection layer, and obtaining the relative coordinates of the intersection point relative to the intersection layer; Based on the relative coordinates and the layer coordinates of the intersecting layers, the mapping coordinates of the to-be-mapped interaction point are obtained.
2. The coordinate mapping method of the interaction point of a three-dimensional object according to claim 1, It is characterized in that Before the intersecting of the preset ray with the first target layer and obtaining the intersection result, the method further includes: Determining a ray direction based on a position of the to-be-mapped interaction point in the first target layer; The ray is generated based on the ray starting point and the ray direction.
3. The coordinate mapping method of the interaction point of a three-dimensional object according to claim 1, It is characterized in that When the intersection result indicates that there is an intersection point, based on the intersection result, determining the layer where the intersection point is located in the first target layer as the intersection layer, and obtaining the relative coordinates of the intersection point relative to the intersection layer, including: Based on the intersection result, determine the intersection point, and determine the layer where the intersection point is located in the first target layer as the intersection layer; Obtaining the distance between the starting point of the ray and the intersection point as the ray length; Obtaining the vertex coordinates of the intersecting layers; Based on the ray direction, the ray length and the vertex coordinates, the relative coordinates of the intersection point are obtained.
4. The coordinate mapping method of the interaction point of a three-dimensional object according to claim 3, It is characterized in that The obtaining the relative coordinates of the intersection point based on the ray direction, the ray length and the vertex coordinates includes: Based on the ray direction, the ray length and the vertex coordinates, obtaining the relative distance between the vertex of the intersecting layer and the intersection point; Based on the relative distance and the vertex coordinates, the relative coordinates of the intersection point are obtained.
5. The coordinate mapping method of the interaction point of a three-dimensional object according to claim 1, It is characterized in that The step of obtaining a first target layer in a three-dimensional space based on a preset conversion matrix and the two-dimensional layer includes: Based on at least one of the two-dimensional layers, generating a second target layer; Based on the conversion matrix, the second target layer is converted into a layer in a three-dimensional space as the first target layer.
6. The coordinate mapping method of the interaction point of a three-dimensional object according to claim 1, It is characterized in that After obtaining at least one two-dimensional layer of the three-dimensional object, the method further includes: The layer coordinates of each of the two-dimensional layers are recorded so as to obtain the layer coordinates of the intersecting layers when determining the intersecting layers.
7. The coordinate mapping method of the interaction point of a three-dimensional object according to any one of claims 1 to 6, It is characterized in that After the preset ray intersects with the first target layer and obtains the intersection result, the method further includes: When the intersection result is that there is no intersection, prompt information is generated based on the direction of the ray and the layer corresponding to the to-be-mapped interaction point to remind the user that the ray and the layer corresponding to the to-be-mapped interaction point do not intersect.
8. A coordinate mapping device for interaction points of a three-dimensional object, It is characterized in that include: A first target layer acquisition module, used to acquire at least one two-dimensional layer of a three-dimensional object and an interaction point to be mapped on the three-dimensional object, and acquire a first target layer in a three-dimensional space based on a preset conversion matrix and the two-dimensional layer; An intersection result obtaining module, used for intersecting the first target layer based on a preset ray to obtain an intersection result; A relative coordinate acquisition module, used for, when the intersection result indicates that there is an intersection point, determining, based on the intersection result, a layer where the intersection point is located in the first target layer as an intersection layer, and obtaining the relative coordinates of the intersection point relative to the intersection layer; The mapping coordinate obtaining module is used to obtain the mapping coordinates of the to-be-mapped interaction point based on the relative coordinates and the layer coordinates of the intersecting layers.
9. A computer device, It is characterized in that The computer device includes a memory and a processor; The memory is used to store computer programs; The processor is used to execute the computer program and implement the coordinate mapping method of the three-dimensional object interaction point as described in any one of claims 1 to 7 when executing the computer program.
10. A computer-readable storage medium, It is characterized in that The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the processor implements the coordinate mapping method of the three-dimensional object interaction point according to any one of claims 1 to 7.