Vertex position determination method, electronic equipment, storage medium and computer program

By determining the depth test range based on the pick object type in Cesium and conducting depth tests within this range, the problem of vertex position inaccuracy caused by floating-point operation accuracy limitation is solved, and a higher accuracy of vertex position determination is achieved.

CN119478271APending Publication Date: 2025-02-18RUIYU SPACE TIME TECH (CHONGQING) CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411611452.3
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-11-12
Publication Date
2025-02-18

AI Technical Summary

Technical Problem

In Cesium's pickup mode, when determining the target position in the model through the CPU ray pickup method, it is limited by floating point operation accuracy, resulting in the picking spatial position inadequately.

Method used

By obtaining the pickup information of the map, the depth test range is determined based on the pickup object type, and the depth test is performed within the depth test range to determine the vertex of the pickup position. If no vertices are found within the current range that meet the requirements, expand the depth test range and test in depth again until the vertex is selected.

Benefits of technology

Improves the accuracy of vertex position determination, ensuring that vertices at the pickup position can be accurately determined in complex three-dimensional models.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119478271A_ABST
    Figure CN119478271A_ABST
Patent Text Reader

Abstract

The invention provides a vertex position determination method, electronic equipment, a storage medium and a computer program, and relates to the technical field of data processing. The method comprises the following steps: acquiring pickup information of a map; the pickup information comprises a pickup position and a pickup object type; the pickup information is generated by triggering a certain point on the map; determining a depth test range based on the pickup object type; performing a depth test according to the pickup position and the depth test range; if the to-be-selected vertexes in the preset depth range do not exist in the depth test range, expanding the depth test range, and performing depth test on the expanded depth test range again until the to-be-selected vertexes are obtained; and determining the vertex position by using the to-be-selected vertex. According to the method, the depth test range is determined based on the type of the pickup object, and when the to-be-selected vertex is not found, the depth test range is expanded until the to-be-selected vertex is obtained, so that the accuracy of the pickup position is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of data processing technology, and in particular to a vertex position determination method, an electronic device, a storage medium and a computer program. Background Art

[0002] With the development of geographic information technology, Cesium has emerged as a high-performance 3D map display platform. Cesium is an open source JavaScript library for creating interactive 3D earth maps.

[0003] In Cesium picking mode, the CPU ray picking method is used to determine the target position in the model, which is limited by the precision of floating-point operations, resulting in inaccurate spatial position. Summary of the invention

[0004] The purpose of the embodiments of the present application is to provide a vertex position determination method, electronic device, storage medium and computer program, which are used to determine the depth test range by picking up the object type, and perform a depth test within the depth test range based on the picked position to determine the vertex of the picked position, thereby improving the accuracy of vertex position determination.

[0005] In a first aspect, an embodiment of the present application provides a vertex position determination method, the method comprising: obtaining picking information of a map; the picking information comprising a picking position and a picking object type; the picking information is generated to trigger a point on the map; determining a depth test range based on the picking object type; performing a depth test according to the depth test range based on the picking position; if there is no candidate vertex within a preset depth range in the depth test range, expanding the depth test range, and performing a depth test on the expanded depth test range again until the candidate vertex is obtained; and determining the vertex position using the candidate vertex.

[0006] In the embodiment of the present application, the depth test range is determined by picking up the object type, and in the process of performing the depth test within the depth test range based on the picked position, if no candidate vertex that meets the requirements is found within the current depth test range, the depth test range is expanded, and the depth test is performed again to determine the position of the vertex from the candidate vertices that meet the requirements. Since the final vertex position is determined from the candidate vertices in this process, the accuracy of vertex position determination is improved.

[0007] In some embodiments, the vertex position is determined using the candidate vertices, including: if there is one candidate vertex, the candidate vertex is rendered to determine the vertex position; if there are multiple candidate vertices, the distance between each candidate vertex and the picking position is calculated, and the candidate vertex with the smallest distance from the picking position is rendered to determine the vertex position.

[0008] In the embodiment of the present application, when there is only one candidate vertex, the candidate vertex is directly rendered. When there are multiple candidate vertices, the candidate vertex closest to the pick position is rendered to determine the vertex position of the pick position. Since when there are multiple candidates, the candidate vertex with the smallest distance is used as the final vertex, the accuracy of vertex position determination is improved.

