Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Let's do the math for a second.</p> <ul> <li>The first line is <code>(0, 61.632653061218946)-(944, 217.25510204080692)</code>. Slope is <code>rise/run</code>, therefore <code>m = 0.16485428917329234533898305084746</code>.</li> <li>The second line is <code>(0, 61.632653061218946)-(9440, 2172.5510204080692)</code>; <code>m = 0.22361423382911549300847457627119</code>.</li> </ul> <p><em>The slopes are different, which is just another way of saying the angles are different.</em></p> <p>What you need to do is <em>extend</em> the line. You cannot just multiply both coordinates of one of the points by 10. First determine either an x or a y beyond the bounds of your canvas, then <em>solve for the other value</em>. </p> <p>How do you do this?</p> <ol> <li><p>First, get the equation for the line. A line is defined by <code>y=m*x+b</code>, where <code>m</code> is the slope, and <code>b</code> is the y-intercept. </p> <ol> <li>We already know how to calculate the slope (<code>rise/run</code> = <code>y2 - y1 / x2 - x1</code>). We get <code>0.16485428917329234533898305084746</code></li> <li>Plug in the slope and solve for <code>b</code> (<code>y - m*x</code>), you get <code>61.632653061218946</code>. In your case you already have this value as the y-intercept is the y-coordinate when <code>x=0</code>.</li> <li>You then get the equation <code>y = 0.16485428917329234533898305084746 * x + 61.632653061218946</code></li> </ol></li> <li><p>Now, pick a sufficiently large x, say 10000. Plug this value in and solve for y. You get <code>1710.1755447941423993898305084746</code>.</p></li> <li><p>Finally, draw your line to this new point, <code>(0, 61.632653061218946)-(10000,1710.1755447941423993898305084746)</code></p></li> </ol> <p>Great, now let's generalize this.</p> <ul> <li>We have two points <code>(x1, y1)</code> and <code>(x2, y2)</code>. We want to solve for <code>(10000, y3)</code>.</li> <li>Therefore, <code>y3 = m*x3 + b</code>, or <code>y3 = m * 10000 + b</code>.</li> <li>We also know that <code>b = y - m * x</code>, so plugging this in and arbitrarily choosing point 1, <code>y3 = m * 10000 + y1 - m * x1</code>.</li> <li>Ok, let's factor out the <code>m</code>: <code>y3 = m * (10000 + x1) - y1</code>.</li> <li>We know <code>m = (y2 - y1) / (x2 - x1)</code>, so plugging this in: <code>y3 = ((y2 - y1) / (x2 - x1)) * (10000 + x1) - y1</code>.</li> </ul> <p>If your line doesn't start at <code>x = 0</code>, you will need to repeat this process for <code>x = 0</code>, meaning you should plot a line <code>(0, ((y2 - y1) / (x2 - x1)) * x1 - y1)-(10000,((y2 - y1) / (x2 - x1)) * (10000 + x1) - y1)</code>.</p> <p>Note: If <code>x2 - x1</code> is 0, you have an infinite slope. This is a vertical line, and you'll have to handle this case separately.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload