圆周弧长的计算问题(简易公式)

/*Java Script for Online Ellipse Arc Length Calculator
Author : Joe Bartok
Date : April / 2004*
Url:http://www.oocities.org/web_sketches/ellipse_notes/ellipse_arc_length/ellipse_arc_length.html
Arc Length of Ellipse 
Scope : First Quadrant, 0 <= x <= R
Semi-Axis lying on the x-axis , R = ? 
Semi-Axis lying on the y-axis ,  r = ? 
( x1 > x2 )   ...   x1 =  ?   x2 = ? (?为输入值)
------------ οnclick="solve_arc_length()" ------------------
/

function solve_arc_length()
{
var pi = Math.PI
var rad = pi/180
var F = 100000
var f = 10000000000


var a = document.arc_length.R.value
var b = document.arc_length.r.value
var x1 = document.arc_length.x1.value
var x2 = document.arc_length.x2.value


var prma1 = Math.acos(x1/a)
var prma2 = Math.acos(x2/a)


var d = (prma2 - prma1)/20


var y1 = Math.sqrt(a*a*Math.sin(prma1)*Math.sin(prma1) + b*b*Math.cos(prma1)*Math.cos(prma1))
document.arc_length.prma_1.value = Math.round(F*prma1)/F
document.arc_length.y_1.value = Math.round(F*y1)/F
document.arc_length.ny_1.value = Math.round(F*y1)/F


var y2 = Math.sqrt(a*a*Math.sin(prma1 + 1*d)*Math.sin(prma1 + 1*d) + b*b*Math.cos(prma1 + 1*d)*Math.cos(prma1 + 1*d))
document.arc_length.prma_2.value = Math.round(F*(prma1 + 1*d))/F
document.arc_length.y_2.value = Math.round(F*y2)/F
document.arc_length.ny_2.value = Math.round(F*4*y2)/F


var y3 = Math.sqrt(a*a*Math.sin(prma1 + 2*d)*Math.sin(prma1 + 2*d) + b*b*Math.cos(prma1 + 2*d)*Math.cos(prma1 +2*d))
document.arc_length.prma_3.value = Math.round(F*(prma1 + 2*d))/F
document.arc_length.y_3.value = Math.round(F*y3)/F
document.arc_length.ny_3.value = Math.round(F*2*y3)/F


var y4 = Math.sqrt(a*a*Math.sin(prma1 + 3*d)*Math.sin(prma1 + 3*d) + b*b*Math.cos(prma1 + 3*d)*Math.cos(prma1 + 3*d))
document.arc_length.prma_4.value = Math.round(F*(prma1 + 3*d))/F
document.arc_length.y_4.value = Math.round(F*y4)/F
document.arc_length.ny_4.value = Math.round(F*4*y4)/F


var y5 = Math.sqrt(a*a*Math.sin(prma1 + 4*d)*Math.sin(prma1 + 4*d) + b*b*Math.cos(prma1 + 4*d)*Math.cos(prma1 + 4*d))
document.arc_length.prma_5.value = Math.round(F*(prma1 + 4*d))/F
document.arc_length.y_5.value = Math.round(F*y5)/F
document.arc_length.ny_5.value = Math.round(F*2*y5)/F


var y6 = Math.sqrt(a*a*Math.sin(prma1 + 5*d)*Math.sin(prma1 + 5*d) + b*b*Math.cos(prma1 + 5*d)*Math.cos(prma1 + 5*d))
document.arc_length.prma_6.value = Math.round(F*(prma1 + 5*d))/F
document.arc_length.y_6.value = Math.round(F*y6)/F
document.arc_length.ny_6.value = Math.round(F*4*y6)/F


var y7 = Math.sqrt(a*a*Math.sin(prma1 + 6*d)*Math.sin(prma1 + 6*d) + b*b*Math.cos(prma1 + 6*d)*Math.cos(prma1 + 6*d))
document.arc_length.prma_7.value = Math.round(F*(prma1 + 6*d))/F
document.arc_length.y_7.value = Math.round(F*y7)/F
document.arc_length.ny_7.value = Math.round(F*2*y7)/F


var y8 = Math.sqrt(a*a*Math.sin(prma1 + 7*d)*Math.sin(prma1 + 7*d) + b*b*Math.cos(prma1 + 7*d)*Math.cos(prma1 + 7*d))
document.arc_length.prma_8.value = Math.round(F*(prma1 + 7*d))/F
document.arc_length.y_8.value = Math.round(F*y8)/F
document.arc_length.ny_8.value = Math.round(F*4*y8)/F


var y9 = Math.sqrt(a*a*Math.sin(prma1 + 8*d)*Math.sin(prma1 + 8*d) + b*b*Math.cos(prma1 + 8*d)*Math.cos(prma1 + 8*d))
document.arc_length.prma_9.value = Math.round(F*(prma1 + 8*d))/F
document.arc_length.y_9.value = Math.round(F*y9)/F
document.arc_length.ny_9.value = Math.round(F*2*y9)/F


var y10 = Math.sqrt(a*a*Math.sin(prma1 + 9*d)*Math.sin(prma1 + 9*d) + b*b*Math.cos(prma1 + 9*d)*Math.cos(prma1 + 9*d))
document.arc_length.prma_10.value = Math.round(F*(prma1 + 9*d))/F
document.arc_length.y_10.value = Math.round(F*y10)/F
document.arc_length.ny_10.value = Math.round(F*4*y10)/F


var y11 = Math.sqrt(a*a*Math.sin(prma1 + 10*d)*Math.sin(prma1 + 10*d) + b*b*Math.cos(prma1 + 10*d)*Math.cos(prma1 + 10*d))
document.arc_length.prma_11.value = Math.round(F*(prma1 + 10*d))/F
document.arc_length.y_11.value = Math.round(F*y11)/F
document.arc_length.ny_11.value = Math.round(F*2*y11)/F


var y12 = Math.sqrt(a*a*Math.sin(prma1 + 11*d)*Math.sin(prma1 + 11*d) + b*b*Math.cos(prma1 + 11*d)*Math.cos(prma1 + 11*d))
document.arc_length.prma_12.value = Math.round(F*(prma1 + 11*d))/F
document.arc_length.y_12.value = Math.round(F*y12)/F
document.arc_length.ny_12.value = Math.round(F*4*y12)/F


var y13 = Math.sqrt(a*a*Math.sin(prma1 + 12*d)*Math.sin(prma1 + 12*d) + b*b*Math.cos(prma1 + 12*d)*Math.cos(prma1 + 12*d))
document.arc_length.prma_13.value = Math.round(F*(prma1 + 12*d))/F
document.arc_length.y_13.value = Math.round(F*y13)/F
document.arc_length.ny_13.value = Math.round(F*2*y13)/F


var y14 = Math.sqrt(a*a*Math.sin(prma1 + 13*d)*Math.sin(prma1 + 13*d) + b*b*Math.cos(prma1 + 13*d)*Math.cos(prma1 + 13*d))
document.arc_length.prma_14.value = Math.round(F*(prma1 + 13*d))/F
document.arc_length.y_14.value = Math.round(F*y14)/F
document.arc_length.ny_14.value = Math.round(F*4*y14)/F


var y15 = Math.sqrt(a*a*Math.sin(prma1 + 14*d)*Math.sin(prma1 + 14*d) + b*b*Math.cos(prma1 + 14*d)*Math.cos(prma1 + 14*d))
document.arc_length.prma_15.value = Math.round(F*(prma1 + 14*d))/F
document.arc_length.y_15.value = Math.round(F*y15)/F
document.arc_length.ny_15.value = Math.round(F*2*y15)/F


var y16 = Math.sqrt(a*a*Math.sin(prma1 + 15*d)*Math.sin(prma1 + 15*d) + b*b*Math.cos(prma1 + 15*d)*Math.cos(prma1 + 15*d))
document.arc_length.prma_16.value = Math.round(F*(prma1 + 15*d))/F
document.arc_length.y_16.value = Math.round(F*y16)/F
document.arc_length.ny_16.value = Math.round(F*4*y16)/F


var y17 = Math.sqrt(a*a*Math.sin(prma1 + 16*d)*Math.sin(prma1 + 16*d) + b*b*Math.cos(prma1 + 16*d)*Math.cos(prma1 + 16*d))
document.arc_length.prma_17.value = Math.round(F*(prma1 + 16*d))/F
document.arc_length.y_17.value = Math.round(F*y17)/F
document.arc_length.ny_17.value = Math.round(F*2*y17)/F


var y18 = Math.sqrt(a*a*Math.sin(prma1 + 17*d)*Math.sin(prma1 + 17*d) + b*b*Math.cos(prma1 + 17*d)*Math.cos(prma1 + 17*d))
document.arc_length.prma_18.value = Math.round(F*(prma1 + 17*d))/F
document.arc_length.y_18.value = Math.round(F*y18)/F
document.arc_length.ny_18.value = Math.round(F*4*y18)/F


var y19 = Math.sqrt(a*a*Math.sin(prma1 + 18*d)*Math.sin(prma1 + 18*d) + b*b*Math.cos(prma1 + 18*d)*Math.cos(prma1 + 18*d))
document.arc_length.prma_19.value = Math.round(F*(prma1 + 18*d))/F
document.arc_length.y_19.value = Math.round(F*y19)/F
document.arc_length.ny_19.value = Math.round(F*2*y19)/F


var y20 = Math.sqrt(a*a*Math.sin(prma1 + 19*d)*Math.sin(prma1 + 19*d) + b*b*Math.cos(prma1 + 19*d)*Math.cos(prma1 + 19*d))
document.arc_length.prma_20.value = Math.round(F*(prma1 + 19*d))/F
document.arc_length.y_20.value = Math.round(F*y20)/F
document.arc_length.ny_20.value = Math.round(F*4*y20)/F


var y21 = Math.sqrt(a*a*Math.sin(prma1 + 20*d)*Math.sin(prma1 + 20*d) + b*b*Math.cos(prma1 + 20*d)*Math.cos(prma1 + 20*d))
document.arc_length.prma_21.value = Math.round(F*(prma1 + 20*d))/F
document.arc_length.y_21.value = Math.round(F*y21)/F
document.arc_length.ny_21.value = Math.round(F*y21)/F


var d_3 = d/3
var y_sum = 1*y1 + 4*y2 + 2*y3 + 4*y4 + 2*y5 + 4*y6 + 2*y7 + 4*y8 + 2*y9 + 4*y10 + 2*y11 + 4*y12 + 2*y13 + 4*y14 + 2*y15 + 4*y16 + 2*y17 + 4*y18 + 2*y19 + 4*y20 + 1*y21
var s = (d/3)*(1*y1 + 4*y2 + 2*y3 + 4*y4 + 2*y5 + 4*y6 + 2*y7 + 4*y8 + 2*y9 + 4*y10 + 2*y11 + 4*y12 + 2*y13 + 4*y14 + 2*y15 + 4*y16 + 2*y17 + 4*y18 + 2*y19 + 4*y20 + 1*y21)


document.arc_length.d_3.value = Math.round(F*d_3)/F
document.arc_length.y_sum.value = Math.round(F*y_sum)/F
document.arc_length.prma1.value = Math.round(F*prma1)/F
document.arc_length.prma2.value = Math.round(F*prma2)/F
document.arc_length.d.value = Math.round(F*d)/F
document.arc_length.arc_calc.value = Math.round(F*d_3)/F + " × " + Math.round(F*y_sum)/F + " = " + Math.round(f*s)/f
window.status = "Ellipse Arc Length = " + Math.round(F*s)/F

var dx = (x1 - x2)/20

var yc1 = Math.sqrt(1 + b*b*x2*x2/(a*a*(a*a - x2*x2)))
var yc2 = Math.sqrt(1 + b*b*(1*x2 + 1*dx)*(1*x2 + 1*dx)/(a*a*(a*a - (1*x2 + 1*dx)*(1*x2 + 1*dx))))
var yc3 =  Math.sqrt(1 + b*b*(1*x2 + 2*dx)*(1*x2 + 2*dx)/(a*a*(a*a - (1*x2 + 2*dx)*(1*x2 + 2*dx))))
var yc4 =  Math.sqrt(1 + b*b*(1*x2 + 3*dx)*(1*x2 + 3*dx)/(a*a*(a*a - (1*x2 + 3*dx)*(1*x2 + 3*dx))))
var yc5 =  Math.sqrt(1 + b*b*(1*x2 + 4*dx)*(1*x2 + 4*dx)/(a*a*(a*a - (1*x2 + 4*dx)*(1*x2 + 4*dx))))
var yc6 =  Math.sqrt(1 + b*b*(1*x2 + 5*dx)*(1*x2 + 5*dx)/(a*a*(a*a - (1*x2 + 5*dx)*(1*x2 + 5*dx))))
var yc7 =  Math.sqrt(1 + b*b*(1*x2 + 6*dx)*(1*x2 + 6*dx)/(a*a*(a*a - (1*x2 + 6*dx)*(1*x2 + 6*dx))))
var yc8 =  Math.sqrt(1 + b*b*(1*x2 + 7*dx)*(1*x2 + 7*dx)/(a*a*(a*a - (1*x2 + 7*dx)*(1*x2 + 7*dx))))
var yc9 =  Math.sqrt(1 + b*b*(1*x2 + 8*dx)*(1*x2 + 8*dx)/(a*a*(a*a - (1*x2 + 8*dx)*(1*x2 + 8*dx))))
var yc10 =  Math.sqrt(1 + b*b*(1*x2 + 9*dx)*(1*x2 + 9*dx)/(a*a*(a*a - (1*x2 + 9*dx)*(1*x2 + 9*dx))))
var yc11 =  Math.sqrt(1 + b*b*(1*x2 + 10*dx)*(1*x2 + 10*dx)/(a*a*(a*a - (1*x2 + 10*dx)*(1*x2 + 10*dx))))
var yc12 =  Math.sqrt(1 + b*b*(1*x2 + 11*dx)*(1*x2 + 11*dx)/(a*a*(a*a - (1*x2 + 11*dx)*(1*x2 + 11*dx))))
var yc13 =  Math.sqrt(1 + b*b*(1*x2 + 12*dx)*(1*x2 + 12*dx)/(a*a*(a*a - (1*x2 + 12*dx)*(1*x2 + 12*dx))))
var yc14 =  Math.sqrt(1 + b*b*(1*x2 + 13*dx)*(1*x2 + 13*dx)/(a*a*(a*a - (1*x2 + 13*dx)*(1*x2 + 13*dx))))
var yc15 =  Math.sqrt(1 + b*b*(1*x2 + 14*dx)*(1*x2 + 14*dx)/(a*a*(a*a - (1*x2 + 14*dx)*(1*x2 + 14*dx))))
var yc16 =  Math.sqrt(1 + b*b*(1*x2 + 15*dx)*(1*x2 + 15*dx)/(a*a*(a*a - (1*x2 + 15*dx)*(1*x2 + 15*dx))))
var yc17 =  Math.sqrt(1 + b*b*(1*x2 + 16*dx)*(1*x2 + 16*dx)/(a*a*(a*a - (1*x2 + 16*dx)*(1*x2 + 16*dx))))
var yc18 =  Math.sqrt(1 + b*b*(1*x2 + 17*dx)*(1*x2 + 17*dx)/(a*a*(a*a - (1*x2 + 17*dx)*(1*x2 + 17*dx))))
var yc19 =  Math.sqrt(1 + b*b*(1*x2 + 18*dx)*(1*x2 + 18*dx)/(a*a*(a*a - (1*x2 + 18*dx)*(1*x2 + 18*dx))))
var yc20 =  Math.sqrt(1 + b*b*(1*x2 + 19*dx)*(1*x2 + 19*dx)/(a*a*(a*a - (1*x2 + 19*dx)*(1*x2 + 19*dx))))
var yc21 =  Math.sqrt(1 + b*b*(1*x2 + 20*dx)*(1*x2 + 20*dx)/(a*a*(a*a - (1*x2 + 20*dx)*(1*x2 + 20*dx))))

var c_arc = (dx/3)*(1*yc1 + 4*yc2 + 2*yc3 + 4*yc4 + 2*yc5 + 4*yc6 + 2*yc7 + 4*yc8 + 2*yc9 + 4*yc10 + 2*yc11 + 4*yc12 + 2*yc13 + 4*yc14 + 2*yc15 + 4*yc16 + 2*yc17 + 
4*yc18 + 2*yc19 + 4*yc20 + 1*yc21)

document.arc_length.c_arc.value = Math.round(f*c_arc)/f
}
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值