1

処理中のデイライトの実用的な分析モデルを実装し、それを 2D キャンバスに投影しようとしています。太陽の方位角に関する厄介な問題を除いて、これまでのところすべて正常に機能しています。

時刻をアニメーション化すると、特定の時刻に太陽が反対側にジャンプします。これは、方位角が -90 度から +90 度、またはその逆になるために発生します。それが論文の制限なのか、それとも太陽の位置の計算を間違えたのかはわかりません。私が理解している限り、方位角は 0 から 360 度の間である必要があります。

誰かがすでにプリサムの論文を実装していて、私を助けることができますか?

これが太陽の位置を計算するための私のコードです。完全な Processing スケッチは、 https ://dl.dropbox.com/u/42247259/PreethamSky.zip からダウンロードできます。

ご協力いただきありがとうございます。HG

private void calculateSolarPosition() {
    float t = solarTime(standardTime, dayOfYear, standardMeridian, longitude);
    float delta = solarDeclination(dayOfYear);
    thetaS = angleFromSunToZenith(t, delta, latitude);
    phiS = sunAzimuth(t, delta, latitude);
}

/// Returns the solar time at a certain geographic place, day of year and standard time.
private float solarTime(float standardTime, int dayOfYear, float standardMeridian, float longitude) {
    return (float)(standardTime + 0.17 * sin(4 * PI * (dayOfYear - 80) / 373) - 0.129 * sin(2 * PI * (dayOfYear - 8) / 355) + 12 * (standardMeridian - longitude) / PI);
}


/// Returns the solar declination. Solar declination is the angle between the rays of the sun and the 
/// plane of the earth's equator.
private float solarDeclination(int dayOfYear) {
    return (float)(0.4093 * sin(2 * PI * (dayOfYear - 81) / 368.0));
}


/// Returns the angle from the sun to the zenith in rad.
private float angleFromSunToZenith(float solarTime, float solarDeclination, float latitude) {
    return (float)(PI / 2 - asin(sin(latitude) * sin(solarDeclination) -  cos(latitude) * cos(solarDeclination) * cos(PI * solarTime / 12)));
}


/// Returns the azimuth of the sun in rad. Azimuth is the angle between a line to south and the sun.
private float sunAzimuth(float solarTime, float solarDeclination, float latitude) {
    return (float)-(atan((-cos(solarDeclination) * sin(PI * solarTime / 12)) /
        (cos(latitude) * sin(solarDeclination) - sin(latitude) * cos(solarDeclination) *
        cos(PI * solarTime / 12.0))));
}
4

1 に答える 1