A three-dimensional display method, an electronic device, and a storage medium
By dividing the 3D scene in Three.js into sub-regions and using intersection operations to identify occupied areas, the display conflict between 3D and 2D objects is resolved, improving display efficiency and user experience.
Patent Information
- Application Number
- CN202510901745.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-07-01
- Publication Date
- 2026-02-10
- Estimated Expiration
- 2045-07-01
AI Technical Summary
In Three.js 3D scenes, display conflicts between 3D and 2D objects affect the content display effect, and existing technologies have difficulty quickly identifying and resolving display conflict areas.
By dividing the two-dimensional display plane into multiple sub-regions, projection transformation is used to determine the images of three-dimensional and two-dimensional objects. Intersection operation is then used to quickly identify occupied sub-regions and move the display position of the two-dimensional objects to resolve display conflicts.
It improves the efficiency of identifying and resolving display conflicts, and enhances the content display effect and user experience of 3D scenes.
Smart Images

Figure CN121010742B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the technical field of three-dimensional object display, and more particularly to a three-dimensional display method, related apparatus, electronic device, and storage medium. Background Technology
[0002] Three.js is a WebGL-based JavaScript 3D engine used to create and display 3D graphics content in a browser. In a Three.js 3D scene, in addition to displaying 3D objects, there are also 2D objects that need to be displayed. These 2D objects can be text labels or flat icons.
[0003] In a Three.js 3D scene, users can adjust the different perspectives of displayed objects (e.g., a horizontal 360-degree angle or a vertical 180-degree tilt angle) and the size of displayed objects (e.g., the distance of the viewpoint). Changes in the viewpoint will alter the perspective relationships of various displayed objects, affecting their relative positions on the display interface. This may cause some 3D objects to be occluded by 2D objects, impacting the content display effect in the Three.js 3D scene. Summary of the Invention
[0004] Based on the above situation, the main objective of this invention is to provide a three-dimensional display method, related device, electronic device, and storage medium that can quickly identify display conflict areas between three-dimensional and two-dimensional objects and resolve display conflict problems.
[0005] To achieve the above objectives, the technical solution adopted by the present invention is as follows:
[0006] The first aspect of this invention provides a three-dimensional display method, comprising:
[0007] S1. Obtain the two-dimensional display plane of the display object under the target viewpoint. The two-dimensional display plane includes multiple sub-regions. In the initial state, all of the multiple sub-regions are marked as unoccupied sub-regions. The display object includes three-dimensional objects and two-dimensional objects.
[0008] S3. Determine the first image of the three-dimensional object projected onto the two-dimensional display plane, perform an intersection operation on the first image and the plurality of sub-regions, and update the sub-regions with intersection relationships to occupied sub-regions;
[0009] S5. Determine the second image projected from the two-dimensional object onto the two-dimensional display plane, and determine the display area range to be occupied by the second image on the two-dimensional display plane;
[0010] S7. In response to the overlap between the display area and the occupied sub-area, the first image is kept unchanged, while the display position of the second image on the two-dimensional display plane is moved to the unoccupied sub-area.
[0011] Optionally, the three-dimensional object includes: a three-dimensional point object; in step S3, for any one of the three-dimensional point objects, determining the first image projected onto the two-dimensional display plane includes: obtaining the bounding box of the three-dimensional point object, the bounding box including the coordinates of multiple corner points; performing a projection transformation on each corner point to obtain the pixel coordinates of the corner point on the two-dimensional display plane; and based on the pixel coordinates of each corner point, obtaining the minimum rectangle of the three-dimensional point object on the two-dimensional display plane, and using the minimum rectangle as the first image.
[0012] Optionally, the three-dimensional object includes a three-dimensional linear object; in step S3, for any one of the three-dimensional linear objects, determining the first image projected onto the two-dimensional display plane includes: acquiring multiple vertices of the three-dimensional linear object; performing a projection transformation on each vertex to obtain the pixel coordinates of the vertex on the two-dimensional display plane; constructing a strip-shaped region of the three-dimensional linear object on the two-dimensional display plane based on the pixel coordinates of each vertex and a preset offset value; and constructing a minimum convex polygon containing the strip-shaped region based on the pixel coordinates corresponding to the strip-shaped region, using the minimum convex polygon as the first image.
[0013] Optionally, in step S5, determining the display area range to be occupied by the second image on the two-dimensional display plane includes: obtaining the smallest rectangular area containing the second image, and using the smallest rectangular area as the display area range to be occupied.
[0014] Optionally, before step S7, the method further includes:
[0015] Obtain the visual distance between each of the second images and the target viewpoint, and set the priority of each of the second images based on the visual distance; wherein the visual distance is perpendicular to the two-dimensional display plane, and the visual distance is negatively correlated with the priority.
[0016] Optionally, step S7 further includes: setting the display position of the second image on the two-dimensional display plane in sequence based on the priority of each second image; wherein, after the display position of any second image is reset, the sub-region where the corresponding pixel of the reset second image is located will be marked as an occupied sub-region; and when the remaining unoccupied sub-region is insufficient to accommodate the current second image, the current second image is abandoned from being displayed, and the second image with a lower priority than the current second image is abandoned from being displayed.
[0017] Optionally, the two-dimensional object is the annotation information of the three-dimensional object, wherein each two-dimensional object is associated with the ID information of its corresponding three-dimensional object.
[0018] Optionally, in step S7, for any of the second images, moving the display position of the second image on the two-dimensional display plane to the unoccupied sub-region includes:
[0019] S701. Based on the ID information associated with the current second image, find the occupied sub-region of the first image corresponding to the current second image, and use it as the target occupied sub-region;
[0020] S702. Obtain the coordinates of the center point of the target occupied sub-region, and the current offset;
[0021] S703. Based on the current offset and the center point coordinates, determine the search range of the current second image. Within the search range, sequentially search the circumferential direction of the target occupied sub-region for an unoccupied sub-region that can accommodate the current second image. If an unoccupied sub-region that can accommodate the current second image is found, move the current second image to the unoccupied sub-region and stop searching. If no unoccupied sub-region that can accommodate the second image is found within the search range, proceed to step S704.
[0022] S704. Add a preset value to the current offset to update the current offset; if the updated current offset is greater than or equal to the preset extreme value, stop searching and abandon displaying the current second image; if the updated current offset is less than the preset extreme value, return to step S703.
[0023] The second aspect of the present invention provides a computer program stored thereon, which, when executed by a processor, implements the three-dimensional display method of the first aspect described above.
[0024] A third aspect of the present invention provides an electronic device including a storage medium storing a computer program, which, when executed by a processor, implements the three-dimensional display method of the first aspect described above.
[0025] In the three-dimensional display method of the present invention, the two-dimensional display plane is pre-divided into multiple sub-regions, each sub-region including a*b pixels (a and b are generally integers greater than 10), and marked with whether it is occupied or not. When displaying the object, the first image of the three-dimensional object projected onto the two-dimensional display plane is first determined. The first image is intersected with multiple sub-regions, and the sub-regions with intersecting relationships can be quickly identified as occupied sub-regions. Then, the display area range to be occupied by the two-dimensional object is determined. If the display area range overlaps with the occupied sub-region, it means that there is a display conflict between the current three-dimensional object and the two-dimensional object. The display position of the second image on the two-dimensional display plane can be moved to an unoccupied sub-region, thereby resolving the display conflict problem. In addition, compared with the traditional method of identifying whether it is occupied pixel by pixel, the present invention pre-defines multiple sub-regions and quickly identifies the occupied sub-regions by intersecting the first image with multiple sub-regions, thereby improving the effect of resolving the display conflict problem.
[0026] Other beneficial effects of the present invention will be explained in detail through the introduction of specific technical features and technical solutions in specific embodiments. Those skilled in the art should be able to understand the beneficial technical effects brought about by these technical features and technical solutions through the introduction of these technical features and technical solutions. Attached Figure Description
[0027] Preferred embodiments of the present invention will now be described with reference to the accompanying drawings. In the drawings:
[0028] Figure 1 This diagram illustrates a flowchart of a three-dimensional display method according to an embodiment of the present invention.
[0029] Figure 2 This diagram illustrates the imaging of a three-dimensional object on a two-dimensional display plane from a viewpoint in an embodiment of the present invention.
[0030] Figure 3 This is a schematic diagram of a display scenario in an embodiment of the present invention;
[0031] Figure 4 This illustrates a flowchart of the projection of a three-dimensional point object onto a two-dimensional display plane in an embodiment of the present invention;
[0032] Figure 5 This illustrates a flowchart of the projection of a three-dimensional linear object onto a two-dimensional display plane in an embodiment of the present invention;
[0033] Figure 6 This diagram illustrates another display scenario in an embodiment of the present invention.
[0034] Figure 7 This diagram illustrates the first image corresponding to a three-dimensional linear object determined using the minimum rectangle.
[0035] Figure 8 This illustrates another flowchart of the three-dimensional display method in an embodiment of the present invention;
[0036] Figure 9 This diagram illustrates a flowchart of a two-dimensional object reset method in an embodiment of the present invention.
[0037] Figure 10 This diagram illustrates the sub-region occupancy situation in an embodiment of the present invention.
[0038] Figure 11 A schematic diagram of the structure of an electronic device in an embodiment of the present invention is shown. Detailed Implementation
[0039] The present invention is described below based on embodiments, but the present invention is not limited to these embodiments. In the following detailed description of the present invention, some specific details are described in detail, but well-known methods, processes, procedures, and elements are not described in detail in order to avoid obscuring the essence of the present invention.
[0040] Furthermore, those skilled in the art should understand that the accompanying drawings provided herein are for illustrative purposes only and are not necessarily drawn to scale.
[0041] Unless the context explicitly requires it, the words "comprising," "including," and similar terms throughout the specification and claims should be interpreted as encompassing rather than being exclusive or exhaustive; that is, meaning "including but not limited to."
[0042] In the description of this invention, it should be understood that the terms "first," "second," etc., are used for descriptive purposes only and should not be construed as indicating or implying relative importance. Furthermore, in the description of this invention, unless otherwise stated, "a plurality of" means two or more.
[0043] The specific embodiments of the present invention will now be described in detail with reference to the accompanying drawings.
[0044] As described above, in a 3D scene display interface, users can adjust the viewpoint and size of displayed objects. This adjustment alters the perspective relationships of various displayed objects, which may cause some 3D objects to be occluded by 2D objects, affecting the content display effect in the 3D scene. In view of this, embodiments of the present invention provide a 3D display method that can quickly identify display conflict areas between 3D and 2D objects and resolve the display conflict problem.
[0045] Please see Figure 1 , Figure 1This diagram illustrates a flowchart of a three-dimensional display method according to an embodiment of the present invention. The present invention provides a three-dimensional display method comprising steps S1, S3, S5, and S7.
[0046] S1. Obtain the two-dimensional display plane of the display object from the target viewpoint.
[0047] The two-dimensional display plane comprises multiple sub-regions, each marked with its current usage status: occupied or unoccupied. Initially, all sub-regions are marked as unoccupied. In this embodiment, the two-dimensional display plane is pre-divided into N*M grid regions (i.e., sub-regions), where N and M are both integers greater than 2, and N can be equal to M. The size of a sub-region can be determined based on the size of the displayed object. For example, assuming the two-dimensional object is a text annotation, the number of pixels contained in a sub-region can be determined based on the font size and average number of characters of the text annotation (e.g., 45*35), so that a sub-region can roughly accommodate a text annotation, facilitating the rapid re-determination of the text annotation's display position (i.e., in which sub-region the text annotation corresponding to the three-dimensional object is displayed).
[0048] Regarding the displayed objects, these include three-dimensional objects and two-dimensional objects. For example, in this embodiment of the invention, the display scene where the displayed objects reside can be a Three.js three-dimensional scene. The three-dimensional objects can be three-dimensional models within the Three.js scene, and the two-dimensional objects can be text annotations or flat icons within the Three.js scene. If a two-dimensional object is a text annotation, then that two-dimensional object is associated with the three-dimensional object it annotates.
[0049] Regarding the target viewpoint, in the 3D scene display interface, the user can adjust the different perspectives and sizes of the displayed objects. The computer can generate a viewpoint (i.e., a virtual visual starting point) based on the user's adjustments. In this embodiment of the invention, the user-adjusted current viewpoint is referred to as the target viewpoint. For example, see [link to relevant documentation]. Figure 2 , Figure 2 This diagram illustrates the imaging of a three-dimensional object on a two-dimensional display plane from a viewpoint in an embodiment of the present invention.
[0050] Regarding two-dimensional display planes, such as Figure 2As shown, the two-dimensional display plane specifically refers to the user display interface on which a display object (including a three-dimensional object) is projected onto the two-dimensional plane from the target viewpoint. In this embodiment of the invention, the target viewpoint includes two changing dimensions: viewing angle and viewing distance. The viewing angle determines the direction of the viewpoint relative to the display object, and the viewing distance determines the virtual distance of the viewpoint relative to the display object. When the viewing angle of the target viewpoint changes, the two-dimensional display plane also changes. When the viewing distance of the target viewpoint changes, the two-dimensional display plane may remain unchanged, only affecting the display size of the display object on the two-dimensional display plane.
[0051] S3. Determine the first image of the three-dimensional object projected onto the two-dimensional display plane, perform intersection operations on the first image and multiple sub-regions, and update the sub-regions with intersection relationships to occupied sub-regions.
[0052] For example, see Figure 2 Once the target viewpoint is determined, the two-dimensional display plane can also be determined. Projection transformation can be used to map the three-dimensional object located in three-dimensional space onto the planar coordinate system of the two-dimensional display plane, obtaining the first image. In other words, this first image is the display image of the three-dimensional object on the two-dimensional display plane. Specifically, the geometric image projected onto the two-dimensional display plane (i.e., the first image) can be defined as a "surface object" in the programming algorithm. The sub-regions divided in this embodiment also belong to "surface objects." Two "surface objects" can directly perform intersection operations, quickly determining the occupied sub-regions without needing to identify whether each pixel is occupied.
[0053] S5. Determine the second image projected onto the two-dimensional display plane from the two-dimensional object, and determine the display area range to be occupied by the second image on the two-dimensional display plane.
[0054] Specifically, since two-dimensional objects need to face the two-dimensional display plane by default, projecting a two-dimensional object onto the two-dimensional display plane can be done as follows: scaling the two-dimensional object based on the target viewpoint to adjust its size; and adjusting the orientation of the two-dimensional object based on the target viewpoint to make it parallel to the two-dimensional display plane. Each vertex of the polygon formed by the scaled two-dimensional object is then projected onto the two-dimensional display plane to obtain the second image. After obtaining the second image, the smallest rectangular area containing the second image is obtained. The second image is not rendered immediately; this smallest rectangular area is used as the display area to be occupied, so as to facilitate subsequent determination of whether there is a display conflict with the occupied sub-area.
[0055] S7. In response to the overlap between the display area and the occupied sub-area, the display position of the second image on the two-dimensional display plane is moved to the unoccupied sub-area.
[0056] After determining the display area range to be occupied by the second image on the two-dimensional display plane, the display area range is compared with all currently occupied sub-regions. If the display area range overlaps with the occupied sub-regions, the display position of the first image is kept unchanged, and the display position of the second image on the two-dimensional display plane is moved to the unoccupied sub-region.
[0057] In this embodiment of the invention, the two-dimensional display plane is pre-divided into multiple sub-regions, each sub-region including a*b pixels (a and b are generally integers greater than 10), and marked with whether it is occupied or not. When displaying the object, the first image of the three-dimensional object projected onto the two-dimensional display plane is first determined. The first image is then intersected with the multiple sub-regions to quickly identify the intersecting sub-regions as occupied sub-regions. Then, the display area range to be occupied by the two-dimensional object is determined. If the display area range overlaps with the occupied sub-region, it means that there is a display conflict between the current three-dimensional object and the two-dimensional object. The display position of the second image on the two-dimensional display plane can be moved to an unoccupied sub-region to resolve the display conflict problem. In addition, compared with the traditional method of identifying whether it is occupied pixel by pixel, this invention pre-defines multiple sub-regions and quickly identifies the occupied sub-regions by intersecting the first image with the multiple sub-regions, thereby improving the effectiveness of resolving the display conflict problem.
[0058] In practical applications, 3D objects include 3D point objects and 3D line objects. In a 3D scene, if an object is complex (e.g., a house, a tower, a car), a separate 3D model is typically created for that object and then loaded into a specific location within the 3D scene for display. This type of 3D model is called a 3D point object. During display, a point position (point coordinates) and orientation (rotation direction) are given within the 3D scene to load and reuse the 3D point object. When this 3D point object is reused multiple times within the 3D scene, the runtime efficiency is higher. For example, see [link to relevant documentation]. Figure 3 The pole model in the figure is a three-dimensional point object. Figure 3 The example is used repeatedly. In this embodiment of the invention, a three-dimensional line object refers to a three-dimensional line model generated based on the connection of at least two point coordinates. For example, see also... Figure 3 The cable model in the figure is a three-dimensional line object. The methods for determining the first image based on three-dimensional point objects and three-dimensional line objects in this embodiment of the invention are described below:
[0059] Please see Figure 4 , Figure 4This diagram illustrates a flowchart of the projection of a three-dimensional point object onto a two-dimensional display plane in an embodiment of the present invention. In step S3, for the three-dimensional point object, a first image can be determined by the following methods, including steps S311, S312, S313, S314, and S315.
[0060] S311. Construct a view frustum space based on the target viewpoint to obtain a collection of three-dimensional point objects that are wholly or partially located within the view frustum space.
[0061] For example, the view frustum space can be referred to Figure 2 The view frustum space can be defined by six faces (top, bottom, left, right, far, and near faces as shown in the figure). By traversing all 3D point objects, if a 3D point object, in whole or in part, lies within the view frustum space, it means that the 3D point object needs to be displayed on the 2D display plane, and thus the 3D point object is added to the set of 3D point objects. Specifically, the six faces of the view frustum space can be determined based on a target matrix, where the target matrix = camera projection matrix * coordinate transformation matrix. The camera projection matrix is used to determine the camera's viewing angle and field of view, and the coordinate transformation matrix is used to convert world coordinates to coordinates on the camera's imaging interface.
[0062] It should be noted that the camera in this embodiment of the invention is a virtual concept. Specifically, it is assumed that there is a camera located at the target viewpoint to take pictures, and the picture captured by the camera can be regarded as the content that the two-dimensional display plane needs to display.
[0063] S312. Obtain any unprocessed 3D point object from the set of 3D point objects, and determine the bounding box of the 3D point object.
[0064] The bounding box of a 3D point object includes the coordinates of multiple corner points. Specifically, the bounding box is a geometric hexahedron, and the coordinates of the eight vertices of this hexahedron are the coordinates of the multiple corner points of the bounding box.
[0065] S313. Perform projection transformation on each corner point to obtain the pixel coordinates of the corner point on the two-dimensional display plane.
[0066] Specifically, the corner coordinates can be converted from three-dimensional spatial coordinates to two-dimensional planar coordinates, thus obtaining the pixel coordinates of the corner on the two-dimensional display plane.
[0067] S314. Based on the pixel coordinates of each corner point, obtain the smallest rectangle of the three-dimensional point object on the two-dimensional display plane, and use this smallest rectangle as the first image.
[0068] Specifically, after obtaining the pixel coordinates of each corner point, lines can be drawn connecting each corner point to obtain a graphic range. Using this graphic range as a reference, a minimum rectangle that can encompass the entire graphic range is determined. This minimum rectangle can then serve as the first image corresponding to the 3D point object. For example, see [reference needed]. Figure 6 , Figure 6 The rectangle corresponding to the utility pole is the smallest rectangle of the three-dimensional point object on the two-dimensional display plane.
[0069] S315. Determine whether there are any unprocessed 3D point objects in the current collection of 3D point objects.
[0070] If so, return to step S312.
[0071] If not, then terminate the current process of determining the first image.
[0072] Please see Figure 5 , Figure 5 This diagram illustrates a flowchart of the projection of a three-dimensional linear object onto a two-dimensional display plane in an embodiment of the present invention. In step S3, for the three-dimensional linear object, a first image can be determined by the following methods, including steps S321, S322, S323, S324, S325, and S326.
[0073] S321. Construct a view frustum space based on the target viewpoint to obtain a collection of three-dimensional linear objects that are wholly or partially located within the view frustum space.
[0074] Specifically, the construction of the view frustum space can be found in step S311 above, and will not be repeated here. After determining the view frustum space, all three-dimensional line objects are traversed. If a three-dimensional line object is wholly or partially located within the view frustum space, it means that the three-dimensional line object needs to be displayed in the two-dimensional display plane, and then the three-dimensional line object is added to the set of three-dimensional line objects.
[0075] It is understandable that the construction of the view frustum space in steps S311 and S321 only needs to be performed once in actual applications. That is to say, if the construction of the view frustum space has been performed before determining the first image based on the three-dimensional point object or the three-dimensional line object, the view frustum space can be used directly without repeating the operation.
[0076] S322. Obtain any unprocessed 3D line object from the set of 3D line objects, and determine multiple vertices of the 3D line object.
[0077] Specifically, in practical applications, multiple vertices of a three-dimensional linear object can be represented by a vertex coordinate string. For example, in this one-dimensional array (3, 2, 6, 2, 7, 8, 3, 6, 9), since the three-dimensional linear object is located in three-dimensional space, each vertex corresponds to three coordinate values (x, y, z). Since there are 9 values in this one-dimensional array, it can be determined that the three-dimensional linear object has three vertices, namely (3, 2, 6), (2, 7, 8), and (3, 6, 9).
[0078] S323. Perform a projection transformation on each vertex to obtain the pixel coordinates of the vertex on the two-dimensional display plane.
[0079] Specifically, vertex coordinates can be converted from three-dimensional spatial coordinates to two-dimensional planar coordinates, thus obtaining the pixel coordinates of the vertex on the two-dimensional display plane.
[0080] S324. Based on the pixel coordinates of each vertex and the preset offset value, construct a strip-shaped area of the three-dimensional linear object on the two-dimensional display plane.
[0081] In practical applications, because three-dimensional linear objects appear as linear patterns on a two-dimensional display plane, and the width of these patterns is relatively narrow, it is not convenient to determine the sub-regions occupied by the three-dimensional linear objects on the two-dimensional display plane. Therefore, this embodiment of the invention expands the linear pattern into a strip-shaped region. The strip-shaped region can construct a surface object, and then the occupied sub-region can be quickly determined through the intersection operation between the surface object and the sub-region. Specifically, the original linear pattern can be used as the center, and a preset offset value can be extended to the left and right sides of the linear pattern to form a strip-shaped region.
[0082] S325. Based on the pixel coordinates corresponding to the strip region, construct the smallest convex polygon containing the strip region, and use the smallest convex polygon as the first image.
[0083] For example, see Figure 6 , Figure 6 The frame corresponding to the cable in the middle is the smallest convex polygon of the three-dimensional linear object on the two-dimensional display plane. Unlike three-dimensional point objects, the smallest convex polygon is used as the first image in step 325. This minimizes the number of pixels corresponding to non-three-dimensional objects within the first image, avoiding unnecessary occupation of sub-regions and improving the utilization rate of display space within the two-dimensional display plane. (See also...) Figure 7 , Figure 7 This diagram illustrates the first image corresponding to a 3D linear object determined using a minimum rectangle. Figure 6 and Figure 7 As can be seen from the range defined by the cables, if the first image corresponding to the three-dimensional linear object is determined by the smallest rectangle, it will cause a lot of unnecessary occupancy in the sub-region.
[0084] S326. Determine whether there are any unprocessed 3D line objects in the current collection of 3D line objects.
[0085] If so, return to step S322.
[0086] If not, then terminate the current process of determining the first image.
[0087] In 3D display scenarios, timely image rendering is often required in response to user actions on the display interface. Therefore, the demand for data processing efficiency is extremely high. Traditional methods for identifying whether a display area is occupied typically require traversing each pixel of the display object one by one. In high-resolution display scenarios, this occupancy identification process is time-consuming, causing significant delays in image display and impacting user experience. However, in this embodiment of the invention, whether constructing a minimum rectangle for a 3D point object or a minimum convex polygon for a 3D line object, the polygonal region projected onto the 2D display plane (i.e., the region corresponding to the minimum rectangle or minimum convex polygon) can be processed as a face object (i.e., converting multiple pixels of the original image into a unified face). Subsequently, only intersection operations need to be performed between the polygonal region and sub-regions in the 2D display plane, marking the intersecting sub-regions as occupied sub-regions. This quickly completes occupancy identification, improving image rendering efficiency.
[0088] In practical applications, besides two-dimensional objects occluding three-dimensional objects, two-dimensional objects can also occlude each other. This invention provides corresponding solutions; please refer to [link / reference]. Figure 8 , Figure 8 Another flowchart of the three-dimensional display method in an embodiment of the present invention is shown. The present invention provides a three-dimensional display method, which includes steps S1, S3, S5, S6, and S7.
[0089] S1. Obtain the two-dimensional display plane of the display object from the target viewpoint.
[0090] S3. Determine the first image of the three-dimensional object projected onto the two-dimensional display plane, perform intersection operations on the first image and multiple sub-regions, and update the sub-regions with intersection relationships to occupied sub-regions.
[0091] S5. Determine the second image projected onto the two-dimensional display plane from the two-dimensional object, and determine the display area range to be occupied by the second image on the two-dimensional display plane.
[0092] It should be noted that steps S1, S3, and S5 in this embodiment are the same as those in the above embodiment, and will not be repeated here.
[0093] S6. Obtain the visual distance between each second image and the target viewpoint, and set the priority of each second image based on the visual distance.
[0094] Specifically, the visual distance is perpendicular to the two-dimensional display plane. Furthermore, the visual distance is negatively correlated with priority; that is, the closer the visual distance, the higher the priority, and the farther the visual distance, the lower the priority. It should be noted that the step of determining the priority of the second image does not necessarily have to be set after step S5; it only needs to be completed before executing step S7. The implementation of step S6 in this embodiment is merely one example.
[0095] S7. In response to the overlap between the display area and the occupied sub-area, the display position of the second image on the two-dimensional display plane is moved to the unoccupied sub-area.
[0096] During the process of resetting the display position of the second image, the display positions of the second images on the two-dimensional display plane can be set sequentially based on their priorities. Specifically, after determining the display area range to be occupied by the second image in step S5, the intersection operation of all the display areas to be occupied with the occupied sub-regions can be performed. The second images with intersection relationships are added to the set of display positions to be reset. Furthermore, in this set of display positions to be reset, the second images are sorted according to the priority determined in step S6, and the display positions of the second images on the two-dimensional display plane are reset sequentially according to the sorting result. After the display position of any second image is reset, the sub-region containing the corresponding pixel of the reset second image will be marked as an occupied sub-region. That is, subsequent reset second images must also avoid the previously reset second images. Further, when the remaining unoccupied sub-regions are insufficient to accommodate the current second image, the display of the current second image and second images with lower priority than the current second image are abandoned.
[0097] In practical applications, if a user primarily wants to view objects at a distance, they can adjust the viewing angle to convert the distant object into a near object. This indicates that a two-dimensional object at a distance has a lower viewing priority than a two-dimensional object at a near distance. Therefore, this embodiment of the invention sets the priority of the second image based on its visual distance, ensuring that the second image at a distance avoids the second image at a near distance (and can be abandoned altogether when display space is insufficient). This allows the display position of the second image to be tailored to the user's needs, improving the user experience.
[0098] In one embodiment of the present invention, the two-dimensional object is the annotation information of the three-dimensional object. In this case, the two-dimensional object needs to be placed near its associated three-dimensional object. The present invention provides a corresponding solution; please refer to [link / reference]. Figure 9 , Figure 9This diagram illustrates a flowchart of a two-dimensional object reset method according to an embodiment of the present invention. The present invention provides a two-dimensional object reset method, which includes steps S701, S702, S703, S704, and S705.
[0099] S701. Based on the ID information associated with the current second image, find the occupied sub-region of the first image corresponding to the current second image, and use it as the target occupied sub-region.
[0100] Since the two-dimensional objects in this embodiment of the invention are annotation information of three-dimensional objects, each two-dimensional object is associated with the ID information of its corresponding three-dimensional object.
[0101] S702. Obtain the coordinates of the center point of the target occupied sub-region, as well as the current offset.
[0102] For example, please refer to Figure 10 , Figure 10 This diagram illustrates the sub-region occupancy situation in an embodiment of the present invention. Specifically, a grid area in the diagram represents a sub-region in an embodiment of the present invention, and the red box indicates the display area to be occupied by the second image. The orange area, roughly in the middle of the image, is the target occupied sub-region, and the green dot represents the coordinates of the center point of this target occupied sub-region.
[0103] In this embodiment of the invention, the offset is used to constrain the distance between a two-dimensional object and its associated three-dimensional object. The initial offset can be set according to the target-occupied sub-region. For example, the center point is approximately one grid area away from the edge of the target-occupied sub-region. Assuming one grid area can accommodate a complete second image, the initial offset can be set to two grid areas. Subsequent offset updates increase the offset by one grid area from the previous one. That is, when initially searching for the reset position of the second image, the search is first performed within a range of one grid area from the target-occupied sub-region. If no reset space is found, the offset is increased, and the search is repeated.
[0104] It should be noted that, for ease of explanation, the embodiments of the present invention are described through... Figure 10 The grid area (i.e., sub-region) shown quantifies the distance information within the two-dimensional display plane (e.g., the offset increases by one grid area with each update). In practical applications, the distance information within the two-dimensional display plane can also be quantified by the number of specific pixels on the two-dimensional display plane (e.g., the offset increases by 40 pixels with each update). The distance quantization method in this embodiment should not be construed as the only implementation.
[0105] S703. Based on the offset and center point coordinates, determine the search range of the current second image, and search for an unoccupied sub-region that can accommodate the second image within the search range.
[0106] Specifically, the search is performed around the target occupied sub-region according to a preset search order (e.g., in the four directions of up, down, left, and right). The search is then performed around the target occupied sub-region to find an unoccupied sub-region that can accommodate the current second image. If an unoccupied sub-region that can accommodate the current second image is found, the current second image is moved to the unoccupied sub-region (i.e., the current second image is rendered in the unoccupied sub-region), and the search stops. If no display position that can accommodate the second image is found in any of the four directions, step S704 is executed.
[0107] For example, please refer to Figure 10 Once the search range for the reset position of the current second image is determined based on the center point coordinates and the current offset (e.g., the space within 4 grid areas from the center point), it is also necessary to exclude the grid areas that are already occupied within the current search range. The remaining unoccupied grid areas within the search range can be used as candidate unoccupied grid areas (as shown in the blue grid area in the figure).
[0108] S704. Add a preset value to the current offset to update the current offset.
[0109] Specifically, each update of the offset can add one grid area to the previous offset. For example, if the previous offset was 3 grid areas, the current offset will be 4 grid areas.
[0110] S705. Determine whether the updated offset is less than the preset extreme value.
[0111] Since the purpose of this embodiment of the invention is to reset the two-dimensional object in the vicinity of the three-dimensional object, a preset extreme value is set for the offset. That is, when the distance is greater than the preset extreme value, it is no longer in the vicinity of the three-dimensional object. Therefore, if the updated offset is greater than or equal to the preset extreme value, the search is stopped and the current second image is abandoned; if the updated offset is less than the preset extreme value, the process returns to step S703.
[0112] In this embodiment of the invention, by expanding the search range layer by layer with the target occupied sub-region as the center, the reset position of the two-dimensional object is found around the three-dimensional object, so as to place the two-dimensional object as close as possible to the three-dimensional object, so that the user can easily view the annotation information of the three-dimensional object.
[0113] The specific steps for implementing the above-described three-dimensional display method by the three-dimensional display device in this embodiment of the invention can be referred to the above method embodiments, and will not be repeated here.
[0114] Figure 11 A schematic diagram of the structure of an electronic device according to an embodiment of the present invention is shown. The electronic device includes a memory 1100 and a processor 1200.
[0115] The processor 1200 can be a Central Processing Unit (CPU), or other general-purpose processors, digital signal processors (DSPs), application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. The general-purpose processor can be a microprocessor or any conventional processor.
[0116] Memory 1100 may include various types of storage units, such as system memory, read-only memory (ROM), and permanent storage devices. ROM may store static data or instructions required by processor 1200 or other modules of the computer. Permanent storage devices may be read-write storage devices. Permanent storage devices may be non-volatile storage devices that retain stored instructions and data even when the computer is powered off. In some embodiments, permanent storage devices use mass storage devices (e.g., magnetic or optical disks, flash memory) as permanent storage devices. In other embodiments, permanent storage devices may be removable storage devices (e.g., floppy disks, optical drives). System memory may be a read-write storage device or a volatile read-write storage device, such as dynamic random access memory. System memory may store some or all of the instructions and data required by the processor during operation. Furthermore, memory 1100 may include any combination of computer-readable storage media, including various types of semiconductor memory chips (DRAM, SRAM, SDRAM, flash memory, programmable read-only memory), and disks and / or optical disks may also be used. In some embodiments, memory 1100 may include a removable storage device that is readable and / or writable, such as a laser disc (CD), a read-only digital multifunction optical disc (e.g., DVD-ROM, dual-layer DVD-ROM), a read-only Blu-ray disc, an ultra-high density optical disc, a flash memory card (e.g., SD card, mini SD card, Micro-SD card, etc.), a magnetic floppy disk, etc. Computer-readable storage media do not contain carrier waves or transient electronic signals transmitted wirelessly or via wired connections.
[0117] The memory 1100 stores executable code for executing the three-dimensional display method in the above method embodiment. When the executable code is processed by the processor 1200, the processor 1200 can execute part or all of the methods described above.
[0118] In addition, the present invention also provides a computer-readable storage medium, such as a chip or optical disc, on which an executable program is stored, which, when executed, implements the three-dimensional display method described above.
[0119] It should be noted that the computer-readable storage medium described in the embodiments of this disclosure is not limited to the embodiments given above. For example, it can also be an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination thereof. More specific examples of computer-readable storage media may include, but are not limited to: electrical connections having one or more wires, portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination thereof. In the embodiments of this disclosure, the computer-readable storage medium can be any tangible medium that contains or stores a program that can be used by or in conjunction with an instruction execution system, apparatus, or device.
[0120] It will be understood by those skilled in the art that the above-described preferred solutions can be freely combined and superimposed without conflict. The flowcharts and block diagrams in the accompanying drawings illustrate the architecture, functionality, and operation of possible implementations of systems, methods, and computer program products according to various embodiments of this disclosure. In this regard, each block in a flowchart or block diagram may represent a module, segment, or portion of code containing one or more executable instructions for implementing a specified logical function. It should also be noted that in some alternative implementations, the functions indicated in the blocks may occur in a different order than those indicated in the drawings; for example, two consecutively indicated blocks may actually be executed substantially in parallel, or sometimes in reverse order, depending on the functions involved. It should also be noted that each block in the block diagrams and / or flowcharts, and combinations of blocks in the block diagrams and / or flowcharts, can be implemented using a dedicated hardware-based system that performs the specified function or operation, or using a combination of dedicated hardware and computer instructions. The numbering of each step in this document is for ease of explanation and reference only and is not intended to limit the order of execution. The specific execution order is determined by the technology itself, and those skilled in the art can determine various permissible and reasonable orders based on the technology itself.
[0121] It should be noted that the use of step numbers (letters or numbers) to refer to certain specific method steps in this invention is merely for the purpose of convenience and brevity in description, and is by no means intended to restrict the order of these method steps. Those skilled in the art will understand that the order of the relevant method steps should be determined by the technology itself and should not be unduly restricted by the existence of step numbers. Those skilled in the art can determine various permissible and reasonable orderings of steps based on the technology itself.
[0122] Those skilled in the art will understand that, without conflict, the above-mentioned preferred solutions can be freely combined and superimposed.
[0123] It should be understood that the above embodiments are merely exemplary and not restrictive. Various obvious or equivalent modifications or substitutions that can be made by those skilled in the art regarding the above details without departing from the basic principles of the present invention will be included within the scope of the claims of the present invention.
Claims
1. A three-dimensional display method, characterized in that, include: S1. Obtain the two-dimensional display plane of the display object under the target viewpoint. The two-dimensional display plane includes multiple sub-regions. In the initial state, all of the multiple sub-regions are marked as unoccupied sub-regions. The display object includes three-dimensional objects and two-dimensional objects. S3. Determine the first image of the three-dimensional object projected onto the two-dimensional display plane, perform an intersection operation on the first image and the plurality of sub-regions, and update the sub-regions with intersection relationships to occupied sub-regions; S5. Determine the second image projected from the two-dimensional object onto the two-dimensional display plane, and determine the display area range to be occupied by the second image on the two-dimensional display plane; Prior to step S7, the visual distance between each of the second images and the target viewpoint is obtained, and the priority of each of the second images is set based on the visual distance; wherein, the visual distance is perpendicular to the two-dimensional display plane, and the visual distance is negatively correlated with the priority; S7. In response to the overlap between the display area and the occupied sub-region, the first image is kept unchanged, while the display position of the second image on the two-dimensional display plane is moved to the unoccupied sub-region; step S7 further includes: setting the display position of the second image on the two-dimensional display plane sequentially based on the priority of each second image; wherein, after the display position of any second image is reset, the sub-region where the corresponding pixel of the reset second image is located will be marked as an occupied sub-region; when the remaining unoccupied sub-region is insufficient to accommodate the current second image, the current second image is abandoned, and the second image with a lower priority than the current second image is also abandoned.
2. The three-dimensional display method according to claim 1, characterized in that, The three-dimensional object includes: a three-dimensional point object; In step S3, for any one of the three-dimensional point objects, determining the first image projected onto the two-dimensional display plane of the three-dimensional object includes: Obtain the bounding box of the three-dimensional point object, the bounding box including the coordinates of multiple corner points; Perform a projection transformation on each corner point to obtain the pixel coordinates of the corner point on the two-dimensional display plane; and Based on the pixel coordinates of each corner point, the smallest rectangle of the three-dimensional point object on the two-dimensional display plane is obtained, and the smallest rectangle is used as the first image.
3. The three-dimensional display method according to claim 1, characterized in that, The three-dimensional object includes a three-dimensional linear object; In step S3, for any one of the three-dimensional linear objects, determining the first image projected onto the two-dimensional display plane of the three-dimensional object includes: Obtain multiple vertices of the three-dimensional linear object; A projection transformation is performed on each vertex to obtain the pixel coordinates of the vertex on the two-dimensional display plane; Based on the pixel coordinates of each vertex and a preset offset value, a strip-shaped region of the three-dimensional linear object is constructed on the two-dimensional display plane; and Based on the pixel coordinates corresponding to the strip region, a minimum convex polygon containing the strip region is constructed, and the minimum convex polygon is used as the first image.
4. The three-dimensional display method according to claim 1, characterized in that, In step S5, determining the display area range to be occupied by the second image on the two-dimensional display plane includes: Obtain the smallest rectangular region containing the second image, and use the smallest rectangular region as the range of the display area to be occupied.
5. The three-dimensional display method according to claim 1, characterized in that, The two-dimensional object is the annotation information of the three-dimensional object, wherein each two-dimensional object is associated with the ID information of its corresponding three-dimensional object.
6. The three-dimensional display method according to claim 5, characterized in that, In step S7, for any of the second images, moving the display position of the second image on the two-dimensional display plane to the unoccupied sub-region includes: S701. Based on the ID information associated with the current second image, find the occupied sub-region of the first image corresponding to the current second image, and use it as the target occupied sub-region; S702. Obtain the coordinates of the center point of the target occupied sub-region, and the current offset; S703. Based on the current offset and the center point coordinates, determine the search range of the current second image. Within the search range, sequentially search the circumferential direction of the target occupied sub-region for an unoccupied sub-region that can accommodate the current second image. If an unoccupied sub-region that can accommodate the current second image is found, move the current second image to the unoccupied sub-region and stop searching. If no unoccupied sub-region that can accommodate the second image is found within the search range, proceed to step S704. S704. Add a preset value to the current offset to update the current offset; if the updated current offset is greater than or equal to the preset extreme value, stop searching and abandon displaying the current second image; if the updated current offset is less than the preset extreme value, return to step S703.
7. An electronic device comprising a processor storing a computer program, characterized in that: When the computer program is executed by the processor, it implements the three-dimensional display method as described in any one of claims 1 to 6.
8. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by the processor, it implements the three-dimensional display method as described in any one of claims 1 to 6.
Citation Information
Patent Citations
Spatial display device, spatial method, and program
EP1923772A1
Information processing device, information processing method, and program
JP2013138418A