Skip to content

Commit bbc0671

Browse files
authored
Update index.html
1 parent 8f93e60 commit bbc0671

File tree

1 file changed

+20
-7
lines changed

1 file changed

+20
-7
lines changed

index.html

Lines changed: 20 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1630,7 +1630,7 @@ <h3 style="margin:7px" itemprop="eduQuestionType">Area of a Triangle</h3>
16301630

16311631
// Triangle validity check
16321632
if (side1 + side2 <= side3 || side2 + side3 <= side1 || side3 + side1 <= side2) {
1633-
document.getElementById('triangle-area').innerText = 'The sum of the length of the two shorter sides of a triangle is larger than the third one.';
1633+
document.getElementById('triangle-area').innerText = 'The sum of the length of the two shorter sides of a triangle must be larger than the third one.';
16341634
return;
16351635
}
16361636

@@ -3034,6 +3034,16 @@ <h3 itemprop="eduQuestionType" style="margin:7px">Area of a Circle Segment</h3>
30343034
<meta itemprop="disambiguatingDescription" content="Area based on the A(circle)=3.2*radius^2 formula, instead of the pi=3.14... approximation">
30353035
<meta itemprop="usageInfo" content="Enter the segment height and either the chord length or the radius of the parent circle. The other value will be discarded in the result.">
30363036

3037+
<label for="segment-height">Segment Height:</label>
3038+
<input id="segment-height" type="number" step="any" oninput="segmentArea()">
3039+
<br>
3040+
<label for="chord-length">Chord Length:</label>
3041+
<input id="chord-length" type="number" step="any" oninput="segmentArea()">
3042+
<br>
3043+
<label for="parent-radius">Circle Radius:</label>
3044+
<input id="parent-radius" type="number" step="any" oninput="segmentArea()">
3045+
<br>
3046+
<div id="segment-area"></div>
30373047
<label for="segment-height">Segment Height:</label>
30383048
<input id="segment-height" type="number" step="any" oninput="segmentArea()">
30393049
<br>
@@ -3061,22 +3071,25 @@ <h3 itemprop="eduQuestionType" style="margin:7px">Area of a Circle Segment</h3>
30613071
if (!isNaN(h) && !isNaN(r) && isNaN(l)) {
30623072
let angle = Acos((r - h) / r);
30633073
l = 2 * r * sin(angle);
3064-
}
3074+
document.getElementById('chord-length').value = l.toFixed(5);
3075+
}
30653076

30663077
// Case 2: height + length known → derive radius
30673078
if (!isNaN(h) && !isNaN(l) && isNaN(r)) {
30683079
r = (l ** 2 + 4 * h ** 2) / (8 * h);
3069-
}
3080+
document.getElementById('parent-radius').value = r.toFixed(5);
3081+
}
30703082

30713083
// Case 3: length + radius known → derive height
30723084
if (!isNaN(l) && !isNaN(r) && isNaN(h)) {
30733085
h = r - Math.sqrt(r ** 2 - (l / 2) ** 2);
3074-
}
3086+
document.getElementById('segment-height').value = h.toFixed(5);
3087+
}
30753088

30763089
// Validity checks
30773090
if (h > r || l < 2 * h || r < h) {
30783091
document.getElementById('segment-area').innerText =
3079-
'Invalid input: must satisfy h ≤ r, l ≥ 2h, r ≥ h.';
3092+
'The height of the segment must be shorter than the parent radius and half the length.';
30803093
return;
30813094
}
30823095

@@ -3099,7 +3112,7 @@ <h3 itemprop="eduQuestionType" style="margin:7px">Area of a Circle Segment</h3>
30993112
`Area: ${area.toFixed(5)} square units`;
31003113
}
31013114
}
3102-
</script>
3115+
</script>
31033116
<p id="segment-area"></p>
31043117
</div>
31053118
</section>
@@ -3388,7 +3401,7 @@ <h3 itemprop="eduQuestionType" style="margin:7px">Volume of a Spherical Cap</h3>
33883401
// Cap validity check
33893402

33903403
if ( height > radius) {
3391-
document.getElementById('cap-volume').innerText = 'The height of a spherical cap is shorter than its radius.';
3404+
document.getElementById('cap-volume').innerText = 'The height of a spherical cap must be shorter than its radius.';
33923405
return;
33933406
}
33943407

0 commit comments

Comments
 (0)