»
AnglaisFrançaisVietnamien

Imprimer - Propriétés géométriques d'un Triangle - JavaScriptBank.com

Version complète: jsB@nk » Calcul » Math » Propriétés géométriques d'un Triangle
URL: https://www.javascriptbank.com/geometric-properties-of-a-triangle.html

Propriétés géométriques d'un Triangle © JavaScriptBank.comAvec cette Le code JavaScript, Vous n'aurez pas à vous rappeler la complexité des formules de calcul les valeurs d'un triangle. Maintenant, ce code ne permet de résoudre les valeurs simples telles que: aire du triangle, La zone de plus grand/plus petit cercle inscrit, l'angle entre deux côtés. Toutefois, l'avantage de la simplicité, il sera facile pour vous de comprendre comment il travail et le personnaliser selon vos besoins. Ce que vous devez alors utiliser ce Le code JavaScript est d'entrer les valeurs des trois côtés.

Version complète: jsB@nk » Calcul » Math » Propriétés géométriques d'un Triangle
URL: https://www.javascriptbank.com/geometric-properties-of-a-triangle.html



JavaScript
<script type="text/javascript">// Created by: Sandeep Gangadharan | http://sivamdesign.com/scripts/function getProp() {  var A = document.prop.A.value;  var B = document.prop.B.value;  var C = document.prop.C.value;  var S = (parseInt(A) + parseInt(B) + parseInt(C)) / 2;  var Z = parseInt((A*A)+(B*B)-(C*C))/parseInt(2*A*B);  document.prop.area.value = Math.round(Math.sqrt(S*(S-A)*(S-B)*(S-C)) * 10000) / 10000;  document.prop.lic.value = Math.round(Math.PI * (document.prop.area.value/S) * (document.prop.area.value/S) * 10000) / 10000;  document.prop.sic.value = Math.round(Math.PI * ((A*B*C)/(4*(document.prop.area.value))) * ((A*B*C)/(4*(document.prop.area.value))) * 10000) / 10000;  document.prop.ang.value = Math.round(Math.atan(Math.sqrt((1/(Z * Z))-1)) * (180/Math.PI) * 10000) / 10000;}</script>


HTML
<table border="0" cellpadding="4" cellspacing="0" bgcolor="#cccccc"><form name="prop"> <tr>  <td colspan="4" style="color: #fff; background: #000080;">    <b>Geometric Properties of a Triangle</b></font>  </td> </tr><tr>  <td>    <b>Side A: </b>  </td>  <td>    <input type="text" size="4" name="A" style="font-size: 9pt">  </td>  <td>    <b>Area of Triangle: </b>  </td>  <td>    <input type="text" size="8" name="area" disabled="disabled" style="color: #000; background: #fff; font-size: 9pt; text-align: right;">  </td> </tr> <tr>  <td>    <b>Side B: </b>  </td>  <td>    <input type="text" size="4" name="B" style="font-size: 9pt">  </td>  <td>    <b>Area of Largest Inscribed Circle: </b>  </td>  <td>    <input type="text" size="8" name="lic" disabled="disabled" style="color: #000; background: #fff; font-size: 9pt; text-align: right;">  </td> </tr> <tr>  <td>    <b>Side C: </b>  </td>  <td>    <input type="text" size="4" name="C" style="font-size: 9pt">  </td>  <td>    <b>Area of Smallest Inscribed Circle: </b>  </td>  <td>    <input type="text" size="8" name="sic" disabled="disabled" style="color: #000; background: #fff; font-size: 9pt; text-align: right;">  </td> </tr> <tr>  <td>    <input type="reset" value="Reset" style="font-size: 9pt" onClick="reset()">  </td>  <td>    <input type="button" value="Compute" style="font-size: 9pt" onClick="getProp()">  </td>  <td>    <b>Angle between A and B: </b>  </td>  <td>    <input type="text" size="8" name="ang" disabled="disabled" style="color: #000; background: #fff; font-size: 9pt; text-align: right;">  </td> </tr></form></table>