[0009] In some embodiments, calculating the distance between each candidate vertex and the picking position includes: calculating the world coordinates of each candidate vertex based on the depth information and screen coordinates of each candidate vertex; and calculating the distance between each candidate vertex and the picking position by using the world coordinates of each candidate vertex and the world coordinates of the picking position.

[0010] The embodiment of the present application takes into account the fact that there is depth in the selected vertex. The screen pixels are very close, but the depth difference is too far, resulting in that the finally calculated distance is not the real physical distance. Therefore, the selected vertex is reversed from the two-dimensional pixel position of the screen space to the world coordinates in the three-dimensional space, and the distance between the selected vertex and the picking position is calculated in the world coordinate system, so that the calculated distance is not affected by the depth, thereby improving the accuracy of vertex position determination.

[0011] In some embodiments, the formula for calculating the world coordinates of each vertex to be selected is as follows:

[0012] ndx=(px / height)*2-1

[0013] ndy=-(py / width)*2+1

[0014] ndcPosition=(ndx,ndy,d,1)

[0015] worldPosition=ViewProjectionInverseMatrix*ndcPosition

[0016] Among them, (px, py) represents the screen pixel coordinates of the selected vertex, height represents the screen height of the map, width represents the screen width of the map, ndcPosition represents the standardized device coordinates of the selected vertex, (ndx, ndy) represents the corresponding value of the screen pixel coordinates (px, py) of the selected vertex in the standardized device coordinate system, d represents the depth information of the selected vertex, worldPosition represents the world coordinates of the selected vertex, and ViewProjectionInverseMatrix represents the inverse matrix of the current projection matrix of the map.

[0017] In some embodiments, before performing the depth test according to the depth test range based on the picking position, the method further includes: changing the rendering mode of the picking position to a vertex rendering mode.

[0018] The embodiment of the present application takes into account that different rendering modes have an impact on the determination of the vertex position of the picking position. Therefore, before performing the depth test, the rendering mode is changed to the vertex rendering mode so that the result of the depth test only contains vertex information, thereby effectively picking up the vertices in the map, thereby improving the accuracy of the vertex position determination.

[0019] In some embodiments, after determining the vertex position using the candidate vertex, the method further includes: storing a mapping relationship between the picked position and the vertex position.

[0020] The embodiment of the present application stores the mapping relationship between the pick-up position and the determined vertex position, so that the vertex position can be quickly determined when the same pick-up position is clicked next time, thereby improving the efficiency of vertex position determination.

[0021] In some embodiments, the method further includes: if the expanded depth test range is greater than a preset maximum depth test range, issuing an alarm prompt.

[0022] The embodiment of the present application sets the maximum depth test range, indicating that the depth test range is not expanded infinitely, but the depth test range is reasonably expanded so that the vertex position finally determined is a reasonable vertex position, thereby improving the rationality of vertex position determination.

[0023] In a second aspect, an embodiment of the present application provides a vertex position determination device, which includes: an acquisition module for acquiring picking information of a map; the picking information includes a picking position and a picking object type; the picking information is generated to trigger a point on the map; a first determination module for determining a depth test range based on the picking object type; a depth test module for performing a depth test according to the depth test range based on the picking position; an expansion module for expanding the depth test range if there is no candidate vertex within a preset depth range in the depth test range, and performing a depth test on the expanded depth test range again until the candidate vertex is obtained; and a second determination module for determining the vertex position using the candidate vertex.

[0024] In a third aspect, an embodiment of the present application provides an electronic device, comprising: a processor, a memory, a storage medium and a bus, wherein the processor and the memory communicate with each other through the bus; the memory stores program instructions that can be executed by the processor, and the processor calls the program instructions to execute the method steps of the first aspect.

[0025] In a fourth aspect, an embodiment of the present application provides a non-transitory computer-readable storage medium, comprising: the computer-readable storage medium stores computer instructions, and the computer instructions enable the computer to execute the method steps of the first aspect.

[0026] In a fifth aspect, an embodiment of the present application provides a computer program product, including: a computer program, which executes the method steps of the first aspect when executed by a processor.

[0027] Other features and advantages of the present application will be described in the subsequent description, and in part will become apparent from the description, or will be understood by implementing the embodiments of the present application. BRIEF DESCRIPTION OF THE DRAWINGS

[0028] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings required for use in the embodiments of the present application will be briefly introduced below. It should be understood that the following drawings only show certain embodiments of the present application and therefore should not be regarded as limiting the scope. For ordinary technicians in this field, other related drawings can be obtained based on these drawings without paying creative work.

[0029] Figure 1 A flowchart of a vertex position determination method provided in an embodiment of the present application;

[0030] Figure 2 A schematic diagram of the structure of a vertex position determination device provided in an embodiment of the present application;

[0031] Figure 3 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0032] The following embodiments of the technical solution of the present application are described in detail in conjunction with the accompanying drawings. The following embodiments are only used to more clearly illustrate the technical solution of the present application, and are therefore only used as examples, and cannot be used to limit the scope of protection of the present application.

[0033] It should be noted that all technical and scientific terms used in this document have the same meanings as those generally understood by technicians in the technical field to which this application belongs; the terms used in this document are only for the purpose of describing specific embodiments and are not intended to limit this application; the terms "including" and "having" in the specification and claims of this application and the above-mentioned figure descriptions and any variations thereof are intended to cover non-exclusive inclusions.

[0034] In the description of the embodiments of the present application, the technical terms "first", "second", etc. are only used to distinguish different objects, and cannot be understood as indicating or implying relative importance or implicitly indicating the number, specific order or primary and secondary relationship of the indicated technical features. In the description of the embodiments of the present application, the meaning of "multiple" is more than two, unless otherwise clearly and specifically defined.

[0035] With the development of geographic information technology, Cesium has emerged as a high-performance 3D map display platform. Cesium is an open source JavaScript library for creating interactive 3D earth maps. It uses WebGL technology to render 3D graphics and can interact with various GIS data sources (such as GeoJSON, KML, TopoJSON, etc.). Cesium also supports a variety of map styles and themes, and can be integrated with various web frameworks (such as React, Vue.js, etc.).

[0036] In Cesium's traditional picking mode, the currently clicked model in the map can be picked up through the Graphics Processing Unit (GPU), but the GPU's picking capability is limited by its rendering pipeline, and it is usually only accurate to the pixel level, and each pixel may contain multiple triangles. Therefore, when a user clicks on a model, the GPU can quickly return the model corresponding to the clicked pixel, but cannot directly provide specific triangle information or precise location coordinates.

[0037] When the target position of the model in the map is determined by the central processing unit (CPU) ray picking method, the picking position is determined by calculating the intersection of the ray and the triangle patch. This method is accurate in theory, but it is limited by the precision of floating-point operations in practical applications, especially when dealing with complex three-dimensional models, such as oblique photography and building models, which often contain a large number of small triangle patches. Small errors will also be magnified, resulting in inaccurate picking results. Among them, triangle patches, or triangle meshes, are the basic geometric construction units used in computer graphics to simulate the surface of three-dimensional objects.

[0038] In response to the above problems, the present application provides a vertex position determination method, which determines the depth test range based on the picked object type, determines the vertex position within the depth test range, and selects the corresponding vertex position from the nearest vertices within a certain range of the picked position, thereby improving the accuracy of vertex position determination.

[0039] Figure 1A flowchart of a vertex position determination method provided in an embodiment of the present application is provided. It can be understood that the vertex position determination method provided in the embodiment of the present application can be applied to a terminal device (also referred to as an electronic device) and a server; wherein the terminal device can specifically be a smart phone, a tablet computer, a computer, a personal digital assistant (PDA), etc.; the server can specifically be an application server or a Web server. To facilitate understanding of the technical solution provided in the embodiment of the present application, the application scenario of the vertex position determination method provided in the embodiment of the present application is introduced below, taking the server as the execution subject as an example.

[0040] like Figure 1 As shown, the method includes:

[0041] Step S101, the server obtains the picking information of the map; the picking information includes the picking location and the picking object type; the picking information is generated by triggering a certain point on the map.

[0042] Optionally, since interactive 3D map models can be created based on Cesium, users can interact with them by clicking the mouse or hand.

[0043] For ease of understanding, the embodiments of the present application are described by taking an example in which a user interacts with a map created based on Cesium by clicking a mouse.

[0044] Before the server obtains the map's pickup information, it determines whether Cesium is in the pickup mode. If Cesium is in the map operation mode, such as map movement and zooming in, in order to successfully pick up the map location, it is necessary to change Cesium mode to the pickup mode.

[0045] In Cesium's picking mode, the user interacts with the map by clicking a point on the map with the mouse. The server obtains the current picking information of the map by listening to the mouse click event.

[0046] Pickup information refers to the event data about the operation that the server obtains and processes when the user clicks the mouse or touches the screen in the Cesium graphical interface. The event data includes the following:

[0047] Pickup location: usually includes the screen coordinates (x, y) of the mouse click. In Cesium, these screen coordinates are usually converted to latitude and longitude coordinates on the map or map projection coordinates.

[0048] Pickup object type: In Cesium maps, mouse clicks are usually associated with a visual object on the map (such as a point, line, surface, image layer, model, etc.). The pickup information may contain information about the clicked object, such as the object's ID, type, properties, contained data, etc.

[0049] View information: Information about the current view of the map, such as viewing angle, zoom level, etc., which helps determine the context when the click event occurs.

[0050] Time information: Recording the timestamp of mouse click events can be used to determine the order of click events and also help optimize performance. For example, by comparing timestamps, you can avoid processing too many click events in a short period of time.

[0051] Event Type: Indicates what type of mouse event occurred. For example: mouse down, mouse move, mouse release, etc.

[0052] Key information: If the click event involves a specific mouse button (such as left button, right button, middle button, etc.), this information will also be recorded.

[0053] Picking result: Cesium returns a picking result, which contains information such as the picked object entity, distance, coordinates, etc.

[0054] Scene information: The status of the current scene in Cesium, such as ambient light settings, atmosphere settings, etc.

[0055] Rendering state: The rendering state when the mouse is clicked, such as whether the vertex rendering mode is turned on.

[0056] Device information: records the input device information that generates click events, such as a mouse, touch screen, or other type of pointer device.

[0057] Error code: If an error occurs while processing a click event, the error code or status can be included in the pickup information for debugging or error handling purposes.

[0058] Step S102: The server determines a depth test range based on the type of the picked object.

[0059] Optionally, different picked object types may be in different depth ranges. For example, in a 3D scene, the background mountains in the distance and the buildings in the near distance are obviously in different depth ranges. Also, in a complex 3D scene, multiple objects may overlap or partially occlude each other.

[0060] Therefore, by setting corresponding reasonable depth test ranges for different types of picked objects, the vertices of the picked positions can be determined more individually to improve the accuracy of vertex position determination.

[0061] It should be noted that in this process, the depth test range determined by the server based on the picked object type is the initial depth test range pre-set based on the picked object type. In the subsequent depth test process, the depth test range can be dynamically expanded or reduced based on the initial depth test range.

[0062] Exemplarily, if the picked object type is a window in the building model, the depth test range determined by the server based on the picked object type is a 1*1 pixel range; if the picked object type is a door in the building model, the depth test range determined by the server based on the picked object type is a 2*2 pixel range.

[0063] Step S103: the server performs a depth test within a depth test range according to the pick-up position.

[0064] Optionally, after the depth test range is determined based on the type of the picked object, a depth test is performed within the determined depth test range with the picked position as the center.

[0065] For example, if the object type is a window, the depth test range is 1*1 pixel range, and the coordinates of the pick position are (x, y). During the depth test, the depth test is performed in the surrounding 1*1 pixel range with (x, y) as the center.

[0066] When performing depth testing, you can use a custom depth testing algorithm or Cesium's built-in depth testing algorithm to perform depth testing.

[0067] Step S104: If there is no candidate vertex within the preset depth range in the depth test range, the server expands the depth test range and performs a depth test on the expanded depth test range again until a candidate vertex is obtained.

[0068] Optionally, since the depth test range determined in the above steps is a preset initial depth test range, during the depth test process, there may not necessarily be vertices to be selected within the preset depth range within the initial depth test range.

[0069] For example, the candidate vertex that needs to be determined is the vertex whose depth information is between 0 and 1, but it does not exist in the initial depth test range. Considering that the mouse click is affected by the mouse operator, the position of the mouse click may be somewhat different from the target click position. At this time, in order to reasonably find the vertex position of the picking position, it is necessary to expand the depth test range on the basis of the initial depth test range, so as to find a reasonable vertex position as much as possible.

[0070] It should be noted that the "preset depth range" is a preset value, for example, the preset depth range is a depth information of 0-1. The specific setting can be made according to the actual situation.

