Map rendering method, electronic device, and computer storage medium
By constructing a quadrangular pyramid in a 3D electronic map and hiding buildings that collide with it, the problem of occlusion at the center of the field of view is solved, improving map clarity and user experience.
Patent Information
- Application Number
- CN202210331707.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-03-31
- Publication Date
- 2026-02-03
- Estimated Expiration
- 2042-03-31
AI Technical Summary
In existing 3D electronic maps, geographical features at the center of the field of view are easily obscured by buildings, resulting in unclear information.
By determining the visual cone at the center of the field of view, a quadrangular pyramid is constructed, and buildings that collide with the quadrangular pyramid are hidden and made invisible, thus ensuring the clear presentation of information at the center of the field of view.
It effectively avoids obstruction by buildings in the center of the field of view, improving the presentation of 3D maps and user experience.
Smart Images

Figure CN114708394B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of map rendering technology, and in particular to a map rendering method, electronic device, and computer storage medium. Background Technology
[0002] With the development of terminal rendering technology, most applications with map navigation functions (including but not limited to navigation applications, ride-hailing applications, etc.) support rendering electronic maps in a three-dimensional perspective to enhance the realism of users browsing electronic maps.
[0003] While researching electronic maps rendered from a three-dimensional perspective, the inventors of this application discovered that geographical features such as roads in the center of the electronic map's field of view are sometimes obscured by buildings, and these geographical features rendered in the center of the field of view are the areas that users focus on when browsing electronic maps.
[0004] Therefore, how to make electronic maps rendered in a three-dimensional perspective clearly present the geographical features at the center of the field of view has become an urgent problem to be solved. Summary of the Invention
[0005] In view of this, embodiments of this application provide a map rendering scheme to at least partially solve the above-mentioned problems.
[0006] According to a first aspect of the embodiments of this application, a map rendering method is provided, comprising: determining the view center of a three-dimensional electronic map to be rendered and a view frustum corresponding to the view center; constructing a quadrangular pyramid based on the view frustum, wherein the vertices of the quadrangular pyramid are the same as the vertices of the view frustum, the base of the quadrangular pyramid is a rectangle parallel to the far clipping plane of the view frustum, and the center of the rectangle is the view center; determining buildings among the geographic features contained in the three-dimensional electronic map that collide with the quadrangular pyramid as geographic features to be hidden; and making the geographic features to be hidden invisible when rendering the three-dimensional electronic map to be rendered.
[0007] According to a second aspect of the embodiments of this application, a map rendering apparatus is provided, comprising: a determining module, configured to determine the field of view center of a three-dimensional electronic map to be rendered and a viewing cone corresponding to the field of view center; a constructing module, configured to construct a quadrangular pyramid based on the viewing cone, wherein the vertices of the quadrangular pyramid are the same as the vertices of the viewing cone, the base of the quadrangular pyramid is a rectangle parallel to the far clipping plane of the viewing cone, and the center of the rectangle is the field of view center; and a hiding module, configured to determine that buildings among the geographic features contained in the three-dimensional electronic map that collide with the quadrangular pyramid, and to make the geographic features to be hidden invisible when rendering the three-dimensional electronic map to be rendered; and to make the geographic features to be hidden invisible when rendering the three-dimensional electronic map to be rendered.
[0008] According to a third aspect of the present application, an electronic device is provided, comprising: a processor, a memory, a communication interface, and a communication bus, wherein the processor, the memory, and the communication interface communicate with each other via the communication bus; the memory is used to store at least one executable instruction, wherein the executable instruction causes the processor to perform an operation corresponding to the map rendering method described in the first aspect.
[0009] According to a fourth aspect of the embodiments of this application, a computer storage medium is provided that stores a computer program thereon, which, when executed by a processor, implements the map rendering method as described in the first aspect.
[0010] According to a fifth aspect of the embodiments of this application, a computer program product is provided, including computer instructions that instruct a computing device to perform an operation corresponding to the map rendering method described in the first aspect.
[0011] According to the map rendering scheme provided in this application, when it is necessary to present information about the area where the center of vision is located in a three-dimensional manner, a quadrangular pyramid is constructed based on the view frustum corresponding to the center of vision. Buildings that collide with the quadrangular pyramid, i.e., buildings that affect the current view, are then hidden from view when presenting the three-dimensional image of the center of vision. Since the quadrangular pyramid is constructed based on the view frustum, it can be seen as an extension of the view frustum. The view frustum is an effective representation of the current view; therefore, buildings that collide with the quadrangular pyramid can be considered as buildings that affect the current view. By hiding these buildings from view when presenting the three-dimensional image, the clear presentation of the information at the center of vision can be effectively ensured, improving the three-dimensional map presentation effect and user experience. Attached Figure Description
[0012] To more clearly illustrate the technical solutions in the embodiments of this application or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments recorded in the embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings.
[0013] Figure 1A This is a flowchart illustrating the steps of a map rendering method according to Embodiment 1 of this application;
[0014] Figure 1B This is a schematic diagram of a viewing cone;
[0015] Figure 1C A schematic diagram of a visual cone corresponding to the center of the field of vision;
[0016] Figure 1D This is a schematic diagram of a field-of-view display interface in related technologies;
[0017] Figure 1E To adopt Figure 1A A schematic diagram of the display interface at the center of the field of view after processing by the method shown.
[0018] Figure 2A This is a flowchart illustrating the steps of a map rendering method according to Embodiment 2 of this application;
[0019] Figure 2B for Figure 2A A schematic diagram of an example scenario in the illustrated embodiment;
[0020] Figure 3 This is a structural block diagram of a map rendering apparatus according to Embodiment 3 of this application;
[0021] Figure 4 This is a schematic diagram of the structure of an electronic device according to Embodiment 4 of this application. Detailed Implementation
[0022] To enable those skilled in the art to better understand the technical solutions in the embodiments of this application, the technical solutions in the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art should fall within the protection scope of the embodiments of this application.
[0023] The specific implementation of the embodiments of this application will be further described below with reference to the accompanying drawings.
[0024] Example 1
[0025] Reference Figure 1A The diagram shows a flowchart of a map rendering method according to Embodiment 1 of this application.
[0026] The map rendering method in this embodiment includes the following steps:
[0027] Step S102: Determine the field of view center of the three-dimensional electronic map to be rendered and the view cone corresponding to the field of view center.
[0028] In 3D maps, the center of view typically refers to the intersection of the line of sight of the image acquisition device (such as a camera) and the ground. Figure 1D and Figure 1E The dashed ellipse shown in the diagram.
[0029] The view frustum typically refers to the shape of the area that a perspective camera can render in a rendering engine. It resembles a square pyramid whose top is cut by a plane parallel to its base, with the camera positioned at the apex. The view frustum has a near clipping plane and a far clipping plane. The near clipping plane is the plane of the view frustum closest to the camera, parallel to the far clipping plane; the far clipping plane is the plane of the view frustum furthest from the camera, parallel to the near clipping plane. An illustrative view frustum is shown below. Figure 1B As shown in the solid line portion.
[0030] Correspondingly, the viewing cone corresponding to the center of the field of view is the viewing cone when the perspective camera is positioned where its line of sight can reach the center of the field of view, such as... Figure 1C As shown by the short dashed line.
[0031] In a 3D electronic map, once the center of view is determined, the corresponding frustum can be determined by connecting the camera position to the center of view. In map viewing or navigation scenarios, the camera's line of sight can be considered to be pointing from the camera position to the center of view in the 3D electronic map.
[0032] For example, first determine the center of the map's field of view, then place the camera at the center of the field of view, facing due north with its line of sight parallel to the ground. Next, determine the azimuth angle alpha, which defaults to 0 degrees (facing due north), and adjust the camera's azimuth angle to alpha. Then, determine the pitch angle pitch, which defaults to 90 degrees (the camera is perpendicular to the ground, this is a two-dimensional field of view), and adjust the camera's pitch angle to pitch. Finally, determine the distance d between the camera and the center of the field of view. This value affects the size of objects displayed in the field of view. Move the camera back a distance d along its current orientation to mid-air, thus determining the camera's position and orientation.
[0033] Among them, the azimuth angle is the rotation angle of the camera around an axis perpendicular to the ground, with a default of 0 degrees, corresponding to facing due north; the pitch angle is the angle between the camera's orientation and the ground, with a default of 90 degrees, that is, looking directly at the ground, which is a two-dimensional field of view (when this angle is less than 90 degrees, it is a three-dimensional field of view).
[0034] Step S104: Construct a quadrangular pyramid based on the view frustum.
[0035] In this structure, the vertices of the quadrangular pyramid are the same as the vertices of the visual cone, and the base of the quadrangular pyramid is a rectangle parallel to the far clipping plane of the visual cone. The center of the rectangle is the center of the field of view. One example of a constructed quadrangular pyramid is... Figure 1C As shown by the solid line. Generally speaking, in order to ensure that the information at the center of the field of view can be clearly displayed, and that the information in the surrounding area can also be effectively displayed so that the viewer can understand it, the volume of the constructed pyramid should be smaller than the volume of the pyramid formed by the camera and the far clipping plane of the viewing cone. This is sufficient to hide the buildings that have the greatest impact on the center of the field of view from being visible when displayed based on the pyramid.
[0036] Step S106: Identify buildings that collide with the pyramid among the geographic features contained in the 3D electronic map as geographic features to be hidden, and make the geographic features to be hidden invisible when rendering the 3D electronic map.
[0037] In this embodiment of the application, a collision with a square pyramid means that there is a partial intersection between the projection of the square pyramid on the ground and the projection of the building on the ground. That is, part of the projection of the building on the ground intersects with the projection of the square pyramid on the ground, while the other part does not intersect.
[0038] Once the buildings that collide with the pyramid are identified, when rendering the 3D electronic map, especially the 3D image located at the center of the field of view in the 3D electronic map, these buildings can be made invisible, including but not limited to removing these buildings or setting these buildings to transparent.
[0039] To illustrate the effect of concealing the building from view using the embodiments of this application, firstly, refer to... Figure 1D ,Depend on Figure 1D As can be seen, the center of the field of view, indicated by the dashed ellipse, is obscured by buildings, and the information of the center of the field of view cannot be clearly presented. However, after adopting the solution of this application embodiment, the presentation effect of the center of the field of view is as follows: Figure 1E As shown. By Figure 1E As can be seen, because the corresponding buildings are hidden and not visible, the information of the center of the field of view marked by the dashed ellipse can be clearly presented.
[0040] As can be seen, through this embodiment, when it is necessary to present information about the area where the center of vision is located in a three-dimensional manner, a quadrangular pyramid is constructed based on the view frustum corresponding to the center of vision. Buildings that collide with the quadrangular pyramid, i.e., buildings that affect the current field of vision, are then hidden from view when presenting the three-dimensional image of the center of vision. Since the quadrangular pyramid is constructed based on the view frustum, it can be seen as an extension of the view frustum. The view frustum is an effective representation of the current field of vision. Therefore, buildings that collide with the quadrangular pyramid can be considered as buildings that affect the current field of vision. By hiding these buildings from view when presenting the three-dimensional image, the clear presentation of the information at the center of vision can be effectively ensured, improving the presentation effect of the three-dimensional map and the user experience.
[0041] The map rendering method of this embodiment can be executed by any suitable electronic device with data processing capabilities, including but not limited to: mobile terminals (such as mobile phones, PADs, etc.), PCs, servers, etc.
[0042] Example 2
[0043] Reference Figure 2AThe diagram shows a flowchart of a map rendering method according to Embodiment 2 of this application.
[0044] The map rendering method in this embodiment includes the following steps:
[0045] Step S202: Determine the field of view center and the corresponding view cone of the 3D electronic map to be rendered.
[0046] In a 3D electronic map, once the center of view is determined, the corresponding frustum can be determined by connecting the camera position to the center of view. In map viewing or navigation scenarios, the camera's line of sight can be considered to be pointing from the camera position to the center of view in the 3D electronic map.
[0047] Step S204: Construct a quadrangular pyramid based on the aforementioned frustum.
[0048] In this structure, the vertices of the quadrangular pyramid are the same as the vertices of the visual cone, the base of the quadrangular pyramid is a rectangle parallel to the far clipping plane of the visual cone, and the center of the rectangle is the center of the field of view.
[0049] Step S206: Identify the buildings in the 3D electronic map that collide with the quadrangular pyramid as geographic features to be hidden.
[0050] In this specific implementation, although a polyhedral collision algorithm can also be used to detect buildings colliding with the pyramid, to further improve detection performance, this embodiment sets the collision region of the building as its axis-aligned bounding box (AABB). This transforms the collision detection into a collision detection between the AABB and the pyramid, i.e., a collision detection between two convex polyhedra, simplifying calculations and improving detection speed, efficiency, and performance. Based on this, when determining the buildings colliding with the pyramid in the 3D electronic map, the relationship between the axis-aligned bounding boxes (AABB) of the pyramid and the building can be used to identify the buildings colliding with the pyramid, which are then used as the geographic features to be hidden.
[0051] After setting the AABB (Aspect-Oriented Block Balance) for a building, in one feasible approach, a 3D GJK algorithm can be used to determine whether the building has collided with a square pyramid. The 3D GJK algorithm can be used to calculate the distance between convex polyhedra in 3D space. It first calculates the Minkowski difference between two convex polyhedra; if the two objects overlap or intersect, their Minkowski difference must include the origin. The 3D GJK algorithm uses the principle of whether the Minkowski difference includes the origin to determine whether a collision has occurred. The specific implementation of this algorithm can be found in related technologies; the embodiments in this application will not be described in detail here.
[0052] However, the 3D GJK algorithm is computationally complex and involves a large amount of data, resulting in low computational efficiency. Therefore, this embodiment employs a method based on the projection of a pyramid and the AABB (Alternating Elementary Box) to determine whether a building collides with the pyramid, simplifying the calculation and improving efficiency. Specifically, when determining the building that collides with the pyramid based on the relationship between the pyramid and the AABB corresponding to the building, the following method can be used: obtain the triangular projection of the pyramid relative to the ground, and the rectangular projection of the AABB corresponding to the building relative to the ground; determine the rectangular projections that have a collision relationship with the triangular projections, and select the buildings corresponding to these rectangular projections as candidate buildings; determine whether any AABB corresponding to the candidate buildings exists that is completely below the side of the pyramid facing the ground; and identify the candidate buildings corresponding to AABBs that do not exist that are completely below the side of the pyramid facing the ground as buildings that collide with the pyramid. That is, the polyhedral collision problem is simplified to a two-dimensional collision problem between AABBs and triangles. Furthermore, the identified buildings are used as geographic features to be hidden.
[0053] The process of determining whether an AABB corresponding to a candidate building exists that is completely beneath the side of the pyramid facing the ground can include: determining whether an AABB corresponding to a candidate building exists that is completely beneath the side of the pyramid facing the ground, based on the vertex coordinates of the AABBs. Since the vertex coordinates of an AABB can effectively represent it, using vertex coordinates for this determination can greatly simplify the calculation and reduce the computational load.
[0054] A feasible method for collision detection using vertex coordinates includes: determining the planar vector equation corresponding to the side of the pyramid facing the ground, and the coefficients in the planar vector equation corresponding to the X-axis, Y-axis, and Z-axis coordinates, respectively; obtaining the maximum and minimum values of the vertex coordinates of the AABB corresponding to each candidate building on the X-axis, Y-axis, and Z-axis, respectively; obtaining the judgment vertex coordinates of the AABB corresponding to each candidate building based on the coefficients and the maximum and minimum values; and determining, based on the judgment vertex coordinates and the planar vector equation, whether there exists an AABB completely located below the side of the pyramid facing the ground. In this method, the planar vector equation is used to represent the side of the pyramid facing the ground, thereby simplifying collision detection to a specific equation implementation, further simplifying the collision detection process and improving detection efficiency.
[0055] In one feasible approach, obtaining the decision vertex coordinates of the AABB corresponding to each candidate building based on the coefficients and the maximum and minimum values includes: for each candidate building's AABB, and for each coefficient among the coefficients corresponding to the X-axis, Y-axis, and Z-axis coordinates, if the coefficient is greater than 0, then the maximum value on the axis corresponding to that coefficient on the AABB is determined as the decision vertex coordinate on that axis; otherwise, the minimum value on the axis corresponding to that coefficient is determined as the decision vertex coordinate on that axis; based on the determined decision vertex coordinates on each axis, the decision vertex coordinates of the AABB are obtained. This method allows determining the maximum coordinates on each axis of the AABB. If the maximum coordinate is completely below the side of the pyramid facing the ground, then the other coordinates should also be completely below the side of the pyramid facing the ground. Therefore, it is unnecessary to calculate the coordinates of each vertex of the AABB, further simplifying the calculation process, reducing the amount of computational data, and improving computational efficiency.
[0056] Specifically, determining whether there exists an AABB completely located below the side of the pyramid facing the ground among the candidate building's AABBs based on the vertex coordinates and the plane vector equation includes: for each candidate building's AABB, using the vertex coordinates of the AABB as the coordinate parameter in the plane vector equation to obtain the equation result; if the equation result is greater than 0, then it is determined that the AABB is not completely located below the side of the pyramid facing the ground (i.e., there is a collision); if the equation result is less than 0, then it is determined that the AABB is completely located below the side of the pyramid facing the ground (i.e., there is no collision).
[0057] The following is a specific example illustrating the collision detection process described above.
[0058] like Figure 2B As shown, the largest rectangle at the bottom represents the ground. Several solid-lined cuboids standing on the ground represent buildings. The three buildings in the middle with dashed outlines represent buildings with an AABB structure. The cylinder on the right represents a camera. The light gray dashed cone structure above represents a square pyramid (a symmetrical square pyramid, with each side being an isosceles triangle) built based on a view frustum. The vertex of this square pyramid is the camera. The base is a rectangle parallel to the camera's view frustum's near and far clipping planes. The center of this rectangle is the center of the field of view (the intersection of the camera's line of sight and the ground). The dark gray dashed triangle below represents the triangular projection of the square pyramid onto the ground. It should be noted that in this embodiment, the midpoint of the base of the triangle overlaps with the center of the base of the square pyramid.
[0059] When determining whether a building's AABB (Aspect-Adjustable Block) collides with a pyramid, first consider the pyramid's projection on the ground (the dark gray dashed triangle below). Determine if the building's AABB projection collides with this triangle; that is, perform a 2D collision detection between the AABB and the triangle. If no collision occurs, the building corresponding to the AABB does not need to be hidden; otherwise, proceed with the following steps.
[0060] That is: denote the plane containing the side of the pyramid facing the ground as p, determine whether the AABB of the building is completely below p, if so, the building does not need to be hidden, otherwise hide it and make it invisible.
[0061] In this context, determining whether an AABB is completely on one side of plane p is equivalent to determining whether all vertices of the AABB are on one side of plane p.
[0062] First, let the analytical expression of plane p be: function(x,y,z)=ax+by+cz+d=0, which is the plane vector equation of plane p, where x, y, and z represent the coordinates on the corresponding X-axis, Y-axis, and Z-axis, respectively, and a, b, and c are the coefficients corresponding to these three coordinate axes. When the vector (a, b, c) is normalized, the absolute value of d is equal to the distance between the plane and the origin. If the plane passes through the origin, then d=0. Therefore, the specific values of the coefficients a, b, and c can be obtained from the coordinate points on the plane passing through the origin. Furthermore, the specific value of d can be obtained from the coordinate points on other planes that do not pass through the origin. It can be seen that in the square pyramid, the coordinate points (x,y,z) that make the above equation ax+by+cz+d=0 true are the coordinate points on plane p, and all such coordinate points constitute plane p.
[0063] If a point (x,y,z) on AABB is below p, then function(x,y,z)<0.
[0064] Based on this, let the ranges of the AABB of the building to be detected on the three coordinate axes, namely the X-axis, Y-axis, and Z-axis, be [xmin, xmax], [ymin, ymax], and [zmin, zmax], respectively. Then, among the 8 vertices of the AABB, determine the coordinates (u, v, w) of the vertex to be judged. Where:
[0065] u = xmax if a > 0 else xmin
[0066] v = ymax if b > 0 else ymin
[0067] w = zmax if c > 0 else zmin
[0068] As can be seen, after the above three simple comparison operations, the value of (u,v,w) can be obtained. The value of (u,v,w) is the value of the vertex (u,v,w) in AABB that maximizes the function.
[0069] Finally, we only need to determine whether function(u,v,w) is greater than zero. If it is greater than zero, the building corresponding to the AABB is not completely under p, that is, it has collided with the pyramid. If it is less than zero, the building corresponding to the AABB is completely under p and has not collided with the pyramid.
[0070] Furthermore, it should be noted that in practical applications, the split axis algorithm and the two-dimensional GJK algorithm can also achieve the collision detection of the two-dimensional AABB and triangle described in the embodiments of this application.
[0071] It should also be noted that, in practical applications, the size of the base of the pyramid can be adjusted according to an appropriate adjustment strategy to adjust the size of the area of the road surface to be avoided from being obstructed. The adjustment strategy can be appropriately adjusted by those skilled in the art according to actual needs, such as scaling according to a certain ratio, and this application embodiment does not impose any limitations on this.
[0072] Step S208: When rendering the 3D electronic map to be rendered, make the geographic features to be hidden invisible.
[0073] After identifying the building that collides with the pyramid, it is used as the geographic feature to be hidden. During 3D display, simply hiding the building that collides with the pyramid prevents it from obscuring the road surface near the center of the view. Specifically... Figure 2B In the middle, the building in the rightmost dashed line AABB is located below the quadrangular pyramid and does not need to be hidden, while the buildings in the other two dashed lines AABB collide with the quadrangular pyramid and need to be hidden and not visible.
[0074] In this embodiment, when it is necessary to present information about the area where the center of the field of view is located in a three-dimensional manner, a quadrangular pyramid is constructed based on the view frustum corresponding to the center of the field of view. Buildings that collide with the quadrangular pyramid, i.e., buildings that affect the current field of view, are then hidden from view when presenting the three-dimensional image of the center of the field of view. Since the quadrangular pyramid is constructed based on the view frustum, it can be seen as an extension of the view frustum. The view frustum is an effective representation of the current field of view; therefore, buildings that collide with the quadrangular pyramid can be considered as buildings that affect the current field of view. By hiding these buildings from view when presenting the three-dimensional image, the clear presentation of the information at the center of the field of view can be effectively ensured, improving the presentation effect of the three-dimensional map and the user experience.
[0075] The map rendering method of this embodiment can be executed by any suitable electronic device with data processing capabilities, including but not limited to: mobile terminals (such as mobile phones, PADs, etc.), PCs, servers, etc.
[0076] Example 3
[0077] Reference Figure 3 The diagram shows a structural block diagram of a map rendering apparatus according to Embodiment 3 of this application.
[0078] The map rendering device of this embodiment includes: a determining module 302, used to determine the field of view center of the three-dimensional electronic map to be rendered and the view frustum corresponding to the field of view center; a constructing module 304, used to construct a quadrangular pyramid based on the view frustum, wherein the vertices of the quadrangular pyramid are the same as the vertices of the view frustum, the base of the quadrangular pyramid is a rectangle parallel to the far clipping plane of the view frustum, and the center of the rectangle is the field of view center; and a hiding module 306, used to determine buildings that collide with the quadrangular pyramid among the geographic features contained in the three-dimensional electronic map as geographic features to be hidden; and to make the geographic features to be hidden invisible when rendering the three-dimensional electronic map to be rendered.
[0079] Optionally, the hiding module 306 is used to determine the building that collides with the quadrangular pyramid as a geographic feature to be hidden based on the relationship between the bounding box of the quadrangular pyramid and the building's corresponding axis coordinates; and to make the geographic feature to be hidden invisible when rendering the three-dimensional electronic map to be rendered.
[0080] Optionally, the hiding module 306 is used to obtain the triangular projection of the pyramid relative to the ground, and the rectangular projection of the bounding box corresponding to the building relative to the ground; determine the rectangular projections that have a collision relationship with the triangular projections, and take the buildings corresponding to the rectangular projections that have a collision relationship as candidate buildings; determine whether there is an axis-coordinate aligned bounding box completely located below the side of the pyramid facing the ground in the bounding box corresponding to the candidate buildings; determine the candidate buildings corresponding to the axis-coordinate aligned bounding boxes that do not completely located below the side of the pyramid facing the ground as buildings that collide with the pyramid as geographic features to be hidden; and make the geographic features to be hidden invisible when rendering the three-dimensional electronic map to be rendered.
[0081] Optionally, when the hiding module 306 determines whether there is an axis coordinate aligned bounding box completely located below the side of the pyramid facing the ground in the axis coordinate aligned bounding box corresponding to the candidate building, it determines whether there is an axis coordinate aligned bounding box completely located below the side of the pyramid facing the ground in the axis coordinate aligned bounding box corresponding to the candidate building based on the vertex coordinates of the axis coordinate aligned bounding box corresponding to the candidate building.
[0082] Optionally, when the hiding module 306 determines whether there exists an axis-coordinate aligned bounding box completely below the side of the pyramid facing the ground within the axis-coordinate aligned bounding box corresponding to the candidate building, based on the vertex coordinates of the axis-coordinate aligned bounding box corresponding to the candidate building: it determines the plane vector equation corresponding to the side of the pyramid facing the ground, and the coefficients in the plane vector equation corresponding to the X-axis, Y-axis, and Z-axis coordinates respectively; it obtains the maximum and minimum values of the vertex coordinates of the axis-coordinate aligned bounding box corresponding to each candidate building on the X-axis, Y-axis, and Z-axis respectively; it obtains the determination vertex coordinates of the axis-coordinate aligned bounding box corresponding to each candidate building based on the coefficients and the maximum and minimum values; and it determines whether there exists an axis-coordinate aligned bounding box completely below the side of the pyramid facing the ground within the axis-coordinate aligned bounding box corresponding to the candidate building based on the determination vertex coordinates and the plane vector equation.
[0083] Optionally, when the hiding module 306 obtains the determination vertex coordinates of the axis-aligned bounding box corresponding to each candidate building based on the coefficients and the maximum and minimum values: for each axis-aligned bounding box corresponding to each candidate building, and for each coefficient among the coefficients corresponding to the X-axis, Y-axis, and Z-axis coordinates, if the coefficient is greater than 0, then the maximum value on the axis corresponding to the coefficient on the axis-aligned bounding box is determined as the determination vertex coordinate on that axis; otherwise, the minimum value on the axis corresponding to the coefficient is determined as the determination vertex coordinate on that axis; and the determination vertex coordinates of the axis-aligned bounding box are obtained based on the determined determination vertex coordinates on each axis.
[0084] Optionally, when the hiding module 306 determines whether there exists an axis-coordinate aligned bounding box completely located below the side of the pyramid facing the ground within the axis-coordinate aligned bounding box corresponding to the candidate building based on the determined vertex coordinates and the plane vector equation: for each axis-coordinate aligned bounding box corresponding to the candidate building, the determined vertex coordinates of the axis-coordinate aligned bounding box are used as coordinate parameters in the plane vector equation to obtain the equation result; if the equation result is greater than 0, it is determined that the axis-coordinate aligned bounding box is not completely located below the side of the pyramid facing the ground; if the equation result is less than 0, it is determined that the axis-coordinate aligned bounding box is completely located below the side of the pyramid facing the ground.
[0085] The map rendering apparatus of this embodiment is used to implement the corresponding map rendering methods in the foregoing method embodiments and has the beneficial effects of the corresponding method embodiments, which will not be repeated here. Furthermore, the functional implementation of each module in the map rendering apparatus of this embodiment can be referred to the description of the corresponding part in the foregoing method embodiments, which will also not be repeated here.
[0086] Example 4
[0087] Reference Figure 4 The diagram shows a structural schematic of an electronic device according to Embodiment 4 of this application. The specific embodiments of this application do not limit the specific implementation of the electronic device.
[0088] like Figure 4 As shown, the electronic device may include: a processor 402, a communications interface 404, a memory 406, and a communications bus 408.
[0089] in:
[0090] The processor 402, communication interface 404, and memory 406 communicate with each other via communication bus 408.
[0091] Communication interface 404 is used to communicate with other electronic devices or servers.
[0092] The processor 402 is used to execute program 410, specifically to perform the relevant steps in the above-described map rendering method embodiment.
[0093] Specifically, program 410 may include program code that includes computer operation instructions.
[0094] Processor 402 may be a CPU, an Application Specific Integrated Circuit (ASIC), or one or more integrated circuits configured to implement the embodiments of this application. The smart device includes one or more processors, which may be processors of the same type, such as one or more CPUs; or processors of different types, such as one or more CPUs and one or more ASICs.
[0095] Memory 406 is used to store program 410. Memory 406 may include high-speed RAM memory, and may also include non-volatile memory, such as at least one disk storage device.
[0096] Specifically, program 410 can be used to cause processor 402 to execute the map rendering method described in the first or second embodiment of the aforementioned method.
[0097] The specific implementation of each step in program 410 can be found in the corresponding steps and units described in the above-described map rendering method embodiments, and will not be repeated here. Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the specific working process of the devices and modules described above can be referred to the corresponding process descriptions in the aforementioned method embodiments, and will not be repeated here.
[0098] In this embodiment, when the electronic device needs to present information about the area where the center of vision is located in a three-dimensional manner, it identifies buildings that collide with the view frustum (the view frustum corresponding to the center of vision) and thus affect the current field of vision. These buildings are then hidden from view when the three-dimensional image of the center of vision is presented. Since the quadrangular pyramid is constructed based on the view frustum, it can be seen as an extension of the view frustum. The view frustum is an effective representation of the current field of vision; therefore, buildings that collide with the quadrangular pyramid can be considered as affecting the current field of vision. By hiding these buildings from view when presenting the three-dimensional image, the clear presentation of the information at the center of vision is effectively ensured, improving the three-dimensional map presentation effect and user experience.
[0099] In addition, this application also provides a computer program product, including computer instructions, which instruct a computing device to perform the operations corresponding to the map rendering method described in Embodiment 1 or 2 above.
[0100] It should be noted that, depending on the implementation needs, the various components / steps described in the embodiments of this application can be broken down into more components / steps, or two or more components / steps or parts of the operation of components / steps can be combined into new components / steps to achieve the purpose of the embodiments of this application.
[0101] The methods described in the embodiments of this application can be implemented in hardware, firmware, or as software or computer code that can be stored in a recording medium (such as a CD-ROM, RAM, floppy disk, hard disk, or magneto-optical disk), or as computer code downloaded over a network that is originally stored in a remote recording medium or a non-transitory machine-readable medium and will be stored in a local recording medium. Thus, the methods described herein can be processed by software stored on a recording medium using a general-purpose computer, a dedicated processor, or programmable or dedicated hardware (such as an ASIC or FPGA). It is understood that the computer, processor, microprocessor controller, or programmable hardware includes storage components (e.g., RAM, ROM, flash memory, etc.) capable of storing or receiving software or computer code that, when accessed and executed by the computer, processor, or hardware, implements the map rendering methods described herein. Furthermore, when a general-purpose computer accesses the code used to implement the map rendering methods shown herein, the execution of the code transforms the general-purpose computer into a dedicated computer for executing the map rendering methods shown herein.
[0102] Those skilled in the art will recognize that the units and method steps of the various examples described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of the embodiments of this application.
[0103] The above embodiments are only used to illustrate the embodiments of this application, and are not intended to limit the embodiments of this application. Those skilled in the art can make various changes and modifications without departing from the spirit and scope of the embodiments of this application. Therefore, all equivalent technical solutions also fall within the scope of the embodiments of this application, and the patent protection scope of the embodiments of this application should be defined by the claims.
Claims
1. A map rendering method, comprising: Determine the field of view center of the 3D electronic map to be rendered and the view cone corresponding to the field of view center, wherein the field of view center refers to the intersection of the line of sight of the image acquisition device and the ground. A quadrangular pyramid is constructed based on the visual frustum, wherein the vertices of the quadrangular pyramid are the same as the vertices of the visual frustum, the base of the quadrangular pyramid is a rectangle parallel to the far clipping plane of the visual frustum, and the center of the rectangle is the center of the field of view; The buildings that collide with the pyramid among the geographic features contained in the three-dimensional electronic map are identified as geographic features to be hidden. When rendering the 3D electronic map to be rendered, the geographic features to be hidden are made invisible.
2. The method according to claim 1, wherein, The step of determining buildings that collide with the pyramid among the geographic features contained in the 3D electronic map as geographic features to be hidden includes: Based on the relationship between the bounding boxes of the quadrangular pyramid and the building, the buildings that collide with the quadrangular pyramid are identified as geographic features to be hidden.
3. The method according to claim 2, wherein, The step of determining the building that collides with the pyramid as a geographic feature to be hidden based on the relationship between the bounding boxes of the pyramid and the building's corresponding axis coordinates includes: Obtain the triangular projection of the square pyramid relative to the ground, and the rectangular projection of the bounding box corresponding to the building relative to the ground; Identify the rectangular projections that have a collision relationship with the triangular projection, and select the buildings corresponding to the rectangular projections that have a collision relationship as candidate buildings; Determine whether there exists an axis coordinate aligned bounding box that is completely located below the side of the pyramid facing the ground in the axis coordinate aligned bounding box corresponding to the candidate building. Candidate buildings whose axis coordinates do not correspond to the bounding box that are not completely located below the side of the pyramid facing the ground are identified as buildings that collide with the pyramid and are thus identified as geographic features to be hidden.
4. The method according to claim 3, wherein, The determination of whether there exists an axis coordinate alignment bounding box completely located below the side of the pyramid facing the ground within the candidate building's corresponding axis coordinate alignment bounding box includes: Based on the vertex coordinates of the bounding box corresponding to the candidate building, determine whether there exists a bounding box that is completely located below the side of the pyramid facing the ground.
5. The method according to claim 4, wherein, The step of determining whether there exists an axis-aligned bounding box completely located below the side of the pyramid facing the ground within the axis-aligned bounding box of the candidate building, based on the vertex coordinates of the axis-aligned bounding box corresponding to the candidate building, includes: Determine the plane vector equation corresponding to the side of the square pyramid facing the ground, and the coefficients in the plane vector equation corresponding to the X-axis coordinate, Y-axis coordinate, and Z-axis coordinate, respectively; Obtain the maximum and minimum values of the vertex coordinates of the axis-aligned bounding box corresponding to each candidate building on the X-axis, Y-axis, and Z-axis, respectively. Based on the coefficients and the maximum and minimum values, the coordinates of the axial coordinates aligned with the bounding box of each candidate building are obtained; Based on the vertex coordinates and the plane vector equation, determine whether there exists an axis coordinate aligned bounding box that is completely located below the side of the pyramid facing the ground in the bounding box corresponding to the candidate building.
6. The method according to claim 5, wherein, The step of obtaining the determination vertex coordinates of the bounding box corresponding to each candidate building based on the coefficients and the maximum and minimum values includes: For each candidate building, the bounding box corresponding to the axis coordinates, and each coefficient among the coefficients corresponding to the X-axis, Y-axis, and Z-axis coordinates, if the coefficient is greater than 0, then the maximum value on the axis corresponding to the coefficient on the bounding box is determined as the decision vertex coordinate on that axis; otherwise, the minimum value on the axis corresponding to the coefficient is determined as the decision vertex coordinate on that axis. Based on the determined vertex coordinates along each axis, obtain the vertex coordinates of the bounding box that align with that axis coordinate.
7. The method according to claim 5 or 6, wherein, The step of determining whether there exists an axis-aligned bounding box completely located below the side of the pyramid facing the ground within the axis-aligned bounding box corresponding to the candidate building, based on the determined vertex coordinates and the plane vector equation, includes: For each candidate building, the coordinates of the axial coordinate aligned bounding box are used as the coordinate parameters in the plane vector equation to obtain the equation result. If the result of the equation is greater than 0, it is determined that the bounding box of the axis coordinate alignment is not completely located below the side of the pyramid facing the ground. If the result of the equation is less than 0, then it is determined that the axis coordinate alignment bounding box is completely located below the side of the pyramid facing the ground.
8. An electronic device, comprising: The processor, memory, communication interface, and communication bus are provided, wherein the processor, memory, and communication interface communicate with each other via the communication bus. The memory is used to store at least one executable instruction, which causes the processor to perform the operation corresponding to the map rendering method as described in any one of claims 1-7.
9. A computer storage medium having a computer program stored thereon, which, when executed by a processor, implements the map rendering method as described in any one of claims 1-7.
10. A computer program product comprising computer instructions that instruct a computing device to perform an operation corresponding to any one of the map rendering methods as described in claims 1-7.
Citation Information
Patent Citations
Navigation apparatus with shape change display function
US5999879A