AS3 The Pythagorean Theorem in Action

Learn how to use the Pythagorean Theorem to calculate the distance between two dots. We will see this theorem in action using ActionScript. The equation is very simple and magical (a squared plus b squared equals c squared). It's probably the only


Learn how to use the Pythagorean Theorem to calculate the distance between two dots. We will see this theorem in action using ActionScript.

The equation is very simple and magical (a squared plus b squared equals c squared). It’s probably the only thing you remember from math lessons in high school. What is its real usage in the real world ? More importantly what is its real usage in programming. The Pythagorean Theorem (aka Pythagoras Theorem) is a simple equation to calculate the relationship between the sides of a right angled triangle.

In real terms to create a right angled triangle you must comply with a basic rule of ratio between the sides or it just would not be a right angled triangle. Knowing the length of two of the sides you can very quickly and easily calculate the length of the 3rd side.

Now that we know that and refreshed our old dying brain cells from high school with a new zap of electric force, it’s time for us to break down the Pythagorean Theorem. The Rule states that the two sites that create the right angle squared will always be equal to the remainder – the hypotenuse. The theory can be written (and we use it in our code that way) as
a2 + b2= c2

a and b represent the length of the sides of the right angle and the c variable represents the hypotenuse (the side facing the angle – the side of a right triangle opposite the right angle).

What’s in the video?

One of our students sent me an email asking me to explain to him the relationship between dots on the screen and how to calculate the relationship with them. That in turn gave me an idea for two YouTube videos. We will be working in as3 Pythagorean Theorem realm for these videos. In the first video we will see how to work with the Pythagorean Theorem in action in AS3 by finding the distance between two MovieClips using this Theorem.

By the end of this video you will have a strong understanding of the importance of math and programming in general. It will take us only 5 minutes or so – enough reading lets start doing. Click on the play button now… By the way if you are not one of our subscribed members on YouTube I strongly recommend you join us. It gives me motivation and satisfaction to hear when you are happy with our videos. If you are interested in becoming one of our prime members please check more information at our main site 02geek.com

What should I learn first?

The Developer Basics in Flash: Learn how to work with Math such as AS3 Pythagorean Theorem

If you are totally new to Flash please first watch this Flash tutorial. It will give you the background you need to get started working with Flash in general. If you worked in Flash before you can check out our full catalog located here

Know everything you want to know about the AS3 Pythagorean Theorem ?  Great ! Then check out some of our other titles or subscribe to us for weekly FREE updates, tricks and tips in programming.

– go from a “zero to geek” | 02Geek.com – ©

Leave a Reply

Be the First to Comment!

Notify of
avatar

wpDiscuz