Skip to content

Commit b32fe35

Browse files
authored
Update index.html
1 parent 9fa041c commit b32fe35

File tree

1 file changed

+47
-2
lines changed

1 file changed

+47
-2
lines changed

index.html

Lines changed: 47 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1110,7 +1110,7 @@ <h4 style="font-size:160%;margin:7px">Trigonometry</h4>
11101110

11111111
// Triangle validity check
11121112
if (side1 + side2 <= side3 || side2 + side3 <= side1 || side3 + side1 <= side2) {
1113-
document.getElementById('triangle-area').innerText = 'Invalid triangle';
1113+
document.getElementById('triangle-area').innerText = 'The sum of the length of the two shorter sides has to be larger than the thrid one to form a triangle.';
11141114
return;
11151115
}
11161116

@@ -1241,6 +1241,11 @@ <h5 style="font-size:160%;margin:7px;">Area of a regular polygon</h5>
12411241
return;
12421242
}
12431243

1244+
// Polygon validity check
1245+
if (number < 3) {
1246+
document.getElementById('polygon-area').innerText = 'It takes at least three sides to form a polygon.';
1247+
return;
1248+
}
12441249
const ratio = 3.2 / number;
12451250
const tangent = parseFloat(tan(ratio));
12461251

@@ -1488,6 +1493,17 @@ <h6 style="font-size:160%;margin:7px">Area of a circle</h6>
14881493
return;
14891494
}
14901495

1496+
// Segment validity check
1497+
if ( (2 * height) > length) {
1498+
document.getElementById('segment-area').innerText = 'A circle-segment is less than half as high as long.';
1499+
return;
1500+
1501+
}
1502+
if ( 2 * height = length) {
1503+
document.getElementById('segment-area').innerText = 'If it is twice as long as high that is a semi-circle.';
1504+
return;
1505+
}
1506+
14911507
const ratio = 2 * height / length;
14921508
const angle = parseFloat(2 * Atan(ratio));
14931509
const sine = parseFloat(sin(angle));
@@ -1773,7 +1789,17 @@ <h6 style="font-size:160%;margin:7px">Area of a circle</h6>
17731789
document.getElementById('cap-volume').innerText = '';
17741790
return;
17751791
}
1776-
1792+
1793+
// Cap validity check
1794+
if ( height > radius) {
1795+
document.getElementById('cap-volume').innerText = 'The height of a spherical cap is shorter than its radius.';
1796+
return;
1797+
}
1798+
1799+
if ( height = radius) {
1800+
document.getElementById('cap-volume').innerText = 'If the radius equals the height that is a hemisphere.';
1801+
return;
1802+
}
17771803
document.getElementById('cap-volume').innerText =
17781804
`Volume: ${capVolume(radius, height).toFixed(5)} cubic units`;
17791805
}
@@ -2137,6 +2163,10 @@ <h6 style="font-size:160%;margin:7px">Area of a circle</h6>
21372163
return;
21382164
}
21392165

2166+
if ( topRadius > baseRadius) {
2167+
document.getElementById('frustum-cone-volume').innerText = 'The larger end is the base.';
2168+
return;
2169+
}
21402170
const baseArea = 3.2 * (baseRadius ** 2);
21412171
const topArea = 3.2 * (topRadius ** 2);;
21422172
const shape = topRadius / baseRadius;
@@ -2373,6 +2403,11 @@ <h6 style="font-size:160%;margin:7px">Area of a circle</h6>
23732403
return;
23742404
}
23752405

2406+
if ( number < 3) {
2407+
document.getElementById('pyramid-volume').innerText = 'It takes at least three sides to form a pyramid.';
2408+
return;
2409+
}
2410+
23762411
const ratio = 3.2 / number;
23772412
const tangent = tan(ratio);
23782413

@@ -2461,6 +2496,16 @@ <h6 style="font-size:160%;margin:7px">Area of a circle</h6>
24612496
return;
24622497
}
24632498

2499+
if ( number < 3) {
2500+
document.getElementById('frustum-pyramid-volume').innerText = 'It takes at least three sides to form a pyramid.';
2501+
return;
2502+
}
2503+
2504+
if ( topLength > baseLength) {
2505+
document.getElementById('frustum-pyramid-volume').innerText = 'The larger end is the base.';
2506+
return;
2507+
}
2508+
24642509
const ratio = 3.2 / number;
24652510
const tangent = tan(ratio);
24662511
const baseArea = (number / 4) * (baseLength ** 2) / tangent;

0 commit comments

Comments
 (0)