# hans/khan-exercises forked from Khan/khan-exercises

fix #9335; fix #8932; fix #9493; fix #9430; fix #9416; #9070;
fix #8694; fix #8531; fix #8481; fix #8422; fix #8417
beneater committed Dec 27, 2011
1 parent f121bfd commit 6bcf8d211555a8727850c6a692abd4a346455407
Showing with 160 additions and 53 deletions.
1. +151 −7 exercises/congruency_postulates.html
3. +1 −42 utils/congruence.js
 @@ -4,6 +4,13 @@ Congruency Postulates +
@@ -35,6 +42,7 @@ randRange( 0, 1 ) === 1 ? true : false { "SSS": "Yes", "SAS": "Yes", "SAA": "Yes", "ASA": "Yes", "SSA": "No", "AAA": "No" }[ TYPE ] new Triangle( [ 0, 0 ], ANGLES, SCALE, {} ) + randRange( 0, 360 )

Is NAME a triangle congruency postulate?
@@ -50,7 +58,7 @@ addMouseLayer(); initCongruence({ triangle: TRIANGLE, type: TYPE, reflected: REFLECTED }); - TRIANGLE.rotate( randRange( 0, 360 ) ); + TRIANGLE.rotate( ROTATION ); style({ stroke: "#b1c9f5", "stroke-width": 5 }); TRIANGLE.translate([ -5 - Math.min(TRIANGLE.points[0][0], TRIANGLE.points[1][0], TRIANGLE.points[2][0]), @@ -62,12 +70,148 @@ -

-
-
• -
• -
-
+
+
+
+
• +
• +
+
+
[ + jQuery( "#solutionarea" ).find( "input:checked" ).val(), + interactiveTriangle.points[0].coord, + interactiveTriangle.points[1].coord, + interactiveTriangle.points[2].coord, + interactiveTriangle.points[3].coord + ]
+
+ var saved = jQuery.map( new Array( 4 ), function( el, n ) { + return [ interactiveTriangle.points[ n ].coord ]; + }); + jQuery.map( guess.slice( 1 ), function( el, n ) { + interactiveTriangle.points[ n ].setCoord( el ); + }); + interactiveTriangle.update(); + var isTriangle = interactiveTriangle.isTriangle; + var isCongruent = abs( getDistance( guess[1], guess[2] ) - TRIANGLE.sideLengths[ 0 ] ) < 0.001 + && abs( getDistance( guess[2], guess[3] ) - TRIANGLE.sideLengths[ 1 ] ) < 0.001 + && abs( getDistance( guess[3], guess[4] ) - TRIANGLE.sideLengths[ 2 ] ) < 0.001; + jQuery.map( saved, function( el, n ) { + interactiveTriangle.points[ n ].setCoord( el ); + }); + interactiveTriangle.update(); + if ( guess[0] == null ) { + return ""; + } else if ( guess[0] !== ANSWER ) { + return false; + } else if ( !isTriangle ) { + return "Your answer is almost correct, but you haven't constructed a triangle."; + } else if ( ANSWER === "No" && isCongruent ) { + return "Your answer is almost correct, but the two triangles are congruent. Prove your answer by trying to construct an incongruent triangle."; + } else { + return true; + } +
+
+ jQuery.map( guess.slice( 1 ), function( el, n ) { + interactiveTriangle.points[ n ].setCoord( el ); + }); + interactiveTriangle.update(); +
+
+ jQuery( "#solutionarea" ).find( "input:checked" ).prop( 'checked', false ); + if ( guess[0] != null ) { + jQuery( "#solutionarea" ).find( "input[value=" + guess[0] + "]" ).prop( 'checked', true ); + } +
+
+ +
+

+ To be a congruency postulate, there must be one, and only one, way to make a triangle + that's the same as the original triangle—except for being moved, rotated, or reflected. +

+

+ With the constraints of NAME, there is exactly one way to make a triangle. +

+

+ NAME is a congruency postulate. Be sure to construct the congruent triangle and think + about why you're only able to construct the triangle in one way. +

+ +

+ With the constraints of NAME, there is more than one way to construct a triangle. See if you can find both ways. +

+
+

Both of these triangles have the same adjacent Side, Side, and Angle, but they are not congruent: +

+ var triangle = new Triangle( [ 0, 0 ], ANGLES, SCALE, {} ); + triangle.rotate( -ANGLES[1] ); + init({ range: triangle.boundingRange( 0.4 ) }); + addMouseLayer(); + style({ stroke: "#b1c9f5", "stroke-width": 5 }); + path( [ lineMidpoint( triangle.sides[ 2 ] ), triangle.points[2], triangle.points[1], triangle.points[0], lineMidpoint( triangle.sides[ 2 ] ) ] ); + addTriangleDecorations( triangle, TYPE ); + KhanUtil.currentGraph = jQuery( "div#triangles" ).data().graphie +
+
+ var points = [ + [ + TRIANGLE.sideLengths[ 1 ] - cos( ( 180 - ( 180 - ANGLES[ 0 ] ) - ANGLES[ 2 ] ) * PI / 180 ) * TRIANGLE.sideLengths[ 0 ], + -sin( ( 180 - ( 180 - ANGLES[ 0 ] ) - ANGLES[ 2 ] ) * PI / 180 ) * TRIANGLE.sideLengths[ 0 ] + ], + [ TRIANGLE.sideLengths[ 1 ], 0 ], + [ 0, 0 ] + ]; + var triangle = new Triangle( [], [], 0, {}, points ); + init({ range: triangle.boundingRange( 0.4 ) }); + addMouseLayer(); + style({ stroke: "#b1c9f5", "stroke-width": 5 }); + path( [ lineMidpoint( triangle.sides[ 2 ] ), triangle.points[2], triangle.points[1], triangle.points[0], lineMidpoint( triangle.sides[ 2 ] ) ] ); + addTriangleDecorations( triangle, TYPE ); + KhanUtil.currentGraph = jQuery( "div#triangles" ).data().graphie +
+
+

+ Because we can create two triangles that are not congruent, we can show by counterexample that + Side-Side-Angle is not a congruency postulate. Be sure to construct the incongruent triangle above to prove it. +

+ +

+ With the constraints of NAME, there is more than one way to construct a triangle. See if you can find some different ways. +

+
+

Both of these triangles have the same three angles, but they are not congruent (just similar): +

+ style({ stroke: "#b1c9f5", "stroke-width": 5 }); + init({ range: TRIANGLE.boundingRange( 0.4 ) }); + addMouseLayer(); + style({ stroke: "#b1c9f5", "stroke-width": 5 }); + path( [ lineMidpoint( TRIANGLE.sides[ 2 ] ), TRIANGLE.points[2], TRIANGLE.points[1], TRIANGLE.points[0], lineMidpoint( TRIANGLE.sides[ 2 ] ) ] ); + addTriangleDecorations( TRIANGLE, TYPE ); + KhanUtil.currentGraph = jQuery( "div#triangles" ).data().graphie +
+
+ var triangle = new Triangle( [ 0, 0 ], ANGLES, SCALE - 4, {} ); + triangle.rotate( ROTATION ); + style({ stroke: "#b1c9f5", "stroke-width": 5 }); + init({ range: triangle.boundingRange( 0.4 ) }); + addMouseLayer(); + style({ stroke: "#b1c9f5", "stroke-width": 5 }); + path( [ lineMidpoint( triangle.sides[ 2 ] ), triangle.points[2], triangle.points[1], triangle.points[0], lineMidpoint( triangle.sides[ 2 ] ) ] ); + addTriangleDecorations( triangle, TYPE ); + KhanUtil.currentGraph = jQuery( "div#triangles" ).data().graphie +
+
+

+ Because we can create triangles that are not congruent, we can show by counterexample that + Angle-Angle-Angle is not a congruency postulate. Be sure to construct an incongruent triangle above to prove it. +

+
 @@ -675,7 +675,7 @@ jQuery.extend( Khan.answerTypes, { var guess = jQuery( this ).is( ":checked" ), answer = jQuery( this ).data( "solution" ), label_text = jQuery( this ).closest( "label" ).text(); - if (label_text == "") { + if (label_text === "") { label_text = "checked"; } // un-checked boxes are recorded as "" to prevent the question from @@ -957,19 +957,23 @@ jQuery.extend( Khan.answerTypes, { return jQuery( el ).html(); }); ret.solution = "custom"; + var showGuessSolutionCode = jQuery( solution ).find( ".show-guess-solutionarea" ).text() || ""; ret.showGuess = function( guess ) { if ( isTimeline ) { guessCorrect = validator( guess ); jQuery( solutionarea ).empty(); - jQuery( solutionarea ).append( guessCorrect ? "Answer correct" : "Answer incorrect" ); + jQuery( solutionarea ).append( guessCorrect === true ? "Answer correct" : "Answer incorrect" ); + } else { + var code = "(function() { var guess = " + ( JSON.stringify( guess ) || "[]" ) + ";" + showGuessSolutionCode + "})()"; + KhanUtil.tmpl.getVAR( code, KhanUtil.currentGraph ); } - } + }; var showGuessCode = jQuery( solution ).find( ".show-guess" ).text(); ret.showCustomGuess = function( guess ) { var code = "(function() { var guess = " + JSON.stringify( guess ) + ";" + showGuessCode + "})()"; KhanUtil.tmpl.getVAR( code, KhanUtil.currentGraph ); - } + }; return ret; }