CN111135562B - Land parcel pickup method, apparatus, electronic device and computer readable storage medium - Google Patents

Land parcel pickup method, apparatus, electronic device and computer readable storage medium Download PDF

Info

Publication number
CN111135562B
CN111135562B CN201911364021.0A CN201911364021A CN111135562B CN 111135562 B CN111135562 B CN 111135562B CN 201911364021 A CN201911364021 A CN 201911364021A CN 111135562 B CN111135562 B CN 111135562B
Authority
CN
China
Prior art keywords
land
intersection point
terrain
screen
preset
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201911364021.0A
Other languages
Chinese (zh)
Other versions
CN111135562A (en
Inventor
许鸿
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing Pixel Software Technology Co Ltd
Original Assignee
Beijing Pixel Software Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Beijing Pixel Software Technology Co Ltd filed Critical Beijing Pixel Software Technology Co Ltd
Priority to CN201911364021.0A priority Critical patent/CN111135562B/en
Publication of CN111135562A publication Critical patent/CN111135562A/en
Application granted granted Critical
Publication of CN111135562B publication Critical patent/CN111135562B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • AHUMAN NECESSITIES
    • A63SPORTS; GAMES; AMUSEMENTS
    • A63FCARD, BOARD, OR ROULETTE GAMES; INDOOR GAMES USING SMALL MOVING PLAYING BODIES; VIDEO GAMES; GAMES NOT OTHERWISE PROVIDED FOR
    • A63F13/00Video games, i.e. games using an electronically generated display having two or more dimensions
    • A63F13/40Processing input control signals of video game devices, e.g. signals generated by the player or derived from the environment
    • A63F13/42Processing input control signals of video game devices, e.g. signals generated by the player or derived from the environment by mapping the input signals into game commands, e.g. mapping the displacement of a stylus on a touch screen to the steering angle of a virtual vehicle
    • A63F13/426Processing input control signals of video game devices, e.g. signals generated by the player or derived from the environment by mapping the input signals into game commands, e.g. mapping the displacement of a stylus on a touch screen to the steering angle of a virtual vehicle involving on-screen location information, e.g. screen coordinates of an area at which the player is aiming with a light gun

Landscapes

  • Engineering & Computer Science (AREA)
  • Multimedia (AREA)
  • Human Computer Interaction (AREA)
  • Processing Or Creating Images (AREA)

Abstract

The invention provides a land parcel pickup method, a land parcel pickup device, an electronic device and a computer readable storage medium, which relate to the technical field of game tool development, wherein the land parcel pickup method is executed by the electronic device and comprises the following steps: dividing the terrain to be divided according to a preset direction and a preset size to obtain a plurality of plots; if the screen contact point of the user aiming at the electronic equipment is detected, screen coordinates corresponding to the screen contact point are obtained, and a target ray is determined based on the screen coordinates and preset camera origin coordinates; the starting point of the target ray is the origin coordinate of the camera, and the target ray passes through the screen coordinate; judging whether the intersection point exists between the target ray and the terrain; if so, picking up a target land block from a plurality of land blocks according to a binary search algorithm, the position of the intersection point and a preset direction; the target land block is the land block where the intersection point is located. The embodiment of the invention improves the land parcel pickup efficiency, is beneficial to a user to pick up the land parcel more quickly, and improves the user experience.

Description

Land parcel pickup method, apparatus, electronic device and computer readable storage medium
Technical Field
The present invention relates to the field of games, and in particular, to a land parcel pickup method, apparatus, electronic device, and computer readable storage medium.
Background
In a game scene, there are usually some models around which virtual characters controlled by players are not allowed to pass, so when the models are put, the models are usually put through brushing blocking blocks around some models, and in game terrain editing, quick pick-up technology for plots is used for manufacturing the blocking blocks. The method is characterized in that the method is realized by constructing the plots and searching the plots, a plurality of plots are constructed on the terrain and are searched one by one in the prior art when the plots are picked up, and each plot is required to be searched when the plots to be picked up are searched, so that the searching efficiency is low. Aiming at the problem of the land parcel pickup method in practical application, no effective solution is proposed at present.
Disclosure of Invention
The invention aims to provide a land parcel pickup method, a land parcel pickup device, electronic equipment and a computer readable storage medium, which effectively improve the land parcel pickup efficiency, are beneficial to a user to pick up land parcel more quickly and improve the user experience.
In a first aspect, an embodiment of the present invention provides a land parcel pickup method, which is executed by an electronic device, and includes: dividing the terrain to be divided according to a preset direction and a preset size to obtain a plurality of plots; if the screen contact point of the user aiming at the electronic equipment is detected, screen coordinates corresponding to the screen contact point are obtained, and a target ray is determined based on the screen coordinates and preset camera origin coordinates; the starting point of the target ray is the origin coordinate of the camera, and the target ray passes through the screen coordinate; judging whether the intersection point exists between the target ray and the terrain; if so, picking up a target land block from a plurality of land blocks according to a binary search algorithm, the position of the intersection point and a preset direction; the target land block is the land block where the intersection point is located.
Further, the preset direction includes a first direction and a second direction; the preset size comprises a first size and a second size; the first dimension and the second dimension are the same or different; dividing the terrain to be divided according to a preset direction and a preset size to obtain a plurality of plots, wherein the method comprises the following steps: dividing the terrain to be divided along a first direction based on the first size to obtain a plurality of first blocks; dividing the terrain to be divided along a second direction based on the second size to obtain a plurality of second blocks; obtaining a plurality of plots based on the plurality of first chunks and the plurality of second chunks; each plot is the intersection of a first chunk and a second chunk. Further, the step of sorting the plurality of plots according to the preset direction to obtain the plot serial number further includes: and storing the transverse serial numbers and the longitudinal serial numbers of the plurality of plots.
Further, the screen coordinates are two-dimensional coordinates in a screen coordinate system; the method for determining the target rays based on the screen coordinates and the preset camera origin coordinates comprises the following steps: converting the screen coordinates into corresponding three-dimensional coordinates in a world coordinate system; and determining the target ray based on the corresponding three-dimensional coordinate in the world coordinate system and the preset camera origin coordinate.
Further, the step of picking up the target land parcel from the plurality of land parcels according to the binary search algorithm, the position of the intersection point and the preset direction includes: acquiring the intersection point coordinates of the target rays and the terrain; based on the intersection point coordinates, performing binary search in a plurality of plots according to the first direction and the second direction respectively until the plot where the intersection point coordinates are located is found; and determining the searched land block as a target land block.
Further, the step of performing binary search in the plurality of plots according to the first direction and the second direction based on the intersection point coordinates until the plot where the intersection point coordinates are located is found, includes: based on the coordinate value of the intersection point coordinate in the first direction, performing binary search on a plurality of first blocks in the first direction until a first land area range where the intersection point coordinate in the first direction is located is searched; based on the coordinate value of the intersection point coordinate in the second direction, performing binary search on a plurality of second blocks in the second direction until a second land parcel range in which the intersection point coordinate in the second direction is located is searched; and obtaining the land block where the intersection point coordinates are located according to the determined first land block range and the determined second land block range.
Further, the above method is applied to a game building editor.
In a second aspect, an embodiment of the present invention provides a land parcel pickup apparatus, including:
the terrain dividing module is used for dividing the land block to be divided according to the preset direction and the preset size to obtain a plurality of land blocks; the ray determination module is used for acquiring screen coordinates corresponding to the screen contact if the screen contact of the user for the electronic equipment is detected, and determining target rays based on the screen coordinates and preset camera origin coordinates; the starting point of the target ray is the origin coordinate of the camera, and the target ray passes through the screen coordinate; the judging module is used for judging whether the ray and the land block have an intersection point or not; the land parcel pickup module is used for picking up a target land parcel from a plurality of land parcels according to a binary search algorithm, the position of the intersection point and a preset direction when the intersection point exists between the ray and the land parcel; the target land block is the land block where the intersection point is located.
Further, the preset direction includes a first direction and a second direction; the preset size comprises a first size and a second size; the first dimension and the second dimension are the same or different; the terrain dividing module is used for: dividing the terrain to be divided along a first direction based on the first size to obtain a plurality of first blocks; dividing the terrain to be divided along a second direction based on the second size to obtain a plurality of second blocks; obtaining a plurality of plots based on the plurality of first chunks and the plurality of second chunks; each plot is an intersection of a first chunk and a second chunk.
In a third aspect, an embodiment of the present invention provides an electronic device, including a processor and a memory, the memory storing computer executable instructions executable by the processor, the processor executing the computer executable instructions to implement the steps of the plot picking method of any of the previous embodiments.
In a fourth aspect, embodiments of the present invention provide a computer readable storage medium having a computer program stored thereon, which when executed by a processor performs the steps of the plot picking method of any of the preceding embodiments.
The invention provides a land parcel pickup method, a land parcel pickup device, electronic equipment and a computer readable storage medium, wherein a terrain to be divided is divided according to a preset direction and a preset size to obtain a plurality of land parcels; if the screen contact point of the user aiming at the electronic equipment is detected, screen coordinates corresponding to the screen contact point are obtained, and a target ray is determined based on the screen coordinates and the preset camera origin coordinates (the starting point is the camera origin coordinates, and the target ray passes through the screen coordinates); and finally, when judging that the intersection point is formed between the target ray and the terrain, picking up the target land block (the land block where the intersection point is located) from the plurality of land blocks according to a binary search algorithm, the position of the intersection point and the preset direction. According to the method provided by the embodiment, the implementation mode of dividing the terrain to be divided according to the preset direction and the preset size is simple, the land block data can be quickly constructed, the land block where the intersection point is located is searched according to the preset direction by using the binary search algorithm, the searching speed can be effectively improved, the land block picking efficiency is comprehensively improved in the above mode, a user can pick up the land block more quickly, and the user experience is improved.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings that are needed in the description of the embodiments or the prior art will be briefly described, and it is obvious that the drawings in the description below are some embodiments of the present invention, and other drawings can be obtained according to the drawings without inventive effort for a person skilled in the art.
Fig. 1 is a schematic flow chart of a land parcel pickup method according to an embodiment of the present invention;
FIG. 2 is a schematic flow chart of another method for picking up plots according to an embodiment of the present invention;
FIG. 3a is a schematic diagram of dividing a terrain to be divided according to an X-axis direction according to an embodiment of the present invention;
FIG. 3b is a schematic diagram of dividing a terrain to be divided according to a Z-axis direction according to an embodiment of the present invention;
FIG. 3c is a schematic diagram of determining a target plot according to an embodiment of the present invention;
fig. 4 is a schematic structural diagram of a land parcel pickup apparatus according to an embodiment of the present invention;
fig. 5 is a schematic structural diagram of an electronic device according to an embodiment of the present invention.
Detailed Description
For the purpose of making the objects, technical solutions and advantages of the embodiments of the present invention more apparent, the technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings in the embodiments of the present invention, and it is apparent that the described embodiments are some embodiments of the present invention, but not all embodiments of the present invention. The components of the embodiments of the present invention generally described and illustrated in the figures herein may be arranged and designed in a wide variety of different configurations.
Considering that when models are placed in a game scene, in order to make the surroundings of some models not allow players to pass, a blocking block is brushed around the models, and then a land parcel picking method is used, and when a land parcel is picked up in the prior art, the following mode is generally used for picking up: generating land block data according to the size of the terrain, intersecting the rays generated by clicking the screen with each land block through a mouse, intersecting the rays generated by clicking the screen with the land block data, and if the rays are obtained, determining that the land block to be picked up is found. However, the method can pick up the plots only by intersecting each plot, and has low searching efficiency.
For the convenience of understanding the present embodiment, first, a detailed description will be given of a block picking method disclosed in the present embodiment, referring to a schematic flow chart of a block picking method shown in fig. 1, the block picking method is executed by an electronic device, and mainly includes the following steps S102 to S108:
step S102: dividing the terrain to be divided according to the preset direction and the preset size to obtain a plurality of plots.
The terrain to be divided is the terrain to be divided into plots, when a certain position on the terrain needs to be searched, the terrain is divided firstly to obtain a plurality of plots, the plots to be picked up are planes, so that the preset direction can be the horizontal direction in one plane or the vertical direction in one plane, when the terrain is divided, the preset can be determined according to the size of the terrain and the size of the picked-up plots, when the plots to be picked up are larger in the larger terrain, the preset size can be set to be larger, and when the plots to be picked up are smaller or the positions of the plots to be picked up need to be very accurate, the smaller size can be set.
Step S104: if the screen contact point of the user aiming at the electronic equipment is detected, screen coordinates corresponding to the screen contact point are obtained, and a target ray is determined based on the screen coordinates and preset camera origin coordinates; the starting point of the target ray is the origin coordinate of the camera, and the target ray passes through the screen coordinate.
In one embodiment, the picked-up land parcels are picked up by clicking the screen with the mouse, when the user clicks the screen, the screen coordinates are obtained based on the touch point of the screen clicked by the user, and the screen coordinates at this time are the positions of the screen clicked by the user mapped to the positions in the game terrain.
Step S106: and judging whether the intersection point exists between the target ray and the terrain. If yes, step S108 is executed, and if no, the process ends.
Judging whether the rays and the terrain have intersection points, if not, indicating that the land is not picked up, if so, indicating that the land is picked up, and further searching the position of the picked up land through step S108.
Step S108: picking up a target land block from a plurality of land blocks according to a binary search algorithm, the position of the intersection point and a preset direction; the target land block is the land block where the intersection point is located.
For example, when the intersection point exists between the ray and the terrain, binary search is performed according to the preset direction based on the obtained intersection point, for example, binary search is performed in the horizontal direction to obtain the position of the intersection point in the horizontal direction, binary search is performed in the vertical direction to obtain the position of the intersection point in the vertical direction, and the land block where the intersection point is located is determined in a plurality of land blocks based on the results of the binary search, so that the target land block is picked up, and in a specific embodiment, the target land block can be used as a blocking block in the game model.
According to the land parcel pickup method provided by the invention, firstly, the terrain to be divided is divided according to the preset direction and the preset size to obtain a plurality of land parcel; if the screen contact point of the user aiming at the electronic equipment is detected, screen coordinates corresponding to the screen contact point are obtained, and a target ray is determined based on the screen coordinates and the preset camera origin coordinates (the starting point is the camera origin coordinates, and the target ray passes through the screen coordinates); and finally, when judging that the intersection point is formed between the target ray and the terrain, picking up the target land block (the land block where the intersection point is located) from the plurality of land blocks according to a binary search algorithm, the position of the intersection point and the preset direction. According to the method provided by the embodiment, the implementation mode of dividing the terrain to be divided according to the preset direction and the preset size is simple, the land block data can be quickly constructed, the land block where the intersection point is located is searched according to the preset direction by using the binary search algorithm, the searching speed can be effectively improved, the land block picking efficiency is comprehensively improved in the above mode, a user can pick up the land block more quickly, and the user experience is improved.
In order to facilitate understanding of step S102 in the foregoing embodiment, the embodiment of the present invention provides a specific implementation manner for dividing a terrain to be divided, where the terrain to be divided is divided according to the foregoing preset dimensions and preset directions, and the preset directions include a first direction and a second direction, and the preset dimensions include a first dimension and a second dimension, and may be set according to actual situations in practical applications, and are not limited to the foregoing situations. And obtaining a plurality of finally divided land parcels based on the preset direction and the preset size division result. The specific implementation manner of the step S102 mainly includes the following steps a to c:
step a: based on the first size, the terrain to be divided is divided along a first direction, and a plurality of first blocks are obtained.
Step b: dividing the terrain to be divided along a second direction based on the second size to obtain a plurality of second blocks;
in one embodiment, when the first size and the second size are the same, the divided land is square, and in another embodiment, the divided land is rectangular when the first size and the second size are different. For example, the preset direction on one plane may be a horizontal direction and a vertical direction, a first direction may be a horizontal direction, and a second direction may be a vertical direction, and in one coordinate system, the preset direction may be two directions of different coordinate axes, where the first direction may be an x-axis direction and the second direction may be a y-axis direction, which are set according to a specific manner. The first block is divided according to the first size and the first direction, and the second block is divided according to the second size and the second direction.
Step c: obtaining a plurality of plots based on the plurality of first chunks and the plurality of second chunks; each plot is the intersection of a first chunk and a second chunk.
And obtaining an intersection of the first block and the second block on the terrain according to the plurality of first blocks and the plurality of second blocks which are obtained by dividing, and obtaining a plurality of divided plots according to the obtained intersection of the blocks.
In order to facilitate understanding of step S104 in the above embodiment, the embodiment of the present invention provides a specific implementation manner of acquiring the target ray, by converting the screen coordinates into three-dimensional coordinates in the world coordinate system, and obtaining the target ray passing through the screen coordinates based on the camera origin coordinates. The specific implementation method of the step S104 mainly includes the following (1) to (2):
(1) Converting the screen coordinates into corresponding three-dimensional coordinates in a world coordinate system;
in game image processing, stereoscopic vision and other directions, a screen coordinate system, a world coordinate system and the like are often involved, screen coordinates obtained by clicking a screen are two-dimensional coordinates under the screen coordinate system, in game topography, plots are all in a three-dimensional space, so that whether plots can be picked up is judged, the two-dimensional screen coordinates need to be converted into the three-dimensional coordinates, in game interface editing, plot data are located under the world coordinate system, so that the screen coordinates need to be converted into the world coordinate system, the world coordinate system is used for describing positions of a camera and an object, the world coordinate system, in addition, a device coordinate system, a physical coordinate system and the like are also used in game interface editing, and in the embodiment of the invention, the description is not expanded.
(2) And determining a target ray based on the corresponding three-dimensional coordinates in the world coordinate system and the preset camera origin coordinates.
The pictures in the game are all presented through the camera, the camera is positioned at the original point position in the three-dimensional space, and a ray is determined according to the corresponding three-dimensional coordinates obtained through conversion of the screen coordinates and the original point coordinates of the camera and passes through the screen coordinates generated through clicking of the mouse.
In order to facilitate understanding of step S108 in the foregoing embodiment, the embodiment of the present invention provides a specific implementation manner of picking up a land parcel, where the land parcel where the intersection point coordinate is located is obtained by acquiring the intersection point coordinate of the target ray and the terrain, and performing binary search in a preset direction based on the intersection point coordinate, that is, the target land parcel. The specific implementation manner of the step S108 mainly includes the following steps 1 to 3:
step 1: and acquiring the intersection point coordinates of the target ray and the terrain.
Step 2: and based on the intersection point coordinates, performing binary search in the plurality of plots according to the first direction and the second direction respectively until the plot where the intersection point coordinates are located is found, and determining the found plot as a target plot.
For ease of understanding, step 2 may further comprise steps 2.1 to 2.3:
step 2.1: and carrying out binary search on a plurality of first blocks in the first direction based on the coordinate value of the intersection point coordinate in the first direction until a first land parcel range where the intersection point coordinate in the first direction is located is searched. For example, when the intersection point coordinate is (1, 3), the first direction is the x-axis, and the first size is 2, it can be determined that the intersection point coordinate is located within the plot range of 0 to 2 in the x-direction, that is, the first plot range.
Step 2.2: and carrying out binary search on a plurality of second blocks in the second direction based on the coordinate value of the intersection point coordinate in the second direction until a second land parcel range in which the intersection point coordinate in the second direction is located is searched. For example, when the intersection point coordinate is (1, 3), the second direction is the y-axis, and the first size is 2, it can be determined that the intersection point coordinate is located within the parcel range of 2 to 4 in the y-direction, that is, the second parcel range.
Step 2.3: and obtaining the land block where the intersection point coordinates are located according to the determined first land block range and the determined second land block range.
Because the plots in each direction are numbered according to the sequence, the plots are searched in the first direction and the second direction by adopting a binary search algorithm, and the searching efficiency of searching the plots with the intersection point coordinates in the plots is improved.
The land parcel pickup method can be applied to a building editor of a game.
In summary, the embodiment of the invention obtains a plurality of first chunks based on the first size and the first direction, obtains a plurality of second chunks based on the second size and the second direction, obtains a plurality of plots based on the first chunks and the second chunks, converts screen coordinates obtained based on a trigger screen into three-dimensional coordinates in a world coordinate system, determines a target ray according to the corresponding three-dimensional coordinates and a preset origin coordinate of a camera, judges whether an intersection point exists between the target ray and the terrain, determines the intersection point coordinates if the intersection point exists, searches the plots where the intersection point coordinates exist according to the first direction and the second direction by using a binary search algorithm, and determines the searched plots as the picked target plots. Through setting up first direction and second direction to and first size and second size divide the mode of topography, can be more convenient divide the plot, because carry out the halving respectively in first direction and second direction and seek, pick up the plot that can be quick. Therefore, the embodiment of the invention improves the land parcel pickup efficiency, is beneficial to a user to pick up the land parcel more quickly, and improves the user experience.
For easy understanding, the embodiment of the present invention provides a specific example of applying the foregoing land parcel pickup method, where the example is described taking a pickup blocking block in a game terrain as a pickup target land parcel, and in a specific implementation, reference may be made to a schematic flow chart of another land parcel pickup method shown in fig. 2, and the method mainly includes the following steps S202 to S214:
step S202: the game terrain is divided according to the directions of the X axis and the Z axis.
For easy understanding, the embodiment of the invention shows a schematic diagram of a specific land parcel pickup method, taking a preset size of 1 in a game scene, a preset direction of Z axis and X axis as an example, refer to a schematic diagram of dividing a land parcel to be divided according to the X axis direction shown in fig. 3a, divide a land parcel according to the X axis direction to obtain 4 land parcel with a width of 1 and a length of 4, refer to a schematic diagram of dividing a land parcel to be divided according to the Z axis direction shown in fig. 3b, and divide the 4 land parcel according to the Z axis direction to obtain a land parcel 4*4 on the land parcel. The above-mentioned method of dividing the land may adopt a method of constructing a structure, and the land information divided in the Z-axis direction is stored in the array 1 of the structure in the order from top to bottom, and the land information divided in the X-axis direction is stored in the array 2 of the structure in the order from left to right.
Step S204: rays emitted by the camera origin coordinates and passing through the screen coordinates are obtained based on the screen coordinates.
In one embodiment, when the mouse clicks on the screen, screen coordinates are generated, two-dimensional screen coordinates obtained by the screen coordinates in the screen coordinate system are back calculated into real three-dimensional space coordinates in the object coordinate system, and then a ray is determined based on the origin coordinates of the camera and the screen coordinates, wherein the ray is a ray passing through the screen coordinates. Judging whether the ray and the terrain have an intersection point, if not, not picking up the land block, and if so, obtaining an intersection point coordinate.
Step S206: whether the ray intersects the terrain is judged, if yes, step S208 is executed, and if no, step 214 is executed.
Step S208: and obtaining an intersection point coordinate according to the intersection point of the ray and the terrain, and performing binary search on the Z axis to obtain the land parcel range of the Z axis.
And performing binary search in the array 1 according to the obtained intersection point coordinates to obtain a land parcel range on the Z axis, thereby determining the final target land parcel range. For example, referring to a schematic diagram of determining a target plot shown in fig. 3c, in the topography of 4*4, when the intersection point of the ray and the topography is located at the "+" position in fig. 3c, the plots divided in the Z-axis direction may be first searched for two halves, so as to determine the plot whose coordinate of the intersection point is located in the Z-axis (1, 2) range.
Step S210: and obtaining an intersection point coordinate according to the intersection point of the ray and the terrain, and performing binary search on the Z axis to obtain the land parcel range of the X axis.
According to the obtained intersection point coordinates, performing binary search in the array 2 to obtain a land block range of an X axis, and in the topography of 4*4, when the intersection point of the ray and the topography is positioned at a "+" position in fig. 3c, binary search can be performed on the land block divided in the Z axis direction first to determine the land block of which the intersection point coordinates are positioned in the X axis (2, 3) range.
Step S212: and obtaining the land area where the intersection point coordinates are located according to the land area of the Z axis and the land area of the X axis, namely the picked-up blocking block.
And determining a finally picked target land block according to the Z-axis range (1, 2) and the X-axis range (2, 3) obtained by searching, wherein the target land block is the land block position of the dotted line frame in fig. 3 c.
Step S214: it is determined that no blocking piece is picked up.
If the ray and terrain have no intersection, it is determined that no blocking object has been picked up.
Based on the above-mentioned land parcel pickup method, the embodiment of the present invention further provides a land parcel pickup apparatus corresponding to the above-mentioned land parcel pickup method, referring to a schematic structure diagram of the land parcel pickup apparatus shown in fig. 4, the apparatus mainly includes the following modules:
the terrain dividing module 402 is configured to divide a block to be divided according to a preset direction and a preset size to obtain a plurality of blocks;
the ray determination module 404 is configured to, if a screen contact point of the user for the electronic device is detected, acquire screen coordinates corresponding to the screen contact point, and determine a target ray based on the screen coordinates and a preset camera origin coordinate; the starting point of the target ray is the origin coordinate of the camera, and the target ray passes through the screen coordinate;
a judging module 406, configured to judge whether the ray has an intersection with the plot;
the plot picking module 408 is configured to pick up a target plot from the plurality of plots according to a binary search algorithm, a position of the intersection point, and a preset direction when the ray has the intersection point with the plot; the target land block is the land block where the intersection point is located.
The land parcel pickup device provided by the invention firstly divides a terrain to be divided according to a preset direction and a preset size to obtain a plurality of land parcel; if the screen contact point of the user aiming at the electronic equipment is detected, screen coordinates corresponding to the screen contact point are obtained, and a target ray is determined based on the screen coordinates and the preset camera origin coordinates (the starting point is the camera origin coordinates, and the target ray passes through the screen coordinates); and finally, when judging that the intersection point is formed between the target ray and the terrain, picking up the target land block (the land block where the intersection point is located) from the plurality of land blocks according to a binary search algorithm, the position of the intersection point and the preset direction. According to the method provided by the embodiment, the implementation mode of dividing the terrain to be divided according to the preset direction and the preset size is simple, the land block data can be quickly constructed, the land block where the intersection point is located is searched according to the preset direction by using the binary search algorithm, the searching speed can be effectively improved, the land block picking efficiency is comprehensively improved in the above mode, a user can pick up the land block more quickly, and the user experience is improved.
In one embodiment, the terrain dividing module 402 is further configured to divide the terrain to be divided along the first direction based on the first size to obtain a plurality of first chunks; dividing the terrain to be divided along a second direction based on the second size to obtain a plurality of second blocks; obtaining a plurality of plots based on the plurality of first chunks and the plurality of second chunks; each plot is an intersection of a first chunk and a second chunk.
In one embodiment, the ray determination module 404 is further configured to convert the screen coordinates to corresponding three-dimensional coordinates in the world coordinate system; and determining the target ray based on the corresponding three-dimensional coordinate in the world coordinate system and the preset camera origin coordinate.
In one embodiment, the block pickup module 408 is further configured to obtain coordinates of an intersection of the target ray and the terrain; based on the intersection point coordinates, performing binary search in a plurality of plots according to the first direction and the second direction respectively until the plot where the intersection point coordinates are located is found; and determining the searched land block as a target land block.
In one embodiment, the block pickup module 408 is further configured to perform binary search on the plurality of first chunks in the first direction based on the coordinate value of the intersection point coordinate in the first direction until a first block range in which the intersection point coordinate in the first direction is located is found; based on the coordinate value of the intersection point coordinate in the second direction, performing binary search on a plurality of second blocks in the second direction until a second land parcel range in which the intersection point coordinate in the second direction is located is searched; and obtaining the land block where the intersection point coordinates are located according to the determined first land block range and the determined second land block range.
The device provided by the embodiment of the present invention has the same implementation principle and technical effects as those of the foregoing method embodiment, and for the sake of brevity, reference may be made to the corresponding content in the foregoing method embodiment where the device embodiment is not mentioned.
The device is an electronic device, and specifically, the electronic device comprises a processor and a storage device; the storage means has stored thereon a computer program which, when executed by the processor, performs the method of any of the embodiments described above.
Fig. 5 is a schematic structural diagram of an electronic device according to an embodiment of the present invention, where the electronic device 100 includes: a processor 50, a memory 51, a bus 52 and a communication interface 53, the processor 50, the communication interface 53 and the memory 51 being connected by the bus 52; the processor 50 is arranged to execute executable modules, such as computer programs, stored in the memory 51.
The memory 51 may include a high-speed random access memory (RAM, random Access Memory), and may further include a non-volatile memory (non-volatile memory), such as at least one magnetic disk memory. The communication connection between the system network element and at least one other network element is achieved via at least one communication interface 53 (which may be wired or wireless), and the internet, wide area network, local network, metropolitan area network, etc. may be used.
Bus 52 may be an ISA bus, a PCI bus, an EISA bus, or the like. The buses may be classified as address buses, data buses, control buses, etc. For ease of illustration, only one bi-directional arrow is shown in FIG. 5, but not only one bus or type of bus.
The memory 51 is configured to store a program, and the processor 50 executes the program after receiving an execution instruction, and the method executed by the apparatus for flow defining disclosed in any of the foregoing embodiments of the present invention may be applied to the processor 50 or implemented by the processor 50.
The processor 50 may be an integrated circuit chip having signal processing capabilities. In implementation, the steps of the above method may be performed by integrated logic circuitry in hardware in the processor 50 or by instructions in the form of software. The processor 50 may be a general-purpose processor, including a central processing unit (Central Processing Unit, CPU), a network processor (Network Processor, NP), etc.; but may also be a digital signal processor (Digital Signal Processing, DSP for short), application specific integrated circuit (Application Specific Integrated Circuit, ASIC for short), off-the-shelf programmable gate array (Field-Programmable Gate Array, FPGA for short), or other programmable logic device, discrete gate or transistor logic device, discrete hardware components. The disclosed methods, steps, and logic blocks in the embodiments of the present invention may be implemented or performed. A general purpose processor may be a microprocessor or the processor may be any conventional processor or the like. The steps of the method disclosed in connection with the embodiments of the present invention may be embodied directly in the execution of a hardware decoding processor, or in the execution of a combination of hardware and software modules in a decoding processor. The software modules may be located in a random access memory, flash memory, read only memory, programmable read only memory, or electrically erasable programmable memory, registers, etc. as well known in the art. The storage medium is located in a memory 51 and the processor 50 reads the information in the memory 51 and in combination with its hardware performs the steps of the above method.
The embodiment of the invention provides a method, a device, an electronic device and a computer program product of a computer readable storage medium, which comprises the computer readable storage medium storing nonvolatile program codes executable by a processor, wherein the computer readable storage medium stores a computer program, and when the computer program is executed by the processor, the method described in the previous method embodiment is executed, and specific implementation can be seen in the method embodiment and will not be repeated herein.
It will be clear to those skilled in the art that, for convenience and brevity of description, the specific working process of the system described above may refer to the corresponding process in the foregoing embodiment, which is not described in detail herein.
The computer program product of the readable storage medium provided by the embodiment of the present invention includes a computer readable storage medium storing a program code, where the program code includes instructions for executing the method described in the foregoing method embodiment, and specific implementation may refer to the method embodiment and will not be described herein.
The functions, if implemented in the form of software functional units and sold or used as a stand-alone product, may be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention may be embodied essentially or in a part contributing to the prior art or in a part of the technical solution, in the form of a software product stored in a storage medium, comprising several instructions for causing a computer device (which may be a personal computer, a server, a network device, etc.) to perform all or part of the steps of the method according to the embodiments of the present invention. And the aforementioned storage medium includes: a U-disk, a removable hard disk, a Read-Only Memory (ROM), a random access Memory (RAM, random Access Memory), a magnetic disk, or an optical disk, or other various media capable of storing program codes.
Thus, the following detailed description of the embodiments of the invention, as presented in the figures, is not intended to limit the scope of the invention, as claimed, but is merely representative of selected embodiments of the invention. All other embodiments, which can be made by those skilled in the art based on the embodiments of the invention without making any inventive effort, are intended to be within the scope of the invention.
It should be noted that: like reference numerals and letters denote like items in the following figures, and thus once an item is defined in one figure, no further definition or explanation thereof is necessary in the following figures.
In the description of the present invention, it should be noted that the azimuth or positional relationship indicated by the terms "vertical", "horizontal", etc. are based on the azimuth or positional relationship shown in the drawings, or the azimuth or positional relationship in which the inventive product is conventionally put in use, are merely for convenience of describing the present invention and simplifying the description, and are not indicative or implying that the apparatus or element to be referred to must have a specific azimuth, be configured and operated in a specific azimuth, and therefore, should not be construed as limiting the present invention. Furthermore, the terms "first," "second," and the like, are used merely to distinguish between descriptions and should not be construed as indicating or implying relative importance.
Furthermore, the terms "horizontal," "vertical," and the like do not denote a requirement that the component be absolutely horizontal or overhang, but rather may be slightly inclined. As "horizontal" merely means that its direction is more horizontal than "vertical", and does not mean that the structure must be perfectly horizontal, but may be slightly inclined.
Finally, it should be noted that: the above embodiments are only for illustrating the technical solution of the present invention, and not for limiting the same; although the invention has been described in detail with reference to the foregoing embodiments, it will be understood by those of ordinary skill in the art that: the technical scheme described in the foregoing embodiments can be modified or some or all of the technical features thereof can be replaced by equivalents; such modifications and substitutions do not depart from the spirit of the invention.

Claims (5)

1. A method of parcel pickup, the method being performed by an electronic device and applied to a construction editor for games, the method comprising:
dividing the terrain to be divided according to a preset direction and a preset size to obtain a plurality of plots; the preset direction comprises a first direction and a second direction; the preset size comprises a first size and a second size; the first dimension and the second dimension are the same or different;
if a screen contact point of a user aiming at the electronic equipment is detected, acquiring screen coordinates corresponding to the screen contact point, and determining a target ray based on the screen coordinates and preset camera origin coordinates; the starting point of the target ray is the origin coordinate of the camera, and the target ray passes through the screen coordinate;
judging whether the target ray and the terrain have an intersection point or not;
if the intersection point exists, acquiring an intersection point coordinate of the target ray and the terrain; based on the coordinate value of the intersection point coordinate in the first direction, performing binary search on a plurality of first blocks in the first direction until a first land area where the intersection point coordinate in the first direction is located is searched; performing binary search on a plurality of second blocks in the second direction based on the coordinate value of the intersection point coordinate in the second direction until a second land parcel range in which the intersection point coordinate in the second direction is located is searched; picking up a target land parcel from a plurality of land parcels according to the determined first land parcel range and the second land parcel range; the target land block is the land block where the intersection point is located;
the step of dividing the terrain to be divided according to the preset direction and the preset size to obtain a plurality of plots comprises the following steps:
dividing the terrain to be divided along the first direction based on the first size to obtain a plurality of first blocks;
dividing the terrain to be divided along the second direction based on the second size to obtain a plurality of second blocks;
obtaining a plurality of plots based on the plurality of first blocks and the plurality of second blocks; each of the plots is an intersection of the first set of plots and the second set of plots.
2. The method of claim 1, wherein the screen coordinates are two-dimensional coordinates in a screen coordinate system; the step of determining the target ray based on the screen coordinates and the preset camera origin coordinates comprises the following steps:
converting the screen coordinates into corresponding three-dimensional coordinates in a world coordinate system;
and determining a target ray based on the corresponding three-dimensional coordinates in the world coordinate system and the preset camera origin coordinates.
3. A land parcel pickup apparatus, wherein the apparatus is provided to an electronic device, the apparatus comprising:
the terrain dividing module is used for dividing the terrain to be divided according to the preset direction and the preset size to obtain a plurality of plots; the preset direction comprises a first direction and a second direction; the preset size comprises a first size and a second size; the first dimension and the second dimension are the same or different;
the ray determination module is used for acquiring screen coordinates corresponding to screen contacts of the electronic equipment if the screen contacts of the user aiming at the electronic equipment are detected, and determining target rays based on the screen coordinates and preset camera origin coordinates; the starting point of the target ray is the origin coordinate of the camera, and the target ray passes through the screen coordinate;
the judging module is used for judging whether the ray and the land block have an intersection point or not;
the land parcel pickup module is used for acquiring the intersection point coordinates of the target ray and the terrain if an intersection point exists; based on the coordinate value of the intersection point coordinate in the first direction, performing binary search on a plurality of first blocks in the first direction until a first land area where the intersection point coordinate in the first direction is located is searched; performing binary search on a plurality of second blocks in the second direction based on the coordinate value of the intersection point coordinate in the second direction until a second land parcel range in which the intersection point coordinate in the second direction is located is searched; picking up a target land parcel from a plurality of land parcels according to the determined first land parcel range and the second land parcel range; the target land block is the land block where the intersection point is located;
the terrain dividing module is used for:
dividing the terrain to be divided along the first direction based on the first size to obtain a plurality of first blocks;
dividing the terrain to be divided along the second direction based on the second size to obtain a plurality of second blocks;
obtaining a plurality of plots based on the plurality of first blocks and the plurality of second blocks; each of the plots is an intersection of the first and second chunks.
4. An electronic device comprising a processor and a memory, the memory storing computer executable instructions executable by the processor, the processor executing the computer executable instructions to implement the steps of the parcel pickup method of any of claims 1 to 2.
5. A computer readable storage medium having stored thereon a computer program, characterized in that the computer program when executed by a processor performs the steps of the parcel pickup method of any of claims 1 to 2.
CN201911364021.0A 2019-12-25 2019-12-25 Land parcel pickup method, apparatus, electronic device and computer readable storage medium Active CN111135562B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201911364021.0A CN111135562B (en) 2019-12-25 2019-12-25 Land parcel pickup method, apparatus, electronic device and computer readable storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201911364021.0A CN111135562B (en) 2019-12-25 2019-12-25 Land parcel pickup method, apparatus, electronic device and computer readable storage medium

Publications (2)

Publication Number Publication Date
CN111135562A CN111135562A (en) 2020-05-12
CN111135562B true CN111135562B (en) 2023-10-20

Family

ID=70520301

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201911364021.0A Active CN111135562B (en) 2019-12-25 2019-12-25 Land parcel pickup method, apparatus, electronic device and computer readable storage medium

Country Status (1)

Country Link
CN (1) CN111135562B (en)

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101188024A (en) * 2006-11-20 2008-05-28 爱克发医疗保健公司 Picking on fused 3D volume rendered images and updating corresponding views according to a picking action
CN106611443A (en) * 2015-10-26 2017-05-03 高德信息技术有限公司 Method and device for picking up three-dimensional terrain point
CN107748643A (en) * 2017-11-10 2018-03-02 济南迅捷万通科技发展有限公司 A kind of interactive object pick-up method based on subsurface three-dimensional space
CN108888954A (en) * 2018-06-20 2018-11-27 苏州玩友时代科技股份有限公司 A kind of method, apparatus, equipment and storage medium picking up coordinate
CN110442339A (en) * 2019-06-17 2019-11-12 搜游网络科技(北京)有限公司 A kind of axial edit methods of visualization, device and performer, readable storage medium storing program for executing

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP6274962B2 (en) * 2014-04-25 2018-02-07 株式会社スクウェア・エニックス Information processing apparatus, control method, program, and recording medium

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101188024A (en) * 2006-11-20 2008-05-28 爱克发医疗保健公司 Picking on fused 3D volume rendered images and updating corresponding views according to a picking action
CN106611443A (en) * 2015-10-26 2017-05-03 高德信息技术有限公司 Method and device for picking up three-dimensional terrain point
CN107748643A (en) * 2017-11-10 2018-03-02 济南迅捷万通科技发展有限公司 A kind of interactive object pick-up method based on subsurface three-dimensional space
CN108888954A (en) * 2018-06-20 2018-11-27 苏州玩友时代科技股份有限公司 A kind of method, apparatus, equipment and storage medium picking up coordinate
CN110442339A (en) * 2019-06-17 2019-11-12 搜游网络科技(北京)有限公司 A kind of axial edit methods of visualization, device and performer, readable storage medium storing program for executing

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
虚拟现实系统中曲线的交互式生成;曹家铭等;《中国科技信息》(第23期);第91页第1栏第6段-第91页第2栏倒数第4段 *

Also Published As

Publication number Publication date
CN111135562A (en) 2020-05-12

Similar Documents

Publication Publication Date Title
CN109214366B (en) Local target re-identification method, device and system
US20190087666A1 (en) Method and apparatus for identifying static obstacle
CN111142514B (en) Robot and obstacle avoidance method and device thereof
CN112200851B (en) Point cloud-based target detection method and device and electronic equipment thereof
JPWO2017051480A1 (en) Image processing apparatus and image processing method
CN113111513B (en) Sensor configuration scheme determining method and device, computer equipment and storage medium
CN112166457A (en) Point cloud segmentation method and system and movable platform
CN112330815A (en) Three-dimensional point cloud data processing method, device and equipment based on obstacle fusion
CN113793413A (en) Three-dimensional reconstruction method and device, electronic equipment and storage medium
CN109961516B (en) Surface acquisition method, device and non-transitory computer readable recording medium
CN113610967B (en) Three-dimensional point detection method, three-dimensional point detection device, electronic equipment and storage medium
JP6403201B2 (en) Image feature registration apparatus, method, and program
CN106611443B (en) Three-dimensional topographic point picking method and device
CN114332134A (en) Building facade extraction method and device based on dense point cloud
CN111135562B (en) Land parcel pickup method, apparatus, electronic device and computer readable storage medium
CN110348900B (en) Data processing method, system and device
CN112633066A (en) Aerial small target detection method, device, equipment and storage medium
CN112861595A (en) Method and device for identifying data points and computer-readable storage medium
CN111739106B (en) Corner point coding method, calibration method, device, electronic equipment and storage medium
CN113762310A (en) Point cloud data classification method and device, computer storage medium and system
CN117152364B (en) Method, device and equipment for three-dimensional reconstruction of water body boundary based on image data
CN111429581A (en) Method and device for determining outline of game model and adding special effect of game
CN117455928B (en) Segmentation method and device for grabbing objects in disordered grabbing process and electronic equipment
CN112068547B (en) AMCL-based robot positioning method and device and robot
CN111724431B (en) Parallax map obtaining method and device and electronic equipment

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant