Using VB to make lissajous such as graphic dynamic demo program

Source: Internet
Author: User

1 Introduction

Lissajous such as a graph is a motion trajectory of a particle [1], the harmonic of the particle in two vertical directions. Lissajous, such as graphics, is one of the important contents of physics, and it also has very important application in the field of engineering technology. Using lissajous such as graphics can measure the frequency and the initial phase of unknown vibration, it is very important to master the forming process of lissajous such as graphics. So the dynamic display Lissajous can understand the formation process.

2 the formation of Lissajous as graphics

Suppose to form a Lissajous two harmonic, one on the x-axis, one on the Y axis,

Their equations of motion are (assuming their amplitudes are equal): Their motion trajectories are lissajous like graphs. In order to be able to describe graphically the formation process of lissajous, the general is to describe the x-axis and the harmonic on the y-axis respectively by rotating vector graphs, as shown in Figure 1. The coordinates (x,y) of the particle at different times are computed by the upper formula, and then the points are connected, and the resulting graph is lissajous as the graph.

Fig. 1 The formation process of lissajous as graphics

3 Lissajous, such as graphical dynamic demonstration of the production principle

In order to dynamically demonstrate the formation process of lissajous such as graphics, it is necessary to dynamically draw the motion of the rotational vectors describing the two harmonic and their motion processes.

The specific approach is:

(1) Draw a reference map describing the rotation vector of x and y direction harmonic, respectively, consisting of two vertical lines and one circle;

(2) According to the calculation, draw a straight line representing the x and y direction harmonic the rotation vector position from the center of the circle;

(3) Draw the positioning line of the movement, get the coordinates of the points belonging to lissajous such as graphics, if it is the first point, then the direct stroke; otherwise, it is connected with the previous point to get the motion trajectory of the particle;

(4) Wiping off two rotation vectors and the motion locating line;

(5) Continue to calculate the next point of the coordinates, and then back to the 2nd step repeated;

(6) Until the program is paused or terminated.

According to the above algorithm, the VB6.0 coding procedure [2, 3]. Run the program, found in the wiping off the movement of the positioning line at the same time, the x, y direction harmonic rotation vector map and lissajous such as graphics also erased a part. For example, a, B, C, D, and e points in Figure 1 are wiped away, and after a period of time, the harmonic rotation vector and lissajous of the X and y directions, such as the graphic, become dashed graphs, no longer a complete graph.

In order to get a good visual effect, you should make the above erased parts in time to fill the painting. For the x, y direction harmonic rotation vector graph, because it is drawn by the regular line and circle, so again to redraw the corresponding line and circle. and lissajous such as the graph is irregular, the point of the erased coordinates, of course, can be computed by the method, but from Figure 1 can be seen that this calculation is quite complex, because in general, it is difficult to accurately determine lissajous such as the figure is erased which points.

To solve this problem, the author's approach is to introduce two arrays in the program, using these two arrays to sequentially record the calculated coordinates (X,Y) values of the Lissajous, such as graphics, and again, after erasing the composite line, to paint the damaged graphic again according to the data in the array.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.