A Flash Developer Resource Site

Page 2 of 2 FirstFirst 12
Results 21 to 24 of 24

Thread: y = m*x+b ( something about equations of lines )

  1. #21
    FK's Woman Chess Grand Master Seldudet's Avatar
    Join Date
    Jul 2002
    Location
    UK
    Posts
    185
    Being in year 10 that would make you like what 16 maybe? im surprised you haven't done this yet then, its pretty important for basic maths knowdledge. proves very difficult to do other/any geometry without it....
    By the way...trigonometry is Sine, Cosine, Tangent stuff, radian measure...rubbish like that.
    Speedy, easy recipes for penniless students:

    Feed The Student



    Who luvvvs the doughnut...I luvvv the doughnut !!

  2. #22
    Junior Member
    Join Date
    May 2003
    Posts
    3
    True this pretty simple math. grade school stuff.

    just an equation of a straignt line you can use the formula y=m*x+b to show when two lines intersect by evaluating
    x1,y1 = x2,y2

  3. #23
    Goooold Member!
    Join Date
    Oct 2002
    Posts
    259
    This is a fairly simlpe concept kostanzas200. I get the feeling that you are over complicating it for yourself. I will try to explain it in a way that makes it seem as simple as it is.

    OK. The equation is Y = mx+b. But what does that mean?

    Y is one part of a grid point that has X and Y for its 2 values. Y is the part that tells you where that point is along the Y axis. X is the other part of that point, but it relates to the points position along the X axis (I'm pretty sure you already know that though). M is the movement along the x and y axis in relation to another point on the same line. M is a fraction, with the top number being the verticle movement and the bottom number of the fraction being the horizontal movement. So if your M value is 2, you have a verticle movement of 2 units for every 1 unit of horizontal movement (because 2 is the same as 2 over 1). Also, an M value of 4/2 makes a line with the same slope as an M value of 2/1 or 8/4 or 16/8 would make because M is also a ratio. B is a number which you add to all the values in order to move them up or down the Y axis. This is how B becomes the y intersept. If B is 0 then you are not adding any verticle modifier to each point. Therefore, when you put 0 in place of X in our equation, 0 times M is 0 and 0 plus 0 is still 0. So then Y is equal to 0, thus your complete point is (0,0).

    We know that to solve an equation such as y=mx+b we must have values for M, X and B. When we combine these values by multiplying or adding or whatever operation the equation tells us to do, we get the value of Y. This is because according to our equation, Y means the same thing as M times X plus B. So if M times X plus b equals 4 then obviously Y is also 4. Then to get our point on the grid we put in the value that we used for X and the value that we got for Y.

    In relation to Flash. To make flash draw a line using the y = mx+b we would use the following code


    _root.createEmptyMovieClip("Line", 1)
    with(_roo.Line){
    moveTo(0,0)
    }
    X = 0;
    Y = 0;
    M = 2;
    B = 0;

    while (X<=200) { //Do the following until we've incrimented X all the way to 200
    Y = M*X+B //get the value for Y.
    with(_root.Line) {
    LineStyle(1, 0xffffff, 100)
    LineTo(X,Y) //Draw the line from the last (x,y) position to the one that was calculated above.
    }
    X ++ //incriment X by one
    }


    What that whole script does is basically the same thing you do on a piece of graph paper when you draw a line. It gives the computer a value for M X and B. Then the computer multiplies M and X, adds B and then assigns the resulting number to Y. Then it draws a point on its grid using the number is has for X and the number it calculated for Y. Then it adds 1 to the value of X, caluculates Y again, draws another point and connects the 2 with a line and then does it all over again. This script makes it stop doing that once X has a value of 200 or more. But it could go on forever if you wanted it to.

  4. #24
    exclusive member ( V I P ) tiGRAN=-2001's Avatar
    Join Date
    Aug 2001
    Posts
    434
    the second _root. is missing a "t"



    This thread should be closed it was like 2 months ago and he hasnt replied

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center