3D Curve Drawing Method and Device Based on 3D Chart Library

By calculating the midpoint coordinates and the mid-perpendicular direction vector, combining the trigonometric function and the Bezier curvature threshold, a quadratic Bezier curve point set is generated and configured into the echarts-gl library, which solves the problem that the echarts-gl library lacks advanced configuration options in three-dimensional ray drawing, and realizes efficient and convenient 3D curve drawing.

CN119888110BActive Publication Date: 2025-06-10HANGZHOU HUIZHI NETWORK TECHNOLOGY CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202510323292.0
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-03-19
Publication Date
2025-06-10
Estimated Expiration
2045-03-19

AI Technical Summary

Technical Problem

In the prior art, the echarts-gl library lacks advanced configuration options such as customized curvature and arrow effects in three-dimensional ray drawing, which is difficult to meet the diversified needs in three-dimensional map display.

Method used

By receiving three-dimensional array data, calculate the midpoint coordinates and mid-perpendicular direction vectors, determine the control point coordinates based on the preset trigonometric function and Bezier curvature threshold, generate the curve point set using the quadratic Bezier curve formula, and configure it into the three-dimensional chart library to realize the drawing of the three-dimensional curve.

Benefits of technology

It improves the efficiency and convenience of 3D curve drawing, meets the diverse needs in 3D map display, and achieves the smoothness and accuracy of the curve.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119888110B_ABST
    Figure CN119888110B_ABST
Patent Text Reader

Abstract

An embodiment of the present application provides a three-dimensional curve drawing method and device based on a three-dimensional chart library. The method includes: performing basic calculations on the starting point coordinates and ending point coordinates in the three-dimensional array data to determine the corresponding midpoint coordinates and the direction vector of the perpendicular bisector; determining basic control points according to the midpoint coordinates, the direction vector of the perpendicular bisector, and a preset trigonometric function; performing a dynamic adjustment operation on the basic control points according to the length of the direction vector from the starting point coordinates to the ending point coordinates to obtain adaptive control points; performing a curvature constraint adjustment on the adaptive control points to determine the corresponding control point coordinates; inputting the preset number of path points, the starting point coordinates, the ending point coordinates, and the control point coordinates into the quadratic Bezier curve formula to obtain a quadratic Bezier curve point set; and performing a data configuration operation on the three-dimensional chart library according to the quadratic Bezier curve point set to obtain a three-dimensional curve of the three-dimensional chart library. The present application can improve the efficiency and convenience of three-dimensional curve drawing.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of data processing, and particularly to a three-dimensional curve drawing method and device based on a three-dimensional chart library. Background Art

[0002] In the field of three-dimensional map drawing, especially when developing using the echarts-gl library (a three-dimensional chart library), there are specific technical challenges in drawing three-dimensional rays. Currently, the three-dimensional ray function in echarts-gl mainly supports straight line drawing, lacking advanced configuration options such as custom curvature and arrow effects, which is relatively limited compared to the two-dimensional ray function in echarts. However, in many application scenarios of echarts, especially in large-screen displays, it is often necessary to draw rays on a three-dimensional map to represent information such as directions, paths, or connections. If only using the default ray drawing function in echarts-gl, only a straight line can be displayed, which not only affects the aesthetics but also does not meet the requirements of the large-screen display effect.

[0003] To overcome this limitation, some developers have tried to use the polyline configuration in echarts-gl to simulate curve drawing. This method requires developers to manually calculate and input the coordinates of multiple waypoints into the data of the three-dimensional ray. However, since the points on the map are usually represented by longitude and latitude coordinates, manually estimating and inserting waypoints is not only a large amount of work but also difficult to ensure the smoothness and accuracy of the curve. In addition, the hard-coded method also lacks flexibility and maintainability, and it is difficult to meet the diverse needs in practical applications.

[0004] In view of the above problems, there is an urgent need to provide an efficient and convenient method to achieve the curved drawing of three-dimensional rays and meet the diverse needs in three-dimensional map displays. Summary of the Invention

[0005] In view of the problems in the prior art, this application provides a three-dimensional curve drawing method and device based on a three-dimensional chart library, which can improve the efficiency and convenience of three-dimensional curve drawing.

[0006] To solve at least one of the above problems, this application provides the following technical solutions:

[0007] In a first aspect, this application provides a three-dimensional curve drawing method based on a three-dimensional chart library, including:

[0008] Receiving three-dimensional array data, performing a coordinate averaging calculation operation on the starting point coordinates and ending point coordinates in the three-dimensional array data to determine the corresponding midpoint coordinates, and performing a cross product calculation operation on the starting point coordinates and ending point coordinates in the three-dimensional array data to determine the corresponding perpendicular bisector direction vector;

[0009] Perform control point calculation operations according to the midpoint coordinates, the perpendicular bisector direction vector, and preset trigonometric functions to determine the corresponding basic control points. Perform distance calculation operations on the starting coordinates and the ending coordinates to determine the corresponding direction vector length. Perform dynamic adjustment operations on the basic control points according to the direction vector length to determine the corresponding adaptive control points. Perform curvature constraint adjustment on the adaptive control points according to a preset Bezier curvature threshold to determine the corresponding control point coordinates;

[0010] Perform quadratic Bezier curve drawing according to the preset number of waypoints, the starting coordinates, the ending coordinates, and the control point coordinates to determine the corresponding quadratic Bezier curve point set. Perform data configuration operations on the three-dimensional chart library according to the quadratic Bezier curve point set to determine the corresponding three-dimensional curve.

[0011] Further, the performing cross product calculation operations on the starting coordinates and the ending coordinates in the three-dimensional array data to determine the corresponding perpendicular bisector direction vector includes:

[0012] Determine the corresponding direction vector from the starting point to the ending point direction according to the starting coordinates and the ending coordinates in the three-dimensional array data;

[0013] Perform cross product calculation operations on the direction vector and a preset perpendicular direction vector to determine the corresponding perpendicular bisector direction vector, where the perpendicular direction vector is a direction vector perpendicular to the world coordinate system.

[0014] Further, the performing control point calculation operations according to the midpoint coordinates, the perpendicular bisector direction vector, and preset trigonometric functions to determine the corresponding basic control points includes:

[0015] Determine the corresponding first control point offset through a preset angle value and preset trigonometric functions;

[0016] Taking the midpoint coordinates as the starting point and the perpendicular bisector direction vector as the offset direction, perform control point calculation operations according to the first control point offset to determine the corresponding basic control points.

[0017] Further, the performing dynamic adjustment operations on the basic control points according to the direction vector length to determine the corresponding adaptive control points includes:

[0018] Determine the corresponding second control point offset according to a preset proportional coefficient and the length of the direction vector, and perform dynamic adjustment on the first control point offset according to the second control point offset to determine the corresponding control point offset;

[0019] Taking the midpoint coordinates as the starting point and the perpendicular bisector direction vector as the offset direction, perform control point calculation operations according to the control point offset to determine the corresponding adaptive control points.

[0020] Further, the curvature constraint adjustment of the adaptive control points according to the preset Bessel curvature threshold to determine the corresponding control point coordinates includes:

[0021] Perform a quadratic Bessel curvature calculation operation according to the adaptive control points to determine the corresponding control point curvature;

[0022] Judge whether the control point curvature is greater than the preset Bessel curvature threshold. If it is greater, reduce the offset of the control point.

[0023] Further, the drawing of the quadratic Bessel curve according to the preset number of waypoints, the starting point coordinates, the ending point coordinates, and the control point coordinates to determine the corresponding quadratic Bessel curve point set includes:

[0024] Input the starting point coordinates, the ending point coordinates, and the control point coordinates into a preset quadratic Bessel curve formula for curve drawing operations to determine the corresponding continuous curve;

[0025] Discretize the continuous curve according to the preset number of waypoints to determine the corresponding quadratic Bessel curve point set.

[0026] Further, the data configuration operation on the three-dimensional chart library according to the quadratic Bessel curve point set to determine the corresponding three-dimensional curve includes:

[0027] Combine the quadratic Bessel curve point set with the unit array data to determine the corresponding linesData array;

[0028] Assign values to the data of the three-dimensional chart library according to the linesData array, so that the three-dimensional chart library generates the corresponding three-dimensional curve according to the linesData array.

[0029] In a second aspect, the present application provides a three-dimensional curve drawing device based on a three-dimensional chart library, including:

[0030] A basic calculation module, configured to receive three-dimensional array data, perform a coordinate averaging calculation operation on the starting point coordinates and the ending point coordinates in the three-dimensional array data to determine the corresponding midpoint coordinates, and perform a cross product calculation operation on the starting point coordinates and the ending point coordinates in the three-dimensional array data to determine the corresponding perpendicular bisector direction vector;

[0031] A control point calculation module, configured to perform control point calculation operations according to the midpoint coordinates, the perpendicular bisector direction vector, and preset trigonometric functions, determine corresponding basic control points, perform distance calculation operations on the starting coordinates and the ending coordinates, determine the corresponding direction vector length, perform dynamic adjustment operations on the basic control points according to the direction vector length, determine corresponding adaptive control points, perform curvature constraint adjustment on the adaptive control points according to a preset Bezier curvature threshold, and determine the corresponding control point coordinates;

[0032] A three-dimensional curve generation module, configured to draw a quadratic Bezier curve according to a preset number of waypoints, the starting coordinates, the ending coordinates, and the control point coordinates, determine a corresponding quadratic Bezier curve point set, and perform data configuration operations on a three-dimensional chart library according to the quadratic Bezier curve point set to determine a corresponding three-dimensional curve.

[0033] In a third aspect, the present application provides an electronic device, including a memory, a processor, and a computer program stored on the memory and executable on the processor. When the processor executes the program, the steps of the three-dimensional curve drawing method based on a three-dimensional chart library are implemented.

[0034] In a fourth aspect, the present application provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the steps of the three-dimensional curve drawing method based on a three-dimensional chart library are implemented.

[0035] In a fifth aspect, the present application provides a computer program product, including a computer program / instructions. When the computer program / instructions are executed by a processor, the steps of the three-dimensional curve drawing method based on a three-dimensional chart library are implemented.

[0036] As can be seen from the above technical solutions, the present application provides a three-dimensional curve drawing method and apparatus based on a three-dimensional chart library. By performing basic calculations on the starting coordinates and ending coordinates in three-dimensional array data, the corresponding midpoint coordinates and perpendicular bisector direction vectors are determined. Based on the midpoint coordinates, the perpendicular bisector direction vector, and preset trigonometric functions, basic control points are determined. Dynamic adjustment operations are performed on the basic control points according to the direction vector length from the starting coordinates to the ending coordinates to obtain adaptive control points. Curvature constraint adjustment is performed on the adaptive control points to determine the corresponding control point coordinates. The preset number of waypoints, starting coordinates, ending coordinates, and control point coordinates are input into the quadratic Bezier curve formula to obtain a quadratic Bezier curve point set. Data configuration operations are performed on the three-dimensional chart library according to the quadratic Bezier curve point set to obtain a three-dimensional curve of the three-dimensional chart library, thereby improving the efficiency and convenience of three-dimensional curve drawing. Description of the Drawings

[0037] To more clearly illustrate the technical solutions in the embodiments of the present application or the prior art, the following will briefly introduce the accompanying drawings required for the description of the embodiments or the prior art. Obviously, the accompanying drawings in the following description are some embodiments of the present application. For those of ordinary skill in the art, without creative efforts, other accompanying drawings can also be obtained based on these drawings.

[0038] Figure 1 One of the schematic flowcharts of the three-dimensional curve drawing method based on a three-dimensional chart library in the embodiments of the present application;

[0039] Figure 2 Another schematic flowchart of the three-dimensional curve drawing method based on a three-dimensional chart library in the embodiments of the present application;

[0040] Figure 3 Another schematic flowchart of the three-dimensional curve drawing method based on a three-dimensional chart library in the embodiments of the present application;

[0041] Figure 4 Another schematic flowchart of the three-dimensional curve drawing method based on a three-dimensional chart library in the embodiments of the present application;

[0042] Figure 5 Another schematic flowchart of the three-dimensional curve drawing method based on a three-dimensional chart library in the embodiments of the present application;

[0043] Figure 6 Another schematic flowchart of the three-dimensional curve drawing method based on a three-dimensional chart library in the embodiments of the present application;

[0044] Figure 7 Another schematic flowchart of the three-dimensional curve drawing method based on a three-dimensional chart library in the embodiments of the present application;

[0045] Figure 8 The structural diagram of the three-dimensional curve drawing device based on a three-dimensional chart library in the embodiments of the present application;

[0046] Figure 9 The structural schematic diagram of the electronic device in the embodiments of the present application.

[0047] Reference numerals:

[0048] Electronic device 9600, central processing unit 9100, memory 9140, communication module 9110, input unit 9120, audio processor 9130, display 9160, power supply 9170, buffer memory 9141, application / function storage unit 9142, data storage unit 9143, driver program storage unit 9144, antenna 9111, speaker 9131, microphone 9132. Detailed implementation manners

[0049] To make the objectives, technical solutions, and advantages of the embodiments of this application clearer, the following will clearly and completely describe the technical solutions in the embodiments of this application with reference to the accompanying drawings in the embodiments of this application. Obviously, the described embodiments are some, but not all, of the embodiments of this application. All other embodiments obtained by those of ordinary skill in the art based on the embodiments in this application without creative efforts shall fall within the scope of protection of this application.

[0050] In the technical solutions of this application, the acquisition, storage, use, processing, etc. of data all comply with the relevant provisions of national laws and regulations.

[0051] Considering the problem that the echarts-gl library (3D chart library) lacks advanced configuration options such as custom curvature and arrow effects for the drawing of 3D rays in the field of 3D drawing. This application provides a 3D curve drawing method and device based on a 3D chart library. By performing basic calculations on the starting point coordinates and ending point coordinates in the 3D array data, the corresponding midpoint coordinates and the direction vector of the perpendicular bisector are determined. Based on the midpoint coordinates, the direction vector of the perpendicular bisector, and a preset trigonometric function, basic control points are determined. The basic control points are dynamically adjusted according to the length of the direction vector from the starting point coordinates to the ending point coordinates to obtain adaptive control points. The adaptive control points are adjusted with curvature constraints to determine the corresponding control point coordinates. The preset number of waypoints, starting point coordinates, ending point coordinates, and control point coordinates are input into the quadratic Bezier curve formula to obtain a set of quadratic Bezier curve points. The 3D chart library is configured with data according to the set of quadratic Bezier curve points to obtain a 3D curve of the 3D chart library, thereby improving the efficiency and convenience of 3D curve drawing.

[0052] To improve the efficiency and convenience of 3D curve drawing, an embodiment of a 3D curve drawing method based on a 3D chart library is provided in this application. Refer to Figure 1 The 3D curve drawing method based on a 3D chart library specifically includes the following content:

[0053] Step S101: Receive 3D array data, perform a coordinate averaging calculation operation on the starting point coordinates and ending point coordinates in the 3D array data to determine the corresponding midpoint coordinates, and perform a cross product calculation operation on the starting point coordinates and ending point coordinates in the 3D array data to determine the corresponding direction vector of the perpendicular bisector;

[0054] Optionally, in this embodiment, since the 3D ray in echarts-gl currently does not have configurations such as customizing the curvature and arrow effects like the 2D ray in echarts, but many echarts applications, especially large-screen applications, will use 3D map displays and need to draw rays on the map. If the default ray is used, a straight line will be displayed, which affects the aesthetics and does not meet the requirements of the large-screen effect. If the polyline configuration of the ray is used, the coordinates of the waypoints need to be passed into the data of the 3D ray. The coordinates of points on the map are longitude and latitude, and it is very difficult to manually enter the waypoints by estimation. Moreover, manually inserting waypoints has disadvantages such as a large amount of work and hard coding. The final result is a polyline, which cannot achieve the expected effect.

[0055] The method makeCurvePoint (curve point generation) is the implementation of a series of mathematical methods. It is possible to input the longitude and latitude (or coordinates, subject to the coordinate system of the current application) of two points, calculate several waypoints that connect the two points with a curve (the more waypoints, the smoother, with a default of 100 waypoints, and the edges and corners are not visually distinguishable), and finally combine the coordinates of the starting point, waypoints, and ending point into a list and pass it into the data configuration of the ray, so as to achieve a 3D ray with a curve. The curvature of the ray can be changed by adjusting the coordinates of the midpoints of the waypoints.

[0056] Specifically, first, this method supports passing in two parameters, namely arr (any number of groups of point position data, each group of data is json data composed of the starting point coordinates, ending point coordinates, starting point name, and ending point name) and numPoints (the number of waypoints to be calculated, default 100). It can be understood that increasing or decreasing the number of waypoints does not affect the application of this embodiment. Here, only an example of the default value is given.

[0057] The following is the description of the arr component parameter:

[0058] 1. The coordinate point combination arr, each group of data in arr is a json, and any number of groups of data can be passed in. Finally, the same number of coordinate sets will be returned. The following are the fields of a single json data:

[0059] 1.1 Starting point coordinates (start): an array of coordinates, such as [1, 1, 0]

[0060] 1.2 Ending point coordinates (end): an array of coordinates, such as [1, 1, 0]

[0061] 1.3 Starting point name (fromName): may be used in map applications, and the name is put into the ray data as auxiliary content;

[0062] 1.4 Endpoint name (toName): The name that may be used in the map application is put into the ray data as auxiliary content;

[0063] Specifically, the implementation logic of this method:

[0064] In this embodiment, this step uses the starting point coordinates and the ending point coordinates in the arr component to calculate the basic points and vectors, laying a solid data foundation for the subsequent steps.

[0065] First, call the calculatePoint method to calculate the midpoint coordinates of the starting point and the ending point.

[0066] Suppose we have a three-dimensional array of data, which contains the starting point coordinates A = (x0, y0, z0) and the ending point coordinates B = (x1, y1, z1). Then, the midpoint coordinates C = ((x0 + x1) / 2, (y0 + y1) / 2, (z0 + z1) / 2).

[0067] Secondly, calculate the normal vector of the perpendicular bisector through the cross product. The cross product calculation can generate a vector perpendicular to the line connecting the starting point and the ending point, including:

[0068] 1. Calculate the direction vector of the starting point and the ending point = (x1 - x0, y1 - y0, z1 - z0);

[0069] 2. Set the vertical direction vector based on the current coordinate system (default world coordinate) = (0, 0, 1);

[0070] 3. Cross multiply with to obtain the perpendicular bisector of the direction vector

[0071] For example, assume A = (1, 1, 0), B = (3, 2, 0), then = (3 - 1, 2 - 1, 0 - 0) = (2, 1, 0).

[0072] According to the formula = × = (x2y3 - x3y2, x3y1 - x1y3, x1y2 - x2y1), where x1 = 2, x2 = 1, x3 = 0, y1 = 0, y2 = 0, y3 = 1;

[0073] Then = (1 - 0, 0 - 2, 0 - 0)) = (1, -2, 0), that is, the direction vector of the perpendicular bisector of ​​

[0074] It can be understood that obtaining the midpoint coordinates and the perpendicular bisector direction vector through this step can lay a data foundation for subsequent calculation of control points using trigonometric functions.

[0075] Step S102: Perform control point calculation operations according to the midpoint coordinates, the perpendicular bisector direction vector, and preset trigonometric functions to determine the corresponding basic control points, perform distance calculation operations on the starting point coordinates and the ending point coordinates to determine the corresponding direction vector length, perform dynamic adjustment operations on the basic control points according to the direction vector length to determine the corresponding adaptive control points, and perform curvature constraint adjustment on the adaptive control points according to a preset Bezier curvature threshold to determine the corresponding control point coordinates;

[0076] Optionally, in this embodiment, first obtain basic control points according to trigonometric functions, and then dynamically adjust the positions of the control points by means of perpendicular bisector self-adaptation adjustment and curvature control, so as to obtain the optimal control point positions to ensure the naturalness of the curve curvature after the generation of the quadratic Bezier curve.

[0077] First, generate basic control points according to the midpoint coordinates, the perpendicular bisector direction vector, and preset trigonometric functions to provide initial values for subsequent dynamic adjustments.

[0078] Specifically, according to the midpoint coordinates C obtained in step S101, the perpendicular bisector direction vector of the AB connection and the preset included angle for control point generation operations, that is, the control point D is located on the perpendicular bisector of the AB connection, at a position where the angle between AD and AC is 30 degrees. Calculate the coordinates of the basic control point D:

[0079]

[0080] where offset is the offset calculated by the trigonometric function tan(30°).

[0081] is the perpendicular bisector direction vector of the AB connection after normalization to a unit vector.

[0082] Next, in order to enhance the flexibility of control point generation, a dynamic adjustment offset mechanism is introduced:

[0083] A. One case of dynamic adjustment is to directly update the offset of the basic control point.

[0084] The specific steps are as follows:

[0085] 1. Dynamically adjust the offset offset according to the distance d between the starting point and the ending point.

[0086]

[0087] Among them, k is a proportionality coefficient. Preferably, the default value can be set to 0.1 and can be adjusted according to requirements.

[0088] The distance between A and B

[0089] 2. Dynamically adjust the included angle θ according to the distance d between the starting point and the ending point.

[0090]

[0091] Among them, θ base is the basic included angle of 30°, and α is the adjustment coefficient.

[0092] The distance between A and B

[0093] By the above method of dynamically adjusting the control points, the greater the distance between A and B, the control point offset and the included angle are dynamically adjusted and increased proportionally. Through dynamic adjustment, it is ensured that the control points can adapt to different distances between the starting point and the ending point, improving the adaptability of the curve and making the curvature of the generated curve more natural.

[0094] Take an embodiment as an example. The starting point coordinates are A(0, 0, 0), the ending point coordinates are B(4, 0, 0), and the midpoint coordinates are C(2, 0, 0)

[0095] The distance d = 4, k = 0.1, θ base = 30°, α = 0.05.

[0096] The initial included angle is 30°, and the initial offset is tan30°. At this time, the basic control point offset is updated according to the distance d between A and B:

[0097] Calculate the offset: offset = 0.1 4 = 0.4

[0098] Calculate the included angle: θ = 30° + 0.05 4 = 32°

[0099] Calculate the control point D: = (2, 0, 0) + (0, 1) 0.4 = (2, 0.4, 0)

[0100] From the above embodiment, it can be seen that the greater the distance, the more natural the curve curvature through the dynamic adjustment of the control point offset and the included angle.

[0101] B. One case of dynamic adjustment is to accumulate the offset of the basic control point.

[0102] Based on the original calculation of tan30°, a dynamic adjustment term related to the distance d is introduced so that the offset can be dynamically adjusted according to the change of the distance. The formula is as follows:

[0103]

[0104] Among them, tan(30°) d is the basic offset calculated based on the included angle.

[0105] k d is the dynamic adjustment term related to the distance d, and k is the proportionality coefficient. Preferably, the default value can be set to 0.05.

[0106] The specific steps are as follows:

[0107] 1. Calculate the distance d between the starting point A and the ending point B:

[0108]

[0109] 2. Calculate the basic offset:

[0110]

[0111] 3. Calculate the dynamic adjustment term:

[0112]

[0113] 4. Calculate the total offset:

[0114]

[0115] 5. Calculate the coordinates of the control point D according to the perpendicular bisector direction vector

[0116]

[0117] Among them, C is the midpoint of AB, is the perpendicular bisector direction vector.

[0118] Take an embodiment as an example. In the case of a short distance, the starting point A(0,0,0), the ending point B(2,0,0), the distance d = 2, and the proportionality coefficient k = 0.05.

[0119] 1. Basic offset:

[0120] offset base =tan(30°) 2≈1.1547

[0121] 2. Dynamic adjustment term:

[0122] offset adjust =0.05 2 = 0.1

[0123] 3. Total offset:

[0124] offset = 1.1547 + 0.1 = 1.2547

[0125] 4. Coordinates of control point D:

[0126] D = (1, 0, 0) + (0, 1, 0) 1.2547 = (1, 1.2547, 0)

[0127] In the case of short distances, the accumulation of offsets slightly increases the curvature of the curve, but it still remains natural.

[0128] Take an example. In the case of long distances, the starting point A(0, 0, 0), the ending point B(8, 0, 0), the distance d = 2, and the proportionality coefficient k = 0.05.

[0129] 1. Basic offset:

[0130] offset base = tan(30°) 8 ≈ 4.6188

[0131] 2. Dynamic adjustment term:

[0132] offset adjust = 0.05 8 = 0.4

[0133] 3. Total offset:

[0134] offset = 4.6188 + 0.4 = 5.0188

[0135] 4. Coordinates of control point D:

[0136] D = (4, 0, 0) + (0, 1, 0) 5.0188 = (4, 5.0188, 0)

[0137] In the case of long distances, the accumulation of offsets significantly increases the curvature of the curve, but it still remains smooth, avoiding the curve being too straight due to excessive distance.

[0138] It can be understood that by accumulating the dynamic adjustment terms related to the distance, the offset can change dynamically according to the distance between the starting point and the ending point, adapting to the requirements of different scenarios. In the case of short distances and long distances, the curve curvature can transition smoothly, avoiding sudden changes in the curve shape due to distance changes. At the same time, by adjusting the proportionality coefficient k, the intensity of the dynamic adjustment terms can be flexibly controlled to meet the requirements of different application scenarios. Combining with the basic offset of tan(30°) ensures the naturalness and aesthetics of the curve shape.

[0139] Finally, to avoid visual distortion caused by excessive bending, a curvature calculation formula is introduced, and the position of the control point is automatically limited by setting a maximum curvature threshold. Curvature is a physical quantity that measures the degree of curve bending. By calculating the curvature of the curve and setting a reasonable maximum curvature threshold, the smoothness and naturalness of the curve can be ensured.

[0140] Specifically, for a quadratic Bézier curve, the curvature calculation formula is:

[0141]

[0142] Among them, the curvature k(t) represents the degree of bending of the curve at the point P(t). By adjusting the value of t, the curvature of any point on the curve can be calculated. The main role of the parameter t (0, 1) is to traverse all points on the curve and check whether the curvature exceeds the set threshold.

[0143] are the first-order and second-order derivatives respectively.

[0144] Next, set the maximum curvature threshold k max , preferably, k max = 0.5.

[0145] Traverse the parameter t, from t = 0 to t = 1, and traverse all points on the curve at a set step size. For each t, calculate its k(t) value. If there exists a k(t) value of t > k max , then the position of the control point D needs to be adjusted and the curve needs to be recalculated.

[0146] For example, reduce the offset of the control point D and regenerate the curve until the curvature k(t) corresponding to all t satisfies k(t) ≤ k max .

[0147] Take an embodiment as an example. The starting point A(0, 0, 0), the ending point B(4, 0, 0), the control point D(2, 2, 0), and set the maximum curvature threshold k max = 0.5. Traverse the parameter t with a step size of 0.01.

[0148] When t = 0.5, calculate

[0149] Calculate the first derivative

[0150] Calculate the second derivative

[0151] Calculate the curvature k(0.5)=0≤k max

[0152] Then no adjustment is required.

[0153] Take another embodiment as an example, A(0,0,0), B(2,0,0), D(1,0.2,0), the initial proportionality coefficient k = 0.1, set the maximum curvature threshold k max =0.5. Traverse the parameter t with a step size of 0.01.

[0154] Calculate the curvature k(0.5)=0.6>k max

[0155] Then adjust the proportionality coefficient k of the control point to 0.05, and recalculate the control point coordinates D(1,0.1,0).

[0156] Next, recalculate the curvature k(0.5)=0.3≤k after adjusting the proportionality coefficient k max , satisfying the constraint.

[0157] Then no further adjustment is required.

[0158] Dynamically adjust the position of the control point through curvature constraint to ensure that the Bezier curve generated based on the control point meets the preset curvature requirements, avoid the curve being too sharp or too gentle, and ensure the smoothness and beauty of the curve.

[0159] Step S103: Draw a quadratic Bezier curve according to the preset number of waypoints, the starting point coordinates, the ending point coordinates, and the control point coordinates, determine the corresponding quadratic Bezier curve point set, and perform data configuration operations on the three-dimensional chart library according to the quadratic Bezier curve point set to determine the corresponding three-dimensional curve.

[0160] Optionally, in this step, the starting point coordinates A, the ending point coordinates B, and the control point coordinates D are passed into the quadraticBezierCurve (quadratic Bezier curve) method to draw a quadratic Bezier curve, generate a smooth curve, and generate a curve point set according to the preset number of waypoints (default value is 100).

[0161] After generating the point set, insert the starting point, ending point, control point, and curve point set into the pre-set linesData data. The empty array linesData is used to store the calculated results.

[0162] By directly assigning the data in the linesData array after inserting the curve point set to the data configuration of the three-dimensional ray, the display effect of the curve ray can be seen on the three-dimensional chart.

[0163] This example shows how this embodiment determines the optimal control points to draw a curve point set by dynamically adjusting and curvature controlling in combination with the perpendicular bisector according to the distance between two points, and assigns the curve point set to the echarts-gl library (three-dimensional chart library) for three-dimensional curve drawing, solving the problem that the echarts-gl library lacks advanced configuration options such as custom curvature and arrow effects in the field of three-dimensional drawing.

[0164] As can be seen from the above description, the three-dimensional curve drawing method provided by the embodiment of the present application can determine the corresponding midpoint coordinates and the direction vector of the perpendicular bisector by performing basic calculations on the starting point coordinates and the ending point coordinates in the three-dimensional array data, determine the basic control points according to the midpoint coordinates, the direction vector of the perpendicular bisector, and the preset trigonometric functions, perform dynamic adjustment operations on the basic control points according to the length of the direction vector from the starting point to the ending point direction to obtain adaptive control points, perform curvature constraint adjustment on the adaptive control points to determine the corresponding control point coordinates, input the preset number of waypoints, starting point coordinates, ending point coordinates, and control point coordinates into the quadratic Bezier curve formula to obtain the quadratic Bezier curve point set, and perform data configuration operations on the three-dimensional chart library according to the quadratic Bezier curve point set to obtain the three-dimensional curve of the three-dimensional chart library, thereby improving the efficiency and convenience of three-dimensional curve drawing.

[0165] In an embodiment of the three-dimensional curve drawing method based on the three-dimensional chart library of the present application, refer to Figure 2 , it may specifically include the following content:

[0166] Step S201: Determine the corresponding direction vector from the starting point to the ending point direction according to the starting point coordinates and the ending point coordinates in the three-dimensional array data;

[0167] Step S202: Perform a cross product calculation operation according to the direction vector and the preset perpendicular direction vector to determine the corresponding direction vector of the perpendicular bisector, where the perpendicular direction vector is a direction vector perpendicular to the world coordinate system.

[0168] Optionally, in this embodiment, the direction vector of the perpendicular bisector is obtained through cross product calculation. Cross product calculation can generate a vector perpendicular to the line connecting the starting point and the ending point, including:

[0169] 1. Calculate the direction vector of the starting point and the ending point = (x1 - x0, y1 - y0, z1 - z0);

[0170] 2. Set the vertical direction vector based on the current coordinate system (default world coordinates). = (0, 0, 1);

[0171] 3. Perform a cross product calculation on and to obtain the perpendicular bisector of the direction vector .

[0172] For example, assume A = (1, 1, 0) and B = (3, 2, 0), then = (3 - 1, 2 - 1, 0 - 0) = (2, 1, 0).

[0173] According to the formula = × = (x2y3 - x3y2, x3y1 - x1y3, x1y2 - x2y1), where x1 = 2, x2 = 1, x3 = 0, y1 = 0, y2 = 0, y3 = 1;

[0174] Then = (1 - 0, 0 - 2, 0 - 0) = (1, -2, 0), that is, the direction vector of the perpendicular bisector of .

[0175] It can be understood that obtaining the midpoint coordinates and the direction vector of the perpendicular bisector through this step can lay a data foundation for subsequent solving of the control points through trigonometric functions.

[0176] Through step S202, this embodiment obtains the direction vector of the perpendicular bisector, laying a data foundation for subsequent solving of the control points through trigonometric functions.

[0177] In an embodiment of the three-dimensional curve drawing method based on a three-dimensional chart library in this application, referring to Figure 3 , it may further specifically include the following content:

[0178] Step S301: Determine the corresponding first control point offset based on a preset angle value and a preset trigonometric function;

[0179] Step S302: Starting from the midpoint coordinates, with the direction vector of the perpendicular bisector as the offset direction, perform a control point calculation operation according to the first control point offset to determine the corresponding basic control point.

[0180] Optionally, in this embodiment, generate basic control points based on the midpoint coordinates, the direction vector of the perpendicular bisector, and a preset trigonometric function to provide an initial value for subsequent dynamic adjustment.

[0181] Specifically, according to the midpoint coordinates C obtained in step S101 and the direction vector of the perpendicular bisector of the AB connection Perform the control point generation operation according to the preset included angle, that is, the control point D is located on the perpendicular bisector of the line segment AB, and the included angle between AD and AC is 30 degrees. Calculate the coordinates of the basic control point D:

[0182]

[0183] where offset is the first offset calculated by the trigonometric function tan(30°).

[0184] is the direction vector of the perpendicular bisector of the line segment AB The unit vector after normalization.

[0185] Through step S302, the basic control point is obtained in this embodiment, laying a foundation for dynamically adjusting the position of the control point according to the basic control point and the length distance to obtain the optimal control point.

[0186] In an embodiment of the three-dimensional curve drawing method based on a three-dimensional chart library of the present application, refer to Figure 4 , and may specifically include the following content:

[0187] Step S401: Determine the corresponding second control point offset according to the preset proportional coefficient and the length of the direction vector, and dynamically adjust the first control point offset according to the second control point offset to determine the corresponding control point offset;

[0188] Step S402: Starting from the midpoint coordinates, with the direction vector of the perpendicular bisector as the offset direction, perform the control point calculation operation according to the control point offset to determine the corresponding adaptive control point.

[0189] Optionally, in this embodiment, in order to enhance the flexibility of control point generation, a dynamic adjustment offset mechanism is introduced:

[0190] A. One case of dynamic adjustment is to directly update the offset of the basic control point.

[0191] The specific steps are as follows:

[0192] 1. Dynamically adjust the offset offset according to the distance d between the start point and the end point.

[0193]

[0194] where k is the proportional coefficient, preferably, the default value can be set to 0.1 and can be adjusted according to requirements.

[0195] The distance between A and B

[0196] 2. Dynamically adjust the included angle θ according to the distance d between the start point and the end point.

[0197]

[0198] Among them, θ base is the base angle of 30°, and α is the adjustment coefficient.

[0199] The distance of AB

[0200] By the above method of dynamically adjusting the control points, the greater the distance of AB, the control point offset and the angle are dynamically adjusted and increased proportionally. Through dynamic adjustment, it is ensured that the control points can adapt to different starting and ending distances, improving the adaptability of the curve and making the curvature of the generated curve more natural.

[0201] Take an embodiment as an example. The starting point coordinates are A(0, 0, 0), the ending point coordinates are B(4, 0, 0), and the midpoint coordinates are C(2, 0, 0)

[0202] The distance d = 4, k = 0.1, θ base = 30°, α = 0.05.

[0203] The initial angle is 30°, and the initial offset is tan30°. At this time, the basic control point offset is updated according to the distance d of AB:

[0204] Calculate the offset: offset = 0.1 4 = 0.4

[0205] Calculate the angle: θ = 30° + 0.05 4 = 32°

[0206] Calculate the control point D: = (2, 0, 0) + (0, 1) 0.4 = (2, 0.4, 0)

[0207] From the above embodiment, it can be seen that the greater the distance, the more natural the curve curvature through the dynamic adjustment of the control point offset and the angle.

[0208] B. One case of dynamic adjustment is to accumulate the offset of the basic control point.

[0209] On the basis of the original calculation of tan30°, a dynamic adjustment term related to the distance d is introduced, so that the offset can be dynamically adjusted according to the change of the distance. The formula is as follows:

[0210]

[0211] Among them, tan(30°) d is the basic offset calculated based on the angle.

[0212] k d is a dynamically adjustable term related to the distance d, and k is a proportionality coefficient. Preferably, the default value can be set to 0.05.

[0213] The specific steps are as follows:

[0214] 1. Calculate the distance d between the starting point A and the ending point B:

[0215]

[0216] 2. Calculate the basic offset:

[0217]

[0218] 3. Calculate the dynamically adjustable term:

[0219]

[0220] 4. Calculate the total offset:

[0221]

[0222] 5. Calculate the coordinates of the control point D according to the perpendicular bisector direction vector :

[0223]

[0224] where C is the midpoint of AB, is the perpendicular bisector direction vector.

[0225] Taking an embodiment as an example, in the case of a short distance, the starting point A(0, 0, 0), the ending point B(2, 0, 0), the distance d = 2, and the proportionality coefficient k = 0.05.

[0226] 1. Basic offset:

[0227] offset base = tan(30°) 2 ≈ 1.1547

[0228] 2. Dynamically adjustable term:

[0229] offset adjust = 0.05 2 = 0.1

[0230] 3. Total offset:

[0231] offset = 1.1547 + 0.1 = 1.2547

[0232] 4. Coordinates of the control point D:

[0233] D = (1, 0, 0) + (0, 1, 0) 1.2547 = (1, 1.2547, 0)

[0234] In the case of short distances, the accumulation of the offset causes a slight increase in the curve curvature, but it still remains natural.

[0235] For example, in the case of long distances, the starting point A(0, 0, 0), the ending point B(8, 0, 0), the distance d = 2, and the proportionality coefficient k = 0.05.

[0236] 1. Basic offset:

[0237] offset base = tan(30°) 8 ≈ 4.6188

[0238] 2. Dynamic adjustment term:

[0239] offset adjust = 0.05 8 = 0.4

[0240] 3. Total offset:

[0241] offset = 4.6188 + 0.4 = 5.0188

[0242] 4. Coordinates of control point D:

[0243] D = (4, 0, 0) + (0, 1, 0) 5.0188 = (4, 5.0188, 0)

[0244] In the case of long distances, the accumulation of the offset causes a significant increase in the curve curvature, but it still remains smooth, avoiding the curve being too straight due to excessive distance.

[0245] It can be understood that by accumulating the dynamic adjustment term related to the distance, the offset can vary dynamically according to the distance between the starting point and the ending point, adapting to different scenario requirements. In the cases of short and long distances, the curve curvature can transition smoothly, avoiding sudden changes in the curve shape due to distance changes. At the same time, by adjusting the proportionality coefficient k, the intensity of the dynamic adjustment term can be flexibly controlled to meet the requirements of different application scenarios. Combining with the basic offset of tan(30°) ensures the naturalness and aesthetics of the curve shape.

[0246] Through step S402, in this embodiment, the offset is successfully made to vary dynamically according to the distance between the starting point and the ending point through dynamic adjustment, adapting to different scenario requirements, thereby obtaining the optimal three-dimensional curve suitable for different scenarios.

[0247] In an embodiment of the three-dimensional curve drawing method based on a three-dimensional chart library of the present application, refer to Figure 5 , it may specifically include the following content:

[0248] Step S501: Perform a quadratic Bezier curvature calculation operation according to the adaptive control points to determine the corresponding control point curvature;

[0249] Step S502: Determine whether the control point curvature is greater than a preset Bezier curvature threshold. If it is greater, reduce the offset of the control point.

[0250] Optionally, in this embodiment, in order to avoid visual distortion caused by excessive bending, a curvature calculation formula is introduced to automatically limit the position of the control points by setting a maximum curvature threshold. Curvature is a physical quantity that measures the degree of curve bending. By calculating the curvature of the curve and setting a reasonable maximum curvature threshold, the smoothness and naturalness of the curve can be ensured.

[0251] Specifically, for a quadratic Bezier curve, the curvature calculation formula is:

[0252]

[0253] Among them, the curvature k(t) represents the degree of bending of the curve at point P(t). By adjusting the value of t, the curvature of any point on the curve can be calculated. The main role of the parameter t (0, 1) is to traverse all points on the curve and check whether the curvature exceeds the set threshold.

[0254] and are the first-order and second-order derivatives respectively.

[0255] Next, set the maximum curvature threshold k max , preferably, k max = 0.5.

[0256] Traverse the parameter t, from t = 0 to t = 1, traverse all points on the curve with a set step size. For each t, calculate its k(t) value. If there exists a k(t) value of t > k max , then the position of the control point D needs to be adjusted and the curve needs to be recalculated.

[0257] For example, reduce the offset of the control point D and regenerate the curve until the curvature k(t) corresponding to all t satisfies k(t) ≤ k max .

[0258] Take an example to illustrate. The starting point A(0, 0, 0), the ending point B(4, 0, 0), the control point D(2, 2, 0), set the maximum curvature threshold k max = 0.5. Traverse the parameter t with a step size of 0.01.

[0259] When t = 0.5, calculate

[0260] Calculate the first derivative

[0261] Calculate the second derivative

[0262] Calculate the curvature k(0.5) = 0 ≤ k max

[0263] Then no adjustment is required.

[0264] Take another embodiment as an example. A(0,0,0), B(2,0,0), D(1,0.2,0), the initial proportionality coefficient k = 0.1, and the maximum curvature threshold k max = 0.5. Traverse the parameter t with a step size of 0.01.

[0265] Calculate the curvature k(0.5) = 0.6 > k max

[0266] Then adjust the proportionality coefficient k of the control point to 0.05 and recalculate the control point coordinates D(1,0.1,0).

[0267] Next, recalculate the curvature k(0.5) = 0.3 ≤ k after adjusting the proportionality coefficient k max , meeting the constraint.

[0268] Then no further adjustment is required.

[0269] Dynamically adjust the position of the control point through curvature constraint to ensure that the Bezier curve generated based on the control point meets the preset curvature requirements, avoid the curve being too sharp or too gentle, and ensure the smoothness and beauty of the curve.

[0270] Through step S502, this embodiment successfully further restricts the position of the control point through curvature constraint, thereby ensuring the beautiful shape of the generated three-dimensional curve.

[0271] In an embodiment of the three-dimensional curve drawing method based on a three-dimensional chart library of the present application, refer to Figure 6 , and it may specifically include the following content:

[0272] Step S601: Input the start point coordinates, the end point coordinates, and the control point coordinates into a preset quadratic Bezier curve formula for curve drawing operations to determine the corresponding continuous curve;

[0273] Step S602: Discretize the continuous curve according to the preset number of waypoints to determine the corresponding quadratic Bezier curve point set.

[0274] Optionally, in this embodiment, in this step, the starting point coordinates A, the ending point coordinates B, and the control point coordinates D are passed into the quadraticBezierCurve method to draw a quadratic Bézier curve, generating a smooth curve, and at the same time generating a curve point set according to the preset number of waypoints (default value is 100).

[0275] Through step S602, this embodiment successfully obtains the curve point set, laying a foundation for subsequent assignment of the curve point set to the three-dimensional chart library.

[0276] In an embodiment of the three-dimensional curve drawing method based on a three-dimensional chart library of the present application, refer to Figure 7 , and it may specifically include the following content:

[0277] Step S701: Combine the quadratic Bézier curve point set with the unit array data to determine the corresponding linesData array;

[0278] Step S702: Perform an assignment operation on the data of the three-dimensional chart library according to the linesData array, so that the three-dimensional chart library generates a corresponding three-dimensional curve according to the linesData array.

[0279] Optionally, in this embodiment, after generating the point set, the starting point, the ending point, the control point, and the curve point set are inserted into the pre-set linesData data. The empty array linesData is used to store the calculated results.

[0280] Directly assign the data of the linesData array after inserting the curve point set to the data configuration of the three-dimensional ray, and the display effect of the curve ray can be seen on the three-dimensional chart.

[0281] Through step S702, this embodiment successfully assigns the linesData array generated by the three-dimensional curve point set to the echarts-gl library (three-dimensional chart library) for three-dimensional curve drawing, solving the problem that the echarts-gl library lacks advanced configuration options such as custom curvature and arrow effects in the field of three-dimensional drawing.

[0282] To improve the efficiency and convenience of three-dimensional curve drawing, the present application provides an embodiment of a three-dimensional curve drawing device based on a three-dimensional chart library for implementing all or part of the content of the three-dimensional curve drawing method based on a three-dimensional chart library, refer to Figure 8 , and the three-dimensional curve drawing device based on a three-dimensional chart library specifically includes the following content:

[0283] The basic calculation module 10 is used to receive three-dimensional array data, perform a coordinate averaging calculation operation on the starting coordinate and the ending coordinate in the three-dimensional array data to determine the corresponding midpoint coordinate, and perform a cross product calculation operation according to the starting coordinate and the ending coordinate in the three-dimensional array data to determine the corresponding perpendicular bisector direction vector;

[0284] The control point calculation module 20 is used to perform a control point calculation operation according to the midpoint coordinate, the perpendicular bisector direction vector, and a preset trigonometric function to determine the corresponding basic control point, perform a distance calculation operation on the starting coordinate and the ending coordinate to determine the corresponding direction vector length, perform a dynamic adjustment operation on the basic control point according to the direction vector length to determine the corresponding adaptive control point, and perform a curvature constraint adjustment on the adaptive control point according to a preset Bezier curvature threshold to determine the corresponding control point coordinate;

[0285] The three-dimensional curve generation module 30 is used to draw a quadratic Bezier curve according to a preset number of waypoints, the starting coordinate, the ending coordinate, and the control point coordinate to determine the corresponding quadratic Bezier curve point set, and perform a data configuration operation on the three-dimensional chart library according to the quadratic Bezier curve point set to determine the corresponding three-dimensional curve.

[0286] As can be seen from the above description, the three-dimensional curve drawing device based on the three-dimensional chart library provided by the embodiment of the present application can determine the corresponding midpoint coordinate and the perpendicular bisector direction vector by performing basic calculations on the starting coordinate and the ending coordinate in the three-dimensional array data, determine the basic control point according to the midpoint coordinate, the perpendicular bisector direction vector, and a preset trigonometric function, perform a dynamic adjustment operation on the basic control point according to the direction vector length from the starting coordinate to the ending coordinate direction to obtain the adaptive control point, perform a curvature constraint adjustment on the adaptive control point to determine the corresponding control point coordinate, input the preset number of waypoints, the starting coordinate, the ending coordinate, and the control point coordinate into the quadratic Bezier curve formula to obtain the quadratic Bezier curve point set, and perform a data configuration operation on the three-dimensional chart library according to the quadratic Bezier curve point set to obtain the three-dimensional curve of the three-dimensional chart library, thereby improving the efficiency and convenience of three-dimensional curve drawing.

[0287] From a hardware level, in order to improve the efficiency and convenience of three-dimensional curve drawing, the present application provides an embodiment of an electronic device for implementing all or part of the content in the three-dimensional curve drawing method based on the three-dimensional chart library. The electronic device specifically includes the following content:

[0288] A processor, a memory, a communications interface, and a bus; wherein, the processor, the memory, and the communications interface complete communication with each other through the bus; the communications interface is used to implement information transmission between the three-dimensional curve drawing method based on a three-dimensional chart library and related devices such as a core business system, a user terminal, and a related database; the logic controller can be a desktop computer, a tablet computer, a mobile terminal, etc., and this embodiment is not limited thereto. In this embodiment, the logic controller can be implemented with reference to the embodiments of the three-dimensional curve drawing method based on a three-dimensional chart library and the embodiments of the three-dimensional curve drawing method based on a three-dimensional chart library, the content of which is incorporated herein, and the repeated parts will not be elaborated.

[0289] It can be understood that the user terminal may include a smart phone, a tablet electronic device, a network set-top box, a portable computer, a desktop computer, a personal digital assistant (PDA), a vehicle-mounted device, a smart wearable device, etc. Among them, the smart wearable device may include smart glasses, a smart watch, a smart bracelet, etc.

[0290] In practical applications, part of the three-dimensional curve drawing method based on a three-dimensional chart library may be executed on the electronic device side as described above, or all operations may be completed in the client device. Specifically, it can be selected according to the processing capacity of the client device and the limitations of the user usage scenario, etc. This application does not make any limitation in this regard. If all operations are completed in the client device, the client device may further include a processor.

[0291] The above-mentioned client device may have a communication module (i.e., a communication unit), and may be communicatively connected to a remote server to implement data transmission with the server. The server may include a server on the task scheduling center side, and in other implementation scenarios, it may also include a server of an intermediate platform, such as a server of a third-party server platform communicatively linked to the task scheduling center server. The server may include a single computer device, or may include a server cluster composed of multiple servers, or a server structure of a distributed device.

[0292] Figure 9 This is a schematic block diagram of the system composition of the electronic device 9600 according to an embodiment of the present application. As Figure 9 shown, the electronic device 9600 may include a central processing unit 9100 and a memory 9140; the memory 9140 is coupled to the central processing unit 9100. It should be noted that this Figure 9 is exemplary; other types of structures may also be used to supplement or replace this structure to implement telecommunication functions or other functions.

[0293] In one embodiment, the function of the three-dimensional curve drawing method based on the three-dimensional chart library can be integrated into the central processing unit 9100. Among them, the central processing unit 9100 can be configured to perform the following controls:

[0294] Step S101: Receive three-dimensional array data, perform a coordinate averaging calculation operation on the starting point coordinates and the ending point coordinates in the three-dimensional array data to determine the corresponding midpoint coordinates, and perform a cross product calculation operation on the starting point coordinates and the ending point coordinates in the three-dimensional array data to determine the corresponding perpendicular bisector direction vector;

[0295] Step S102: Perform a control point calculation operation according to the midpoint coordinates, the perpendicular bisector direction vector, and a preset trigonometric function to determine the corresponding basic control points, perform a distance calculation operation on the starting point coordinates and the ending point coordinates to determine the corresponding direction vector length, perform a dynamic adjustment operation on the basic control points according to the direction vector length to determine the corresponding adaptive control points, and perform a curvature constraint adjustment on the adaptive control points according to a preset Bezier curvature threshold to determine the corresponding control point coordinates;

[0296] Step S103: Perform a quadratic Bezier curve drawing according to a preset number of waypoints, the starting point coordinates, the ending point coordinates, and the control point coordinates to determine the corresponding quadratic Bezier curve point set, and perform a data configuration operation on the three-dimensional chart library according to the quadratic Bezier curve point set to determine the corresponding three-dimensional curve.

[0297] As can be seen from the above description, the electronic device provided by the embodiment of the present application determines the corresponding midpoint coordinates and the perpendicular bisector direction vector by performing basic calculations on the starting point coordinates and the ending point coordinates in the three-dimensional array data, determines the basic control points according to the midpoint coordinates, the perpendicular bisector direction vector, and a preset trigonometric function, performs a dynamic adjustment operation on the basic control points according to the direction vector length from the starting point coordinates to the ending point coordinates to obtain the adaptive control points, performs a curvature constraint adjustment on the adaptive control points to determine the corresponding control point coordinates, inputs the preset number of waypoints, the starting point coordinates, the ending point coordinates, and the control point coordinates into the quadratic Bezier curve formula to obtain the quadratic Bezier curve point set, and performs a data configuration operation on the three-dimensional chart library according to the quadratic Bezier curve point set to obtain the three-dimensional curve of the three-dimensional chart library, thereby being able to improve the efficiency and convenience of three-dimensional curve drawing.

[0298] In another embodiment, the three-dimensional curve drawing method based on the three-dimensional chart library can be separately configured from the central processing unit 9100. For example, the three-dimensional curve drawing method based on the three-dimensional chart library can be configured as a chip connected to the central processing unit 9100, and the function of the three-dimensional curve drawing method based on the three-dimensional chart library is realized through the control of the central processing unit.

[0299] Such asFigure 9 As shown, the electronic device 9600 may further include: a communication module 9110, an input unit 9120, an audio processor 9130, a display 9160, and a power supply 9170. It should be noted that the electronic device 9600 does not necessarily have to include Figure 9 all the components shown therein; in addition, the electronic device 9600 may further include Figure 9 components not shown in the figure, and reference may be made to the prior art.

[0300] As Figure 9 shown, the central processing unit 9100, sometimes also referred to as a controller or operation control, may include a microprocessor or other processor devices and / or logic devices. The central processing unit 9100 receives inputs and controls the operations of the various components of the electronic device 9600.

[0301] Among them, the memory 9140 may be, for example, one or more of a buffer, a flash memory, a hard drive, a removable medium, a volatile memory, a non-volatile memory, or other suitable devices. The above information related to failures can be stored, and in addition, programs for executing relevant information can also be stored. And the central processing unit 9100 can execute the programs stored in the memory 9140 to implement information storage or processing, etc.

[0302] The input unit 9120 provides inputs to the central processing unit 9100. The input unit 9120 is, for example, a key or a touch input device. The power supply 9170 is used to supply power to the electronic device 9600. The display 9160 is used to display display objects such as images and texts. The display may be, for example, an LCD display, but is not limited thereto.

[0303] The memory 9140 may be a solid-state memory. For example, a read-only memory (ROM), a random access memory (RAM), a SIM card, etc. It may also be a memory that stores information even when powered off, can be selectively erased and has more data. Examples of such a memory are sometimes referred to as EPROMs, etc. The memory 9140 may also be some other type of device. The memory 9140 includes a buffer memory 9141 (sometimes referred to as a buffer). The memory 9140 may include an application / function storage unit 9142, and the application / function storage unit 9142 is used to store application programs and function programs or the processes for operating the electronic device 9600 through the central processing unit 9100.

[0304] The memory 9140 may further include a data storage section 9143 for storing data such as contacts, digital data, pictures, sounds, and / or any other data used by the electronic device. The driver storage section 9144 of the memory 9140 may include various drivers of the electronic device for communication functions and / or for performing other functions of the electronic device such as messaging applications, address book applications, etc.

[0305] The communication module 9110 is a transmitter / receiver that transmits and receives signals via the antenna 9111. The communication module 9110 is coupled to the central processor 9100 to provide input signals and receive output signals, which may be the same as in the case of a conventional mobile communication terminal.

[0306] Based on different communication technologies, multiple communication modules 9110 may be provided in the same electronic device, such as a cellular network module, a Bluetooth module, and / or a wireless local area network module, etc. The communication module 9110 is also coupled to the speaker 9131 and the microphone 9132 via the audio processor 9130 to provide an audio output via the speaker 9131 and receive an audio input from the microphone 9132, thereby implementing normal telecommunication functions. The audio processor 9130 may include any suitable buffers, decoders, amplifiers, etc. Additionally, the audio processor 9130 is also coupled to the central processor 9100, so that recording can be performed on the local machine through the microphone 9132, and the sound stored on the local machine can be played through the speaker 9131.

[0307] Embodiments of the present application also provide a computer-readable storage medium capable of implementing all steps of the three-dimensional curve drawing method based on a three-dimensional chart library with the execution subject being a server or a client in the above embodiments. A computer program is stored on the computer-readable storage medium, and when the computer program is executed by a processor, it implements all steps of the three-dimensional curve drawing method based on a three-dimensional chart library with the execution subject being a server or a client in the above embodiments. For example, when the processor executes the computer program, the following steps are implemented:

[0308] Step S101: Receive three-dimensional array data, perform a coordinate averaging calculation operation on the starting point coordinates and the ending point coordinates in the three-dimensional array data to determine the corresponding midpoint coordinates, and perform a cross product calculation operation on the starting point coordinates and the ending point coordinates in the three-dimensional array data to determine the corresponding perpendicular bisector direction vector;

[0309] Step S102: Perform control point calculation operations according to the midpoint coordinates, the perpendicular bisector direction vector, and preset trigonometric functions to determine the corresponding basic control points, perform distance calculation operations on the starting coordinates and the ending coordinates to determine the corresponding direction vector length, perform dynamic adjustment operations on the basic control points according to the direction vector length to determine the corresponding adaptive control points, and perform curvature constraint adjustment on the adaptive control points according to a preset Bezier curvature threshold to determine the corresponding control point coordinates;

[0310] Step S103: Perform quadratic Bezier curve drawing according to the preset number of waypoints, the starting coordinates, the ending coordinates, and the control point coordinates to determine the corresponding quadratic Bezier curve point set, and perform data configuration operations on the three-dimensional chart library according to the quadratic Bezier curve point set to determine the corresponding three-dimensional curve.

[0311] As can be seen from the above description, the computer-readable storage medium provided by the embodiment of the present application determines the corresponding midpoint coordinates and perpendicular bisector direction vectors by performing basic calculations on the starting coordinates and the ending coordinates in the three-dimensional array data, determines the basic control points according to the midpoint coordinates, the perpendicular bisector direction vector, and preset trigonometric functions, performs dynamic adjustment operations on the basic control points according to the direction vector length from the starting coordinates to the ending coordinates direction to obtain the adaptive control points, performs curvature constraint adjustment on the adaptive control points to determine the corresponding control point coordinates, inputs the preset number of waypoints, the starting coordinates, the ending coordinates, and the control point coordinates into the quadratic Bezier curve formula to obtain the quadratic Bezier curve point set, and performs data configuration operations on the three-dimensional chart library according to the quadratic Bezier curve point set to obtain the three-dimensional curve of the three-dimensional chart library, thereby improving the efficiency and convenience of three-dimensional curve drawing.

[0312] The embodiment of the present application further provides a computer program product capable of implementing all the steps in the three-dimensional curve drawing method based on a three-dimensional chart library whose execution subject in the above embodiment is a server or a client. When the computer program / instructions are executed by a processor, the steps of the three-dimensional curve drawing method based on the three-dimensional chart library are implemented. For example, the computer program / instructions implement the following steps:

[0313] Step S101: Receive three-dimensional array data, perform coordinate averaging calculation operations on the starting coordinates and the ending coordinates in the three-dimensional array data to determine the corresponding midpoint coordinates, and perform cross product calculation operations on the starting coordinates and the ending coordinates in the three-dimensional array data to determine the corresponding perpendicular bisector direction vector;

[0314] Step S102: Perform control point calculation operations according to the midpoint coordinates, the perpendicular bisector direction vector, and preset trigonometric functions to determine the corresponding basic control points, perform distance calculation operations on the starting coordinates and the ending coordinates to determine the corresponding direction vector length, perform dynamic adjustment operations on the basic control points according to the direction vector length to determine the corresponding adaptive control points, perform curvature constraint adjustment on the adaptive control points according to a preset Bezier curvature threshold to determine the corresponding control point coordinates;

[0315] Step S103: Draw a quadratic Bezier curve according to the preset number of waypoints, the starting coordinates, the ending coordinates, and the control point coordinates to determine the corresponding quadratic Bezier curve point set, and perform data configuration operations on the three-dimensional chart library according to the quadratic Bezier curve point set to determine the corresponding three-dimensional curve.

[0316] As can be seen from the above description, the computer program product provided by the embodiments of the present application performs basic calculations on the starting coordinates and ending coordinates in the three-dimensional array data to determine the corresponding midpoint coordinates and perpendicular bisector direction vectors, determines the basic control points according to the midpoint coordinates, the perpendicular bisector direction vector, and preset trigonometric functions, performs dynamic adjustment operations on the basic control points according to the direction vector length from the starting coordinates to the ending coordinates direction to obtain adaptive control points, performs curvature constraint adjustment on the adaptive control points to determine the corresponding control point coordinates, inputs the preset number of waypoints, starting coordinates, ending coordinates, and control point coordinates into the quadratic Bezier curve formula to obtain the quadratic Bezier curve point set, and performs data configuration operations on the three-dimensional chart library according to the quadratic Bezier curve point set to obtain the three-dimensional curve of the three-dimensional chart library, thereby being able to improve the efficiency and convenience of three-dimensional curve drawing.

[0317] Those skilled in the art should understand that the embodiments of the present invention can be provided as a method, a device, or a computer program product. Therefore, the present invention can take the form of an entirely hardware embodiment, an entirely software embodiment, or an embodiment combining software and hardware aspects. Moreover, the present invention can take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.

[0318] The present invention is described with reference to the flowcharts and / or block diagrams of methods, apparatuses (devices), and computer program products according to embodiments of the present invention. It should be understood that each flow and / or block in the flowcharts and / or block diagrams, as well as the combination of flows and / or blocks in the flowcharts and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to the processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing devices to generate a machine, such that the instructions executed by the processor of the computer or other programmable data processing devices generate a means for implementing the functions specified in one or more flows and / or blocks. Figure 1 in one or more flows and / or blocks Figure 1 in one or more blocks.

[0319] These computer program instructions can 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, such that the instructions stored in the computer-readable memory generate a manufactured article including an instruction means that implements the functions specified in one or more flows and / or blocks. Figure 1 in one or more flows and / or blocks Figure 1 in one or more blocks.

[0320] These computer program instructions can also be loaded onto a computer or other programmable data processing device, such that a series of operation steps are executed on the computer or other programmable device to generate a computer-implemented process, and thus the instructions executed on the computer or other programmable device provide steps for implementing the functions specified in one or more flows and / or blocks. Figure 1 in one or more flows and / or blocks Figure 1 in one or more blocks.

[0321] Specific embodiments are applied in the present invention to elaborate on the principles and implementation manners of the present invention. The description of the above embodiments is only used to help understand the method and its core idea of the present invention; at the same time, for those of ordinary skill in the art, according to the idea of the present invention, there will be changes in the specific implementation manners and application scopes. In summary, the content of this specification should not be construed as a limitation to the present invention.

Claims

1. A three-dimensional curve drawing method based on a three-dimensional chart library, characterized in that: The method comprises: Receive three-dimensional array data, perform coordinate average calculation operation on the starting point coordinates and the end point coordinates in the three-dimensional array data to determine the corresponding midpoint coordinates, and perform cross multiplication calculation operation according to the starting point coordinates and the end point coordinates in the three-dimensional array data to determine the corresponding perpendicular bisector direction vector; The corresponding first control point offset is determined by a preset angle value and a preset trigonometric function; taking the midpoint coordinate as the starting point and the perpendicular bisector direction vector as the offset direction, a control point calculation operation is performed according to the first control point offset to determine the corresponding basic control point, a distance calculation operation is performed on the starting point coordinate and the end point coordinate to determine the corresponding direction vector length, a corresponding second control point offset is determined according to a preset proportional coefficient and the length of the direction vector, and the basic offset is dynamically adjusted according to the second control point offset to determine the corresponding control point offset, wherein the basic offset is the product of the first control offset and the direction vector length; taking the midpoint coordinate as the starting point and the perpendicular bisector direction vector as the offset direction, a control point calculation operation is performed according to the control point offset to determine the corresponding adaptive control point, and a curvature constraint adjustment is performed on the adaptive control point according to a preset Bezier curvature threshold to determine the corresponding control point coordinates; A quadratic Bezier curve is drawn according to the preset number of path points, the starting point coordinates, the end point coordinates and the control point coordinates, and a corresponding quadratic Bezier curve point set is determined. A data configuration operation is performed on a three-dimensional chart library according to the quadratic Bezier curve point set to determine a corresponding three-dimensional curve.

2. The three-dimensional curve drawing method based on the three-dimensional chart library according to claim 1 is characterized in that: The performing a cross product calculation operation according to the starting point coordinates and the end point coordinates in the three-dimensional array data to determine the corresponding perpendicular bisector direction vector includes: Determine the corresponding direction vector from the starting point to the end point according to the starting point coordinates and the end point coordinates in the three-dimensional array data; A cross product calculation operation is performed based on the direction vector and a preset vertical direction vector to determine the corresponding perpendicular bisector direction vector, wherein the vertical direction vector is a direction vector perpendicular to the world coordinate system.

3. The three-dimensional curve drawing method based on the three-dimensional chart library according to claim 1 is characterized in that: The step of adjusting the curvature constraint of the adaptive control point according to the preset Bezier curvature threshold to determine the corresponding control point coordinates includes: Performing a quadratic Bezier curvature calculation operation according to the adaptive control point to determine the corresponding control point curvature; It is determined whether the curvature of the control point is greater than a preset Bezier curvature threshold. If so, the offset of the control point is reduced.

4. The three-dimensional curve drawing method based on the three-dimensional chart library according to claim 1 is characterized in that: The drawing of a quadratic Bezier curve according to the preset number of waypoints, the starting point coordinates, the end point coordinates and the control point coordinates to determine a corresponding quadratic Bezier curve point set includes: Inputting the starting point coordinates, the end point coordinates and the control point coordinates into a preset quadratic Bezier curve formula to perform a curve drawing operation to determine a corresponding continuous curve; The continuous curve is discretized according to a preset number of path points to determine a corresponding quadratic Bezier curve point set.

5. The three-dimensional curve drawing method based on the three-dimensional chart library according to claim 1 is characterized in that: The performing of data configuration operation on the three-dimensional chart library according to the quadratic Bezier curve point set to determine the corresponding three-dimensional curve includes: Combine the quadratic Bezier curve point set with the unit array data to determine the corresponding linesData array; The data of the three-dimensional chart library is assigned a value according to the linesData array, so that the three-dimensional chart library generates a corresponding three-dimensional curve according to the linesData array.

6. A three-dimensional curve drawing device based on a three-dimensional chart library, characterized in that: The device comprises: A basic calculation module, for receiving three-dimensional array data, performing a coordinate average calculation operation on the starting point coordinates and the end point coordinates in the three-dimensional array data to determine the corresponding midpoint coordinates, and performing a cross multiplication calculation operation according to the starting point coordinates and the end point coordinates in the three-dimensional array data to determine the corresponding perpendicular bisector direction vector; A control point calculation module, used to determine the corresponding first control point offset through a preset angle value and a preset trigonometric function; taking the midpoint coordinates as a starting point and the perpendicular bisector direction vector as an offset direction, performing a control point calculation operation according to the first control point offset to determine the corresponding basic control point, performing a distance calculation operation on the starting point coordinates and the end point coordinates to determine the corresponding direction vector length, determining the corresponding second control point offset according to a preset proportional coefficient and the length of the direction vector, dynamically adjusting the basic offset according to the second control point offset to determine the corresponding control point offset, wherein the basic offset is the product of the first control offset and the direction vector length; taking the midpoint coordinates as a starting point and the perpendicular bisector direction vector as an offset direction, performing a control point calculation operation according to the control point offset to determine the corresponding adaptive control point, performing a curvature constraint adjustment on the adaptive control point according to a preset Bezier curvature threshold to determine the corresponding control point coordinates; The three-dimensional curve generation module is used to draw a quadratic Bezier curve according to the preset number of path points, the starting point coordinates, the end point coordinates and the control point coordinates, determine the corresponding quadratic Bezier curve point set, perform data configuration operations on the three-dimensional chart library according to the quadratic Bezier curve point set, and determine the corresponding three-dimensional curve.

7. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the program, the steps of the three-dimensional curve drawing method based on the three-dimensional chart library described in any one of claims 1 to 5 are implemented.

8. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the three-dimensional curve drawing method based on a three-dimensional chart library as described in any one of claims 1 to 5 are implemented.

Citation Information

Patent Citations

  • Speed curve processing method and device, electric vehicle and electronic equipment

    CN113370995A

  • Vision-based AGV trajectory tracking method

    CN119596929A