https://dl.dropboxusercontent.com/u/84419009/houseSunshine.html
<!DOCTYPE html>
<html>
<head><meta http-equiv="content-type" content="text/html;charset=utf-8">
<title>楼间距计算器</title>
<style ></style>
<script type="text/javascript" >
var tropic=23.27;
function cal(){
var weidu=parseInt(w.value);
var myHigh=parseInt(myh.value);
var hateHigh=parseInt(H.value);
///msg(weidu);
//msg(myHigh);
//msg(hateHigh);
var sunshineDG=getWinterSunshineDG(weidu);
//msg(sunshineDG);
//msgToId(tan(45),"summer");
msgToId("冬至能见到阳光的最小楼间距:"+Math.round(getWide(sunshineDG,myHigh,hateHigh))+"米","winter");
sunshineDG=getSummerSunshineDG(weidu);
//msg(sunshineDG);
//msgToId(tan(45),"summer");
msgToId("夏至能见到阳光的最小楼间距:"+Math.round(getWide(sunshineDG,myHigh,hateHigh))+"米","summer");
sunshineDG=getEquinoxSunshineDG(weidu);
//msg(sunshineDG);
//msgToId(tan(45),"summer");
msgToId("春分能见到阳光的最小楼间距:"+Math.round(getWide(sunshineDG,myHigh,hateHigh))+"米","equinox");
}
function getWide(sunshineDG,myHigh,hateHigh){
return (hateHigh-myHigh)/tan(sunshineDG);
}
function getWinterSunshineDG(weidu){
return 90-(weidu+tropic);
}
function getSummerSunshineDG(weidu){
return 90-(weidu-tropic);
}
function getEquinoxSunshineDG(weidu){
return 90-(weidu);
}
function revert(dg){
return 2*Math.PI/360*dg;
}
function sin(dg){
return Math.sin(revert(dg));
}
function tan(dg){
return Math.tan(revert(dg));
}
function msg(msg){
var tag=document.createElement("div");
tag.innerHTML=msg;
getById("debug_div_id_name").appendChild(tag);
}
function msgToId(msg,id){
getById(id).innerHTML=msg;
}
function getById(id){
return document.getElementById(id);
}
function getByName(name){
return document.getElementsByName(name);
}
</script>
</head>
<body>
纬度:<input type="text" id="w" value="34.84" />----可从各种地图上获得<br/>
我家窗高(米):<input type="text" id="myh" value="16.6" />----窗户到地面高度<br/>
前方楼高(米):<input type="text" id="H" value="50" />----可能遮住阳光的建筑高度<br/>
<!--楼间距(米):<input type="text" id="l" value="8" /><br/>-->
<input type="button" value="计算" onClick="cal()"/>
<div id="summer"></div>
<div id="equinox"></div>
<div id="winter"></div>
<br/>
<br/>
《中华人民共和国国家标准城市居住区规划设计规范》规定:<br/>
大城市住宅日照标准为大寒日大于等于2小时,冬至日大于等于1小时,老年人居住建筑不应低于冬至日日照2小时的标准;在原设计建筑外增加任何设施不应使相邻住宅原有日照标准降低;旧区改造的项目内新建住宅日照标准可酌情降低,但不应低于大寒日日照1小时的标准。<br/>
<a href="http://www.baiyuxiong.com/sun/">http://www.baiyuxiong.com/sun/</a>
<div id="debug_div_id_name"></div>
</body>
</html>