太阳球体
##@@
function updateTime() { // 获取当前时间 var date = new Date(); var year = date.getFullYear(); var month = date.getMonth(); var week = date.getDay(); var day = date.getDate(); var hour = date.getHours(); var mim = date.getMinutes(); var second = date.getSeconds(); // 获取儒略日 var jd = getJulianDay(year, month + 1, day); // 经纬度 var latitude = position.coords.latitude; var longitude = position.coords.longitude; // 时区 var tz = 8; // 今天已过了多少分钟 var tl = getLocalTime(hour, mim, second); // 使用时间、时区修正的分钟数 var t = jd + tl / 1440.0 - tz / 24.0; // 世纪数calcSolNoon(t, longitude, tz,0) t = calcTimeJulianCent(t); this.year = date.getFullYear(); this.month = date.getMonth() + 1; this.date = date.getDate(); this.day = new Array("星期日", "星期一", "星期二", "星期三", "星期四", "星期五", "星期六")[date.getDay()]; this.hour = date.getHours() < 10 ? "0" + date.getHours() : date.getHours(); this.minute = date.getMinutes() < 10 ? "0" + date.getMinutes() : date.getMinutes(); this.second = date.getSeconds() < 10 ? "0" + date.getSeconds() : date.getSeconds(); var currentTime = this.year + "." + this.month + "." + this.date + "," + this.day + "," + this.hour + ":" + this.minute + ":" + this.second; var fwj = calcazimuth(t, tl, latitude, longitude, tz, 0); $("#sj").html(currentTime); $("#dj").html('经度: ' + longitude); $("#bw").html('纬度: ' + latitude); $("#sc").html('时差:' + calcEquationOfTime(t)); // 时差 $("#cj").html('赤经:' + calcSunRtAscension(t)); // 赤经 $("#cw").html('赤纬:' + calcSunDeclination(t)); //赤纬 $("#fwj").html('方位角:' + fwj); // 方位角 var gdj = calcelevation(t, tl, latitude, longitude, tz); $("#gdj").html('高度角:' + gdj); // 高度角 var sunr = 500; var x = roundWithTwoDecimals(-sunr * Math.sin(fwj * 3.14 / 180)); var y = roundWithTwoDecimals(sunr * Math.sin(gdj * 3.14 / 180)); var z = roundWithTwoDecimals(sunr * Math.cos(fwj * 3.14 / 180)); var w = roundWithTwoDecimals(sunr * Math.cos(gdj * 3.14 / 180)); /* //θ=高度角,φ=方位角 var sunx = (sunr * Math.sin(gdj) * Math.cos(fwj)); var suny = (sunr * Math.sin(gdj) * Math.sin(fwj)); var sunz = (sunr * Math.cos(gdj)); */ $("#ty").html('太阳位置:' + x + " " + y + " " + z + " " + w); $('#sun_tf').attr("translation", x + " " + y + " " + z); // $("#richu").html('日出:56'); //赤纬 //$("#an").html(3 + Math.sin((2 * Math.PI / 360) * 6 * (second)) * 3); //var Y = b - Math.cos(hudu) * r // 注意此处是“-”号,因为我们要得到的Y是相对于(0,0)而言的。 }