[0071] To improve the computational efficiency during the depth test, after the depth test range is expanded, only the expanded part is depth tested. For example, the depth test range determined based on the type of picked object is 1*1, but no candidate vertex that meets the preset depth range is found within the 1*1 pixel range. In this case, the depth test range is expanded to 2*2. When the depth test is performed again on the expanded depth test range, only the area between 1*1 and 2*2 needs to be depth tested.

[0072] Step S105: The server determines the vertex position using the selected vertex.

[0073] Optionally, after obtaining the candidate vertices, the vertex positions are determined from the candidate vertices.

[0074] Vertex refers to the basic unit that constitutes the physical space data model. For example, in a geographic information system, the model is composed of multiple polygons, which are connected by vertices. Vertices usually contain position information, such as (x, y, z) coordinates. They can also include attribute information such as color, normal, texture coordinates, etc.

[0075] In the embodiment of the present application, the depth test range is determined by picking up the object type, and in the process of performing the depth test within the depth test range based on the picked position, if no candidate vertex that meets the requirements is found within the current depth test range, the depth test range is expanded, and the depth test is performed again to determine the position of the vertex from the candidate vertices that meet the requirements. Since the final vertex position is determined from the candidate vertices in this process, the accuracy of vertex position determination is improved.

[0076] In some embodiments, the server uses the candidate vertices to determine the vertex position, including: if there is one candidate vertex, the server renders the candidate vertex to determine the vertex position; if there are multiple candidate vertices, the server calculates the distance between each candidate vertex and the picking position, and renders the candidate vertex with the smallest distance from the picking position to determine the vertex position.

[0077] Optionally, since the depth test is performed within a depth test range, the range can be regarded as a small area around the picking position, and therefore, the number of selected vertices can be one or more.

[0078] When there is only one vertex to be selected, the vertex to be selected is rendered as the target vertex to determine the vertex position.

[0079] When there are multiple vertices to be selected, it is necessary to select the vertex closest to the picking position from the multiple vertices as the target vertex for rendering.

[0080] When rendering, you can use Cesium's Point primitive to render.

[0081] In the embodiment of the present application, when there is only one candidate vertex, the candidate vertex is directly rendered. When there are multiple candidate vertices, the candidate vertex closest to the pick position is rendered to determine the vertex position of the pick position. Since when there are multiple candidates, the candidate vertex with the smallest distance is used as the final vertex, the accuracy of vertex position determination is improved.

[0082] In some embodiments, calculating the distance between each candidate vertex and the picking position includes: calculating the world coordinates of each candidate vertex based on the depth information and screen coordinates of each candidate vertex; and calculating the distance between each candidate vertex and the picking position by using the world coordinates of each candidate vertex and the world coordinates of the picking position.

[0083] Optionally, when calculating the distance between each candidate vertex and the picking position, considering the depth of the candidate vertex, the screen pixels are very close, but the depth difference is too far, resulting in the final calculated distance not being the real physical distance. Therefore, the candidate vertex is reversed from the two-dimensional pixel position of the screen space to the world coordinate in the three-dimensional space, and the distance between the candidate vertex and the picking position is calculated in the world coordinate system.

[0084] The process of inferring the candidate vertex from the two-dimensional pixel position of the screen space to the world coordinate in the three-dimensional space is to calculate the world coordinate of each candidate vertex based on the depth information and the screen coordinate of each candidate vertex.

[0085] The formula for calculating the world coordinates of each vertex to be selected is as follows:

[0086] ndx=(px / height)*2-1

[0087] ndy=-(py / width)*2+1

[0088] ndcPosition=(ndx,ndy,d,1)

[0089] worldPosition=ViewProjectionInverseMatrix*ndcPosition

[0090] Among them, (px, py) represents the screen pixel coordinates of the selected vertex, height represents the screen height of the map, width represents the screen width of the map, ndcPosition represents the standardized device coordinates of the selected vertex, (ndx, ndy) represents the corresponding value of the screen pixel coordinates (px, py) of the selected vertex in the standardized device coordinate system, d represents the depth information of the selected vertex, worldPosition represents the world coordinates of the selected vertex, and ViewProjectionInverseMatrix represents the inverse matrix of the current projection matrix of the map.

