Virtual reality technology is a low-cost,high-efficiency,and repeatable important auxiliary technology.Coupled with the convenience of Internet web-side technology,web-side virtual reality applications are gradually widespread,but the curve design tools required for developing virtual scenes are not yet mature.At present,the development of WebGL-based virtual reality engine curve drawing tool set is facing the following problems:(1)The method of using the principle of object motion to calculate the trajectory of a three-dimensional object curve is inconvenient for developers,and it is difficult to quickly describe irregular curves,and the trajectory is quite inconvenient to adjust;(2)Most of the 3D curves in the virtual world currently use UI textures,which have low flexibility and real-time performance;(3)Curved surfaces are extensions of curves.In project development,the model composed of curved surfaces is made by professional software.Developers cannot understand the vertex structure of the model,and cannot perform operations such as deformation on the surface.For this reason,the main research contents of this topic are:(1)First of all,an interactive drawing method of N-order Bezier curve based on Babylon.js is proposed in the trajectory design.The comparison test and the ball motion simulation test show that this method can effectively generate the curved trajectory of the three-dimensional object.The advantage of this method is that the number and position of intermediate control points can be customized,and it has strong design flexibility and practicability.Then,aiming at the non-local adjustment shortcomings of the Bezier curve,the B-spline curve is used to improve it,and two reasonable solutions are proposed to the problem of not having the first and last control points in practical applications,and the validity and universality of the two solutions are verified.Compared with the Bezier curve trajectory,the B-spline curve trajectory is not only smooth at the connection,but also has a continuous G~2overall,which is closer to the curve control polygon and has good locality.Finally,in the camera shooting simulation test based on the B-spline curve trajectory,the camera runs stably along the curve trajectory and the shooting pictures are continuous.(2)Secondly,the key technologies in the process of drawing data curves are studied.On the data node fitting problem,adopting the continuous segmented cubic Bezier curve fitting method,conceived an automatic generation method of the control points of the cubic Bezier curve,carried out the optimal analysis of the control point construction coefficient,and ensured that the fitting curve of the control point is adopted the overall curve is G~2continuous.Then,a comparison test was carried out on the browser canvas,and the results showed that in the two-dimensional and three-dimensional curve fitting,the use of the front and rear point parallel construction method can ensure that the slope of the left and right tangent lines at the joint points is consistent,and the drawn curve has achieved a good fitting effect;the fitting method not only inherits the advantages of the Bezier curve,but also smoothly passes through all the data feature points,which can better reflect the changing trend of the data in different situations,and has high reliability;the drawn curve can be used in the three-dimensional virtual screen can be clearly displayed.Compared with the curved UI map,this method has strong flexibility and can be recognized by VR glasses.In addition,this method can not only be used for curve fitting,but also can be used for data fitting of characteristic points.(3)Finally,in order to control the vertices of the curved surface,simulate the dynamic deformation of the object,analyze the surface rendering principle and NURBS theory,in the Babylon.js environment,design the NURBS surface rendering process in detail,and implement it with Typescript programming language that the Hadley-Judd method is used to calculate the node value and the de Boor-Cox method is used to calculate the basis function value,and the triangular mesh surface connection algorithm is designed to connect the interpolated vertices to fix the shape of the surface and realize the basic drawing of the NURBS surface on the web page and display;designed a dynamic sea level special effect experiment,taking the sinusoidal change of the surface control point position as the starting point,and completed the calculation,connection,and rendering of the vertices of the NURBS surface in sequence,successfully simulating the fluctuation effect of the virtual sea level on the web page. |