WPF-based chemical instrument fluid simulation system and method thereof

The chemical instrument fluid simulation system based on WPF solves the problems of low fluid simulation animation simulation accuracy and inconvenient interaction in the existing technology, and realizes high-precision fluid simulation animation and interaction in chemical instruments of any shape, improving the teaching effect.

CN118761348APending Publication Date: 2024-10-11RETURNSTAR INTERACTIVE TECH GRP
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410839068.2
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-06-26
Publication Date
2024-10-11

AI Technical Summary

Technical Problem

Existing chemical experiment teaching software has problems such as low accuracy, inconvenient interaction, and weak scalability when simulating fluid simulation animations, making it difficult to provide realistic chemical experiment simulation effects.

Method used

A chemical instrument fluid simulation system based on WPF is adopted, including a chemical instrument initialization module, an interaction module and a fluid animation simulation module. The dynamic interaction of chemical instruments is realized through the vector text data conversion of SVG image files, the initialization and matrix transformation of object coordinate data sets. and fluid simulation animation effects, supporting the simulation of chemical instruments of any shape.

Benefits of technology

It realizes high-precision fluid simulation animation effects in arbitrary-shaped chemical instruments, with convenient interaction and strong scalability, which improves the teaching effect and ease of use.

✦ Generated by Eureka AI based on patent content.
Patent Text Reader

Abstract

The invention discloses a WPF-based chemical instrument fluid simulation system and method. The system comprises a chemical instrument initialization module; the chemical instrument interaction module can enable a user to operate one or more chemical instrument objects at the same time and calculate tense data of the chemical instrument objects in real time, and the operation environment can be carried out in a Windows system desktop computer and can also be carried out in a Windows system liquid crystal screen; a fluid animation simulation module; and a withdrawing mechanism and a data storage module. According to the simulation system and the method thereof, a fluid simulation animation effect generated by fluid along with user interaction in a chemical instrument in any shape can be realized, a teacher can conveniently simulate a real chemical experiment action in an education and teaching process, the simulation precision is high, the interaction is convenient, the expansibility is high, the teaching effect is favorably improved, and the use is convenient.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of teaching technology, in particular to a chemical instrument fluid simulation system based on WPF and a method thereof. Background Art

[0002] Chemical experiment refers to a teaching practice activity in which teachers or students, based on certain chemical experiment purposes, use certain chemical experiment instruments, equipment, devices and other material means to change the state and properties of the experimental objects under artificial experimental conditions, thereby obtaining various chemical experimental facts and achieving the purpose of chemical teaching.

[0003] With the development of science and technology, existing chemical experiments can be demonstrated using simulation equipment to provide certain visual effects and interactivity. However, traditional educational and teaching software has few simulation animations for chemical experiments, especially fluid simulation animations, which have the disadvantages of low accuracy, inconvenient interaction, weak scalability, and high performance loss. Summary of the invention

[0004] The technical problem to be solved by the present invention is to overcome the existing defects and provide a chemical instrument fluid simulation system and method based on WPF, which can realize the fluid simulation animation effect generated by the fluid as the user interacts in a chemical instrument of any shape, so as to facilitate teachers to simulate real chemical experiment actions in the process of education and teaching. The simulation has high precision, convenient interaction, strong scalability, helps to improve the teaching effect, is easy to use, and can effectively solve the problems in the background technology.

[0005] To achieve the above objectives, the present invention provides the following technical solutions: a chemical instrument fluid simulation system based on WPF, including a chemical instrument initialization module, a chemical instrument interaction module, a fluid animation simulation module, an undo and recall mechanism and a data storage module.

[0006] A chemical instrument fluid simulation method based on WPF, using the chemical instrument fluid simulation system based on WPF as claimed in claim 1, comprising the following steps:

[0007] S1, chemical instrument initialization module, specifically including the following steps:

[0008] S11, firstly obtain a UI image of a certain chemical instrument, that is, an image file in SVG format;