[0091] Since worldPosition is a four-dimensional vector, it contains the position information and homogeneous coordinates in the world coordinate system, where the last component w is the homogeneous coordinate. In order to convert worldPosition into standard three-dimensional coordinates, the first three components of worldPosition need to be divided by w, that is, worldPosition / =worldPosition.w, where worldPosition.w represents the w component. Thus, the actual world coordinates are obtained.

[0092] After obtaining the world coordinates of each vertex to be selected, the distance between each vertex to be selected and the picking position is calculated by using the world coordinates of each vertex to be selected and the world coordinates of the picking position. The distance calculation can be performed using the Euclidean distance.

[0093] The embodiment of the present application takes into account the fact that there is depth in the selected vertex. The screen pixels are very close, but the depth difference is too far, resulting in that the finally calculated distance is not the real physical distance. Therefore, the selected vertex is reversed from the two-dimensional pixel position of the screen space to the world coordinates in the three-dimensional space, and the distance between the selected vertex and the picking position is calculated in the world coordinate system, so that the calculated distance is not affected by the depth, thereby improving the accuracy of vertex position determination.

[0094] In some embodiments, before performing the depth test according to the depth test range based on the picking position, the method further includes: changing the rendering mode of the picking position to a vertex rendering mode.

[0095] Optionally, although increasing the depth test range will increase the chance of capturing more vertices, if the rendering accuracy is not high enough, even if the vertex is within the depth test range, it may not be accurately captured. Therefore, if only increasing the depth test range, there may be omissions when obtaining vertex information.

[0096] Therefore, before performing depth testing by the depth test range, if the current rendering mode is not vertex rendering mode, change the rendering mode of the picked position to vertex rendering mode.

[0097] Among them, vertex rendering mode refers to a rendering method of graphics hardware, in which the attributes of each vertex (such as position, color, normal, etc.) are processed individually to achieve more complex rendering effects.

[0098] Therefore, through vertex rendering mode, since the attributes of each vertex, such as position, color, normal, etc., can be processed individually, the vertex can show richer details when rendered. For example, through per-vertex shading.

[0099] In addition, since vertex data can be directly manipulated, the amount of data transferred between the CPU and GPU can be reduced, thereby optimizing rendering performance. Especially when processing complex scenes, the complexity of the geometry can be effectively reduced, which can improve the rendering frame rate. In addition, the same vertex data can be shared by multiple triangles, reducing data redundancy.

[0100] The triangle rendering mode in the rendering mode is to render the surface of the model by triangles. Therefore, the vertex rendering mode can reduce unnecessary triangle drawing, thereby optimizing rendering efficiency and accuracy.

[0101] It should be noted that when the current rendering mode is changed to the vertex rendering mode, in addition to changing the rendering mode of the surrounding area of ​​the picking position, the rendering mode of the entire model including the picking position may also be changed.

[0102] The embodiment of the present application takes into account that different rendering modes have an impact on the determination of the vertex position of the picking position. Therefore, before performing the depth test, the rendering mode is changed to the vertex rendering mode so that the result of the depth test only contains vertex information, thereby effectively picking up the vertices in the map, thereby improving the accuracy of the vertex position determination.

[0103] In some embodiments, after determining the vertex position using the candidate vertex, the method further includes: storing a mapping relationship between the picked position and the vertex position.

[0104] Optionally, after the vertex position of the pick-up position is determined, the pick-up position and the corresponding vertex position may be associated, and the mapping relationship may be stored for quick access next time.

[0105] It should be noted that the mapping relationship can be stored in a cache or stored in a database for persistence, which can be set specifically according to actual conditions.

[0106] The embodiment of the present application stores the mapping relationship between the pick-up position and the determined vertex position, so that the vertex position can be quickly determined when the same pick-up position is clicked next time, thereby improving the efficiency of vertex position determination.

[0107] In some embodiments, the method further includes: if the expanded depth test range is greater than a preset maximum depth test range, issuing an alarm prompt.

[0108] Optionally, if the depth test range is infinitely expanded, even if the vertex to be selected is finally found, the reference of the vertex to be selected is low. Therefore, when the depth test range is expanded, the maximum depth test range is pre-set. When the expanded depth test range exceeds the preset maximum depth test range, the program stops running and issues an alarm, indicating that the vertex position of the pick position has not been found. This makes it easier for operators to troubleshoot problems.

