Skip to content

Commit f509109

Browse files
authored
Update index.html
1 parent 381296f commit f509109

File tree

1 file changed

+22
-1
lines changed

1 file changed

+22
-1
lines changed

index.html

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1494,7 +1494,17 @@ <h6 style="font-size:160%;margin:7px">Area of a circle</h6>
14941494
}
14951495

14961496
const ratio = 2 * height / length;
1497-
1497+
1498+
// Segment validity check
1499+
1500+
if ( ratio === 1) {
1501+
document.getElementById('segment-area').innerText = 'If it is twice as long as high that is a semi-circle.';
1502+
return;
1503+
}
1504+
if ( ratio > 1) {
1505+
document.getElementById('segment-area').innerText = 'A circle-segment is less than half as high as long.';
1506+
return;
1507+
}
14981508

14991509
const angle = parseFloat(2 * Atan(ratio));
15001510
const sine = parseFloat(sin(angle));
@@ -1780,7 +1790,18 @@ <h6 style="font-size:160%;margin:7px">Area of a circle</h6>
17801790
document.getElementById('cap-volume').innerText = '';
17811791
return;
17821792
}
1793+
1794+
// Cap validity check
17831795

1796+
if ( height === radius) {
1797+
document.getElementById('cap-volume').innerText = 'If the radius equals the height that is a hemisphere.';
1798+
return;
1799+
}
1800+
1801+
if ( height > radius) {
1802+
document.getElementById('cap-volume').innerText = 'The height of a spherical cap is shorter than its radius.';
1803+
return;
1804+
}
17841805

17851806
document.getElementById('cap-volume').innerText =
17861807
`Volume: ${capVolume(radius, height).toFixed(5)} cubic units`;

0 commit comments

Comments
 (0)