[0009] S12, extracting the vector text data of the SVG file, and converting it into a coordinate data set for the WPF interface to be calculated by the algorithm through the function method ConvertSvgPathToPolylines, so as to form an object to facilitate the control of the following steps. The conversion process includes straight line segments, arc segments, polylines, Bezier curve segments, and multi-segment Bezier curve segments;

[0010] S13, after the object vector coordinate data set is acquired, the bottle mouth points of the chemical instrument are initialized and defined (since the present invention is not limited to the instrument style, the number of bottle mouth points can be any even number);

[0011] S14, through the object vector coordinate data set, the module coordinate data set of the bottle body, bottle cap, scale, decoration, etc. of the chemical instrument can be further determined;

[0012] S15. Each object inherits from FrameworkElement and rewrites the OnRender event as the display of the object, adds each object to the child collection of the parent form Grid, and rewrites the OnPreviewMouseDown, OnPreviewMouseMove, OnPreviewMouseUp and ManipulationStarting, ManipulationDelta, ManipulationCompleted events inherited by each object from the parent form Grid to meet the dynamic interaction of objects in different operating environments;

[0013] S16, initializing necessary parameters such as the chemical point of each object (i.e., the control point where the chemical instrument and the user interact), the outflow point where the liquid flows out of the instrument, and the liquid area of ​​each interaction state;

[0014] S2, initialization of the interaction module, specifically including the following steps:

[0015] S21. In the present invention, each object (i.e., each chemical instrument) inherits from a FrameworkElement. The function of this module is to realize the display, movement, rotation, and scaling of each object.

[0016] S22, when an object is created, the outer rectangular frame of the object is obtained, and the four corner points and the midpoint are obtained, and a Stroke is created according to the four points;

[0017] S23, control the Matrix through Stroke, and perform corresponding movement, rotation, scaling, and matrix transformation. It can also be used to determine whether the object is selected;

[0018] S3, chemical instrument interaction module, this module can enable users to operate one or more chemical instrument objects at the same time, and calculate their temporal data in real time; the operating environment can be carried out on a Windows system desktop computer or on a Windows system LCD screen, and specifically includes the following steps:

[0019] S31. When operating an object:

[0020] S311, through the event OnPreviewMouseDown or ManipulationStarting, determine whether the operation point (mouse point or touch point, the operation points described below are all the content) is in the outer rectangular frame of the object, if so, start the subsequent interactive operation on the object, that is, proceed to step S312, and record the initial operation point, if not, the object cannot be operated;

[0021] S312, through the event OnPreviewMouseMove or ManipulationDelta, the latest operation point is obtained in real time, and the vector coordinate data set of the object (i.e., the chemical instrument) is recalculated according to the following judgment, and updated and displayed through the rewritten OnRender event;

[0022] 1. If the initial operation point is within the custom rotation point range, a rotation matrix Matrix is ​​obtained through the latest operation point, the initial operation point, and the object midpoint, and the object is rotated by the matrix;

[0023] 2. If the initial operation point is within the custom scaling point range, a scaling matrix Matrix is ​​obtained through the latest operation point, the initial operation point, and the object midpoint, and the object is scaled by the matrix;

[0024] 3. If the initial operating point is within the range of the custom chemical point (i.e., the height point of the fluid in the instrument, the chemical points described below are all of this content), the fluid height at this time is calculated through the latest operating point, and the fluid contour is calculated and updated and displayed in combination with the vector coordinate data set of the chemical instrument object (the calculation process is roughly as follows: it is known that the screen coordinate Y axis gradually increases from top to bottom, and all instrument contour point sets are traversed according to the order of the instrument contour point set. If the line segment point straight line intersects the fluid height straight line, the contour set where the line segment is located can only take a point with a Y coordinate greater than the fluid height and the intersection point; if the line segment points are all less than the fluid height, they are discarded; if the line segment points are all greater than the fluid height, they are added to the fluid contour set. This method is a key method marked as method one, and method one described below is this method);