[0109] It should be noted that the preset maximum depth test range can be specifically set according to actual conditions. For example, a 4*4 pixel range is set as the preset maximum depth test range.

[0110] The embodiment of the present application sets the maximum depth test range, indicating that the depth test range is not expanded infinitely, but the depth test range is reasonably expanded so that the vertex position finally determined is a reasonable vertex position, thereby improving the rationality of vertex position determination.

[0111] Figure 2 A schematic diagram of a structure of a vertex position determination device provided in an embodiment of the present application is shown in FIG. Figure 2 As shown, the device includes: an acquisition module 201, a first determination module 202, a depth test module 203, an expansion module 204 and a second determination module 205; wherein,

[0112] The acquisition module 201 is used to acquire the picking information of the map; the picking information includes the picking position and the picking object type; the picking information is generated by triggering a certain point on the map; the first determination module 202 is used to determine the depth test range based on the picking object type; the depth test module 203 is used to perform a depth test according to the depth test range according to the picking position; the expansion module 204 is used to expand the depth test range if there is no candidate vertex within the preset depth range in the depth test range, and perform a depth test on the expanded depth test range again until the candidate vertex is obtained; the second determination module 205 is used to determine the vertex position using the candidate vertex.

[0113] Based on the above embodiment, the second determination module 205 is specifically used for: if there is one vertex to be selected, the vertex to be selected is rendered to determine the vertex position; if there are multiple vertices to be selected, the distance between each vertex to be selected and the picking position is calculated, and the vertex to be selected with the smallest distance from the picking position is rendered to determine the vertex position.

[0114] Based on the above embodiment, the second determination module 205 is specifically used to: calculate the world coordinates of each candidate vertex based on the depth information and screen coordinates of each candidate vertex; calculate the distance between each candidate vertex and the picking position through the world coordinates of each candidate vertex and the world coordinates of the picking position.

[0115] Based on the above embodiment, in the second determination module 205, the formula for calculating the world coordinates of each vertex to be selected is as follows:

[0116] ndx=(px / height)*2-1

[0117] ndy=-(py / width)*2+1

[0118] ndcPosition=(ndx,ndy,d,1)

[0119] worldPosition=ViewProjectionInverseMatrix*ndcPosition

[0120] Among them, (px, py) represents the screen pixel coordinates of the selected vertex, height represents the screen height of the map, width represents the screen width of the map, ndcPosition represents the standardized device coordinates of the selected vertex, (ndx, ndy) represents the corresponding value of the screen pixel coordinates (px, py) of the selected vertex in the standardized device coordinate system, d represents the depth information of the selected vertex, worldPosition represents the world coordinates of the selected vertex, and ViewProjectionInverseMatrix represents the inverse matrix of the current projection matrix of the map.

[0121] Based on the above embodiment, the device further includes a changing module, which is used to change the rendering mode of the picking position to a vertex rendering mode.

[0122] Based on the above embodiment, the device further includes a storage module for storing the mapping relationship between the pick-up position and the vertex position.

[0123] On the basis of the above embodiment, the device further comprises an alarm module for issuing an alarm prompt if the expanded depth test range is greater than a preset maximum depth test range.

[0124] It should be understood that the device corresponds to the above-mentioned vertex position determination method embodiment and can execute the various steps involved in the above-mentioned method embodiment. The specific functions of the device can be found in the above description. To avoid repetition, the detailed description is appropriately omitted here. The device includes at least one software function module that can be stored in a memory in the form of software or firmware or fixed in the operating system (OS) of the device.

[0125] Figure 3 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application, such as Figure 3 As shown, the electronic device includes a processor 301 (processor), a memory 302 (memory) and a bus 303; wherein the processor 301 and the memory 302 communicate with each other through the bus 303. The processor 301 is used to call the program instructions in the memory 302 to execute the methods provided by the above-mentioned method embodiments.

[0126] The processor 301 can be an integrated circuit chip with signal processing capabilities. The above-mentioned processor 301 can be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), etc.; it can also be a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field-programmable gate array (FPGA) or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components. It can implement or execute various methods, steps and logic block diagrams disclosed in the embodiments of the present application. The general-purpose processor can be a microprocessor or the processor can also be any conventional processor, etc.

