//the added bias-arguments are there to enable the calculation for daylight sinusvalue too private float sinusValue(SinusSeason season, float lon, float timeFrom_0_To_12, float biasAdd, float biasDiv, float biasAmplitude) { //use values to swap sinus computation, becasue the sinus for spring and fall is a little different int month, exp; switch (season) { case SinusSeason.SPRING: month = 3; //spring is approximatly 3 month before summer (ahead) exp = 5; //should be odd N to get negative sinus values break; case SinusSeason.FALL: month = -3; //fall/autumn is approximatly 3 month after summer (behind) exp = 5; //should be odd N to get negative sinus values break; case SinusSeason.WINTER: month = 0; //winter equals summer (negative values from function value, its okay) exp = 3;//exp = 3; //1 is normal and should be okay... maybe we can use a 3 to dont interfere with spring&fall break; case SinusSeason.SUMMER: default: month = 0; exp = 1; break; } //move value of latitude from -180 - +180 to 0-12, becasue it should fit the months, not the longitude lon += 180; //lon = (lon / 360) * 12; //convert longitude to "month adopted from latitude" to change latitude to the actual season/month it should be, the "should month" can be further compared with actual month (not done within this function) lon = (lon / 360) * 2 * biasDiv; //convert longitude to "month adopted from latitude" to change latitude to the actual season/month it should be, the "should month" can be further compared with actual month (not done within this function) //the axis for "0" at starting month is not the 0-greenwitch meridian, so try to find a correction //lon += _constSinusCorrection; //correct for 1 month ... amybe it should correct for longitude some lines before lon += biasAdd; //correct for 1 month ... amybe it should correct for longitude some lines before //return with +timefrom0to12 for actual influence and +month for spring or fall influence //return _constSinusAmplitudeFactor * Math.Pow(Math.Cos((lon + timeFrom_0_To_12 + month) * Math.PI / 6f), exp); //return _constSinusAmplitudeFactor * Mathf.Pow(Mathf.Cos((lon + timeFrom_0_To_12 + month) * Mathf.PI / 6f), exp); //return sinusValueRaw((lon + timeFrom_0_To_12 + month + biasAdd) * Mathf.PI / biasDiv, _constSinusAmplitudeFactor, exp); return sinusValueRaw((lon + timeFrom_0_To_12 + month) * Mathf.PI / biasDiv, biasAmplitude, exp); }
private double distanceFactor(SinusSeason season, double dist, double distanceMax) { switch (season) { case SinusSeason.SPRING: break; case SinusSeason.FALL: break; case SinusSeason.WINTER: distanceMax = -distanceMax; break; case SinusSeason.SUMMER: default: break; } //change this from liniar to maybe quadric? so the transition is more smooth return Math.Floor(((dist + distanceMax) / (90f + 25f)) * 255f); }
private float sinusValue(SinusSeason season, float lon, float timeFrom_0_To_12) { //returns for calculation of sinsvalue for months (like first intended) return sinusValue(season, lon, timeFrom_0_To_12, _constSinusCorrection, 6f, _constSinusAmplitudeFactor); }