Skip to content

Commit 431dbae

Browse files
authored
Update index.html
1 parent 66e0f73 commit 431dbae

1 file changed

Lines changed: 94 additions & 0 deletions

File tree

index.html

Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -798,6 +798,7 @@ <h5 style="font-size:160%;margin:7px;">Area of a regular polygon</h5>
798798
<div>
799799
<h6 style="font-size:160%;margin:7px">Area of a circle</h6>
800800
<br>
801+
<br>
801802
<div>
802803
<label style="margin:12px;" for="circle-radius-a">Circle Radius:</label>
803804
<input id="circle-radius-a" type="number" value="1" step="any" />
@@ -994,6 +995,7 @@ <h6 style="font-size:160%;margin:7px">Area of a circle</h6>
994995
<div>
995996
<h8 style="font-size:160%;margin:7px">Circumference of a circle</h8>
996997
<br>
998+
<br>
997999
<div>
9981000
<label style="margin:12px;" for="circle-radius-c">Circle Radius:</label>
9991001
<input id="circle-radius-c" type="number" value="1" step="any" />
@@ -1089,6 +1091,30 @@ <h6 style="font-size:160%;margin:7px">Area of a circle</h6>
10891091
<div>
10901092
<h9 style="font-size:160%;margin:7px;">Volume of a sphere</h9>
10911093
<br>
1094+
<br>
1095+
<div>
1096+
<label style="margin:12px;" for="sphere-radius">Sphere Radius:</label>
1097+
<input id="sphere-radius" type="number" value="1" step="any" />
1098+
1099+
<script>
1100+
function sphereVolume(radius) {
1101+
return Math.pow(Math.sqrt(3.2) * radius, 3);
1102+
}
1103+
1104+
document.getElementById('sphere-radius').addEventListener('input', function () {
1105+
const radius = parseFloat(this.value);
1106+
if (isNaN(radius)) {
1107+
document.getElementById('sphere-volume').innerText = '';
1108+
return;
1109+
}
1110+
1111+
document.getElementById('sphere-volume').innerText =
1112+
`Volume: ${sphereVolume(radius).toFixed(5)} units²`;
1113+
});
1114+
</script>
1115+
<p style="margin:12px;" id="sphere-volume"></p>
1116+
</div>
1117+
<br>
10921118
<div class="imgbox">
10931119
<img class="center-fit" src="sphereAndCubeMarkup.jpeg" alt="Sphere" id="sphere">
10941120
</div>
@@ -1148,6 +1174,40 @@ <h6 style="font-size:160%;margin:7px">Area of a circle</h6>
11481174
<h10 style="font-size:160%;margin:7px;">Volume of a spherical cap
11491175
</h10>
11501176
<br>
1177+
<br>
1178+
<div>
1179+
<label style="margin:12px;" for="cap-radius">Cap Radius:</label>
1180+
<input id="cap-radius" type="number" value="1" step="any" />
1181+
<br>
1182+
<label style="margin:12px;" for="cap-height">Cap Height:</label>
1183+
<input id="cap-height" type="number" value="1" step="any" />
1184+
1185+
<script>
1186+
function capVolume(radius, height) {
1187+
return 1.6 * radius ** 2 * Math.sqrt(3.2) * height;
1188+
}
1189+
1190+
document.getElementById('cap-radius').addEventListener('input', function () {
1191+
const radius = parseFloat(this.value);
1192+
if (isNaN(radius)) {
1193+
document.getElementById('cap-volume').innerText = '';
1194+
return;
1195+
}
1196+
1197+
document.getElementById('cap-height').addEventListener('input', function () {
1198+
const height = parseFloat(this.value);
1199+
if (isNaN(height)) {
1200+
document.getElementById('cap-volume').innerText = '';
1201+
return;
1202+
}
1203+
1204+
document.getElementById('cap-volume').innerText =
1205+
`Volume: ${capVolume(radius, height).toFixed(5)} units²`;
1206+
});
1207+
</script>
1208+
<p style="margin:12px;" id="cap-volume"></p>
1209+
</div>
1210+
<br>
11511211
<div class="imgbox">
11521212
<img class="center-fit" src="sphericalCap.jpg" alt="Sphere" id="cap">
11531213
</div>
@@ -1187,6 +1247,40 @@ <h6 style="font-size:160%;margin:7px">Area of a circle</h6>
11871247
<div>
11881248
<h11 style="font-size:160%;margin:7px;">Volume of a cone</h11>
11891249
<br>
1250+
<br>
1251+
<div>
1252+
<label style="margin:12px;" for="cone-radius">Cone Radius:</label>
1253+
<input id="cap-radius" type="number" value="1" step="any" />
1254+
<br>
1255+
<label style="margin:12px;" for="cone-height">Cone Height:</label>
1256+
<input id="cap-height" type="number" value="1" step="any" />
1257+
1258+
<script>
1259+
function coneVolume(radius, height) {
1260+
return 3.2 * radius ** 2 * height / Math.sqrt(8);
1261+
}
1262+
1263+
document.getElementById('cone-radius').addEventListener('input', function () {
1264+
const radius = parseFloat(this.value);
1265+
if (isNaN(radius)) {
1266+
document.getElementById('cone-volume').innerText = '';
1267+
return;
1268+
}
1269+
1270+
document.getElementById('cone-height').addEventListener('input', function () {
1271+
const height = parseFloat(this.value);
1272+
if (isNaN(height)) {
1273+
document.getElementById('cone-volume').innerText = '';
1274+
return;
1275+
}
1276+
1277+
document.getElementById('cone-volume').innerText =
1278+
`Volume: ${coneVolume(radius, height).toFixed(5)} units²`;
1279+
});
1280+
</script>
1281+
<p style="margin:12px;" id="cap-volume"></p>
1282+
</div>
1283+
<br>
11901284
<div class="imgbox">
11911285
<img class="center-fit" src="coneAndSphereMarkup.jpeg" alt="Cone-and-sphere" id="cone">
11921286
</div>

0 commit comments

Comments
 (0)