This repository has been archived by the owner on May 11, 2021. It is now read-only.
/
similar_triangles_1.html
142 lines (136 loc) · 6.17 KB
/
similar_triangles_1.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
<!DOCTYPE html>
<html data-require="math graphie graphie-helpers graphie-geometry math-format">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Similar Triangles 1</title>
<script src="../khan-exercise.js"></script>
<script>
function randomTriangle( current ){
var a = KhanUtil.randRange( 35, 150 );
var b = KhanUtil.randRange( 35, 180 - a );
if ( a + b > 160 ){
a = Math.max( 30, a - 15 );
b = Math.max( 30, b - 15 );
}
var c = 180 - a - b;
//Make sure we do not create the same triangle
if ( current ){
if ( $.inArray( a, current ) != -1 && $.inArray( b, current ) != -1 ){
return randomTriangle( current );
}
}
if ( a < 30 || b < 30 || c < 30 ){
return randomTriangle( current );
}
return [ a, b, c];
}
</script>
</head>
<body>
<div class="exercise">
<div class="vars">
<var id="MAIN"> randomTriangle()</var>
<var id="ANSWERS">[ "B", "C", "Both", "None" ]</var>
<var id="ANSWER">randFromArray( ANSWERS )</var>
<var id="B"> ANSWER === "B" || ANSWER === "Both" ? shuffle( MAIN ) : randomTriangle( MAIN )</var>
<var id="C"> ANSWER === "C" || ANSWER === "Both" ? shuffle( MAIN ): randomTriangle( MAIN )</var>
<var id="TR">
function(){
var tr = new Triangle( [ 3, -2 ], MAIN, 5, {} );
tr.labels = { "name" : "A", "angles" : clearArray( tr.niceAngles, [ 0, 2 ] ) };
tr.rotate( randRange( 0, 360 ) );
tr.boxOut( [ [ [ -4, 1.5 ], [ 10, 1.5 ] ] ], [ 0, -0.5 ] );
return tr;
}()
</var>
<var id="TR_A">
function(){
var trA = new Triangle( [ 2, -8 ], B, randRange( 400, 600 )/100, { } );
trA.labels = { "name" : "B", "angles" : clearArray( trA.niceAngles, [ 0, 1 ] ) };
trA.rotate( randRange( 0, 360 ) );
trA.color = "blue";
trA.boxOut( [ [ [ -1, -10 ], [ -1, 20 ] ] ], [ 0.5, 0 ] );
trA.boxOut( TR.sides, [ 0, -1 ] );
return trA;
}()
</var>
<var id="TR_B">
function(){
var trB = new Triangle( [ 7, -6 ], C, randRange( 400, 600 )/100, {} );
trB.labels = { "name" : "C", "angles" : clearArray( trB.niceAngles, [ 0, 2 ] ) };
trB.rotate( randRange( 0, 360 ) );
trB.color = "red";
trB.boxOut( [ [ [ 13, -10 ], [ 13, 20 ] ] ], [ -0.5, 0 ] );
trB.boxOut( TR.sides, [ 0, -1 ] );
trB.boxOut( TR_A.sides, [ 0, -1 ] );
return trB;
}()
</var>
</div>
<div class="problems">
<div id="similar">
<div class="problem">
Which triangles are similar to triangle <code>A</code>?
</div>
<div class="question">
<div class="graphie" id="triangles" >
init({
range: [ [-1, 13 ], [ -14, 2.5 ] ],
scale: 35
})
TR.draw();
TR.drawLabels();
style({
stroke: "blue",
});
TR_A.draw();
TR_A.drawLabels();
style({
stroke: "red",
});
TR_B.draw();
TR_B.drawLabels();
</div>
</div>
<div class="solution"><var>ANSWER</var></div>
<ul class="choices" data-category="true">
<li>B</li>
<li>C</li>
<li>Both</li>
<li>None</li>
</ul>
<div class="hints">
<p>Two triangles are similar if their angles are congruent (equal).</p>
<div>
<p>We see that triangle <code>A</code> has angles of <code><var>MAIN[ 0 ]</var></code> and <code><var>MAIN[ 2 ]</var></code>. The third angle is therefore <code>180 - <var>MAIN[ 0 ]</var> - <var>MAIN[ 2 ]</var> = <var>MAIN[ 1 ]</var></code></p>
<div class="graphie" data-update="triangles">
TR.labels.angles = TR.niceAngles;
TR.drawLabels();
</div>
</div>
<div>
<p>Triangle <code>B</code> has angles of <code><var>B[ 0 ]</var></code> and <code><var>B[ 1 ]</var></code>. The third angle is <code>180 - <var>B[ 0 ]</var> - <var>B[ 1 ]</var> = <var>B[ 2 ]</var></code>. Therefore triangle <code>B</code> is <span data-if="ANSWER === 'None' || ANSWER === 'C'" >not</span> similar to triangle <code>A</code>.</p>
<div class="graphie" data-update="triangles">
style({
stroke: "blue",
});
TR_A.labels.angles = TR_A.niceAngles;
TR_A.drawLabels();
</div>
</div>
<div>
<p>Triangle <code>C</code> has angles of <code><var>C[ 0 ]</var></code> and <code><var>C[ 2 ]</var></code>. The third angle is <code>180 - <var>C[ 0 ]</var> - <var>C[ 2 ]</var> = <var>C[ 1 ]</var></code>. Therefore triangle <code>C</code> is <span data-if="ANSWER === 'None' || ANSWER === 'B'" >not</span> similar to triangle <code>A</code>.</p>
<div class="graphie" data-update="triangles">
style({
stroke: "red",
});
TR_B.labels.angles = TR_B.niceAngles;
TR_B.drawLabels();
</div>
</div>
</div>
</div>
</div>
</div>
</body>
</html>