Three-dimensional curve drawing method and device based on three-dimensional chart library

By calculating the midpoint coordinates and the vector of the mid-perpendicular direction of the three-dimensional ray, combining the trigonometric function and the Bezier curvature threshold, the curve point set is drawn using the quadratic Bezier curve formula and configured into the echarts-gl library, the problem of lack of curvature and arrow effects in three-dimensional ray drawing is solved, and efficient and convenient 3-dimensional curve drawing is achieved.

CN119888110AActive Publication Date: 2025-04-25HANGZHOU HUIZHI NETWORK TECHNOLOGY CO LTD
View PDF 5 Cites 0 Cited by

Patent Information

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

AI Technical Summary

Technical Problem

The existing echarts-gl library lacks advanced configuration options such as customized curvature and arrow effects in three-dimensional ray drawing, resulting in three-dimensional rays that can only display straight lines, affecting the aesthetics and not meeting the needs of large-screen display effects.

Method used

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

Benefits of technology

The curved drawing of three-dimensional rays is realized, the efficiency and convenience of three-dimensional curve drawing is improved, and the diversified needs in the display of three-dimensional maps is met.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119888110A_ABST
    Figure CN119888110A_ABST
Patent Text Reader

Abstract

The embodiment of the invention provides a three-dimensional curve drawing method and device based on a three-dimensional chart library, and the method comprises the steps: carrying out the basic calculation of a starting point coordinate and an end point coordinate in three-dimensional array data, and determining a corresponding midpoint coordinate and a midperpendicular direction vector, determining a basic control point according to the midpoint coordinate, the midperpendicular direction vector and a preset trigonometric function, performing dynamic adjustment operation on the basic control point according to the direction vector length from the starting point coordinate to the end point coordinate to obtain a self-adaptive control point, performing curvature constraint adjustment on the self-adaptive control point, and determining a corresponding control point coordinate. Inputting the preset path point number, the starting point coordinate, the end point coordinate and the control point coordinate into a quadratic Bezier curve formula to obtain a quadratic Bezier curve point set, and performing 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. According to the invention, the efficiency and convenience of three-dimensional curve drawing can be improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

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

[0002] In the field of 3D map drawing, especially when developing with the echarts-gl library (3D chart library), there are specific technical challenges for drawing 3D rays. At present, the 3D ray function in echarts-gl mainly supports straight line drawing, lacks advanced configuration options such as customized curvature and arrow effects, which is more limited compared to the 2D ray function in echarts. However, in many echarts application scenarios, especially in large-screen presentations, it is often necessary to draw rays on 3D maps to indicate information such as direction, path or connection. If only the default ray drawing function of echarts-gl is used, only a straight line can be displayed, which not only affects the aesthetics, but also does not meet the needs of large-screen presentation effects.

[0003] To overcome this limitation, some developers try to use echarts-gl's polyline configuration to simulate the drawing of curves. This method requires developers to manually calculate and pass the coordinates of multiple waypoints into the data of the three-dimensional ray. However, since points on the map are usually represented by longitude and latitude coordinates, manually estimating and inserting waypoints is not only labor-intensive, but also difficult to ensure the smoothness and accuracy of the curve. In addition, the hard-coded method 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 realize the curve drawing of three-dimensional rays to meet the diverse needs of three-dimensional map display. Summary of the invention

[0005] In view of the problems in the prior art, the present 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] In order to solve at least one of the above problems, the present application provides the following technical solutions: In a first aspect, the present application provides a three-dimensional curve drawing method based on a three-dimensional chart library, comprising: 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; Perform a control point calculation operation according to the midpoint coordinates, the perpendicular bisector direction vector, and a preset trigonometric function to determine a corresponding basic control point, perform a distance calculation operation on the start point coordinates and the end point coordinates to determine a corresponding direction vector length, perform a dynamic adjustment operation on the basic control point according to the direction vector length to determine a corresponding adaptive control point, perform a curvature constraint adjustment on the adaptive control point according to a preset Bezier curvature threshold, and 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.

[0007] Further, 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.

[0008] Further, the control point calculation operation is performed according to the midpoint coordinates, the perpendicular bisector direction vector and a preset trigonometric function to determine the corresponding basic control point, including: Determine the corresponding first control point offset by using 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.

[0009] Furthermore, the dynamically adjusting the basic control point according to the length of the direction vector to determine the corresponding adaptive control point includes: Determine a corresponding second control point offset according to a preset scale factor and the length of the direction vector, dynamically adjust the first control point offset according to the second control point offset, and determine a corresponding control point offset; 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.

[0010] Further, the 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.

[0011] Furthermore, 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.

[0012] Further, performing 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.

[0013] In a second aspect, the present application provides a three-dimensional curve drawing device based on a three-dimensional chart library, comprising: A basic calculation module is used to receive three-dimensional array data, perform 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 perform a cross multiplication calculation operation based on 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 perform a control point calculation operation according to the midpoint coordinates, the perpendicular bisector direction vector and a preset trigonometric function, determine a corresponding basic control point, perform a distance calculation operation on the start point coordinates and the end point coordinates, determine a corresponding direction vector length, perform a dynamic adjustment operation on the basic control point according to the direction vector length, determine a corresponding adaptive control point, perform a curvature constraint adjustment on the adaptive control point according to a preset Bezier curvature threshold, and 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.

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

[0015] In a fourth aspect, the present application provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the steps of the three-dimensional curve drawing method based on a three-dimensional chart library.