[0025] 4. If the initial operation point is neither within the range of rotation points nor within the range of scaling points, a moving matrix Matrix is ​​passed through the latest operation point and the initial operation point, and the object is moved and changed through the matrix;

[0026] 5. After the above four operations are completed, the new operation point will replace the initial operation point and update;

[0027] S313, through the event OnPreviewMouseUp or ManipulationCompleted, determine whether the operation point is released: if released, end the current round of interactive operation and clear the initial operation point; if not released, continue the current round of interactive operation;

[0028] S32. When operating multiple objects:

[0029] Through the event OnPreviewMouseDown or ManipulationStarting, it is determined whether the operation point is in the outer rectangle of an object among multiple objects. If so, the operation is the same as that of one object, but at this time all objects are changed according to the corresponding Matrix matrix of the marked object;

[0030] S4, fluid animation simulation module, can realize the animation effect of the fluid inside the chemical instrument object in the above interactive module process, which simulates the state of the operation, so as to provide a simulated chemical experiment process, which is convenient for teachers to simulate real chemical experiment actions in the teaching process. This module is dynamically executed through the OnPreviewMouseUp or ManipulationCompleted events bound to the object, mainly in the following situations:

[0031] S41. Case 1: Bottle cap is not opened:

[0032] At this time, the fluid contour area will not change. (According to the initial fluid contour area and the temporal instrument object contour vector coordinate data set, the lowest point, the highest point and the lowest point of the bottle mouth point concentration of the temporal instrument object are calculated. This method is the key method 2. The method 2 described below is this method). The unit 1 is used as the scale (the default is unit 1. The smaller the default data, the more accurate the algorithm is, but the calculation efficiency is lost. The larger the default data, the loss of accuracy of the algorithm, but the higher the calculation efficiency. The default scale described below is the same). Traverse from the lowest point to the highest point to find the chemical point closest to the initial fluid contour area. Through method 1, the fluid contour vector coordinate data set at this time is updated and displayed;

[0033] S42, Case 1: Bottle cap opened:

[0034] S421, at this time, the fluid contour area may change, and the method 2 is used to traverse from the lowest point to the lowest bottle mouth point with unit 1 as the scale. At this time, the chemical point is the lowest bottle mouth point, and the method 1 is used to update and display the fluid contour vector coordinate data set at this time;

[0035] S422. At the same time, record the change difference of the fluid contour area as the outflow area. If the outflow area is greater than 0, generate an outflow animation. If it is equal to 0, turn off the outflow animation. (If the outflow area is greater than 0, traverse the X coordinate range between all the bottle mouth points of the chemical instrument object. If the current lowest bottle mouth point coordinate is within the X coordinate range of the traversed chemical instrument object bottle mouth point group and is less than the Y coordinate and the bottle cap is open, then the outflow area is added to the new chemical instrument object. If it is judged to be non-existent, generate an outflow animation to the bottom of the screen. This method is the key method three).

[0036] S423, recursively executing the AddArea method in the new chemical instrument object, using method 2 with unit 1 as the scale, traversing from the lowest point to the lowest bottle mouth point, the fluid contour area of ​​the new chemical instrument object is the original fluid contour area plus the outflow area, and updating and displaying the fluid contour vector coordinate data set at this time through method 1, until the outflow area is 0, and then terminating the recursive method;

[0037] S424. If necessary, chemical reaction formulas can be superimposed in this module, and the chemical loss in the fluid flow process can be calculated according to the formula, and accumulated or subtracted in the outflow area to truly simulate the flow of fluid in chemical instruments. At the same time, the chemical reaction color can also be preset to make the effect more realistic. In this way, the flow of the entire fluid between chemical instruments will be truly simulated.

[0038] As a preferred technical solution of the present invention, in S12, the number of steps controlling the Bezier curve approximation is controlled by an initialization parameter, which defaults to 20. The larger the default data, the more accurate the algorithm is, but the calculation efficiency is lost. The smaller the default data, the loss of accuracy of the algorithm, but the higher the calculation efficiency. The coordinate data set is defined as a set of contour sets that surround a circle clockwise or counterclockwise, and each contour set contains two adjacent points. This definition uses calculus to process the contour of the chemical instrument, and the complex curve is simulated by the Bezier curve.

[0039] As a preferred technical solution of the present invention, the undo and recall mechanism module and the data storage module: when each chemical instrument object is initialized, an ElementRetractCloneObj class is created and added to a collection. In the chemical instrument interaction module, the temporal data of the chemical instrument object of each action process will be recorded in this class. If the user executes the undo or recall module, the clone class recorded during the undo or recall will be updated and displayed. The data supports being saved as Json or IWB format files.

[0040] Compared with the prior art, the present invention has the following beneficial effects:

[0041] The WPF-based chemical instrument fluid simulation system and method exemplified in the present invention can realize the fluid simulation animation effect generated by the fluid in the chemical instrument of any shape as the user interacts, which is convenient for teachers to simulate real chemical experiment actions in the education and teaching process. The simulation has high precision, convenient interaction, strong scalability, helps to improve the teaching effect, and is easy to use. DETAILED DESCRIPTION

[0042] The following will be combined with the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of the present invention.

[0043] The present invention provides a technical solution: a chemical instrument fluid simulation system based on WPF, comprising a chemical instrument initialization module, a chemical instrument interaction module, a fluid animation simulation module, an undo and recall mechanism and a data storage module.

[0044] A chemical instrument fluid simulation method based on WPF, using the chemical instrument fluid simulation system based on WPF as claimed in claim 1, comprising the following steps:

[0045] S1, chemical instrument initialization module, specifically including the following steps:

[0046] S11, firstly obtain a UI image of a certain chemical instrument, that is, an image file in SVG format;

[0047] S12, extracting the vector text data of the SVG file, and converting it into a coordinate data set for the WPF interface to be calculated by the algorithm through the function method ConvertSvgPathToPolylines, so as to form an object to facilitate the control of the subsequent steps. The conversion process includes straight line segments, arc segments, polylines, Bezier curve segments, and multi-segment Bezier curve segments (wherein, the number of steps controlling the approximation of the Bezier curve is controlled by an initialization parameter, which defaults to 20. The larger the default data, the more accurate the algorithm is, but the calculation efficiency is lost. The smaller the default data, the loss of accuracy of the algorithm is, but the calculation efficiency is higher; the coordinate data set is defined as a set of contour sets that surround a circle in a clockwise or counterclockwise direction, and each contour set contains two adjacent points. The definition uses calculus to process the contour of the chemical instrument, and the complex curve is simulated by the Bezier curve);

[0048] S13, after the object vector coordinate data set is acquired, the bottle mouth points of the chemical instrument are initialized and defined (since the present invention is not limited to the instrument style, the number of bottle mouth points can be any even number);

[0049] S14, through the object vector coordinate data set, the module coordinate data set of the bottle body, bottle cap, scale, decoration, etc. of the chemical instrument can be further determined;

[0050] S15. Each object inherits from FrameworkElement and rewrites the OnRender event as the display of the object, adds each object to the child collection of the parent form Grid, and rewrites the OnPreviewMouseDown, OnPreviewMouseMove, OnPreviewMouseUp and ManipulationStarting, ManipulationDelta, ManipulationCompleted events inherited by each object from the parent form Grid to meet the dynamic interaction of objects in different operating environments;

[0051] S16, initializing necessary parameters such as the chemical point of each object (i.e., the control point where the chemical instrument and the user interact), the outflow point where the liquid flows out of the instrument, and the liquid area of ​​each interaction state;

[0052] S2, initialization of the interaction module, specifically including the following steps:

[0053] S21. In the present invention, each object (i.e., each chemical instrument) inherits from a FrameworkElement. The function of this module is to realize the display, movement, rotation, and scaling of each object.

[0054] S22, when an object is created, the outer rectangular frame of the object is obtained, and the four corner points and the midpoint are obtained, and a Stroke is created according to the four points;

[0055] S23, control the Matrix through Stroke, and perform corresponding movement, rotation, scaling, and matrix transformation. It can also be used to determine whether the object is selected;

[0056] S3, chemical instrument interaction module, this module can enable users to operate one or more chemical instrument objects at the same time, and calculate their temporal data in real time; the operating environment can be carried out on a Windows system desktop computer or on a Windows system LCD screen, and specifically includes the following steps:

[0057] S31. When operating an object:

[0058] S311, through the event OnPreviewMouseDown or ManipulationStarting, determine whether the operation point (mouse point or touch point, the operation points described below are all the content) is in the outer rectangular frame of the object, if so, start the subsequent interactive operation on the object, that is, proceed to step S312, and record the initial operation point, if not, the object cannot be operated;

[0059] S312, through the event OnPreviewMouseMove or ManipulationDelta, the latest operation point is obtained in real time, and the vector coordinate data set of the object (i.e., the chemical instrument) is recalculated according to the following judgment, and updated and displayed through the rewritten OnRender event;

[0060] 1. If the initial operation point is within the custom rotation point range, a rotation matrix Matrix is ​​obtained through the latest operation point, the initial operation point, and the object midpoint, and the object is rotated by the matrix;

[0061] 2. If the initial operation point is within the custom scaling point range, a scaling matrix Matrix is ​​obtained through the latest operation point, the initial operation point, and the object midpoint, and the object is scaled by the matrix;

[0062] 3. If the initial operating point is within the range of the custom chemical point (i.e., the height point of the fluid in the instrument, the chemical points described below are all of this content), the fluid height at this time is calculated through the latest operating point, and the fluid contour is calculated and updated and displayed in combination with the vector coordinate data set of the chemical instrument object (the calculation process is roughly as follows: it is known that the screen coordinate Y axis gradually increases from top to bottom, and all instrument contour point sets are traversed according to the order of the instrument contour point set. If the line segment point straight line intersects the fluid height straight line, the contour set where the line segment is located can only take a point with a Y coordinate greater than the fluid height and the intersection point; if the line segment points are all less than the fluid height, they are discarded; if the line segment points are all greater than the fluid height, they are added to the fluid contour set. This method is a key method marked as method one, and method one described below is this method);

[0063] 4. If the initial operation point is neither within the range of rotation points nor within the range of scaling points, a moving matrix Matrix is ​​passed through the latest operation point and the initial operation point, and the object is moved and changed through the matrix;

[0064] 5. After the above four operations are completed, the new operation point will replace the initial operation point and update;

[0065] S313, through the event OnPreviewMouseUp or ManipulationCompleted, determine whether the operation point is released: if released, end the current round of interactive operation and clear the initial operation point; if not released, continue the current round of interactive operation;

[0066] S32. When operating multiple objects:

[0067] Through the event OnPreviewMouseDown or ManipulationStarting, it is determined whether the operation point is in the outer rectangle of an object among multiple objects. If so, the operation is the same as that of one object, but at this time all objects are changed according to the corresponding Matrix matrix of the marked object;

[0068] S4, fluid animation simulation module, can realize the animation effect of the fluid inside the chemical instrument object in the above interactive module process, which simulates the state of the operation, so as to provide a simulated chemical experiment process, which is convenient for teachers to simulate real chemical experiment actions in the teaching process. This module is dynamically executed through the OnPreviewMouseUp or ManipulationCompleted events bound to the object, mainly in the following situations:

[0069] S41. Case 1: Bottle cap is not opened:

[0070] At this time, the fluid contour area will not change. (According to the initial fluid contour area and the temporal instrument object contour vector coordinate data set, the lowest point, the highest point and the lowest point of the bottle mouth point concentration of the temporal instrument object are calculated. This method is the key method 2. The method 2 described below is this method). The unit 1 is used as the scale (the default is unit 1. The smaller the default data, the more accurate the algorithm is, but the calculation efficiency is lost. The larger the default data, the loss of accuracy of the algorithm, but the higher the calculation efficiency. The default scale described below is the same). Traverse from the lowest point to the highest point to find the chemical point closest to the initial fluid contour area. Through method 1, the fluid contour vector coordinate data set at this time is updated and displayed;

[0071] S42, Case 1: Bottle cap opened:

[0072] S421, at this time, the fluid contour area may change, and the method 2 is used to traverse from the lowest point to the lowest bottle mouth point with unit 1 as the scale. At this time, the chemical point is the lowest bottle mouth point, and the method 1 is used to update and display the fluid contour vector coordinate data set at this time;

[0073] S422. At the same time, record the change difference of the fluid contour area as the outflow area. If the outflow area is greater than 0, generate an outflow animation. If it is equal to 0, turn off the outflow animation. (If the outflow area is greater than 0, traverse the X coordinate range between all the bottle mouth points of the chemical instrument object. If the current lowest bottle mouth point coordinate is within the X coordinate range of the traversed chemical instrument object bottle mouth point group and is less than the Y coordinate and the bottle cap is open, then the outflow area is added to the new chemical instrument object. If it is judged to be non-existent, generate an outflow animation to the bottom of the screen. This method is the key method three).

[0074] S423, recursively executing the AddArea method in the new chemical instrument object, using method 2 with unit 1 as the scale, traversing from the lowest point to the lowest bottle mouth point, the fluid contour area of ​​the new chemical instrument object is the original fluid contour area plus the outflow area, and updating and displaying the fluid contour vector coordinate data set at this time through method 1, until the outflow area is 0, and then terminating the recursive method;

[0075] S424. If necessary, chemical reaction formulas can be superimposed in this module, and the chemical loss in the fluid flow process can be calculated according to the formula, and accumulated or subtracted in the outflow area to truly simulate the flow of fluid in chemical instruments. At the same time, the chemical reaction color can also be preset to make the effect more realistic. In this way, the flow of the entire fluid between chemical instruments will be truly simulated.

[0076] Undo and recall mechanism module and data storage module: When each chemical instrument object is initialized, an ElementRetractCloneObj class is created and added to a collection. In the chemical instrument interaction module, the temporal data of the chemical instrument object of each action process will be recorded in this class. If the user executes the undo or recall module, the clone class recorded during the undo or recall will be updated and displayed. The data can be saved as Json or IWB format files.

[0077] The technology adopted by the present invention is WPF+FrameworkElement, and the processes are all developed based on WPF+FrameworkElement.

[0078] The present invention can realize fluid simulation animation effects generated by user interaction in chemical instruments of any shape, which is convenient for teachers to simulate real chemical experiment actions in the process of education and teaching. The simulation has high precision, convenient interaction, strong expansibility, helps to improve teaching effects, and is easy to use.

[0079] The undisclosed parts in the present invention are all prior art, and their specific structures, materials and working principles are not described in detail. Although the embodiments of the present invention have been shown and described, it is understood by those skilled in the art that various changes, modifications, substitutions and variations can be made to these embodiments without departing from the principles and spirit of the present invention, and the scope of the present invention is defined by the attached claims and their equivalents.

Claims

1. A chemical instrument fluid simulation system based on WPF, characterized in that: It includes a chemical instrument initialization module, a chemical instrument interaction module, a fluid animation simulation module, an undo and recall mechanism and a data storage module.

2. A chemical instrument fluid simulation method based on WPF, using the chemical instrument fluid simulation system based on WPF as claimed in claim 1, characterized in that: The steps include: S1, chemical instrument initialization module, specifically including the following steps: S11, firstly obtain a UI image of a certain chemical instrument, that is, an image file in SVG format; S12, extracting the vector text data of the SVG file, and converting it into a coordinate data set for the WPF interface to be calculated by the algorithm through the function method ConvertSvgPathToPolylines, so as to form an object to facilitate the control of the following steps. The conversion process includes straight line segments, arc segments, polylines, Bezier curve segments, and multi-segment Bezier curve segments; S13, after the object vector coordinate data set is acquired, the bottle mouth points of the chemical instrument are initialized and defined (since the present invention is not limited to the instrument style, the number of bottle mouth points can be any even number); S14, through the object vector coordinate data set, the module coordinate data set of the bottle body, bottle cap, scale, decoration, etc. of the chemical instrument can be further determined; S15. Each object inherits from FrameworkElement and rewrites the OnRender event as the display of the object, adds each object to the child collection of the parent form Grid, and rewrites the OnPreviewMouseDown, OnPreviewMouseMove, OnPreviewMouseUp and ManipulationStarting, ManipulationDelta, ManipulationCompleted events inherited by each object from the parent form Grid to meet the dynamic interaction of objects in different operating environments; S16, initializing necessary parameters such as the chemical point of each object (i.e., the control point where the chemical instrument and the user interact), the outflow point where the liquid flows out of the instrument, and the liquid area of ​​each interaction state; S2, initialization of the interaction module, specifically including the following steps: S21. In the present invention, each object (i.e., each chemical instrument) inherits from a FrameworkElement. The function of this module is to realize the display, movement, rotation, and scaling of each object. S22, when an object is created, the outer rectangular frame of the object is obtained, and the four corner points and the midpoint are obtained, and a Stroke is created according to the four points; S23, control the Matrix through Stroke, and perform corresponding movement, rotation, scaling, and matrix transformation. It can also be used to determine whether the object is selected; S3, chemical instrument interaction module, this module can enable users to operate one or more chemical instrument objects at the same time, and calculate their temporal data in real time; the operating environment can be carried out on a Windows system desktop computer or on a Windows system LCD screen, and specifically includes the following steps: S31. When operating an object: S311, through the event OnPreviewMouseDown or ManipulationStarting, determine whether the operation point (mouse point or touch point, the operation points described below are all the content) is in the outer rectangular frame of the object, if so, start the subsequent interactive operation on the object, that is, proceed to step S312, and record the initial operation point, if not, the object cannot be operated; S312, through the event OnPreviewMouseMove or ManipulationDelta, the latest operation point is obtained in real time, and the vector coordinate data set of the object (i.e., the chemical instrument) is recalculated according to the following judgment, and updated and displayed through the rewritten OnRender event; 1. If the initial operation point is within the custom rotation point range, a rotation matrix Matrix is ​​obtained through the latest operation point, the initial operation point, and the object midpoint, and the object is rotated by the matrix; 2. If the initial operation point is within the custom scaling point range, a scaling matrix Matrix is ​​obtained through the latest operation point, the initial operation point, and the object midpoint, and the object is scaled by the matrix; 3. If the initial operating point is within the range of the custom chemical point (i.e., the height point of the fluid in the instrument, the chemical points described below are all of this content), the fluid height at this time is calculated through the latest operating point, and the fluid contour is calculated and updated and displayed in combination with the vector coordinate data set of the chemical instrument object (the calculation process is roughly as follows: it is known that the screen coordinate Y axis gradually increases from top to bottom, and all instrument contour point sets are traversed according to the order of the instrument contour point set. If the line segment point straight line intersects the fluid height straight line, the contour set where the line segment is located can only take a point with a Y coordinate greater than the fluid height and the intersection point; if the line segment points are all less than the fluid height, they are discarded; if the line segment points are all greater than the fluid height, they are added to the fluid contour set. This method is a key method marked as method one, and method one described below is this method); 4. If the initial operation point is neither within the range of rotation points nor within the range of scaling points, a moving matrix Matrix is ​​passed through the latest operation point and the initial operation point, and the object is moved and changed through the matrix; 5. After the above four operations are completed, the new operation point will replace the initial operation point and update; S313, through the event OnPreviewMouseUp or ManipulationCompleted, determine whether the operation point is released: if released, end the current round of interactive operation and clear the initial operation point; if not released, continue the current round of interactive operation; S32. When operating multiple objects: Through the event OnPreviewMouseDown or ManipulationStarting, it is determined whether the operation point is in the outer rectangle of an object among multiple objects. If so, the operation is the same as that of one object, but at this time all objects are changed according to the corresponding Matrix matrix of the marked object; S4, fluid animation simulation module, can realize the animation effect of the fluid inside the chemical instrument object in the above interactive module process, which simulates the state of the operation, so as to provide a simulated chemical experiment process, which is convenient for teachers to simulate real chemical experiment actions in the teaching process. This module is dynamically executed through the OnPreviewMouseUp or ManipulationCompleted events bound to the object, mainly in the following situations: S41. Case 1: Bottle cap is not opened: At this time, the fluid contour area will not change. (According to the initial fluid contour area and the temporal instrument object contour vector coordinate data set, the lowest point, the highest point and the lowest point of the bottle mouth point concentration of the temporal instrument object are calculated. This method is the key method 2. The method 2 described below is this method). The unit 1 is used as the scale (the default is unit 1. The smaller the default data, the more accurate the algorithm is, but the calculation efficiency is lost. The larger the default data, the loss of accuracy of the algorithm, but the higher the calculation efficiency. The default scale described below is the same). Traverse from the lowest point to the highest point to find the chemical point closest to the initial fluid contour area. Through method 1, the fluid contour vector coordinate data set at this time is updated and displayed; S42, Case 1: Bottle cap opened: S421, at this time, the fluid contour area may change, and the method 2 is used to traverse from the lowest point to the lowest bottle mouth point with unit 1 as the scale. At this time, the chemical point is the lowest bottle mouth point, and the method 1 is used to update and display the fluid contour vector coordinate data set at this time; S422. At the same time, record the change difference of the fluid contour area as the outflow area. If the outflow area is greater than 0, generate an outflow animation. If it is equal to 0, turn off the outflow animation. (If the outflow area is greater than 0, traverse the X coordinate range between all the bottle mouth points of the chemical instrument object. If the current lowest bottle mouth point coordinate is within the X coordinate range of the traversed chemical instrument object bottle mouth point group and is less than the Y coordinate and the bottle cap is open, then the outflow area is added to the new chemical instrument object. If it is judged to be non-existent, generate an outflow animation to the bottom of the screen. This method is the key method three). S423, recursively executing the AddArea method in the new chemical instrument object, using method 2 with unit 1 as the scale, traversing from the lowest point to the lowest bottle mouth point, the fluid contour area of ​​the new chemical instrument object is the original fluid contour area plus the outflow area, and updating and displaying the fluid contour vector coordinate data set at this time through method 1, until the outflow area is 0, and then terminating the recursive method; S424. If necessary, chemical reaction formulas can be superimposed in this module, and the chemical loss in the fluid flow process can be calculated according to the formula, and accumulated or subtracted in the outflow area to truly simulate the flow of fluid in chemical instruments. At the same time, the chemical reaction color can also be preset to make the effect more realistic. In this way, the flow of the entire fluid between chemical instruments will be truly simulated.

3. The chemical instrument fluid simulation method based on WPF according to claim 2 is characterized in that: In S12, the number of steps controlling the Bezier curve approximation is controlled by an initialization parameter, which defaults to 20. The larger the default data, the more accurate the algorithm is, but the computational efficiency is lost. The smaller the default data, the less accurate the algorithm is, but the computational efficiency is higher. The coordinate data set is defined as a set of contour sets that are arranged in a circle clockwise or counterclockwise, and each contour set contains two adjacent points. This definition uses calculus to process the contours of chemical instruments, and complex curves are simulated using Bezier curves.

4. The chemical instrument fluid simulation system and method based on WPF according to claim 2, characterized in that: The undo and recall mechanism module and data storage module: when each chemical instrument object is initialized, an ElementRetractCloneObj class is created and added to a collection. In the chemical instrument interaction module, the temporal data of the chemical instrument object of each action process will be recorded in this class. If the user executes the undo or recall module, the clone class recorded during the undo or recall will be updated and displayed. The data supports being saved as Json or IWB format files.