Silverlight mathematical engine (6)-scale chart analysis

Source: Internet
Author: User

Many of the ideas in the geometric part of this series (Silverlight mathematical engine) refer to the open-source project livegeometry of Microsoft's engineer Kirill osenkov. If you are interested, you can participate in the discussion of this project, project address: http://livegeometry.codeplex.com.

Is to use a ruler (without a scale) and a circular gauge. Of course, there are still pens to draw ry to solve the mathematical problem of pure ry, let's summarize these three elements:

  1. Pen: used to draw points (including any point, intersection point, and graph point) and name.
  2. Ruler: used to draw a line (two points determine the first line, so the line is directly dependent on two points ).
  3. Rules: used to draw a circle (determined by a line segment (RADIUS) and a point (center), so the circle directly or indirectly depends on three points ).

Simply put, everything starts from one point. Second, second, third, and third life are wonderful and comparable to the real world, in this way, we are interested in displaying the subtlety of the geometric universe in an inch of the screen. So in this section, we don't write code pages and don't design them. We just want to go around the geometric world. By the way, we'll take the snacks and go back-rugoo wants to write poems, and work out the poems.

First, paste two pieces of ry:

 

The world of ry is the same as the world of object-oriented programming. Everything has rules. If you do not play the cards according to the rules, you will not be able to expect the results, there are often unexpected gains. From the two pictures above, what do you see? Quantitative changes can reflect qualitative changes. Just as we can sum up the essence of the pattern only after thousands or hundreds of times of code restructuring, the appearance of an external triangle with numerous circles has created another day out of the circle.

 

Well, let's get back to the original scene. In fact, even more complex graphics are ultimately dependent on some insignificant points. So let's summarize the behavior and attributes of the points, there are three types of points in ing:

  1. Freepoint: a random point drawn on paper with a pen. The position is specified by the pen.
  2. Intersectionpoint: for example, the intersection of a line and a circle can have at most two locations, which are determined by the position of a line and a circle.
  3. Pointonfigure: for example, a point on a circle is a semi-arbitrary point, because the position can be uncertain as long as it is on a circle,

There is no direct dependency between the three basic points. other points, such as the midpoint, are all extension points, which are one of the three points, for example, we can figure out that the midpoint is actually a point of intersection.

From the first analysis, we know that any complex graph depends on vertices, so the intersection is indirectly dependent on any vertex, the position of any point is determined during painting (however, when drawing on the screen, we must allow it to move by the mouse, that is, its position is specified by the mouse ), these are easy to understand and implement.

Next, let's talk about pointonfigure, which is a bit of a headache. Anything that is ambiguous can be a headache, this kind of things is like a part of the society that does not observe the rules. You cannot say that it does not follow the rules, but it just makes you uncomfortable. For such things, apart from improving laws and regulations to govern it, there is no other way to do it. We cannot solve any problems without violence or non-violence. We must govern the country by law and serve people by virtue.

Well, the law is also categorized, but the root is the Fundamental Law, to sum up the rules of pointonfigure, to find out the common points and differences, so as to find a basis for us to develop the Fundamental Law and the specialized law, is only wired and circular (of course there are still arcs, other do not use the arc), we have two pointonfigure:

  1. Pointonline: If line is dependent on two free verbs, the line also changes when the position of a changes. How does the position of pointonline (c) change at this time? Of course there are multiple options, such

(1): keep the distance between it and line's first Vertex a unchanged;

(2) Change the AB ratio (AC: CB) of the sub-line.

Obviously, it is more appropriate to select (2.

  1. Pointoncircle: If P is on the circle o, what is the position of P when the circle o size changes? There can also be multiple options, such

(1): Keep the angle (angle POX) between the X axis and the horizontal line unchanged,

(2) If the circle o is a circle with the diameter of Mn, the ratio of P-arc pm and Pn can be changed.

These two points have their own advantages and different application scenarios. In fact, Mn only converts the horizontal axis X to an angle, so selecting (2) is more flexible.

 

 

Now the rule has been clarified. Our fundamental law is "The ratio remains unchanged", and the special law is determined based on the specific figure. The line is "The distance ratio remains unchanged ", for the circle, the angle ratio remains unchanged ".The law has a special term in the object-oriented programming world (Interface), Familiar with interface programming should know that it is powerful, because it has developed regulations to achieve equality for everyone.

 

Now, we have analyzed some of the features of the point. In the final analysis, we will discuss the determination of the point location. As a result, the coordinate system emerged again (we have already implemented coordinatesystem ), although the concept of coordinates is not used in the actual ing, We need to display it on the screen, and naturally the coordinate system is indispensable. Besides, the coordinate system we have previously implemented is a canvas, which can be used as a canvas to draw our points. Otherwise, it will be invisible!

Okay, there is no code in this section, so we will not download it!

In the next section, we will analyze some mathematical calculations, such as how to calculate the coordinates of the intersection of the circle and the line, and the extreme mathematical values (for example, the intersection of the two lines is infinitely far from being) and so on.

Because a large number of UI operations will be involved in the future, just like game programming, involving a large number of screen elements related to mathematical computing, we will first sum up what we need to use and sharpen the knife without mistake!

 

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.