[0016] In a fifth aspect, the present application provides a computer program product, including a computer program / instruction, which, when executed by a processor, implements the steps of the three-dimensional curve drawing method based on a three-dimensional chart library.

[0017] It can be seen from the above technical scheme that the present application provides a three-dimensional curve drawing method and device based on a three-dimensional chart library, by performing basic calculations on the starting point coordinates and the end point coordinates in the three-dimensional array data, determining the corresponding midpoint coordinates and the perpendicular bisector direction vector, determining the basic control points according to the midpoint coordinates, the perpendicular bisector direction vector and the preset trigonometric function, dynamically adjusting the basic control points according to the length of the direction vector from the starting point coordinates to the end point coordinates to obtain adaptive control points, performing curvature constraint adjustment on the adaptive control points, determining the corresponding control point coordinates, inputting the preset number of path points, the starting point coordinates, the end point coordinates and the control point coordinates into the quadratic Bezier curve formula to obtain a quadratic Bezier curve point set, performing 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. BRIEF DESCRIPTION OF THE DRAWINGS

[0018] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.

[0019] Figure 1 This is one of the flow diagrams of a three-dimensional curve drawing method based on a three-dimensional chart library in an embodiment of the present application; Figure 2 The second flowchart of the three-dimensional curve drawing method based on the three-dimensional chart library in the embodiment of the present application; Figure 3 The third flowchart of the three-dimensional curve drawing method based on the three-dimensional chart library in the embodiment of the present application; Figure 4 This is a fourth flow chart of a three-dimensional curve drawing method based on a three-dimensional chart library in an embodiment of the present application; Figure 5 This is a fifth flow chart of a three-dimensional curve drawing method based on a three-dimensional chart library in an embodiment of the present application; Figure 6 This is a sixth flow chart of a three-dimensional curve drawing method based on a three-dimensional chart library in an embodiment of the present application; Figure 7 FIG7 is a flow chart of a three-dimensional curve drawing method based on a three-dimensional chart library in an embodiment of the present application; Figure 8 It is a structural diagram of a three-dimensional curve drawing device based on a three-dimensional chart library in an embodiment of the present application; Fig. 9 It is a schematic diagram of the structure of an electronic device in an embodiment of the present application.

[0020] Reference numerals: 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 DESCRIPTION

[0021] In order to make the purpose, technical solution and advantages of the embodiments of the present application clearer, the technical solution 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 part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.

[0022] The acquisition, storage, use, and processing of data in the technical solution of this application comply with the relevant provisions of national laws and regulations.

[0023] Considering the problem that the echarts-gl library (3D chart library) lacks advanced configuration options such as customized curvature and arrow effects for the drawing of 3D rays in the field of 3D drawing, the present application provides a 3D curve drawing method and device based on the 3D chart library, by performing basic calculations on the starting point coordinates and the end point coordinates in the 3D array data, determining the corresponding midpoint coordinates and the direction vector of the perpendicular bisector, determining the basic control points according to the midpoint coordinates, the direction vector of the perpendicular bisector and the preset trigonometric function, dynamically adjusting the basic control points according to the length of the direction vector from the starting point coordinates to the end point coordinates, obtaining the adaptive control points, adjusting the curvature constraints on the adaptive control points, determining the corresponding control point coordinates, inputting the preset path point number, the starting point coordinates, the end point coordinates and the control point coordinates into the quadratic Bezier curve formula, obtaining the quadratic Bezier curve point set, performing data configuration operations on the 3D chart library according to the quadratic Bezier curve point set, obtaining the 3D curve of the 3D chart library, thereby improving the efficiency and convenience of 3D curve drawing.

[0024] In order to improve the efficiency and convenience of three-dimensional curve drawing, the present application provides an embodiment of a three-dimensional curve drawing method based on a three-dimensional chart library, see Figure 1 The three-dimensional curve drawing method based on the three-dimensional chart library specifically includes the following contents: Step S101: receiving three-dimensional array data, performing 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, performing 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; Optional, in this embodiment, since the three-dimensional ray of echarts-gl does not have customized curvature, arrow effects and other configurations like the two-dimensional ray in echarts, many echarts applications, especially large-screen applications, will use three-dimensional map display, 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 large-screen effect requirements. If the polyline configuration of the ray is used, the coordinates of the waypoints need to be passed into the data of the three-dimensional ray. The coordinates of the points on the map are longitude and latitude, and it is difficult to manually enter the waypoints by estimation. In addition, manual insertion of waypoints has the disadvantages of large workload and hard coding. The final result is a multi-segment polyline, which cannot achieve the expected effect.

[0025] This method makeCurvePoint (curve point generation) is the implementation of a series of mathematical methods. You can input the longitude and latitude of two points (or coordinates, based on the currently applied coordinate system), calculate a number of waypoints connecting the two points with a curve (the more waypoints, the smoother the curve, the default is 100 waypoints, and the edges are no longer visible visually), and finally combine the coordinates of the starting point, waypoints, and end point into a list and pass it into the data configuration of the ray, so that the three-dimensional ray of the curve can be realized. The curvature of the ray can be changed by adjusting the coordinates of the midpoints of the waypoints.

[0026] Specifically, first of all, this method supports passing in two parameters, namely arr (any number of point data sets, each set of data is a json data consisting of the starting point coordinates, the end point coordinates, the starting point name, and the end point name) and numPoints (the number of waypoints to be calculated, the default value is 100). It can be understood that the increase or decrease in the number of waypoints does not affect the application of this embodiment, and this is just an example of a default value.