[0127] The memory 302 may include but is not limited to random access memory (RAM), read only memory (ROM), programmable read-only memory (PROM), erasable programmable read-only memory (EPROM), electrically erasable read-only memory (EEPROM), etc.

[0128] This embodiment discloses a computer program product, which includes a computer program stored on a non-transitory computer-readable storage medium. The computer program includes program instructions. When the program instructions are executed by a computer, the computer can execute the methods provided by the above-mentioned method embodiments.

[0129] This embodiment provides a non-transitory computer-readable storage medium, which stores computer instructions, and the computer instructions enable the computer to execute the methods provided by the above-mentioned method embodiments.

[0130] In the embodiments provided in the present application, it should be understood that the disclosed devices and methods can be implemented in other ways. The device embodiments described above are merely schematic. For example, the division of the units is only a logical function division. There may be other division methods in actual implementation. For example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some communication interfaces, and the indirect coupling or communication connection of the devices or units can be electrical, mechanical or other forms.

[0131] In addition, the units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.

[0132] Furthermore, the functional modules in the various embodiments of the present application may be integrated together to form an independent part, or each module may exist separately, or two or more modules may be integrated to form an independent part.

[0133] The above description is only an embodiment of the present application and is not intended to limit the protection scope of the present application. For those skilled in the art, the present application may have various modifications and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application shall be included in the protection scope of the present application.

Claims

1. A method for determining a vertex position, characterized in that: The method comprises: Acquire the pickup information of the map; the pickup information includes the pickup location and the type of the picked object; the pickup information is generated by triggering a certain point on the map; Determining a depth test range based on the picked object type; According to the pick-up position, a depth test is performed within the depth test range; If the depth test range does not contain a candidate vertex within the preset depth range, the depth test range is expanded, and the expanded depth test range is depth-tested again until the candidate vertex is obtained; The vertex position is determined using the candidate vertex.

2. The method according to claim 1, characterized in that The step of determining the vertex position by using the selected vertex comprises: If there is only one vertex to be selected, the vertex to be selected is rendered to determine the vertex position; If there are multiple vertices to be selected, the distance between each of the vertices to be selected and the picking position is calculated, and the vertex to be selected with the smallest distance from the picking position is rendered to determine the vertex position.

3. The method according to claim 2, wherein the calculating the distance between each of the to-be-selected vertices and the picking position comprises: Calculating the world coordinates of each of the to-be-selected vertices based on the depth information and the screen coordinates of each of the to-be-selected vertices; The distance between each of the to-be-selected vertices and the picking position is calculated by using the world coordinates of each of the to-be-selected vertices and the world coordinates of the picking position.

4. The method according to claim 3, characterized in that The formula for calculating the world coordinates of each of the selected vertices is as follows: ndx=(px / height)*2-1 ndy=-(py / width)*2+1 ndcPosition=(ndx,ndy,d,1) worldPosition=ViewProjectionInverseMatrix*ndcPosition Among them, (px, py) represents the screen pixel coordinates of the vertex to be selected, height represents the screen height of the map, width represents the screen width of the map, ndcPosition represents the standardized device coordinates of the vertex to be selected, (ndx, ndy) represents the corresponding value of the screen pixel coordinates (px, py) of the vertex to be selected in the standardized device coordinate system, d represents the depth information of the vertex to be selected, worldPosition represents the world coordinates of the vertex to be selected, and ViewProjectionInverseMatrix represents the inverse matrix of the current projection matrix of the map.

5. The method according to claim 1, characterized in that: Before performing the depth test according to the pick-up position and the depth test range, the method further includes: Changes the rendering mode of the picked position to vertex rendering mode.

6. The method according to claim 1, characterized in that After determining the vertex position by using the selected vertex, the method further includes: The mapping relationship between the pick-up position and the vertex position is stored.

7. The method according to any one of claims 1 to 6, characterized in that: The method further comprises: If the expanded depth test range is greater than the preset maximum depth test range, an alarm will be issued.

8. An electronic device, characterized in that: include: A processor and a memory, wherein the memory stores machine-readable instructions executable by the processor, and when the machine-readable instructions are executed by the processor, the method according to any one of claims 1 to 7 is performed.

9. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the method according to any one of claims 1 to 7 is executed.

10. A computer program product, characterized in that include: A computer program, wherein when the computer program is executed by a processor, the method according to any one of claims 1 to 7 is executed.