var cleanstring = x1.replace(/\,/g,'');
no=cleanstring.length;
switch(no)
{
case 3: str=cleanstring.substr(0);
document.getElementById(ids).value=str;
break;
case 4: str=cleanstring.substr(1);
str1=cleanstring.substr(0,1);
document.getElementById(ids).value=str1+","+str;
break;
case 5:
str=cleanstring.substr(2);
str1=cleanstring.substr(0,2);
document.getElementById(ids).value=str1+","+str;
break;
case 6:
str=cleanstring.substr(3);
str1=cleanstring.substr(1,2);
str2=cleanstring.substr(0,1);
document.getElementById(ids).value=str2+","+str1+","+str;
break;
case 7:
str=cleanstring.substr(4);
str1=cleanstring.substr(2,2);
str2=cleanstring.substr(0,2);
document.getElementById(ids).value=str2+","+str1+","+str;
break;
case 8:
str=cleanstring.substr(5);
str1=cleanstring.substr(3,2);
str2=cleanstring.substr(1,2);
str3=cleanstring.substr(0,1);
document.getElementById(ids).value=str3+","+str2+","+str1+","+str;
break;
case 9:
str=cleanstring.substr(6);
str1=cleanstring.substr(4,2);
str2=cleanstring.substr(2,2);
str3=cleanstring.substr(0,2);
document.getElementById(ids).value=str3+","+str2+","+str1+","+str;
break;
case 10:
str=cleanstring.substr(7);
str1=cleanstring.substr(5,2);
str2=cleanstring.substr(3,2);
str3=cleanstring.substr(1,2);
str4=cleanstring.substr(0,1);
document.getElementById(ids).value=str4+","+str3+","+str2+","+str1+","+str;
break;
case 11:
str=cleanstring.substr(8);
str1=cleanstring.substr(6,2);
str2=cleanstring.substr(4,2);
str3=cleanstring.substr(2,2);
str4=cleanstring.substr(0,2);
document.getElementById(ids).value=str4+","+str3+","+str2+","+str1+","+str;
break;
case 12:
str=cleanstring.substr(9); //1,11,11,11,11,111
str1=cleanstring.substr(7,2);
str2=cleanstring.substr(5,2);
str3=cleanstring.substr(3,2);
str4=cleanstring.substr(1,2);
str5=cleanstring.substr(0,1);
document.getElementById(ids).value=str5+","+str4+","+str3+","+str2+","+str1+","+str;
break;
}
}
function cal_ratio()
{
var x1 = document.form1.pointx1.value;
var y1 = document.form1.pointy1.value;
var z1 = document.form1.pointz1.value;
var x2 = document.form1.pointx2.value;
var y2 = document.form1.pointy2.value;
var z2 = document.form1.pointz2.value;
var m = document.form1.pointm.value;
var n = document.form1.pointn.value;
if(document.form1.typ.value=="int")
{
var prt1 = (m*x2) + (n*x1);
var prt2 = parseInt(m) + parseInt(n);
var prt3 = (m*y2) + (n*y1);
var prt4 = (m*z2) + (n*z1);
if(Math.round(prt1/prt2) == (prt1/prt2))
{
var xval = prt1/prt2;
}
else{
var xval = prt1 + "/" + prt2;
}
if(Math.round(prt3/prt2) == (prt3/prt2))
{
var yval = prt3/prt2;
}
else{
var yval = prt3 + "/" + prt2;
}
if(Math.round(prt4/prt2) == (prt4/prt2))
{
var zval = prt4/prt2;
}
else{
var zval = prt4 + "/" + prt2;
}
document.form1.res_val.value = xval+ " , " + yval+ " , " + zval;
}
if(document.form1.typ.value=="ext")
{
var prt1 = (m*x2) - (n*x1);
var prt2 = parseInt(m) - parseInt(n);
var prt3 = (m*y2) - (n*y1);
var prt4= (m*z2) - (n*z1);
if(Math.round(prt1/prt2) == (prt1/prt2))
{
var xval = prt1/prt2;
}
else{
var xval = prt1 + "/" + prt2;
}
if(Math.round(prt3/prt2) == (prt3/prt2))
{
var yval = prt3/prt2;
}
else{
var yval = prt3 + "/" + prt2;
}
if(Math.round(prt4/prt2) == (prt4/prt2))
{
var zval = prt4/prt2;
}
else{
var zval = prt4 + "/" + prt2;
}
document.form1.res_val.value = xval + " , " + yval + " , " + zval;
}
}
-->
Sekcja lub stosunek formuły wewnętrznej
(MX2 + NX1 / M + N, My2 + NY1 / M + N, MZ2 + NZ1 / M + N)
Sekcja lub stosunek formuły zewnętrznej
(MX2-NX1 / M-N, MY2-NY1 / M-N, MZ2-NZ1 / M-N)
Kalkulator, aby znaleźć współrzędne z punktu zewnętrznego / wewnętrznego. Po podaniu dwóch punktów i zewnętrznie lub wewnętrznie racji m: n, możesz uzyskać współrzędną P.