[0027] The following is a description of the arr component parameters: 1. Coordinate point combination arr, each set of data in arr is a json, you can pass in any set of data, and eventually return the same number of coordinate sets. The following are the fields of a single json data: 1.1 Starting point coordinates (start): coordinate array, for example [1,1,0] 1.2 End point coordinates (end): coordinate array, for example [1,1,0] 1.3 Starting point name (fromName): The name may be used in the map application and put into the ray data as auxiliary content; 1.4 Destination name (toName): The name may be used in map applications and put into the ray data as auxiliary content; Specifically, the implementation logic of this method is: In this embodiment, this step uses the starting point coordinates and the end point coordinates in the arr component to calculate the basic points and vectors, laying a solid data foundation for subsequent steps.

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

[0029] Suppose we have a three-dimensional array data containing the starting point coordinates A = (x0, y0, z0) and the end point coordinates B = (x1, y1, z1), then the midpoint coordinates C = ((x0+x1) / 2, (y0+y1) / 2, (z0+z1) / 2).

[0030] Secondly, the perpendicular bisector direction vector is obtained by cross product calculation. The cross product calculation can generate a vector perpendicular to the line connecting the starting point and the end point, including: 1. Calculate the direction vectors of the start and end points = (x1-x0, y1-y0, z1- z0); 2. Set the vertical direction vector based on the current coordinate system (default world coordinates) =(0,0,1); 3. and Perform cross multiplication to obtain the direction vector The perpendicular bisector of .

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

[0032] According to the formula = × =(x2y3-x3y2,x3y1-x1y3,x1y2-x2y1), where x1=2, x2=1, x3=0, y1=0, y2=0, y3=1; but =(1-0,0-2,0-0))=(1,-2,0), that is The direction vector of the perpendicular bisector.

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

[0034] Step S102: performing a control point calculation operation according to the midpoint coordinates, the perpendicular bisector direction vector, and a preset trigonometric function to determine a corresponding basic control point, performing a distance calculation operation on the start point coordinates and the end point coordinates to determine a corresponding direction vector length, dynamically adjusting the basic control point according to the direction vector length to determine a 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; Optionally, in this embodiment, basic control points are first obtained according to trigonometric functions, and then the positions of the control points are dynamically adjusted by adaptive adjustment of the perpendicular bisector and curvature control, so as to obtain the optimal control point positions to ensure the naturalness of the curvature of the curve after the quadratic Bezier curve is generated.

[0035] First, basic control points are generated according to the midpoint coordinates, the direction vector of the perpendicular bisector and the preset trigonometric function to provide initial values ​​for subsequent dynamic adjustments.

[0036] Specifically, according to the midpoint coordinate C obtained in step S101 and the perpendicular bisector direction vector of the line AB The control point generation operation is performed based on the preset angle, that is, the control point D is located on the perpendicular bisector of the line AB, where AD and AC form a 30-degree angle. Calculate the coordinates of the basic control point D:

[0037] Wherein, offset is the offset calculated by the trigonometric function tan(30°).

[0038] is the direction vector of the perpendicular bisector of line AB Normalized unit vector.

[0039] Next, in order to enhance the flexibility of control point generation, a dynamic offset adjustment mechanism is introduced: A. A dynamic adjustment situation is to directly update the offset of the basic control point.

[0040] The specific steps are: 1. Dynamically adjust the offset according to the distance d between the starting point and the end point.

[0041]

[0042] Wherein, k is a proportionality coefficient, preferably, the default value can be set to 0.1, and can be adjusted according to demand.

[0043] Distance between AB

[0044] 2. Dynamically adjust the angle θ according to the distance d between the starting point and the end point.

[0045]

[0046] Among them, θ base The basic angle is 30°, and α is the adjustment coefficient.

[0047] Distance between AB

[0048] By dynamically adjusting the control points as described above, the larger the distance between AB, the more the control point offset and angle will be dynamically adjusted and increased proportionally. By dynamically adjusting, it is ensured that the control points can adapt to different start and end point distances, thereby improving the adaptability of the curve and making the curvature of the generated curve more natural.

[0049] For example, the starting point coordinates are A (0,0,0), the end point coordinates are B (4,0,0), and the midpoint coordinates are C (2,0,0). Distance d=4, k=0.1, θ base =30°, α=0.05.

[0050] The initial angle is 30°, and the initial offset is tan30°. At this time, the offset of the basic control point is updated according to the distance d between AB: Calculate the offset: offset=0.1 4=0.4 Calculate the angle: θ=30°+0.05 4=32° Calculate the control point D: =(2,0,0)+(0,1) 0.4=(2,0.4,0) It can be seen from the above embodiments that the larger the distance is, the more natural the curvature of the curve is by dynamically adjusting the control point offset and the angle.

[0051] B. A case of dynamic adjustment is to accumulate the offsets of the basic control points.

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

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

[0054] k d is a dynamic adjustment item related to the distance d, k is a proportional coefficient, and preferably, the default value may be set to 0.05.

[0055] The specific steps are: 1. Calculate the distance d between the starting point A and the end point B:

[0056] 2. Calculate the base offset:

[0057] 3. Calculate dynamic adjustment items:

[0058] 4. Calculate the total offset:

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

[0060] Where C is the midpoint of AB, is the direction vector of the perpendicular bisector.

[0061] For example, in a short distance case, the starting point is A (0, 0, 0), the end point is B (2, 0, 0), the distance d = 2, and the proportionality coefficient k = 0.05.

[0062] 1. Basic offset: offset base =tan(30°) 2≈1.1547 2. Dynamic adjustment items: offset adjust =0.05 2=0.1 3. Total offset: offset=1.1547+0.1=1.2547 4. Coordinates of control point D: D=(1,0,0)+(0,1,0) 1.2547=(1,1.2547,0) At short distances, the accumulation of offsets makes the curve slightly more curvature, but still remains natural.

[0063] For example, in the long distance case, the starting point A is (0,0,0), the end point B is (8,0,0), the distance d=2, and the proportionality coefficient k=0.05.

[0064] 1. Basic offset: offset base =tan(30°) 8≈4.6188 2. Dynamic adjustment items: offset adjust =0.05 8=0.4 3. Total offset: offset=4.6188+0.4=5.0188 4. Coordinates of control point D: D=(4,0,0)+(0,1,0) 5.0188=(4,5.0188,0) 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 flat due to excessive distance.

[0065] It is understandable that by accumulating dynamic adjustment items related to distance, the offset can change dynamically according to the distance between the starting point and the end point to adapt to the needs of different scenarios. In the case of short and long distances, the curve curvature can transition smoothly to avoid sudden changes in the curve shape due to distance changes. At the same time, by adjusting the proportional coefficient k, the intensity of the dynamic adjustment item can be flexibly controlled to meet the needs of different application scenarios. Combined with the basic offset of tan (30°), the naturalness and aesthetics of the curve shape are ensured.

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

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

[0068] The curvature k(t) represents the curvature 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 function of the parameter t (0, 1) is to traverse all points on the curve and check whether the curvature exceeds the set threshold.

[0069] are the first and second order derivatives respectively.

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

[0071] Traverse the parameter t from t=0 to t=1, traverse all points on the curve with the set step size, and for each t, ​​calculate its k(t) value. If there is a k(t) value of t> k max , you need to adjust the position of control point D and recalculate the curve.

[0072] 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 .

[0073] For example, starting point A (0,0,0), end point B (4,0,0), control point D (2,2,0), set the maximum curvature threshold k max = 0.5. The parameter t is traversed with a step size of 0.01.

[0074] When t=0.5, calculate

[0075] Calculate the first derivative

[0076] Calculate the second derivative

[0077] Calculate the curvature k(0.5)=0≤k max No adjustment is required.

[0078] Take another example to illustrate, A(0,0,0), B(2,0,0), D(1,0.2,0), initial scale factor k=0.1, set the maximum curvature threshold k max = 0.5. The parameter t is traversed with a step size of 0.01.

[0079] Calculate the curvature k(0.5)=0.6>k max Then adjust the scale factor k of the control point to 0.05 and recalculate the control point coordinates D (1, 0.1, 0).

[0080] Next, recalculate the curvature after adjusting the scale factor k(0.5) = 0.3 ≤ k max , satisfying the constraints.

[0081] No further adjustment is required.

[0082] The curvature constraint is used to further dynamically adjust the position of the control points to ensure that the Bezier curve generated based on the control points meets the preset curvature requirements, avoids the curve being too sharp or too flat, and ensures the smoothness and beauty of the curve.

[0083] Step S103: 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 operation on the three-dimensional chart library according to the quadratic Bezier curve point set, and determine the corresponding three-dimensional curve.

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

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

[0086] Assign the linesData array data after inserting the curve point set directly to the data configuration of the three-dimensional ray, and you can see the display effect of the curve ray on the three-dimensional chart.

[0087] This example shows how to draw a curve point set by determining the best control point based on the distance between two points combined with dynamic adjustment of the perpendicular bisector and curvature control, and assign the curve point set to the echarts-gl library (3D chart library) for 3D curve drawing. This solves the problem of the echarts-gl library in the field of 3D drawing, which lacks advanced configuration options such as customized curvature and arrow effects for 3D ray drawing.

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

[0089] In one embodiment of the three-dimensional curve drawing method based on the three-dimensional chart library of the present application, see Figure 2 , and can also include the following: Step S201: determining a 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; Step S202: performing a cross product calculation operation 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.

[0090] Optionally, in this embodiment, the perpendicular bisector direction vector is obtained by cross product calculation, and the cross product calculation can generate a vector perpendicular to the line connecting the starting point and the end point, including: 1. Calculate the direction vectors of the start and end points = (x1-x0, y1-y0, z1- z0); 2. Set the vertical direction vector based on the current coordinate system (default world coordinates) =(0,0,1); 3. and Perform cross multiplication to obtain the direction vector The perpendicular bisector of .

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

[0092] According to the formula = × =(x2y3-x3y2,x3y1-x1y3,x1y2-x2y1), where x1=2, x2=1, x3=0, y1=0, y2=0, y3=1; but =(1-0,0-2,0-0)=(1,-2,0), that is The direction vector of the perpendicular bisector.

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

[0094] Through step S202, this embodiment obtains the direction vector of the perpendicular bisector, which lays a data foundation for solving the control points through trigonometric functions later.

[0095] In one embodiment of the three-dimensional curve drawing method based on the three-dimensional chart library of the present application, see Figure 3 , and can also include the following: Step S301: determining the corresponding first control point offset by a preset angle value and a preset trigonometric function; Step S302: Taking the midpoint coordinates 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.

[0096] Optionally, in this embodiment, basic control points are generated according to the midpoint coordinates, the perpendicular bisector direction vector and a preset trigonometric function to provide initial values ​​for subsequent dynamic adjustments.

[0097] Specifically, according to the midpoint coordinate C obtained in step S101 and the perpendicular bisector direction vector of the line AB The control point generation operation is performed based on the preset angle, that is, the control point D is located on the perpendicular bisector of the line AB, where AD and AC form a 30-degree angle. Calculate the coordinates of the basic control point D:

[0098] Here, offset is a first offset calculated by using the trigonometric function tan(30°).

[0099] is the direction vector of the perpendicular bisector of line AB Normalized unit vector.

[0100] Through step S302, the present embodiment obtains basic control points, which lays a foundation for dynamically adjusting the positions of control points according to the basic control points and the length distance to obtain the optimal control points.

[0101] In one embodiment of the three-dimensional curve drawing method based on the three-dimensional chart library of the present application, see Figure 4 , and can also include the following: Step S401: determining a corresponding second control point offset according to a preset scale factor and the length of the direction vector, dynamically adjusting the first control point offset according to the second control point offset, and determining a corresponding control point offset; Step S402: taking the midpoint coordinate as the starting point and the perpendicular bisector direction vector as the offset direction, performing a control point calculation operation according to the control point offset to determine the corresponding adaptive control point.

[0102] Optionally, in this embodiment, in order to enhance the flexibility of control point generation, a dynamic offset adjustment mechanism is introduced: A. A dynamic adjustment situation is to directly update the offset of the basic control point.

[0103] The specific steps are: 1. Dynamically adjust the offset according to the distance d between the starting point and the end point.

[0104]

[0105] Wherein, k is a proportionality coefficient, preferably, the default value can be set to 0.1, and can be adjusted according to demand.

[0106] Distance between AB

[0107] 2. Dynamically adjust the angle θ according to the distance d between the starting point and the end point.

[0108]

[0109] Among them, θ base The basic angle is 30°, and α is the adjustment coefficient.

[0110] Distance between AB

[0111] By dynamically adjusting the control points as described above, the larger the distance between AB, the more the control point offset and angle will be dynamically adjusted and increased proportionally. By dynamically adjusting, it is ensured that the control points can adapt to different start and end point distances, thereby improving the adaptability of the curve and making the curvature of the generated curve more natural.

[0112] For example, the starting point coordinates are A (0,0,0), the end point coordinates are B (4,0,0), and the midpoint coordinates are C (2,0,0). Distance d=4, k=0.1, θ base =30°, α=0.05.

[0113] The initial angle is 30°, and the initial offset is tan30°. At this time, the offset of the basic control point is updated according to the distance d between AB: Calculate the offset: offset=0.1 4=0.4 Calculate the angle: θ=30°+0.05 4=32° Calculate the control point D: =(2,0,0)+(0,1) 0.4=(2,0.4,0) It can be seen from the above embodiments that the larger the distance is, the more natural the curvature of the curve is by dynamically adjusting the control point offset and the angle.

[0114] B. A case of dynamic adjustment is to accumulate the offsets of the basic control points.

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

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

[0117] k d is a dynamic adjustment item related to the distance d, k is a proportional coefficient, and preferably, the default value may be set to 0.05.

[0118] The specific steps are: 1. Calculate the distance d between the starting point A and the end point B:

[0119] 2. Calculate the base offset:

[0120] 3. Calculate dynamic adjustment items:

[0121] 4. Calculate the total offset:

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

[0123] Where C is the midpoint of AB, is the direction vector of the perpendicular bisector.

[0124] For example, in a short distance case, the starting point is A (0, 0, 0), the end point is B (2, 0, 0), the distance d = 2, and the proportionality coefficient k = 0.05.

[0125] 1. Basic offset: offset base =tan(30°) 2≈1.1547 2. Dynamic adjustment items: offset adjust =0.05 2=0.1 3. Total offset: offset=1.1547+0.1=1.2547 4. Coordinates of control point D: D=(1,0,0)+(0,1,0) 1.2547=(1,1.2547,0) At short distances, the accumulation of offsets makes the curve slightly more curvature, but still remains natural.

[0126] For example, in the long distance case, the starting point A is (0,0,0), the end point B is (8,0,0), the distance d=2, and the proportionality coefficient k=0.05.

[0127] 1. Basic offset: offset base =tan(30°) 8≈4.6188 2. Dynamic adjustment items: offset adjust =0.05 8=0.4 3. Total offset: offset=4.6188+0.4=5.0188 4. Coordinates of control point D: D=(4,0,0)+(0,1,0) 5.0188=(4,5.0188,0) 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 flat due to excessive distance.

[0128] It is understandable that by accumulating dynamic adjustment items related to distance, the offset can change dynamically according to the distance between the starting point and the end point to adapt to the needs of different scenarios. In the case of short and long distances, the curve curvature can transition smoothly to avoid sudden changes in the curve shape due to distance changes. At the same time, by adjusting the proportional coefficient k, the intensity of the dynamic adjustment item can be flexibly controlled to meet the needs of different application scenarios. Combined with the basic offset of tan (30°), the naturalness and aesthetics of the curve shape are ensured.

[0129] Through step S402, this embodiment successfully enables the offset to change dynamically according to the distance between the starting point and the end point through dynamic adjustment, so as to adapt to different scene requirements and obtain the best three-dimensional curve that adapts to different scenes.

