You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.';
1114
1114
return;
1115
1115
}
1116
1116
@@ -1241,6 +1241,11 @@ <h5 style="font-size:160%;margin:7px;">Area of a regular polygon</h5>
1241
1241
return;
1242
1242
}
1243
1243
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
+
}
1244
1249
constratio=3.2/number;
1245
1250
consttangent=parseFloat(tan(ratio));
1246
1251
@@ -1488,6 +1493,17 @@ <h6 style="font-size:160%;margin:7px">Area of a circle</h6>
1488
1493
return;
1489
1494
}
1490
1495
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
+
1491
1507
constratio=2*height/length;
1492
1508
constangle=parseFloat(2*Atan(ratio));
1493
1509
constsine=parseFloat(sin(angle));
@@ -1773,7 +1789,17 @@ <h6 style="font-size:160%;margin:7px">Area of a circle</h6>
0 commit comments