Skip to content

Instantly share code, notes, and snippets.

@beneater
Created November 14, 2011 21:34
Show Gist options
  • Save beneater/1365255 to your computer and use it in GitHub Desktop.
Save beneater/1365255 to your computer and use it in GitHub Desktop.
<div class="solution" data-type="interactive">
<div class="instruction">
Drag the two points to move the line into the correct position.
</div>
<div class="guess"> [ graph.pointA.coord, graph.pointB.coord ] </div>
<div class="validator-function">
var slope = ( guess[1][1] - guess[0][1] ) / ( guess[1][0] - guess[0][0] );
var yint = slope * ( 0 - guess[0][0] ) + guess[0][1];
return abs( SLOPE - slope ) &lt; 0.001 &amp;&amp; abs( YINT - yint ) &lt; 0.001;
</div>
<div class="show-guess">
graph.pointA.setCoord( guess[0] );
graph.pointB.setCoord( guess[1] );
graph.line1.transform( true );
</div>
</div>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment