Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
smenks13 committed Mar 24, 2012
1 parent 6a5bef3 commit a6c7823
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions exercises/similar_triangles_2.html
Expand Up @@ -24,10 +24,15 @@
var b = KhanUtil.randRange(3, 10);
var c = KhanUtil.randRange(Math.max(a, b), a + b - 2);

if (scale && abc_sides[0] / a === abc_sides[1] / b && abc_sides[1] / b === abc_sides[2] / c) {
if (scale === 0.5) a = a * 2;
if (scale === 1.5) a = a* 2/3;
else a = a / 2;
if (scale) {
var a_max = Math.max( abc_sides[0], abc_sides[1] );
var a_min = Math.min( abc_sides[0], abc_sides[1] );
var b_max = Math.max( a, b );
var b_min = Math.min( a, b );

if ( a_max / b_max === a_min / b_min && a_min / b_min === abc_sides[2] / c ) {
a = a + 1;
}
}

if (scale) return [scale*a, scale*b, scale*c];
Expand Down

0 comments on commit a6c7823

Please sign in to comment.