Method, device, electronic device and computer-readable storage medium for drawing trajectory

By obtaining the starting point, end point and trajectory arc parameters, using the target trajectory equation to generate trajectory points and connecting them into a trajectory curve, the problem of quickly drawing trajectory curves is solved, and the drawing efficiency and flexibility are improved.

CN115496832BActive Publication Date: 2025-09-23BEIJING TOPSEC NETWORK SECURITY TECH +2
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202211247860.6
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-10-12
Publication Date
2025-09-23
Estimated Expiration
2042-10-12

AI Technical Summary

Technical Problem

How to quickly draw a trajectory curve, especially connecting two coordinate points to generate a trajectory curve in data visualization application scenarios.

Method used

By obtaining the coordinates of the starting point and the end point and the trajectory arc parameters, the coordinates of multiple trajectory points between the starting point and the end point are generated using the target trajectory equation, and these points are connected to form a trajectory curve.

Benefits of technology

The efficiency of trajectory curve generation is improved, and trajectory curves can be drawn quickly to adapt to the arc and direction of different requirements. Flexible drawing can be performed through canvas or svg API, solving the efficiency and flexibility problems of trajectory drawing.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115496832B_ABST
    Figure CN115496832B_ABST
Patent Text Reader

Abstract

The present application belongs to the field of image processing technology and discloses a method, device, electronic device and computer-readable storage medium for drawing a trajectory. The method includes obtaining the starting point coordinates of the starting point, the ending point coordinates of the ending point and the trajectory radian parameter, wherein the trajectory radian parameter is used to set the radian size and direction of the trajectory curve to be drawn; generating trajectory coordinates corresponding to multiple trajectory points between the starting point and the ending point according to the target trajectory equation based on the starting point coordinates, the ending point coordinates and the trajectory radian parameter; and connecting the starting point, the ending point and each trajectory point according to the starting point coordinates, the ending point coordinates and each trajectory coordinate to generate a target trajectory curve. In this way, a trajectory curve between the starting point and the ending point can be generated according to the target trajectory equation and the trajectory radian parameter, thereby improving the efficiency of trajectory curve generation.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of image processing technology, and in particular to a method, device, electronic device, and computer-readable storage medium for drawing a trajectory. Background Art

[0002] With the development of internet technology, users' demand for data visualization has gradually increased. Data visualization refers to representing each data item as a single primitive element, generating a data image so that users can intuitively view data changes. In some trajectory mapping applications, it is often necessary to connect two different coordinate points to generate a trajectory curve between the two points. For example, you can draw a trajectory curve between two city centers on a map.

[0003] Therefore, how to quickly draw the trajectory curve is a problem that needs to be solved. Summary of the Invention

[0004] The purpose of the embodiments of the present application is to provide a method, device, electronic device and computer-readable storage medium for drawing a trajectory, so as to solve the problem of how to quickly draw a trajectory curve when drawing a trajectory curve.

[0005] In one aspect, a method for drawing a trajectory is provided, comprising:

[0006] Get the starting point coordinates, the ending point coordinates and the trajectory arc parameters. The trajectory arc parameters are used to set the arc size and direction of the trajectory curve to be drawn.

[0007] According to the target trajectory equation, based on the starting point coordinates, the end point coordinates and the trajectory arc parameters, the trajectory coordinates corresponding to multiple trajectory points between the starting point and the end point are generated;

[0008] According to the starting point coordinates, the end point coordinates and the coordinates of each track, the starting point, the end point and the track points are connected to generate the target track curve.

[0009] In the above implementation process, a trajectory curve between the starting point and the end point can be generated according to the target trajectory equation and the trajectory radian parameter, thereby improving the efficiency of trajectory curve generation.

[0010] In one embodiment, the starting point coordinates include a starting horizontal coordinate and a starting vertical coordinate, the ending point coordinates include a ending horizontal coordinate and a ending vertical coordinate; the trajectory coordinates include a trajectory horizontal coordinate and a trajectory vertical coordinate; and according to the target trajectory equation, based on the starting point coordinates, the ending point coordinates, and the trajectory arc parameter, the trajectory coordinates corresponding to multiple trajectory points between the starting point and the ending point are generated, including:

[0011] Get the target number of trajectory points to be generated;

[0012] Based on the starting horizontal coordinate, the ending horizontal coordinate, and the number of targets, the trajectory horizontal coordinate corresponding to each trajectory point is generated. The trajectory horizontal coordinate is positively correlated with the ending horizontal coordinate and the starting horizontal coordinate, and negatively correlated with the number of targets.

[0013] Based on the starting ordinate, ending ordinate, trajectory arc parameter, and target number, the trajectory ordinate corresponding to each trajectory point is generated. The trajectory ordinate is positively correlated with the starting ordinate and ending ordinate.

[0014] In the above implementation process, different methods can be used to generate the track horizontal coordinate and the track vertical coordinate respectively.

[0015] In one embodiment, based on the starting horizontal coordinate, the ending horizontal coordinate, and the target number, the trajectory horizontal coordinate corresponding to each trajectory point is generated, including:

[0016] Determine the difference between the ending abscissa and the starting abscissa to obtain the abscissa difference;

[0017] Based on the starting horizontal coordinate, the horizontal coordinate difference, and the target number, the trajectory horizontal coordinate corresponding to each trajectory point is generated.

[0018] In one embodiment, based on the starting ordinate, the ending ordinate, the trajectory arc parameter, and the number of targets, the trajectory ordinate corresponding to each trajectory point is generated, including:

[0019] Based on the starting ordinate, ending ordinate, and the number of targets, the initial ordinate corresponding to each trajectory point is generated; the initial ordinate is positively correlated with the starting ordinate and ending ordinate, and negatively correlated with the number of targets;

[0020] Based on the trajectory arc parameter and the number of targets, the adjustment value corresponding to each trajectory point is generated;

[0021] Based on the adjustment value of each track point, the initial vertical coordinate of each track point is adjusted respectively to obtain the track vertical coordinate corresponding to each track point.

[0022] In one embodiment, based on the trajectory arc parameter and the target number, generating the adjustment value corresponding to each trajectory point includes:

[0023] The target equation expression is used to obtain each adjustment value based on the trajectory arc parameter and the target quantity; the target trajectory equation includes the target equation expression, and the target equation expression is a quadratic equation.

[0024] In one aspect, a device for drawing a trajectory is provided, comprising:

[0025] An acquisition unit is used to obtain the starting point coordinates, the end point coordinates and the trajectory arc parameters, and the trajectory arc parameters are used to set the arc size and direction of the trajectory curve to be drawn;

[0026] A generating unit, configured to generate trajectory coordinates corresponding to a plurality of trajectory points between a starting point and an ending point according to a target trajectory equation, based on the starting point coordinates, the ending point coordinates, and the trajectory arc parameter;

[0027] The connection unit is used to connect the starting point, the ending point and each track point according to the starting point coordinates, the ending point coordinates and each track coordinates to generate a target track curve.

[0028] In one embodiment, the starting point coordinates include a starting horizontal coordinate and a starting vertical coordinate, the ending point coordinates include a final horizontal coordinate and a final vertical coordinate; the trajectory coordinates include a trajectory horizontal coordinate and a trajectory vertical coordinate; and the generating unit is configured to:

[0029] Get the target number of trajectory points to be generated;

[0030] Based on the starting horizontal coordinate, the ending horizontal coordinate, and the number of targets, the trajectory horizontal coordinate corresponding to each trajectory point is generated. The trajectory horizontal coordinate is positively correlated with the ending horizontal coordinate and the starting horizontal coordinate, and negatively correlated with the number of targets.

[0031] Based on the starting ordinate, ending ordinate, trajectory arc parameter, and target number, the trajectory ordinate corresponding to each trajectory point is generated. The trajectory ordinate is positively correlated with the starting ordinate and ending ordinate.

[0032] In one embodiment, the generating unit is configured to:

[0033] Determine the difference between the ending abscissa and the starting abscissa to obtain the abscissa difference;

[0034] Based on the starting horizontal coordinate, the horizontal coordinate difference, and the target number, the trajectory horizontal coordinate corresponding to each trajectory point is generated.

[0035] In one embodiment, the generating unit is configured to:

[0036] Based on the starting ordinate, ending ordinate, and the number of targets, the initial ordinate corresponding to each trajectory point is generated; the initial ordinate is positively correlated with the starting ordinate and ending ordinate, and negatively correlated with the number of targets;

[0037] Based on the trajectory arc parameter and the number of targets, the adjustment value corresponding to each trajectory point is generated;

[0038] Based on the adjustment value of each track point, the initial vertical coordinate of each track point is adjusted respectively to obtain the track vertical coordinate corresponding to each track point.

[0039] In one embodiment, the generating unit is configured to:

[0040] The target equation expression is used to obtain each adjustment value based on the trajectory arc parameter and the target quantity; the target trajectory equation includes the target equation expression, and the target equation expression is a quadratic equation.

[0041] On the one hand, an electronic device is provided, including a processor and a memory, wherein the memory stores computer-readable instructions. When the computer-readable instructions are executed by the processor, the steps of the method provided in any of the various optional implementations of drawing a trajectory as described above are executed.

[0042] In one aspect, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the steps of the method provided in any of the various optional implementations of drawing a trajectory are executed.

[0043] In one aspect, a computer program product is provided. When the computer program product is run on a computer, the computer is caused to perform the steps of the method provided in any of the various optional implementations of drawing a trajectory described above.

[0044] Other features and advantages of the present application will be described in the following description, and in part will become apparent from the description, or will be understood by practicing the present application. The purposes and other advantages of the present application can be realized and obtained by the structures particularly pointed out in the written description, claims, and drawings. BRIEF DESCRIPTION OF THE DRAWINGS

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

[0046] Figure 1 A flowchart of a method for drawing a trajectory provided in an embodiment of the present application;

[0047] Figure 2 An example diagram of a target equation expression provided in an embodiment of the present application;

[0048] Figure 3 An example diagram of a trajectory curve provided in an embodiment of the present application;

[0049] Figure 4 A structural block diagram of a trajectory drawing device provided in an embodiment of the present application;

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

[0051] The technical solutions in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are only a part of the embodiments of the present application, rather than all of the embodiments. The components of the embodiments of the present application generally described and shown in the drawings here can be arranged and designed in various different configurations. Therefore, the following detailed description of the embodiments of the present application provided in the drawings is not intended to limit the scope of the application for protection, but merely represents the selected embodiments of the present application. Based on the embodiments of the present application, all other embodiments obtained by those skilled in the art without making creative work fall within the scope of protection of the present application.

[0052] First, some of the terms involved in the embodiments of the present application are explained to facilitate understanding by those skilled in the art.

[0053] Terminal device: can be a mobile terminal, fixed terminal or portable terminal, such as a mobile phone, station, unit, device, multimedia computer, multimedia tablet, Internet node, communicator, desktop computer, laptop computer, notebook computer, netbook computer, tablet computer, personal communication system device, personal navigation device, personal digital assistant, audio / video player, digital camera / camcorder, positioning device, television receiver, radio broadcast receiver, e-book device, gaming device or any combination thereof, including accessories and peripherals of these devices or any combination thereof. It is also foreseeable that the terminal device can support any type of user interface (such as wearable device), etc.

[0054] Server: It can be an independent physical server, a server cluster or distributed system composed of multiple physical servers, or a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, and big data and artificial intelligence platforms.

[0055] In order to solve the problem of how to quickly draw a trajectory curve when drawing a trajectory curve, embodiments of the present application provide a method, device, electronic device, and computer-readable storage medium for drawing a trajectory.

[0056] See Figure 1 The figure shows a flow chart of a method for drawing a trajectory provided by an embodiment of the present application, which is applied to an electronic device, which can be a server or a terminal device. The specific implementation process of the method is as follows:

[0057] Step 100: Obtain the starting point coordinates of the starting point, the ending point coordinates of the ending point, and the trajectory arc parameters.

[0058] The trajectory arc parameter is used to set the arc size and direction of the trajectory curve to be drawn. The trajectory arc parameter can be pre-set, determined by user instructions, or adaptively adjusted based on any factors such as interface size and map size.

[0059] Step 101: Generate trajectory coordinates corresponding to multiple trajectory points between the starting point and the ending point according to the target trajectory equation based on the starting point coordinates, the ending point coordinates and the trajectory arc parameters.

[0060] Specifically, the starting coordinates include the starting horizontal coordinate and the starting vertical coordinate, the ending coordinates include the ending horizontal coordinate and the ending vertical coordinate, and the trajectory coordinates include the trajectory horizontal coordinate and the trajectory vertical coordinate. The target trajectory equation may include a trajectory horizontal coordinate equation for generating the trajectory horizontal coordinate and a trajectory vertical coordinate equation for generating the trajectory vertical coordinate.

[0061] In one embodiment, when executing step 101, the following steps may be performed:

[0062] S1010: Obtain the target number of trajectory points to be generated.

[0063] The target number is the number of trajectory points, such as 100. The target number can be a pre-set fixed value, or it can be obtained based on user input (e.g., a target number input in real time). It can also be adaptively adjusted based on factors such as interface size, resolution, and the distance between the starting and ending points. For example, the target number can be positively correlated with the interface size, resolution, and the aforementioned distance.

[0064] S1011: Based on the starting horizontal coordinate, the ending horizontal coordinate, and the target number, generate the trajectory horizontal coordinate corresponding to each trajectory point.

[0065] Among them, the trajectory horizontal coordinate is positively correlated with the ending horizontal coordinate and the starting horizontal coordinate, and is negatively correlated with the number of targets.

[0066] In one embodiment, a trajectory horizontal coordinate equation is used to determine the difference between the ending horizontal coordinate and the starting horizontal coordinate to obtain the horizontal coordinate difference, and based on the starting horizontal coordinate, the horizontal coordinate difference, and the target number, the trajectory horizontal coordinate corresponding to each trajectory point is generated.

[0067] Among them, the trajectory abscissa equation can be expressed as follows:

[0068] X i =X0+(X z -X0)*t i ;ti =i / n;

[0069] Among them, i is the sequence number of the trajectory point, X i is the horizontal coordinate of the trajectory point i, X0 is the starting horizontal coordinate, X z is the ending horizontal coordinate, n is the target number, t i is the increment.

[0070] For example, if n is 100, the horizontal coordinate difference is divided into 100 parts, and the horizontal coordinate of the first track point is: X1 = X0 + (X z -X0)*1 / 100.

[0071] S1012: Generate the trajectory ordinate corresponding to each trajectory point based on the starting ordinate, the ending ordinate, the trajectory arc parameter, and the number of targets.

[0072] Specifically, the trajectory ordinate equation is used to generate the trajectory ordinate corresponding to each trajectory point based on the starting ordinate, the ending ordinate, the trajectory arc parameter, and the number of targets.

[0073] Among them, the trajectory ordinate is positively correlated with the starting ordinate and the ending ordinate.

[0074] In one implementation, the implementation process of S1012 may include:

[0075] S1012-1: Based on the starting vertical coordinate, the ending vertical coordinate, and the number of targets, generate the initial vertical coordinate corresponding to each trajectory point.

[0076] Among them, the initial ordinate is positively correlated with the starting ordinate and the ending ordinate, and negatively correlated with the target number.

[0077] S1012-2: Based on the trajectory arc parameter and the target number, generate adjustment values ​​corresponding to each trajectory point.

[0078] Specifically, the target equation expression is used to obtain each adjustment value based on the trajectory arc parameter and the target quantity; the target trajectory equation includes the target equation expression, and the target equation expression is a quadratic equation.

[0079] The target equation can be expressed as follows: a*h(t i -t i 2 );t i =i / n;

[0080] Among them, a is a constant, h is the trajectory arc parameter, t i is the increment.

[0081] See Figure 2 As shown in the figure, it is an example diagram of the target equation expression. Assuming a is 4, then Figure 2 In the example, the target equation expression is shown as 4*h(t i -t i 2 ) curve graph.

[0082] S1012-3: Based on the adjustment value of each track point, the initial vertical coordinate of each track point is adjusted to obtain the track vertical coordinate corresponding to each track point.

[0083] Among them, the trajectory ordinate equation can be expressed as follows:

[0084] Y i =Y0+(Y z -Y0)*t i -a*h(t i -t i 2 );t i =i / n;

[0085] Among them, i is the sequence number of the trajectory point, Y i is the vertical coordinate of the i-th trajectory point, Y0 is the starting coordinate, Y z is the ending horizontal coordinate, n is the number of targets, a is a constant, h is the trajectory arc parameter, t i is the increment.

[0086] For example, if n is 100, the vertical coordinate difference (i.e. Y z -Y0) is divided into 100 parts, and the vertical coordinate of the first track point is: Y1=Y0+(Y z -Y0)*1 / 100.

[0087] Step 102: Connect the starting point, the ending point and each track point according to the starting point coordinates, the ending point coordinates and each track coordinates to generate a target track curve.

[0088] In one implementation, an application programming interface (API) of canvas or svg may be called to connect the starting point coordinates, the end point coordinates, and the coordinates of each trajectory to obtain a target trajectory curve.

[0089] See Figure 3 The figure shows an example of a trajectory curve. Figure 3 In the figure, the target trajectory curve generated based on the starting point coordinates (100, 500) and the end point coordinates (900, 200) is shown.

[0090] In one embodiment, the center point between the starting point and the end point includes: the center horizontal coordinate X m And the center vertical coordinate Y m Then the central horizontal coordinate X m =((X z -+X0)), center vertical coordinate Y m =(Y z +Y0) / 2-h. When h is 0, the target trajectory curve is a straight line. A larger h indicates a larger arc and a larger amplitude, while a smaller h indicates a smaller amplitude. For example, in a browser, since the coordinate system is established from the upper left corner of the browser, a larger h indicates an upward arc, and vice versa.

[0091] Therefore, the center point between the starting point and the ending point can be used as the control point for drawing the trajectory. The user can determine the size, amplitude and direction of the arc of the target trajectory curve through the control point and h.

[0092] In map applications, the first and second coordinates corresponding to two locations can be determined based on their latitude and longitude. Based on user-defined instructions, the user's designated h and n can be obtained. A target trajectory curve can then be generated on the map based on the first and second coordinates, h, and n. Furthermore, animation effects can be combined to achieve attack and point-to-point effects.

[0093] In an embodiment of the present application, multiple trajectory points can be quickly calculated based on the starting point coordinates, the end point coordinates and the trajectory curvature parameters to obtain a set of trajectory points between the two points. The trajectory point generation efficiency is high, thereby improving the trajectory drawing efficiency. When the amount of data is large, the trajectory drawing can also be performed in a timely manner. Moreover, the size and direction of the trajectory curvature can be customized through h according to actual needs. Furthermore, it can be adaptively adjusted according to factors such as the interface size, resolution and the distance between the starting point and the end point, and the trajectory can be drawn through the canvas or svg API, which improves the flexibility of trajectory drawing and can solve the distortion problem.

[0094] Based on the same inventive concept, an embodiment of the present application also provides a device for drawing a trajectory. Since the principle of solving the problem by the above-mentioned device and equipment is similar to that of a method for drawing a trajectory, the implementation of the above-mentioned device can refer to the implementation of the method, and the repeated parts will not be repeated.

[0095] like Figure 4 As shown, it is a structural schematic diagram of a trajectory drawing device provided by an embodiment of the present application, including:

[0096] An acquisition unit 401 is used to acquire the starting point coordinates, the ending point coordinates, and the trajectory arc parameter, where the trajectory arc parameter is used to set the arc size and direction of the trajectory curve to be drawn;

[0097] A generating unit 402 is configured to generate trajectory coordinates corresponding to a plurality of trajectory points between a starting point and an ending point according to a target trajectory equation, based on the starting point coordinates, the ending point coordinates, and the trajectory arc parameter;

[0098] The connection unit 403 is used to connect the starting point, the ending point and each track point according to the starting point coordinates, the ending point coordinates and each track coordinates to generate a target track curve.

[0099] In one embodiment, the starting point coordinates include a starting horizontal coordinate and a starting vertical coordinate, the ending point coordinates include a final horizontal coordinate and a final vertical coordinate; the trajectory coordinates include a trajectory horizontal coordinate and a trajectory vertical coordinate; the generating unit 402 is used to:

[0100] Get the target number of trajectory points to be generated;

[0101] Based on the starting horizontal coordinate, the ending horizontal coordinate, and the number of targets, the trajectory horizontal coordinate corresponding to each trajectory point is generated. The trajectory horizontal coordinate is positively correlated with the ending horizontal coordinate and the starting horizontal coordinate, and negatively correlated with the number of targets.

[0102] Based on the starting ordinate, ending ordinate, trajectory arc parameter, and target number, the trajectory ordinate corresponding to each trajectory point is generated. The trajectory ordinate is positively correlated with the starting ordinate and ending ordinate.

[0103] In one implementation, the generating unit 402 is configured to:

[0104] Determine the difference between the ending abscissa and the starting abscissa to obtain the abscissa difference;

[0105] Based on the starting horizontal coordinate, the horizontal coordinate difference, and the target number, the trajectory horizontal coordinate corresponding to each trajectory point is generated.

[0106] In one implementation, the generating unit 402 is configured to:

[0107] Based on the starting ordinate, ending ordinate, and the number of targets, the initial ordinate corresponding to each trajectory point is generated; the initial ordinate is positively correlated with the starting ordinate and ending ordinate, and negatively correlated with the number of targets;

[0108] Based on the trajectory arc parameter and the number of targets, the adjustment value corresponding to each trajectory point is generated;

[0109] Based on the adjustment value of each track point, the initial vertical coordinate of each track point is adjusted respectively to obtain the track vertical coordinate corresponding to each track point.

[0110] In one implementation, the generating unit 402 is configured to:

[0111] The target equation expression is used to obtain each adjustment value based on the trajectory arc parameter and the target quantity; the target trajectory equation includes the target equation expression, and the target equation expression is a quadratic equation.

[0112] In the method, device, electronic device, and computer-readable storage medium for drawing a trajectory provided by the embodiments of the present application, the starting coordinates of the starting point, the ending coordinates of the ending point, and the trajectory radian parameter are obtained. The trajectory radian parameter is used to set the radian size and direction of the trajectory curve to be drawn; according to the target trajectory equation, based on the starting coordinates, the ending coordinates, and the trajectory radian parameter, the trajectory coordinates corresponding to multiple trajectory points between the starting point and the ending point are generated; according to the starting coordinates, the ending coordinates, and the trajectory coordinates, the starting point, the ending point, and the trajectory points are connected to generate the target trajectory curve. In this way, the trajectory curve between the starting point and the ending point can be generated according to the target trajectory equation and the trajectory radian parameter, thereby improving the efficiency of trajectory curve generation.

[0113] Figure 5 FIG. 5 shows a schematic structural diagram of an electronic device 5000. Figure 5 As shown, the electronic device 5000 includes: a processor 5010 and a memory 5020, and optionally, may also include a power supply 5030, a display unit 5040, and an input unit 5050.

[0114] The processor 5010 is the control center of the electronic device 5000. It uses various interfaces and lines to connect various components, and performs various functions of the electronic device 5000 by running or executing software programs and / or data stored in the memory 5020, thereby monitoring the electronic device 5000 as a whole.

[0115] In the embodiment of the present application, the processor 5010 executes the various steps in the above embodiment when calling the computer program stored in the memory 5020.

[0116] Optionally, the processor 5010 may include one or more processing units. Preferably, the processor 5010 may integrate an application processor and a modem processor, wherein the application processor primarily processes the operating system, user interface, and applications, and the modem processor primarily processes wireless communications. It is understood that the modem processor may not be integrated into the processor 5010. In some embodiments, the processor and memory may be implemented on a single chip. In some embodiments, they may also be implemented on separate chips.

[0117] The memory 5020 may mainly include a program storage area and a data storage area. The program storage area may store an operating system, various applications, etc., and the data storage area may store data created based on the use of the electronic device 5000. In addition, the memory 5020 may include a high-speed random access memory and may also include a non-volatile memory, such as at least one disk storage device, a flash memory device, or other volatile solid-state storage device.

[0118] The electronic device 5000 also includes a power supply 5030 (such as a battery) for supplying power to various components. The power supply can be logically connected to the processor 5010 through a power management system, thereby managing functions such as charging, discharging, and power consumption through the power management system.

[0119] The display unit 5040 can be used to display information input by the user or information provided to the user, as well as various menus of the electronic device 5000. In the embodiment of the present invention, it is mainly used to display the display interface of each application in the electronic device 5000 and objects such as text and pictures displayed on the display interface. The display unit 5040 may include a display panel 5041. The display panel 5041 can be configured in the form of a liquid crystal display (LCD), an organic light-emitting diode (OLED), etc.

[0120] The input unit 5050 can be used to receive information such as numbers or characters input by the user. The input unit 5050 may include a touch panel 5051 and other input devices 5052. The touch panel 5051, also known as a touch screen, can receive user touch operations on or near it (for example, operations performed by the user using a finger, a stylus, or any other suitable object or accessory on or near the touch panel 5051).

[0121] Specifically, the touch panel 5051 can detect user touch operations and the signals generated by the touch operations, convert these signals into touch point coordinates, send them to the processor 5010, and receive and execute commands sent by the processor 5010. In addition, the touch panel 5051 can be implemented using various types, such as resistive, capacitive, infrared, and surface acoustic wave. Other input devices 5052 can include, but are not limited to, one or more of a physical keyboard, function keys (such as volume control buttons, power buttons, etc.), a trackball, a mouse, a joystick, etc.

[0122] Of course, the touch panel 5051 can cover the display panel 5041. When the touch panel 5051 detects a touch operation on or near it, it transmits the information to the processor 5010 to determine the type of touch event. Then, the processor 5010 provides corresponding visual output on the display panel 5041 according to the type of touch event. Figure 5 In the embodiment, the touch panel 5051 and the display panel 5041 are two independent components to realize the input and output functions of the electronic device 5000, but in some embodiments, the touch panel 5051 and the display panel 5041 can be integrated to realize the input and output functions of the electronic device 5000.

[0123] The electronic device 5000 may also include one or more sensors, such as a pressure sensor, a gravity acceleration sensor, a proximity light sensor, etc. Of course, according to the needs of specific applications, the electronic device 5000 may also include other components such as a camera. Since these components are not the key components used in the embodiments of this application, Figure 5 It is not shown and will not be described in detail.

[0124] Those skilled in the art will understand that Figure 5 The electronic device is merely an example and does not limit the electronic device. The electronic device may include more or fewer components than shown in the figure, or may include a combination of certain components or different components.

[0125] In an embodiment of the present application, a computer-readable storage medium stores a computer program. When the computer program is executed by a processor, a communication device can perform each step in the above embodiment.

[0126] For the convenience of description, the above parts are divided into modules (or units) according to their functions and described separately. Of course, when implementing this application, the functions of each module (or unit) can be implemented in the same or multiple software or hardware.

[0127] Those skilled in the art will appreciate that the embodiments of the present application can be provided as methods, systems, or computer program products. Therefore, the present application can adopt the form of a complete hardware embodiment, a complete software embodiment, or an embodiment in combination with software and hardware. Moreover, the present application can adopt the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to magnetic disk storage, CD-ROM, optical storage, etc.) that contain computer-usable program code.

[0128] The present application is described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to the embodiments of the present application. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the processes and / or boxes in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the steps in the process. Figure 1 a process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.

[0129] These computer program instructions may also be stored in a computer readable memory that can direct a computer or other programmable data processing device to work in a specific manner, so that the instructions stored in the computer readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 a process or multiple processes and / or boxes Figure 1 The function specified in one or more boxes.

[0130] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operational steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing the instructions executed on the computer or other programmable device for implementing the process. Figure 1 a process or multiple processes and / or boxes Figure 1 A step that specifies a function in one or more boxes.

[0131] Although the preferred embodiments of the present application have been described, those skilled in the art may make additional changes and modifications to these embodiments once they have learned the basic creative concept. Therefore, the appended claims are intended to be interpreted as including the preferred embodiments and all changes and modifications that fall within the scope of the present application.

[0132] Obviously, those skilled in the art may make various changes and modifications to this application without departing from the spirit and scope of this application. Thus, if these modifications and variations of this application fall within the scope of the claims of this application and their equivalents, this application is intended to include these modifications and variations.

Claims

1. A method for drawing a trajectory, characterized in that: include: Obtain the starting point coordinates, the ending point coordinates, and the trajectory arc parameters, which are used to set the arc size and direction of the trajectory curve to be drawn; Generate trajectory coordinates corresponding to a plurality of trajectory points between the starting point and the ending point according to a target trajectory equation based on the starting point coordinates, the ending point coordinates, and the trajectory arc parameter, wherein the target trajectory equation includes a trajectory abscissa equation for generating a trajectory abscissa, and a trajectory ordinate equation for generating a trajectory ordinate; Connecting the starting point, the ending point and each track point according to the starting point coordinates, the ending point coordinates and each track coordinates to generate a target track curve; In a map application scenario, the first coordinate and the second coordinate corresponding to the two locations are determined according to the latitude and longitude of the two locations; According to the user's customized instructions, the trajectory arc parameter and the number of targets indicated by the user are obtained, and the target trajectory curve is generated in the map according to the first coordinate, the second coordinate, the trajectory arc parameter and the number of targets; Based on the starting point coordinates, end point coordinates, and trajectory arc parameters, multiple trajectory points are quickly calculated to obtain the trajectory point set between the two points. The trajectory point generation efficiency is high, which improves the efficiency of trajectory drawing. When the data volume is large, trajectory drawing is carried out in a timely manner. According to actual needs, the trajectory arc size and direction can be customized through the trajectory arc parameter. It is adaptively adjusted according to the interface size, resolution, and the distance between the starting point and the end point. Trajectory drawing is performed through the canvas or SVG API, which improves the flexibility of trajectory drawing and can solve the problem of distortion. The starting point coordinates include a starting horizontal coordinate and a starting vertical coordinate, and the ending point coordinates include a ending horizontal coordinate and a ending vertical coordinate; the trajectory coordinates include a trajectory horizontal coordinate and a trajectory vertical coordinate; and generating trajectory coordinates corresponding to a plurality of trajectory points between the starting point and the ending point according to the target trajectory equation based on the starting point coordinates, the ending point coordinates, and the trajectory arc parameter includes: Get the target number of trajectory points to be generated; Based on the starting horizontal coordinate, the ending horizontal coordinate, and the target number, the trajectory horizontal coordinate corresponding to each trajectory point is generated; wherein: the trajectory horizontal coordinate equation can be adopted as the following formula: X i =X0+(X z - X0)*t i ;t i =y / n; Among them, i is the sequence number of the trajectory point, X i is the horizontal coordinate of the trajectory point i, X0 is the starting horizontal coordinate, X z is the ending horizontal coordinate, n is the target number, t i is the increment; Based on the starting ordinate, the ending ordinate, the trajectory arc parameter, and the target quantity, the trajectory ordinate corresponding to each trajectory point is generated; wherein: The trajectory ordinate equation can be expressed as follows: Y i =Y0+(Y z -Y0)* t i - a*h(t i -t i 2 );t i =i / n; Among them, i is the sequence number of the trajectory point, Y i is the vertical coordinate of the i-th trajectory point, Y0 is the starting coordinate, Y z is the ending horizontal coordinate, n is the number of targets, a is a constant, h is the trajectory arc parameter, t i is the increment.

2. The method according to claim 1, wherein The trajectory abscissa is positively correlated with the end abscissa and the start abscissa, and negatively correlated with the number of targets; The trajectory ordinate is positively correlated with the starting ordinate and the ending ordinate.

3. The method according to claim 2, wherein The step of generating the trajectory horizontal coordinates corresponding to each trajectory point based on the starting horizontal coordinate, the ending horizontal coordinate, and the target quantity includes: Determine the difference between the end horizontal coordinate and the start horizontal coordinate to obtain a horizontal coordinate difference value; Based on the starting horizontal coordinate, the horizontal coordinate difference, and the target number, the trajectory horizontal coordinate corresponding to each trajectory point is generated.

4. The method according to claim 2, wherein The generating of the trajectory ordinate corresponding to each trajectory point based on the starting ordinate, the ending ordinate, the trajectory arc parameter, and the target quantity includes: Based on the starting ordinate, the ending ordinate, and the number of targets, generating initial ordinates corresponding to each trajectory point; the initial ordinates are positively correlated with the starting ordinate and the ending ordinate, and negatively correlated with the number of targets; Based on the trajectory radian parameter and the target quantity, generating adjustment values ​​corresponding to each of the trajectory points; Based on the adjustment value of each track point, the initial vertical coordinate of each track point is adjusted respectively to obtain the track vertical coordinate corresponding to each track point.

5. The method according to claim 4, wherein Generating the adjustment values ​​corresponding to the respective trajectory points based on the trajectory radian parameter and the target quantity includes: The target equation expression is used to obtain each adjustment value based on the trajectory radian parameter and the target quantity; the target trajectory equation includes the target equation expression, and the target equation expression is a quadratic equation.

6. A device for drawing a trajectory, characterized in that include: An acquisition unit, configured to acquire the starting point coordinates of the starting point, the ending point coordinates of the ending point, and a trajectory radian parameter, wherein the trajectory radian parameter is used to set the radian size and direction of the trajectory curve to be drawn; a generating unit, configured to generate trajectory coordinates corresponding to a plurality of trajectory points between the starting point and the ending point according to a target trajectory equation based on the starting point coordinates, the ending point coordinates, and the trajectory arc parameter; the target trajectory equation comprising a trajectory abscissa equation for generating a trajectory abscissa, and a trajectory ordinate equation for generating a trajectory ordinate; a connecting unit, configured to connect the starting point, the ending point and each track point according to the starting point coordinates, the ending point coordinates and each track coordinates to generate a target track curve; In a map application scenario, the first coordinate and the second coordinate corresponding to the two locations are determined according to the latitude and longitude of the two locations; According to the user's customized instructions, the trajectory arc parameter and the number of targets indicated by the user are obtained, and the target trajectory curve is generated in the map according to the first coordinate, the second coordinate, the trajectory arc parameter and the number of targets; Based on the starting point coordinates, end point coordinates, and trajectory arc parameters, multiple trajectory points are quickly calculated to obtain the trajectory point set between the two points. The trajectory point generation efficiency is high, which improves the efficiency of trajectory drawing. When the data volume is large, trajectory drawing is carried out in a timely manner. According to actual needs, the trajectory arc size and direction can be customized through the trajectory arc parameter. It is adaptively adjusted according to the interface size, resolution, and the distance between the starting point and the end point. Trajectory drawing is performed through the canvas or SVG API, which improves the flexibility of trajectory drawing and can solve the problem of distortion. The starting point coordinates include a starting horizontal coordinate and a starting vertical coordinate, and the ending point coordinates include a final horizontal coordinate and a final vertical coordinate; the trajectory coordinates include a trajectory horizontal coordinate and a trajectory vertical coordinate; and the generating unit is used to: Get the target number of trajectory points to be generated; Based on the starting horizontal coordinate, the ending horizontal coordinate, and the target number, the trajectory horizontal coordinate corresponding to each trajectory point is generated. The trajectory horizontal coordinate is positively correlated with the ending horizontal coordinate and the starting horizontal coordinate, and negatively correlated with the target number. The trajectory horizontal coordinate equation can be expressed as follows: X i =X0+(X z - X0)*t i ;t i =y / n; Among them, i is the sequence number of the trajectory point, X i is the horizontal coordinate of the trajectory point i, X0 is the starting horizontal coordinate, X z is the ending horizontal coordinate, n is the target number, t i is the increment; Based on the starting ordinate, the ending ordinate, the trajectory arc parameter, and the number of targets, generating trajectory ordinates corresponding to each trajectory point, wherein the trajectory ordinates are positively correlated with the starting ordinate and the ending ordinate; The trajectory ordinate equation can be expressed as follows: Y i =Y0+(Y z -Y0)* t i - a*h(t i -t i 2 );t i =i / n; Among them, i is the sequence number of the trajectory point, Y i is the vertical coordinate of the i-th trajectory point, Y0 is the starting coordinate, Y z is the ending horizontal coordinate, n is the number of targets, a is a constant, h is the trajectory arc parameter, t i is the increment.

7. The device according to claim 6, characterized in that The trajectory abscissa is positively correlated with the end abscissa and the start abscissa, and negatively correlated with the number of targets; The trajectory ordinate is positively correlated with the starting ordinate and the ending ordinate.

8. The device according to claim 7, wherein The generating unit is used for: Determine the difference between the end horizontal coordinate and the start horizontal coordinate to obtain a horizontal coordinate difference value; Based on the starting horizontal coordinate, the horizontal coordinate difference, and the target number, the trajectory horizontal coordinate corresponding to each trajectory point is generated.

9. The device according to claim 7, wherein The generating unit is used for: Based on the starting ordinate, the ending ordinate, and the number of targets, generating initial ordinates corresponding to each trajectory point; the initial ordinates are positively correlated with the starting ordinate and the ending ordinate, and negatively correlated with the number of targets; Based on the trajectory radian parameter and the target quantity, generating adjustment values ​​corresponding to each of the trajectory points; Based on the adjustment value of each track point, the initial vertical coordinate of each track point is adjusted respectively to obtain the track vertical coordinate corresponding to each track point.

10. The device according to claim 9, wherein The generating unit is used for: The target equation expression is used to obtain each adjustment value based on the trajectory radian parameter and the target quantity; the target trajectory equation includes the target equation expression, and the target equation expression is a quadratic equation.

11. An electronic device, characterized in that: The method comprises a processor and a memory, wherein the memory stores computer-readable instructions. When the computer-readable instructions are executed by the processor, the method according to any one of claims 1 to 5 is executed.

12. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the method according to any one of claims 1 to 5 is executed.

Citation Information

Patent Citations

  • GIS application based on Bezier curve algorithm

    CN111767361A