CN111968246A - Scene switching method and device, electronic equipment and storage medium - Google Patents
Scene switching method and device, electronic equipment and storage medium Download PDFInfo
- Publication number
- CN111968246A CN111968246A CN202010648711.5A CN202010648711A CN111968246A CN 111968246 A CN111968246 A CN 111968246A CN 202010648711 A CN202010648711 A CN 202010648711A CN 111968246 A CN111968246 A CN 111968246A
- Authority
- CN
- China
- Prior art keywords
- point
- roaming
- screen
- current
- coordinate
- 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.)
- Granted
Links
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T19/00—Manipulating 3D models or images for computer graphics
- G06T19/003—Navigation within 3D models or images
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F3/00—Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
- G06F3/01—Input arrangements or combined input and output arrangements for interaction between user and computer
- G06F3/048—Interaction techniques based on graphical user interfaces [GUI]
- G06F3/0481—Interaction techniques based on graphical user interfaces [GUI] based on specific properties of the displayed interaction object or a metaphor-based environment, e.g. interaction with desktop elements like windows or icons, or assisted by a cursor's changing behaviour or appearance
- G06F3/04815—Interaction with a metaphor-based environment or interaction object displayed as three-dimensional, e.g. changing the user viewpoint with respect to the environment or object
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F3/00—Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
- G06F3/01—Input arrangements or combined input and output arrangements for interaction between user and computer
- G06F3/048—Interaction techniques based on graphical user interfaces [GUI]
- G06F3/0487—Interaction techniques based on graphical user interfaces [GUI] using specific features provided by the input device, e.g. functions controlled by the rotation of a mouse with dual sensing arrangements, or of the nature of the input device, e.g. tap gestures based on pressure sensed by a digitiser
Landscapes
- Engineering & Computer Science (AREA)
- General Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Physics & Mathematics (AREA)
- General Physics & Mathematics (AREA)
- Software Systems (AREA)
- Human Computer Interaction (AREA)
- Radar, Positioning & Navigation (AREA)
- Remote Sensing (AREA)
- Computer Graphics (AREA)
- Computer Hardware Design (AREA)
- Mobile Radio Communication Systems (AREA)
Abstract
The invention provides a method, a device, electronic equipment and a storage medium for scene switching, wherein the method comprises the following steps: in a display interface of a current scene, acquiring a click coordinate of a user on a screen, and taking a vector from an origin of the screen to the click coordinate as a first vector; initializing the value of a roaming point variable to be 0; traversing all roaming points in the current scene, converting the space coordinates of the current roaming points into screen coordinates, and taking a vector from the screen origin to the screen coordinates as a second vector; judging whether the included angle between the second vector and the first vector and the distance between the click coordinate and the screen coordinate meet preset conditions or not; if so, judging whether the distance is smaller than the distance between the value of the roaming point variable and the click coordinate; and if so, assigning the current roaming point to the roaming point variable, judging the next roaming point until all the roaming points are judged, and switching the current scene into a scene corresponding to the value of the roaming point variable. The invention enhances the interactivity with the user.
Description
Technical Field
The present invention relates to the field of virtual reality technologies, and in particular, to a method and an apparatus for scene switching, an electronic device, and a storage medium.
Background
With the development of Virtual Reality (VR) technology, the VR technology is now widely used in a panoramic viewing room based on a three-dimensional space. In order to interact with a user, a roaming point is arranged on one or more objects in the three-dimensional space, so that the user can switch roaming effects by clicking the roaming point on the basis of panoramic display.
In the prior art, a click position of a user on a screen is acquired, a ray from a camera to a click point is sent out through the camera in a panorama, an object through which the ray passes is captured through the ray, and if the object through which the ray passes has a roaming point, a roaming effect and room switching are performed.
In the prior art, the user needs to accurately click on the roaming point object to switch, so that the interaction effect is poor.
Disclosure of Invention
In view of the above, embodiments of the present invention are proposed to provide a method, an apparatus, an electronic device and a storage medium for scene switching that overcome or at least partially solve the above problems.
According to a first aspect of the present invention, there is provided a method for scene switching, including:
s1, acquiring a click coordinate of a user on a screen in a display interface of a current scene, and determining a vector from a screen origin to the click coordinate as a first vector;
s2, initializing a value of a roaming point variable to be 0, wherein the roaming point variable is used for recording the current optimal roaming point;
s3, determining a roaming point from all roaming points in the current scene as a current roaming point, converting the space coordinate of the current roaming point into a screen coordinate, and determining a vector from a screen origin to the screen coordinate as a second vector;
s4, calculating an included angle between the first vector and the second vector, and calculating a distance between a click point corresponding to the click coordinate and a screen point corresponding to the screen coordinate;
s5, judging whether the included angle and the distance meet preset conditions, if so, executing a step S6, and if not, executing a step S8;
s6, judging whether the distance is smaller than the distance between the value of the roaming point variable and the click point corresponding to the click coordinate, if so, executing a step S7, otherwise, executing a step S8;
s7, assigning the current roaming point to a roaming point variable;
s8, judging whether all the roaming points in the current scene are judged to be finished, if so, executing a step S9, and if not, executing a step S3;
and S9, taking the value of the roaming point variable as an optimal roaming point, and switching the current scene to the scene corresponding to the optimal roaming point.
Optionally, the determining whether the included angle and the distance satisfy a preset condition includes:
and judging whether the included angle is smaller than or equal to a preset included angle threshold value or not, and the distance is smaller than or equal to a preset distance threshold value.
Optionally, the preset included angle threshold is equal to an included angle between a tangent line from the screen origin to the circle and the second vector, the circle center of the circle is a screen point corresponding to the current roaming point, and the radius is the preset distance threshold.
Optionally, the converting the spatial coordinates of the current roaming point into screen coordinates includes:
and taking the screen as a projection plane, and projecting the space coordinate of the current roaming point to the projection plane to obtain the screen coordinate of the current roaming point.
According to a second aspect of the present invention, there is provided an apparatus for scene switching, comprising:
the system comprises a click point determining module, a click point determining module and a click point determining module, wherein the click point determining module is used for acquiring a click coordinate of a user on a screen in a display interface of a current scene, and determining a vector from a screen origin to the click coordinate as a first vector;
the device comprises an initialization module, a processing module and a processing module, wherein the initialization module is used for initializing the value of a roaming point variable to be 0, and the roaming point variable is used for recording the current optimal roaming point;
the current roaming point determining module is used for determining a roaming point from all roaming points in a current scene as a current roaming point, converting the space coordinate of the current roaming point into a screen coordinate, and determining a vector from a screen origin to the screen coordinate as a second vector;
the included angle distance calculation module is used for calculating an included angle between the first vector and the second vector and calculating the distance between a click point corresponding to the click coordinate and a screen point corresponding to the screen coordinate;
the first judgment module is used for judging whether the included angle and the distance meet preset conditions or not;
the second judgment module is used for judging whether the distance is smaller than the distance between the value of the roaming point variable and the click point corresponding to the click coordinate or not when the encryption and the distance meet the preset condition;
the assignment module is used for assigning the current roaming point to the roaming point variable when the distance is smaller than the distance between the value of the roaming point variable and the click point corresponding to the click coordinate;
a third judging module, configured to judge whether all roaming points in the current scene are judged to be completed when the included angle and the distance do not meet preset conditions, or the distance is greater than or equal to a distance between a value of a roaming point variable and a click point corresponding to a click coordinate;
and the scene switching module is used for taking the value of the roaming point variable as an optimal roaming point when all the roaming points in the current scene are judged, and switching the current scene into the scene corresponding to the optimal roaming point.
Optionally, the first determining module is specifically configured to:
and judging whether the included angle is smaller than or equal to a preset included angle threshold value or not, and the distance is smaller than or equal to a preset distance threshold value.
Optionally, the preset included angle threshold is equal to an included angle between a tangent line from the screen origin to the circle and the second vector, the circle center of the circle is a screen point corresponding to the current roaming point, and the radius is the preset distance threshold.
Optionally, the current roaming point determining module includes:
and the coordinate conversion unit is used for taking the screen as a projection plane and projecting the space coordinate of the current roaming point to the projection plane to obtain the screen coordinate of the current roaming point.
According to a third aspect of the present invention, there is also provided a server, a processor, a memory and a computer program stored on the memory and executable on the processor, the computer program, when executed by the processor, implementing the method of scene switching according to the first aspect.
According to a fourth aspect of the present invention, there is also provided a computer-readable storage medium having stored thereon a computer program which, when executed by a processor, implements the method of scene cut as described in the first aspect.
According to the method, the device, the electronic equipment and the storage medium for scene switching, after the click coordinate of the user on the screen is obtained, the vector from the screen origin to the click coordinate is used as a first vector, the space coordinate of the roaming point in the current scene is converted into the screen coordinate, the vector from the screen origin to the screen coordinate is used as a second vector, the roaming point with the included angle between the second vector and the first vector and the distance between the click coordinate and the screen coordinate meeting the preset conditions is selected as the optimal roaming point, and scene switching is performed, so that the scene switching can be performed when the click point is in a certain range of the roaming point, the click point does not need to coincide with the roaming point, and the interactivity with the user is enhanced.
The foregoing description is only an overview of the technical solutions of the present invention, and the present invention can be implemented according to the content of the description in order to make the technical means of the present invention more clearly understood, and the following detailed description of the present invention is provided in order to make the above and other objects, features, and advantages of the present invention more clearly understandable.
Drawings
Various other advantages and benefits will become apparent to those of ordinary skill in the art upon reading the following detailed description of the preferred embodiments. The drawings are only for purposes of illustrating the preferred embodiments and are not to be construed as limiting the invention.
Fig. 1 is a flowchart illustrating steps of a method for scene switching according to an embodiment of the present invention;
FIG. 2 is a diagram illustrating distribution of on-screen points and click points corresponding to roaming points in an embodiment of the present invention;
fig. 3 is a block diagram illustrating a scene switching apparatus according to an embodiment of the present invention;
fig. 4 is a block diagram of an electronic device according to an embodiment of the present invention.
Detailed Description
Exemplary embodiments of the present invention will be described in more detail below with reference to the accompanying drawings. While exemplary embodiments of the invention are shown in the drawings, it should be understood that the invention can be embodied in various forms and should not be limited to the embodiments set forth herein. Rather, these embodiments are provided so that this disclosure will be thorough and complete, and will fully convey the scope of the invention to those skilled in the art.
Fig. 1 is a flowchart of steps of a method for scene switching according to an embodiment of the present invention, which may be executed by an electronic device such as a terminal device or a server, as shown in fig. 1, where the method may include:
The current scene may be a different application scene, such as a scene in a current room when the room is viewed in a panoramic manner. The screen origin generally refers to the top left corner vertex of the screen.
An object with a roaming point exists in the current scene, and a user can click the roaming point to switch the roaming effect. In a display interface of a current scene, when a user clicks a screen, acquiring a click coordinate of the user on the screen, and taking a vector from an origin of the screen to the click coordinate as a first vector.
After the click coordinate of the user on the screen is acquired and the first vector is determined, the roaming point in the current scene can be traversed according to the click coordinate and the first vector to determine a roaming point which has the minimum distance from the click coordinate and meets the preset condition as the optimal roaming point. Before traversing the roaming points in the current scene, firstly defining a roaming point variable, using the roaming point variable to record the optimal roaming point in the currently traversed roaming points, and initializing the value of the roaming point variable to be 0.
A roaming point may be randomly determined from all roaming points in the current scene, or a roaming point may be determined from all roaming points in the current scene according to the order of the roaming points, and the determined roaming point is used as the current roaming point. Since the roaming point is an object in the three-dimensional space of the current scene, the roaming point has a space coordinate in the three-dimensional space, and for convenience of calculation, the space coordinate of the current roaming point may be converted into a screen coordinate, and a vector from the screen origin to the screen coordinate of the current roaming point may be used as the second vector.
In an embodiment of the present invention, the converting the spatial coordinates of the current roaming point into the screen coordinates includes:
and taking the screen as a projection plane, and projecting the space coordinate of the current roaming point to the projection plane to obtain the screen coordinate of the current roaming point.
And determining the spatial coordinates of the current roaming point in the current scene. The method comprises the steps that a current scene is a virtual three-dimensional space, in a display interface of the three-dimensional space, a user can view images of the three-dimensional space at different angles by rotating a virtual camera, so that the display interface of the current scene corresponds to one rotation angle of the virtual camera, a screen is used as a projection plane according to the relation between the space coordinate of the three-dimensional space and the rotation angle of the virtual camera, the space coordinate of a current roaming point is projected and contracted to the projection plane, and the screen coordinate of the current roaming point is obtained. The screen coordinate is obtained by performing projection conversion on the space coordinate of the current roaming point, and the obtained screen coordinate is more accurate.
And 104, calculating an included angle between the first vector and the second vector, and calculating a distance between a click point corresponding to the click coordinate and a screen point corresponding to the screen coordinate.
The point multiplication calculation can be performed on the first vector and the second vector to obtain a cosine value of an included angle between the first vector and the second vector, and the cosine value is subjected to the inverse cosine calculation to obtain an included angle between the first vector and the second vector. Of course, other included angle calculation methods may be used to calculate the included angle between the first vector and the second vector.
And calculating the distance between the click point corresponding to the click coordinate and the screen point corresponding to the screen coordinate according to the click coordinate and the screen coordinate. For example, the click coordinate is (x)1,y1) Screen coordinates of (x)2,y2) Then the distance between the click point and the screen point isAnd the screen point is a point corresponding to the current free-tour point on the screen.
And 105, judging whether the included angle and the distance meet preset conditions, if so, executing step 106, and if not, executing step 108.
The preset conditions simultaneously specify conditions required to be met by the included angle and conditions required to be met by the distance so as to determine roaming points within a certain range from the click coordinates.
In an embodiment of the present invention, the determining whether the included angle and the distance satisfy a preset condition includes: and judging whether the included angle is smaller than a preset included angle threshold value or not and the distance is smaller than a preset distance threshold value.
The preset included angle threshold value is equal to an included angle between a tangent line from a screen origin point to a circle and a second vector, the circle center of the circle is a screen point corresponding to the current roaming point, and the radius is the preset distance threshold value.
The preset included angle threshold value and the preset distance threshold value have a certain relation, namely, a circle which takes a screen point corresponding to the current roaming point as a circle center and takes the preset distance threshold value as a radius is determined, a tangent line from the original point of the screen to the circle is determined, the included angle between the tangent line and the second vector is calculated, and the obtained included angle is the preset included angle threshold value. When the determination is made, it is first determined whether the included angle is smaller than or equal to the preset included angle threshold, and if the included angle is smaller than or equal to the preset included angle threshold, it is further determined whether the distance is smaller than or equal to the preset distance threshold, if the distance is smaller than or equal to the preset distance threshold, step 106 may be executed, and if the distance is greater than the preset distance threshold or the included angle is greater than the preset included angle threshold, step 108 may be executed.
For example, fig. 2 is a schematic diagram of distribution of the screen points and the click points corresponding to the roaming points on the screen in the embodiment of the present invention, as shown in fig. 2, width is the screen width, height is the screen height, and point B (x) is1,y1) For the screen point corresponding to the current roaming point, the click point is A (x, y), the first vector is obtained as (x, y), and the second vector is obtained as (x, y)1,y1) The angle between the first vector and the second vector is an angle 2, and the screen point B (x) corresponding to the current roaming point is firstly used1,y1) Determining a circle by taking a preset distance threshold value as a radius, determining a tangent line from the original point (0,0) of the screen to the circle, calculating an included angle between the tangent line and a second vector, taking the obtained included angle as a preset included angle threshold value, taking the preset included angle threshold value as an angle 1, judging whether the angle 2 is less than or equal to the angle 1, obtaining that the angle 2 is less than the angle 1, and further judging a click point A (x, y) and a screen point B (x, y)1,y1) Whether the distance between the click point A and the screen point B is less than or equal to a preset distance threshold value is judged, and the click point A (x, y) and the screen point B (x) are clicked1,y1) The distance between them is less than a preset distance threshold.
And step 106, judging whether the distance is smaller than the distance between the value of the roaming point variable and the click point corresponding to the click coordinate, if so, executing step 107, and if not, executing step 108.
And when the included angle between the first vector and the second vector and the distance between the click point and the screen point meet preset conditions, further judging whether the distance is smaller than the distance between the value of the roaming point variable and the click point corresponding to the click coordinate to determine whether to update the value of the roaming point variable. When the distance is larger than the distance between the value of the roaming point variable and the click point corresponding to the click coordinate, the value of the roaming point variable does not need to be updated, and when the distance is smaller than the distance between the value of the roaming point variable and the click point corresponding to the click coordinate, the value of the roaming point variable is updated.
And 107, assigning the current roaming point to a roaming point variable.
And if the distance between the click point corresponding to the click coordinate and the screen point corresponding to the screen coordinate is less than the distance between the value of the roaming point variable and the click point corresponding to the click coordinate, indicating that the screen point corresponding to the current roaming point is closer to the click point, and assigning the current roaming point to the roaming point variable.
And 108, judging whether all the roaming points in the current scene are judged to be finished, if so, executing step 109, and if not, executing step 103.
After the judgment of the current roaming point is completed, whether all the roaming points in the current scene are judged to be completed or not is judged currently, if all the roaming points are judged to be completed, the circulating judgment is stopped, and if the roaming points which are not judged to be completed exist, the steps 103 to 108 are executed circularly until all the roaming points are judged to be completed.
For the judgment of this step, a loop variable may be set to record the number of currently traversed roaming points, and if the loop variable is initialized, the value of the loop variable is initialized to 0, after the judgment of the current roaming point is completed, it is judged whether the value of the loop variable is smaller than the total number of all roaming points in the current scene, if so, the value of the loop variable is added by 1, and step 103 is executed, if not, the loop is ended, and step 109 is executed.
And step 109, taking the value of the roaming point variable as an optimal roaming point, and switching the current scene to the scene corresponding to the optimal roaming point.
After all the roaming points in the current scene are judged, the obtained value of the roaming point variable records a roaming point closest to the click point, the roaming point is used as the optimal roaming point, the scene corresponding to the optimal roaming point is obtained, and the current scene is switched to the scene corresponding to the optimal roaming point.
In the method for switching scenes provided by this embodiment, after the click coordinate of the user on the screen is obtained, the vector from the screen origin to the click coordinate is used as a first vector, the spatial coordinate of the wandering point in the current scene is converted into the screen coordinate, the vector from the screen origin to the screen coordinate is used as a second vector, the roaming point where the included angle between the second vector and the first vector and the distance between the click coordinate and the screen coordinate satisfy the preset condition is selected as the optimal roaming point, and the switching of scenes is performed, that is, the switching of scenes can be performed when the click point is within a certain range of the roaming point without the click point being overlapped with the wandering point, so that the interactivity with the user is enhanced.
It is noted that, for simplicity of explanation, the method embodiments are described as a series of acts or combination of acts, but those skilled in the art will appreciate that the present invention is not limited by the order of acts, as some steps may occur in other orders or concurrently in accordance with the embodiments of the invention. Further, those skilled in the art will appreciate that the embodiments described in the specification are presently preferred and that no particular act is required to implement the invention.
Fig. 3 is a block diagram illustrating a scene switching apparatus according to an embodiment of the present invention, where as shown in fig. 3, the scene switching apparatus may include:
a click point determining module 301, configured to obtain a click coordinate of a user on a screen in a display interface of a current scene, and determine a vector from a screen origin to the click coordinate as a first vector;
an initialization module 302, configured to initialize a value of a roaming point variable to be 0, where the roaming point variable is used to record a current optimal roaming point;
a current roaming point determining module 303, configured to determine a roaming point from all roaming points in the current scene, as a current roaming point, convert a spatial coordinate of the current roaming point into a screen coordinate, and determine a vector from a screen origin to the screen coordinate, as a second vector;
an included angle distance calculation module 304, configured to calculate an included angle between the first vector and the second vector, and calculate a distance between a click point corresponding to the click coordinate and a screen point corresponding to the screen coordinate;
a first judging module 305, configured to judge whether the included angle and the distance satisfy preset conditions;
a second determining module 306, configured to determine whether the distance is smaller than a distance between a value of the roaming point variable and a click point corresponding to the click coordinate when the encryption and the distance meet a preset condition;
an assigning module 307, configured to assign the current roaming point to a roaming point variable when the distance is smaller than the distance between the value of the roaming point variable and the click point corresponding to the click coordinate;
a third determining module 308, configured to determine whether all roaming points in the current scene are determined to be completed when the included angle and the distance do not meet preset conditions, or the distance is greater than or equal to a distance between a value of a roaming point variable and a click point corresponding to a click coordinate;
and a scene switching module 309, configured to, when all roaming points in the current scene are determined to be complete, use the value of the roaming point variable as an optimal roaming point, and switch the current scene to a scene corresponding to the optimal roaming point.
Optionally, the first determining module is specifically configured to:
and judging whether the included angle is smaller than or equal to a preset included angle threshold value or not, and the distance is smaller than or equal to a preset distance threshold value.
Optionally, the preset included angle threshold is equal to an included angle between a tangent line from the screen origin to the circle and the second vector, the circle center of the circle is a screen point corresponding to the current roaming point, and the radius is the preset distance threshold.
Optionally, the current roaming point determining module includes:
and the coordinate conversion unit is used for taking the screen as a projection plane and projecting the space coordinate of the current roaming point to the projection plane to obtain the screen coordinate of the current roaming point.
In the scene switching device provided by this embodiment, after the click coordinate of the user on the screen is acquired, the vector from the screen origin to the click coordinate is used as a first vector, the spatial coordinate of the wandering point in the current scene is converted into the screen coordinate, the vector from the screen origin to the screen coordinate is used as a second vector, the roaming point where the included angle between the second vector and the first vector and the distance between the click coordinate and the screen coordinate satisfy the preset condition is selected as the optimal roaming point, and the scene switching is performed, that is, the switching of the scene can be performed when the click point is within a certain range of the roaming point, and the click point does not need to coincide with the wandering point, so that the interactivity with the user is enhanced.
Fig. 4 is a block diagram of an electronic device according to an embodiment of the present invention. As shown in fig. 4, the electronic device 400 may include one or more processors 401 and one or more memories 402 connected to the processors 401. The electronic device 400 may also include an input interface 403 and an output interface 404 for communicating with another apparatus or system. Program code executed by the CPU of processor 401 may be stored in memory 402.
The processor 401 in the electronic device 400 calls the program code stored in the memory 402 to perform the method of scene switching in the above-described embodiment.
The above elements in the above electronic device may be connected to each other by a bus, such as one of a data bus, an address bus, a control bus, an expansion bus, and a local bus, or any combination thereof.
There is also provided, in accordance with an embodiment of the present invention, a computer-readable storage medium having a computer program stored thereon, where the storage medium may be a Read-Only Memory (ROM) or a Read-write medium, such as a hard disk or a flash Memory. The computer program, when executed by a processor, implements the method of scene switching of the foregoing embodiments.
The embodiments in the present specification are described in a progressive manner, each embodiment focuses on differences from other embodiments, and the same and similar parts among the embodiments are referred to each other.
As will be appreciated by one skilled in the art, embodiments of the present invention may be provided as a method, apparatus, or computer program product. Accordingly, embodiments of the present invention may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, embodiments of the invention may take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, and the like) having computer-usable program code embodied therein.
Embodiments of the present invention are described with reference to flowchart illustrations and/or block diagrams of methods, terminal devices (systems), and computer program products according to embodiments of the invention. It will be understood that each flow and/or block of the flow diagrams and/or block diagrams, and combinations of flows and/or blocks in the flow diagrams and/or block diagrams, can be implemented by computer program instructions. These computer program instructions may be provided to a processor of a general purpose computer, special purpose computer, embedded processor, or other programmable data processing terminal to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing terminal, create means for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing terminal to function in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including instruction means which implement the function specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be loaded onto a computer or other programmable data processing terminal to cause a series of operational steps to be performed on the computer or other programmable terminal to produce a computer implemented process such that the instructions which execute on the computer or other programmable terminal provide steps for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
While preferred embodiments of the present invention have been described, additional variations and modifications of these embodiments may occur to those skilled in the art once they learn of the basic inventive concepts. Therefore, it is intended that the appended claims be interpreted as including preferred embodiments and all such alterations and modifications as fall within the true scope of the embodiments of the invention.
Finally, it should also be noted that, herein, relational terms such as first and second, and the like may be used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions. Moreover, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or terminal that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or terminal. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other like elements in a process, method, article, or terminal that comprises the element.
The method, the apparatus, the electronic device and the storage medium for scene switching provided by the present invention are introduced in detail, and a specific example is applied in the text to explain the principle and the implementation of the present invention, and the description of the above embodiment is only used to help understanding the method and the core idea of the present invention; meanwhile, for a person skilled in the art, according to the idea of the present invention, there may be variations in the specific embodiments and the application scope, and in summary, the content of the present specification should not be construed as a limitation to the present invention.
Claims (10)
1. A method of scene change, comprising:
s1, acquiring a click coordinate of a user on a screen in a display interface of a current scene, and determining a vector from a screen origin to the click coordinate as a first vector;
s2, initializing the value of a roaming point variable to be 0, wherein the roaming point variable is used for recording the current optimal roaming point;
s3, determining a roaming point from all roaming points in the current scene as a current roaming point, converting the space coordinate of the current roaming point into a screen coordinate, and determining a vector from a screen origin to the screen coordinate as a second vector;
s4, calculating an included angle between the first vector and the second vector, and calculating a distance between a click point corresponding to the click coordinate and a screen point corresponding to the screen coordinate;
s5, judging whether the included angle and the distance meet preset conditions, if so, executing a step S6, and if not, executing a step S8;
s6, judging whether the distance is smaller than the distance between the value of the roaming point variable and the click point corresponding to the click coordinate, if so, executing a step S7, otherwise, executing a step S8;
s7, assigning the current roaming point to a roaming point variable;
s8, judging whether all the roaming points in the current scene are judged to be finished, if so, executing a step S9, and if not, executing a step S3;
and S9, taking the value of the roaming point variable as an optimal roaming point, and switching the current scene to the scene corresponding to the optimal roaming point.
2. The method according to claim 1, wherein the determining whether the included angle and the distance satisfy a preset condition comprises:
and judging whether the included angle is smaller than or equal to a preset included angle threshold value or not, and judging whether the distance is smaller than or equal to a preset distance threshold value or not.
3. The method of claim 2, wherein the predetermined angle threshold is equal to an angle between a tangent line from an origin of the screen to a circle and a second vector, a center of the circle is a screen point corresponding to the current roaming point, and a radius is the predetermined distance threshold.
4. The method according to any one of claims 1-3, wherein the converting the spatial coordinates of the current roaming point to screen coordinates comprises:
and taking the screen as a projection plane, and projecting the space coordinate of the current roaming point to the projection plane to obtain the screen coordinate of the current roaming point.
5. An apparatus for scene change, comprising:
the system comprises a click point determining module, a click point determining module and a click point determining module, wherein the click point determining module is used for acquiring a click coordinate of a user on a screen in a display interface of a current scene, and determining a vector from a screen origin to the click coordinate as a first vector;
the device comprises an initialization module, a selection module and a selection module, wherein the initialization module is used for initializing the value of a roaming point variable to be 0, and the roaming point variable is used for recording the current optimal roaming point;
the current roaming point determining module is used for determining a roaming point from all roaming points in a current scene as a current roaming point, converting the space coordinate of the current roaming point into a screen coordinate, and determining a vector from a screen origin to the screen coordinate as a second vector;
the included angle distance calculation module is used for calculating an included angle between the first vector and the second vector and calculating the distance between a click point corresponding to the click coordinate and a screen point corresponding to the screen coordinate;
the first judgment module is used for judging whether the included angle and the distance meet preset conditions or not;
the second judgment module is used for judging whether the distance is smaller than the distance between the value of the roaming point variable and the click point corresponding to the click coordinate or not when the encryption and the distance meet the preset condition;
the assignment module is used for assigning the current roaming point to the roaming point variable when the distance is smaller than the distance between the value of the roaming point variable and the click point corresponding to the click coordinate;
a third judging module, configured to judge whether all roaming points in the current scene are judged to be completed when the included angle and the distance do not meet preset conditions, or the distance is greater than or equal to a distance between a value of a roaming point variable and a click point corresponding to a click coordinate;
and the scene switching module is used for taking the value of the roaming point variable as an optimal roaming point when all the roaming points in the current scene are judged, and switching the current scene into the scene corresponding to the optimal roaming point.
6. The apparatus of claim 5, wherein the first determining module is specifically configured to:
and judging whether the included angle is smaller than or equal to a preset included angle threshold value or not, and judging whether the distance is smaller than or equal to a preset distance threshold value or not.
7. The apparatus of claim 6, wherein the predetermined angle threshold is equal to an angle between a tangent line from an origin of the screen to a circle and a second vector, a center of the circle is a screen point corresponding to the current roaming point, and a radius is the predetermined distance threshold.
8. The apparatus according to any of claims 5-7, wherein the current roaming point determining module comprises:
and the coordinate conversion unit is used for taking the screen as a projection plane and projecting the space coordinate of the current roaming point to the projection plane to obtain the screen coordinate of the current roaming point.
9. An electronic device, comprising: processor, memory and computer program stored on the memory and executable on the processor, which computer program, when executed by the processor, implements the method of scene switching as claimed in any one of claims 1-4.
10. A computer-readable storage medium, having stored thereon a computer program which, when being executed by a processor, carries out the method of scene cut according to any one of claims 1 to 4.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202010648711.5A CN111968246B (en) | 2020-07-07 | 2020-07-07 | Scene switching method and device, electronic equipment and storage medium |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202010648711.5A CN111968246B (en) | 2020-07-07 | 2020-07-07 | Scene switching method and device, electronic equipment and storage medium |
Publications (2)
Publication Number | Publication Date |
---|---|
CN111968246A true CN111968246A (en) | 2020-11-20 |
CN111968246B CN111968246B (en) | 2021-12-03 |
Family
ID=73361356
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202010648711.5A Active CN111968246B (en) | 2020-07-07 | 2020-07-07 | Scene switching method and device, electronic equipment and storage medium |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN111968246B (en) |
Cited By (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN112465901A (en) * | 2020-12-11 | 2021-03-09 | 北京城市网邻信息技术有限公司 | Information processing method and device |
CN115857702A (en) * | 2023-02-28 | 2023-03-28 | 北京国星创图科技有限公司 | Scene roaming and view angle conversion method in space scene |
CN116385273A (en) * | 2023-06-05 | 2023-07-04 | 南京维赛客网络科技有限公司 | Method, system and storage medium for moving points in stepping panoramic roaming |
Citations (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20150138193A1 (en) * | 2012-05-29 | 2015-05-21 | Tencent Technology (Shenzhen) Company Limited | Method and device for panorama-based inter-viewpoint walkthrough, and machine readable medium |
CN107817895A (en) * | 2017-09-26 | 2018-03-20 | 微幻科技(北京)有限公司 | Method for changing scenes and device |
CN111028336A (en) * | 2019-11-30 | 2020-04-17 | 北京城市网邻信息技术有限公司 | Scene switching method and device and storage medium |
-
2020
- 2020-07-07 CN CN202010648711.5A patent/CN111968246B/en active Active
Patent Citations (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20150138193A1 (en) * | 2012-05-29 | 2015-05-21 | Tencent Technology (Shenzhen) Company Limited | Method and device for panorama-based inter-viewpoint walkthrough, and machine readable medium |
CN107817895A (en) * | 2017-09-26 | 2018-03-20 | 微幻科技(北京)有限公司 | Method for changing scenes and device |
CN111028336A (en) * | 2019-11-30 | 2020-04-17 | 北京城市网邻信息技术有限公司 | Scene switching method and device and storage medium |
Cited By (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN112465901A (en) * | 2020-12-11 | 2021-03-09 | 北京城市网邻信息技术有限公司 | Information processing method and device |
CN112465901B (en) * | 2020-12-11 | 2022-03-08 | 北京城市网邻信息技术有限公司 | Information processing method and device |
CN115857702A (en) * | 2023-02-28 | 2023-03-28 | 北京国星创图科技有限公司 | Scene roaming and view angle conversion method in space scene |
CN115857702B (en) * | 2023-02-28 | 2024-02-02 | 北京国星创图科技有限公司 | Scene roaming and visual angle conversion method under space scene |
CN116385273A (en) * | 2023-06-05 | 2023-07-04 | 南京维赛客网络科技有限公司 | Method, system and storage medium for moving points in stepping panoramic roaming |
CN116385273B (en) * | 2023-06-05 | 2023-08-15 | 南京维赛客网络科技有限公司 | Method, system and storage medium for moving points in stepping panoramic roaming |
Also Published As
Publication number | Publication date |
---|---|
CN111968246B (en) | 2021-12-03 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN111968246B (en) | Scene switching method and device, electronic equipment and storage medium | |
CN109771951B (en) | Game map generation method, device, storage medium and electronic equipment | |
CN111737518B (en) | Image display method and device based on three-dimensional scene model and electronic equipment | |
US9311756B2 (en) | Image group processing and visualization | |
JP7073092B2 (en) | Image processing equipment, image processing methods and programs | |
US10769811B2 (en) | Space coordinate converting server and method thereof | |
CN109816587B (en) | Fisheye image processing method and device and electronic equipment | |
CN108353151A (en) | The control method and device of target device | |
CN111429518A (en) | Labeling method, labeling device, computing equipment and storage medium | |
CN114511668A (en) | Method, device and equipment for acquiring three-dimensional decoration image and storage medium | |
US20140267587A1 (en) | Panorama packet | |
CN108280135B (en) | Method and device for realizing visualization of data structure and electronic equipment | |
CN110548289B (en) | Method and device for displaying three-dimensional control | |
WO2023056879A1 (en) | Model processing method and apparatus, device, and medium | |
CN113034582A (en) | Pose optimization device and method, electronic device and computer readable storage medium | |
CN114511684A (en) | Scene switching method and device, electronic equipment and storage medium | |
CN112870714A (en) | Map display method and device | |
CN110378948B (en) | 3D model reconstruction method and device and electronic equipment | |
CN117201883A (en) | Method, apparatus, device and storage medium for image editing | |
CN113961066B (en) | Visual angle switching method and device, electronic equipment and readable medium | |
CN115311397A (en) | Method, apparatus, device and storage medium for image rendering | |
CN111968245B (en) | Three-dimensional space marking line display method and device, electronic equipment and storage medium | |
CN113344957B (en) | Image processing method, image processing apparatus, and non-transitory storage medium | |
CN115049757A (en) | Building information determination method and device and electronic equipment | |
CN115115786A (en) | Method, apparatus, device and storage medium for three-dimensional model generation |
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 |