[0130] In one embodiment of the three-dimensional curve drawing method based on the three-dimensional chart library of the present application, see Figure 5 , and can also include the following: Step S501: performing a quadratic Bezier curvature calculation operation according to the adaptive control point to determine the corresponding control point curvature; Step S502: determining whether the curvature of the control point is greater than a preset Bezier curvature threshold; if so, reducing the offset of the control point.

[0131] Optionally, in this embodiment, in order to avoid visual distortion caused by excessive curvature, 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 curvature of a curve. By calculating the curvature of the curve and setting a reasonable maximum curvature threshold, the smoothness and naturalness of the curve can be ensured.

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

[0133] The curvature k(t) represents the curvature 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 function of the parameter t (0, 1) is to traverse all points on the curve and check whether the curvature exceeds the set threshold.

[0134] and are the first and second order derivatives respectively.

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

[0136] Traverse the parameter t from t=0 to t=1, traverse all points on the curve with the set step size, and for each t, ​​calculate its k(t) value. If there is a k(t) value of t> k max , you need to adjust the position of control point D and recalculate the curve.

[0137] 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 .

[0138] For example, starting point A (0,0,0), end point B (4,0,0), control point D (2,2,0), set the maximum curvature threshold k max = 0.5. The parameter t is traversed with a step size of 0.01.

[0139] When t=0.5, calculate

[0140] Calculate the first derivative

[0141] Calculate the second derivative

[0142] Calculate the curvature k(0.5)=0≤k max No adjustment is required.

[0143] Take another example to illustrate, A(0,0,0), B(2,0,0), D(1,0.2,0), initial scale factor k=0.1, set the maximum curvature threshold k max = 0.5. The parameter t is traversed with a step size of 0.01.

[0144] Calculate the curvature k(0.5)=0.6>k max Then adjust the scale factor k of the control point to 0.05 and recalculate the control point coordinates D (1, 0.1, 0).

[0145] Next, recalculate the curvature after adjusting the scale factor k(0.5) = 0.3 ≤ k max , satisfying the constraints.

[0146] No further adjustment is required.

[0147] The curvature constraint is used to further dynamically adjust the position of the control points to ensure that the Bezier curve generated based on the control points meets the preset curvature requirements, avoids the curve being too sharp or too flat, and ensures the smoothness and beauty of the curve.

[0148] Through step S502, this embodiment successfully further limits the positions of the control points by means of curvature constraints, thereby ensuring that the generated three-dimensional curve has a beautiful shape.

[0149] In one embodiment of the three-dimensional curve drawing method based on the three-dimensional chart library of the present application, see Figure 6 , and can also include the following: Step S601: 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; Step S602: discretizing the continuous curve according to a preset number of path points to determine a corresponding quadratic Bezier curve point set.

[0150] Optionally, in this embodiment, optionally, in this step, the starting point coordinates A, the end point coordinates B and the control point coordinates D are passed into the quadraticBezierCurve method to draw the quadratic Bezier curve to generate a smooth curve, and at the same time, a curve point set is generated according to the preset number of path points (the default value is 100).

[0151] Through step S602, this embodiment successfully obtains the curve point set, laying a foundation for subsequently assigning the curve point set to the three-dimensional chart library.

[0152] In one embodiment of the three-dimensional curve drawing method based on the three-dimensional chart library of the present application, see Figure 7 , and can also include the following: Step S701: combining the quadratic Bezier curve point set with the unit array data to determine the corresponding linesData array; Step S702: performing 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.

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

[0154] Assign the linesData array data after inserting the curve point set directly to the data configuration of the three-dimensional ray, and you can see the display effect of the curve ray on the three-dimensional chart.

[0155] 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, which solves the problem that the echarts-gl library lacks advanced configuration options such as customized curvature and arrow effects for the drawing of three-dimensional rays in the field of three-dimensional drawing.

[0156] In order 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 three-dimensional curve drawing method based on a three-dimensional chart library, see Figure 8 The three-dimensional curve drawing device based on the three-dimensional chart library specifically includes the following contents: The basic calculation module 10 is used to receive three-dimensional array data, perform 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 perform 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 20 is used to perform a control point calculation operation according to the midpoint coordinates, the perpendicular bisector direction vector and a preset trigonometric function to determine a corresponding basic control point, perform a distance calculation operation on the start point coordinates and the end point coordinates to determine a corresponding direction vector length, dynamically adjust the basic control point according to the direction vector length to determine a corresponding adaptive control point, perform a curvature constraint adjustment on the adaptive control point according to a preset Bezier curvature threshold, and determine the corresponding control point coordinates; The three-dimensional curve generation module 30 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.

[0157] From the above description, it can be seen that the three-dimensional curve drawing device based on the three-dimensional chart library provided in the embodiment of the present application can determine the corresponding midpoint coordinates and the perpendicular bisector direction vector by performing basic calculations on the starting point coordinates and the end point coordinates in the three-dimensional array data, determine the basic control points according to the midpoint coordinates, the perpendicular bisector direction vector and the preset trigonometric function, dynamically adjust the basic control points according to the length of the direction vector from the starting point coordinates to the end point coordinates to obtain adaptive control points, perform curvature constraint adjustment on the adaptive control points, determine the corresponding control point coordinates, input the preset number of path points, the starting point coordinates, the end point coordinates and the control point coordinates into the quadratic Bezier curve formula to obtain a quadratic Bezier curve point set, 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.

[0158] From the 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 of the three-dimensional curve drawing method based on the three-dimensional chart library, and the electronic device specifically includes the following content: Processor, memory, communication interface and bus; wherein the processor, memory and communication interface communicate with each other through the bus; the communication interface is used to realize information transmission between the three-dimensional curve drawing method based on the three-dimensional chart library and the core business system, user terminal and related database and other related devices; the logic controller can be a desktop computer, a tablet computer and a mobile terminal, etc., but the present embodiment is not limited thereto. In the present embodiment, the logic controller can be implemented with reference to the embodiment of the three-dimensional curve drawing method based on the three-dimensional chart library and the embodiment of the three-dimensional curve drawing method based on the three-dimensional chart library in the embodiment, and the contents thereof are incorporated herein, and the repeated parts are not repeated.

[0159] It is understandable 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.

[0160] In practical applications, part of the three-dimensional curve drawing method based on the three-dimensional chart library can be executed on the electronic device side as described above, or all operations can be completed in the client device. The selection can be made based on the processing capability of the client device and the limitations of the user's usage scenario. This application does not limit this. If all operations are completed in the client device, the client device may also include a processor.

[0161] The client device may have a communication module (i.e., a communication unit) that can communicate with a remote server to achieve data transmission with the server. The server may include a server on the task scheduling center side, and other implementation scenarios may also include a server on an intermediate platform, such as a server on a third-party server platform that has a communication link with the task scheduling center server. The server may include a single computer device, or a server cluster consisting of multiple servers, or a server structure of a distributed device.

[0162] Fig. 9 FIG. 9 is a schematic block diagram of the system structure of the electronic device 9600 according to an embodiment of the present application. Fig. 9 As shown, the electronic device 9600 may include a central processor 9100 and a memory 9140; the memory 9140 is coupled to the central processor 9100. It is worth noting that Fig. 9 is exemplary; other types of structures may also be used to supplement or replace this structure to implement telecommunication functions or other functions.

[0163] In one embodiment, the 3D curve drawing method function based on the 3D chart library can be integrated into the central processing unit 9100. The central processing unit 9100 can be configured to perform the following control: Step S101: receiving three-dimensional array data, performing 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, performing 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; Step S102: performing a control point calculation operation according to the midpoint coordinates, the perpendicular bisector direction vector, and a preset trigonometric function to determine a corresponding basic control point, performing a distance calculation operation on the start point coordinates and the end point coordinates to determine a corresponding direction vector length, dynamically adjusting the basic control point according to the direction vector length to determine a 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; Step S103: 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 operation on the three-dimensional chart library according to the quadratic Bezier curve point set, and determine the corresponding three-dimensional curve.

[0164] From the above description, it can be seen that 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 end point coordinates in the three-dimensional array data, determines the basic control points according to the midpoint coordinates, the perpendicular bisector direction vector and the preset trigonometric function, dynamically adjusts the basic control points according to the length of the direction vector from the starting point coordinates to the end point coordinates 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 path points, the starting point coordinates, the end point coordinates and the control point coordinates into the quadratic Bezier curve formula to obtain a quadratic Bezier curve point set, performs data configuration operations 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.

[0165] In another embodiment, the three-dimensional curve drawing method based on the three-dimensional chart library can be configured separately 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.

[0166] like Fig. 9 As shown, the electronic device 9600 may also include: a communication module 9110, an input unit 9120, an audio processor 9130, a display 9160, and a power supply 9170. It is worth noting that the electronic device 9600 does not necessarily have to include Fig. 9 In addition, the electronic device 9600 may also include Fig. 9 For components not shown, reference may be made to the prior art.

[0167] like Fig. 9 As shown, the central processing unit 9100 is sometimes also referred to as a controller or an operation control, and may include a microprocessor or other processor device and / or logic device. The central processing unit 9100 receives input and controls the operation of various components of the electronic device 9600.

[0168] The memory 9140 may be, for example, one or more of a cache, a flash memory, a hard drive, a removable medium, a volatile memory, a non-volatile memory or other suitable devices. The above-mentioned information related to the failure may be stored, and a program for executing the relevant information may also be stored. The CPU 9100 may execute the program stored in the memory 9140 to implement information storage or processing, etc.

[0169] The input unit 9120 provides input 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 provide 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.

[0170] The memory 9140 may be a solid-state memory, such as a read-only memory (ROM), a random access memory (RAM), a SIM card, etc. It may also be a memory that saves information even when the power is off, can be selectively erased, and is provided with more data, examples of which 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, which is used to store application programs and function programs or processes for executing the operation of the electronic device 9600 through the central processor 9100.

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

[0172] The communication module 9110 is a transmitter / receiver that sends 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 the case of a conventional mobile communication terminal.

[0173] 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 a speaker 9131 and a microphone 9132 via an audio processor 9130 to provide an audio output via the speaker 9131 and receive an audio input from the microphone 9132, thereby realizing a common telecommunication function. The audio processor 9130 may include any suitable buffer, decoder, amplifier, etc. In addition, the audio processor 9130 is also coupled to the central processor 9100, so that recording can be performed on the machine through the microphone 9132, and the sound stored on the machine can be played through the speaker 9131.

[0174] The 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 the three-dimensional chart library in the above-mentioned embodiment, where the execution subject is a server or a client. The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, all steps of the three-dimensional curve drawing method based on the three-dimensional chart library in the above-mentioned embodiment are implemented. For example, when the processor executes the computer program, the following steps are implemented: Step S101: receiving three-dimensional array data, performing 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, performing 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; Step S102: performing a control point calculation operation according to the midpoint coordinates, the perpendicular bisector direction vector, and a preset trigonometric function to determine a corresponding basic control point, performing a distance calculation operation on the start point coordinates and the end point coordinates to determine a corresponding direction vector length, dynamically adjusting the basic control point according to the direction vector length to determine a 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; Step S103: 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 operation on the three-dimensional chart library according to the quadratic Bezier curve point set, and determine the corresponding three-dimensional curve.

[0175] From the above description, it can be seen that the computer-readable storage medium provided in the embodiment of the present application performs basic calculations on the starting point coordinates and the end point coordinates in the three-dimensional array data to determine the corresponding midpoint coordinates and the perpendicular bisector direction vector, determines the basic control points according to the midpoint coordinates, the perpendicular bisector direction vector and the preset trigonometric function, dynamically adjusts the basic control points according to the length of the direction vector from the starting point coordinates to the end point coordinates 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 path points, the starting point coordinates, the end point coordinates and the control point coordinates into the quadratic Bezier curve formula to obtain a quadratic Bezier curve point set, performs data configuration operations 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.

[0176] The embodiments of the present application also provide a computer program product capable of implementing all steps of the three-dimensional curve drawing method based on the three-dimensional chart library in the above embodiments, where the execution subject is a server or a client. When the computer program / instruction is 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 / instruction implements the following steps: Step S101: receiving three-dimensional array data, performing 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, performing 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; Step S102: performing a control point calculation operation according to the midpoint coordinates, the perpendicular bisector direction vector, and a preset trigonometric function to determine a corresponding basic control point, performing a distance calculation operation on the start point coordinates and the end point coordinates to determine a corresponding direction vector length, dynamically adjusting the basic control point according to the direction vector length to determine a 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; Step S103: 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 operation on the three-dimensional chart library according to the quadratic Bezier curve point set, and determine the corresponding three-dimensional curve.

[0177] From the above description, it can be seen that the computer program product provided in the embodiment of the present application performs basic calculations on the starting point coordinates and the end point coordinates in the three-dimensional array data to determine the corresponding midpoint coordinates and the perpendicular bisector direction vector, determines the basic control points according to the midpoint coordinates, the perpendicular bisector direction vector and the preset trigonometric function, dynamically adjusts the basic control points according to the length of the direction vector from the starting point coordinates to the end point coordinates 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 path points, the starting point coordinates, the end point coordinates and the control point coordinates into the quadratic Bezier curve formula to obtain a quadratic Bezier curve point set, performs data configuration operations 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.

[0178] It should be understood by those skilled in the art that embodiments of the present invention may be provided as methods, devices, or computer program products. Therefore, the present invention may take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware aspects. Moreover, the present invention may 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.

[0179] The present invention is described with reference to flowcharts and / or block diagrams of methods, devices (apparatus), and computer program products according to embodiments of the present invention. It should be understood that each process and / or block in the flowchart and / or block diagram, as well as the combination of processes and / or blocks 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 generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. 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.

[0180] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate 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 A function specified in one or more boxes.

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

[0182] The present invention uses specific embodiments to illustrate the principles and implementation methods of the present invention. The description of the above embodiments is only used to help understand the method of the present invention and its core idea. At the same time, for those skilled in the art, according to the idea of ​​the present invention, there will be changes in the specific implementation methods and application scope. In summary, the content of this specification should not be understood as a limitation on 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; Perform a control point calculation operation according to the midpoint coordinates, the perpendicular bisector direction vector, and a preset trigonometric function to determine a corresponding basic control point, perform a distance calculation operation on the start point coordinates and the end point coordinates to determine a corresponding direction vector length, perform a dynamic adjustment operation on the basic control point according to the direction vector length to determine a corresponding adaptive control point, perform a curvature constraint adjustment on the adaptive control point according to a preset Bezier curvature threshold, and 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 performing a control point calculation operation according to the midpoint coordinates, the perpendicular bisector direction vector and a preset trigonometric function to determine a corresponding basic control point includes: Determine the corresponding first control point offset by using 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.

4. The three-dimensional curve drawing method based on the three-dimensional chart library according to claim 3 is characterized in that: The dynamically adjusting the basic control point according to the length of the direction vector to determine the corresponding adaptive control point includes: Determine a corresponding second control point offset according to a preset scale factor and the length of the direction vector, dynamically adjust the first control point offset according to the second control point offset, and determine a corresponding control point offset; 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.

5. 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.

6. The three-dimensional curve drawing method based on the three-dimensional chart library according to claim 1 is characterized in that: The step of drawing a quadratic Bezier curve according to the preset number of waypoints, the starting point coordinates, the end point coordinates and the control point coordinates, and determining 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.

7. 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.

8. 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 perform a control point calculation operation according to the midpoint coordinates, the perpendicular bisector direction vector and a preset trigonometric function, determine a corresponding basic control point, perform a distance calculation operation on the start point coordinates and the end point coordinates, determine a corresponding direction vector length, perform a dynamic adjustment operation on the basic control point according to the direction vector length, determine a corresponding adaptive control point, perform a curvature constraint adjustment on the adaptive control point according to a preset Bezier curvature threshold, and 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.

9. 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 7 are implemented.

10. 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 7 are implemented.

Citation Information

Patent Citations

  • Radar-based curve drawing method and device, electronic equipment and storage medium

    CN111986286A

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

    CN113370995A

  • Vision-based AGV trajectory tracking method

    CN119596929A

  • Track correction method, electronic equipment and computer readable storage medium

    CN119620746A

  • Curve generating circuit

    JP1990213897A