Silverlight, WPF and C# .NET development
User NamePassword

Archive for January, 2009


Click the video above for a demo of Polynomial Explorer.

Polynomial Explorer is an application developed in C# using Visual Studio 2008. It was written to graph and display a polynomial equation with terms included up to the 6th degree (x6). Any combination of terms can be displayed and each term is controlled by a slider to alter a terms coefficient value. The user interface has been designed so that the equation is displayed clearly and the terms can be altered in an intuitive method via the slider controls. continue

Category : C# | Mathematics | Blog

Here is an implementation of a trigonometric function, plotted as a 2D graph. Interactive controls are available to alter the graph dynamically. The sine wave plotted incorporates parameters commonly used in physics. You can directly control the amplitude (A), phase (phi), and the angular frequency (k).

Try it now! Click on the slider bars in the Flash example above to change the sine waves properties.

There are also some basic graph options that can be set via check boxes, these can be toggled on/off. Finally, there is a useful function that is a good thing to have in any application, and that is a reset button. This simply resets the graph back to the state when first loaded. This example is coded using ActionScript 2.0.

Extending this example to graph any function is fairly straight forward and could handle some quite complex equations with multiple parameters. The range of each axis would have to be carefully rendered though to make sure the graph ‘zoom’ was correctly set, otherwise the graph may not display correctly.

Category : ActionScript | Flash | Mathematics | Blog

This is a dynamic bar chart written in Flash. Ok, so this may not have an everyday instant usage but you have to admit it is eye catching! :)

Unlike a standard bar chart which displays a series of bars with static values, our example has each bar dynamically cycling its value its maximum value down to a fixed lower value. Each bar chart still has an individual maximum value like its static counterpart.

This example is coded using ActionScript 2.0 and we can achieve the desired effect by modifying the value for each bar with the sinusoidal function as follows:

bar1_mc._height = Math.abs(Math.sin(offset*0.4+0.5))*100+bar1_val;

Animation of the numerical text is done in a similar way. Each bars text y co-ordinate is tied to the bars top y co-ordinate. The idea used in this example can be extended to create some interesting effects. Also, advanced charting in 2D and even 3D can be accomplished by using a bit of polish and creativity!

If you are interested in creating your own custom charts, or have any specific requirements then please contact us for some assistance. We can create charts in other languages of course. This one was done in Flash so it can easily be embedded in a web page blog post.

Category : Flash | Graphics | Mathematics | Blog

In many graphics applications it is often necessary to know the distance between two points or pixels, such as collision detection in games. Here, we are just interested in calculating the distance between pixels in 2D. However, it is not that much more complicated to extend this to 3D and we will be covering this at a later date. Anyway, back to our 2D example.

We can determine the distance from one known pixel co-ordinate to another using some simple trigonometry. In the figure below we would like to calculate the distance from point a to point b. These could be any two pixels on the screen with co-ordinates (x1,y1) and (x2,y2) respectively.

The distance from a to b is calculated using Pythagoras’ theorem, as long as the co-ordinates of the two points are known. First we need to know the vertical difference between the points (y2-y1) and the horizontal difference (x2-x1) as show below. continue

Category : Graphics | Mathematics | Blog