Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- private static Vector3 WindDirTendancy(double latitude, CelestialBody body)
- {
- Vessel vessel = FlightGlobals.ActiveVessel;
- CelestialBody orbitingBody = FlightGlobals.currentMainBody;
- String orbitingBodyName = orbitingBody.bodyName;
- Vector3 Up = vessel.upAxis; //get the up relative to the surface
- Up.Normalize(); //normalize that shit
- Vector3 East = Vector3.Cross(vessel.mainBody.angularVelocity, Up); //Get the reverse East axis
- East.Normalize(); //Normalize that shit
- Vector3 North = Vector3.Cross(East, vessel.upAxis); //Get the reverse north axis
- North.Normalize();//Guess what? Normalize that shit
- Vector3d coriolisAcc = FlightGlobals.getCoriolisAcc(TradeWindTendancy, body);
- switch(latitude)
- {
- case 1:
- break;
- default:
- break;
- }
- if(orbitingBodyName == "Kerbin")
- {
- //Trade wind stuff below
- if (Latitude >= -5 && Latitude <= 5) //Easterly trade wind at the Inter-Tropical Convergence zone
- {
- FlightGlobals.getCoriolisAcc(TradeWindTendancy, body);
- //Debug.Log("Wind is Easterly!");
- //This area is nominally of lower pressure
- TradeWindTendancy = -East * (windSpeed * (float)CurrentAtmoPressure); // * RecipDeltaAtmoPressure);
- windDirectionNumb = 2;
- }
- if (Latitude > 5 && Latitude <= 15) //Hadley Cell, North Easterly trade wind
- {
- TradeWindTendancy = (North + -East).normalized * (windSpeed * (float)CurrentAtmoPressure); // * RecipDeltaAtmoPressure);
- windDirectionNumb = 5;
- }
- if (Latitude > 15 && Latitude <= 20) //Hadley Cell, Northerly trade wind.
- {
- TradeWindTendancy = North * (windSpeed * (float)CurrentAtmoPressure);// * RecipDeltaAtmoPressure);
- windDirectionNumb = 1;
- }
- if (Latitude > 20 && Latitude <= 27) //Hadley Cell - Sub-Tropical Ridge, North Westerly trade wind
- {
- TradeWindTendancy = (North + East).normalized * (windSpeed * (float)CurrentAtmoPressure); // * RecipDeltaAtmoPressure);
- windDirectionNumb = 8;
- }
- if (Latitude > 27 && Latitude <= 33) //Sub-tropical Ridge, Westerlies
- {
- TradeWindTendancy = East * (windSpeed * (float)CurrentAtmoPressure); // * RecipDeltaAtmoPressure);
- windDirectionNumb = 4;
- }
- if (Latitude > 33 && Latitude <= 40) //Sub-Tropical Ridge - Ferrel Cell, Mid-Latitude. Westerlies
- {
- TradeWindTendancy = East * (windSpeed * (float)CurrentAtmoPressure); // * RecipDeltaAtmoPressure);
- windDirectionNumb = 4;
- }
- if (Latitude > 40 && Latitude <= 80) //Ferrel Cell - Polar Cell/Vortex, High Latitude. High Pressure, North Westerlies
- {
- TradeWindTendancy = (North + East).normalized * (windSpeed * (float)CurrentAtmoPressure); // * RecipDeltaAtmoPressure);
- windDirectionNumb = 8;
- }
- if (Latitude > 80 && Latitude <= 90) //Extreme high polar region, High Pressure, Northerlies
- {
- TradeWindTendancy = North * (windSpeed * (float)CurrentAtmoPressure); // * RecipDeltaAtmoPressure);
- windDirectionNumb = 1;
- }
- //Southern hemisphere
- if (Latitude < -5 && Latitude >= -15) //ITCZ - Hadley Cell, South Easterlies
- {
- TradeWindTendancy = (-North + -East).normalized * (windSpeed * (float)CurrentAtmoPressure); // * RecipDeltaAtmoPressure);
- windDirectionNumb = 6;
- }
- if (Latitude < -15 && Latitude >= -20) //Hadley Cell, Southerlies
- {
- TradeWindTendancy = -North * (windSpeed * (float)CurrentAtmoPressure); // * RecipDeltaAtmoPressure);
- windDirectionNumb = 3;
- }
- if (Latitude < -20 && Latitude >= -27) //Hadley Cell - Sub-Tropical Ridge, North Westerlies
- {
- TradeWindTendancy = (North + East).normalized * (windSpeed * (float)CurrentAtmoPressure); // * RecipDeltaAtmoPressure);
- windDirectionNumb = 7;
- }
- if (Latitude < -27 && Latitude >= -33) //Sub-Tropical Ridge, Westerlies
- {
- TradeWindTendancy = East * (windSpeed * (float)CurrentAtmoPressure); // * RecipDeltaAtmoPressure);
- windDirectionNumb = 4;
- }
- if (Latitude < -33 && Latitude >= -40)//Sub-Tropical Ridge - Ferrel Cell, Westerlies
- {
- TradeWindTendancy = East * (windSpeed * (float)CurrentAtmoPressure); //* RecipDeltaAtmoPressure);
- windDirectionNumb = 4;
- }
- if (Latitude < -40 && Latitude >= -80) //Ferrel Cell - Polar Cell/Vortex, High Latitude. High Pressure, South Westerlies
- {
- TradeWindTendancy = (-North + East).normalized * (windSpeed * (float)CurrentAtmoPressure); // * RecipDeltaAtmoPressure);
- windDirectionNumb = 7;
- }
- if (Latitude < -80 && Latitude >= -90) //Polar Cell, High Latitude, High Pressure, Southerlies
- {
- TradeWindTendancy = -North * (windSpeed * (float)CurrentAtmoPressure); //* RecipDeltaAtmoPressure);
- windDirectionNumb = 3;
- }
- }
- else if (orbitingBodyName == "Duna")
- {
- //Trade wind stuff below
- if (Latitude >= -5 && Latitude <= 5) //Easterly trade wind at the Inter-Tropical Convergence zone
- {
- //Debug.Log("Wind is Easterly!");
- //This area is nominally of lower pressure
- TradeWindTendancy = -East * (windSpeed * (float)CurrentAtmoPressure); // * RecipDeltaAtmoPressure);
- windDirectionNumb = 2;
- }
- if (Latitude > 5 && Latitude <= 15) //Hadley Cell, North Easterly trade wind
- {
- TradeWindTendancy = (North + -East).normalized * (windSpeed * (float)CurrentAtmoPressure); // * RecipDeltaAtmoPressure);
- windDirectionNumb = 5;
- }
- if (Latitude > 15 && Latitude <= 20) //Hadley Cell, Northerly trade wind.
- {
- TradeWindTendancy = North * (windSpeed * (float)CurrentAtmoPressure);// * RecipDeltaAtmoPressure);
- windDirectionNumb = 1;
- }
- if (Latitude > 20 && Latitude <= 27) //Hadley Cell - Sub-Tropical Ridge, North Westerly trade wind
- {
- TradeWindTendancy = (North + East).normalized * (windSpeed * (float)CurrentAtmoPressure); // * RecipDeltaAtmoPressure);
- windDirectionNumb = 8;
- }
- if (Latitude > 27 && Latitude <= 33) //Sub-tropical Ridge, Westerlies
- {
- TradeWindTendancy = East * (windSpeed * (float)CurrentAtmoPressure); // * RecipDeltaAtmoPressure);
- windDirectionNumb = 4;
- }
- if (Latitude > 33 && Latitude <= 40) //Sub-Tropical Ridge - Ferrel Cell, Mid-Latitude. Westerlies
- {
- TradeWindTendancy = East * (windSpeed * (float)CurrentAtmoPressure); // * RecipDeltaAtmoPressure);
- windDirectionNumb = 4;
- }
- if (Latitude > 40 && Latitude <= 80) //Ferrel Cell - Polar Cell/Vortex, High Latitude. High Pressure, North Westerlies
- {
- TradeWindTendancy = (North + East).normalized * (windSpeed * (float)CurrentAtmoPressure); // * RecipDeltaAtmoPressure);
- windDirectionNumb = 8;
- }
- if (Latitude > 80 && Latitude <= 90) //Extreme high polar region, High Pressure, Northerlies
- {
- TradeWindTendancy = North * (windSpeed * (float)CurrentAtmoPressure); // * RecipDeltaAtmoPressure);
- windDirectionNumb = 1;
- }
- //Southern hemisphere
- if (Latitude < -5 && Latitude >= -15) //ITCZ - Hadley Cell, South Easterlies
- {
- TradeWindTendancy = (-North + -East).normalized * (windSpeed * (float)CurrentAtmoPressure); // * RecipDeltaAtmoPressure);
- windDirectionNumb = 6;
- }
- if (Latitude < -15 && Latitude >= -20) //Hadley Cell, Southerlies
- {
- TradeWindTendancy = -North * (windSpeed * (float)CurrentAtmoPressure); // * RecipDeltaAtmoPressure);
- windDirectionNumb = 3;
- }
- if (Latitude < -20 && Latitude >= -27) //Hadley Cell - Sub-Tropical Ridge, North Westerlies
- {
- TradeWindTendancy = (North + East).normalized * (windSpeed * (float)CurrentAtmoPressure); // * RecipDeltaAtmoPressure);
- windDirectionNumb = 7;
- }
- if (Latitude < -27 && Latitude >= -33) //Sub-Tropical Ridge, Westerlies
- {
- TradeWindTendancy = East * (windSpeed * (float)CurrentAtmoPressure); // * RecipDeltaAtmoPressure);
- windDirectionNumb = 4;
- }
- if (Latitude < -33 && Latitude >= -40)//Sub-Tropical Ridge - Ferrel Cell, Westerlies
- {
- TradeWindTendancy = East * (windSpeed * (float)CurrentAtmoPressure); //* RecipDeltaAtmoPressure);
- windDirectionNumb = 4;
- }
- if (Latitude < -40 && Latitude >= -80) //Ferrel Cell - Polar Cell/Vortex, High Latitude. High Pressure, South Westerlies
- {
- TradeWindTendancy = (-North + East).normalized * (windSpeed * (float)CurrentAtmoPressure); // * RecipDeltaAtmoPressure);
- windDirectionNumb = 7;
- }
- if (Latitude < -80 && Latitude >= -90) //Polar Cell, High Latitude, High Pressure, Southerlies
- {
- TradeWindTendancy = -North * (windSpeed * (float)CurrentAtmoPressure); //* RecipDeltaAtmoPressure);
- windDirectionNumb = 3;
- }
- }
- else if (orbitingBodyName == "Eve")
- {
- //Trade wind stuff below
- if (Latitude >= -5 && Latitude <= 5) //Easterly trade wind at the Inter-Tropical Convergence zone
- {
- //Debug.Log("Wind is Easterly!");
- //This area is nominally of lower pressure
- TradeWindTendancy = -East * (windSpeed * (float)CurrentAtmoPressure); // * RecipDeltaAtmoPressure);
- windDirectionNumb = 2;
- }
- if (Latitude > 5 && Latitude <= 15) //Hadley Cell, North Easterly trade wind
- {
- TradeWindTendancy = (North + -East).normalized * (windSpeed * (float)CurrentAtmoPressure); // * RecipDeltaAtmoPressure);
- windDirectionNumb = 5;
- }
- if (Latitude > 15 && Latitude <= 20) //Hadley Cell, Northerly trade wind.
- {
- TradeWindTendancy = North * (windSpeed * (float)CurrentAtmoPressure);// * RecipDeltaAtmoPressure);
- windDirectionNumb = 1;
- }
- if (Latitude > 20 && Latitude <= 27) //Hadley Cell - Sub-Tropical Ridge, North Westerly trade wind
- {
- TradeWindTendancy = (North + East).normalized * (windSpeed * (float)CurrentAtmoPressure); // * RecipDeltaAtmoPressure);
- windDirectionNumb = 8;
- }
- if (Latitude > 27 && Latitude <= 33) //Sub-tropical Ridge, Westerlies
- {
- TradeWindTendancy = East * (windSpeed * (float)CurrentAtmoPressure); // * RecipDeltaAtmoPressure);
- windDirectionNumb = 4;
- }
- if (Latitude > 33 && Latitude <= 40) //Sub-Tropical Ridge - Ferrel Cell, Mid-Latitude. Westerlies
- {
- TradeWindTendancy = East * (windSpeed * (float)CurrentAtmoPressure); // * RecipDeltaAtmoPressure);
- windDirectionNumb = 4;
- }
- if (Latitude > 40 && Latitude <= 80) //Ferrel Cell - Polar Cell/Vortex, High Latitude. High Pressure, North Westerlies
- {
- TradeWindTendancy = (North + East).normalized * (windSpeed * (float)CurrentAtmoPressure); // * RecipDeltaAtmoPressure);
- windDirectionNumb = 8;
- }
- if (Latitude > 80 && Latitude <= 90) //Extreme high polar region, High Pressure, Northerlies
- {
- TradeWindTendancy = North * (windSpeed * (float)CurrentAtmoPressure); // * RecipDeltaAtmoPressure);
- windDirectionNumb = 1;
- }
- //Southern hemisphere
- if (Latitude < -5 && Latitude >= -15) //ITCZ - Hadley Cell, South Easterlies
- {
- TradeWindTendancy = (-North + -East).normalized * (windSpeed * (float)CurrentAtmoPressure); // * RecipDeltaAtmoPressure);
- windDirectionNumb = 6;
- }
- if (Latitude < -15 && Latitude >= -20) //Hadley Cell, Southerlies
- {
- TradeWindTendancy = -North * (windSpeed * (float)CurrentAtmoPressure); // * RecipDeltaAtmoPressure);
- windDirectionNumb = 3;
- }
- if (Latitude < -20 && Latitude >= -27) //Hadley Cell - Sub-Tropical Ridge, North Westerlies
- {
- TradeWindTendancy = (North + East).normalized * (windSpeed * (float)CurrentAtmoPressure); // * RecipDeltaAtmoPressure);
- windDirectionNumb = 7;
- }
- if (Latitude < -27 && Latitude >= -33) //Sub-Tropical Ridge, Westerlies
- {
- TradeWindTendancy = East * (windSpeed * (float)CurrentAtmoPressure); // * RecipDeltaAtmoPressure);
- windDirectionNumb = 4;
- }
- if (Latitude < -33 && Latitude >= -40)//Sub-Tropical Ridge - Ferrel Cell, Westerlies
- {
- TradeWindTendancy = East * (windSpeed * (float)CurrentAtmoPressure); //* RecipDeltaAtmoPressure);
- windDirectionNumb = 4;
- }
- if (Latitude < -40 && Latitude >= -80) //Ferrel Cell - Polar Cell/Vortex, High Latitude. High Pressure, South Westerlies
- {
- TradeWindTendancy = (-North + East).normalized * (windSpeed * (float)CurrentAtmoPressure); // * RecipDeltaAtmoPressure);
- windDirectionNumb = 7;
- }
- if (Latitude < -80 && Latitude >= -90) //Polar Cell, High Latitude, High Pressure, Southerlies
- {
- TradeWindTendancy = -North * (windSpeed * (float)CurrentAtmoPressure); //* RecipDeltaAtmoPressure);
- windDirectionNumb = 3;
- }
- }
- else if (orbitingBodyName == "Laythe")
- {
- //Trade wind stuff below
- if (Latitude >= -5 && Latitude <= 5) //Easterly trade wind at the Inter-Tropical Convergence zone
- {
- //Debug.Log("Wind is Easterly!");
- //This area is nominally of lower pressure
- TradeWindTendancy = -East * (windSpeed * (float)CurrentAtmoPressure); // * RecipDeltaAtmoPressure);
- windDirectionNumb = 2;
- }
- if (Latitude > 5 && Latitude <= 15) //Hadley Cell, North Easterly trade wind
- {
- TradeWindTendancy = (North + -East).normalized * (windSpeed * (float)CurrentAtmoPressure); // * RecipDeltaAtmoPressure);
- windDirectionNumb = 5;
- }
- if (Latitude > 15 && Latitude <= 20) //Hadley Cell, Northerly trade wind.
- {
- TradeWindTendancy = North * (windSpeed * (float)CurrentAtmoPressure);// * RecipDeltaAtmoPressure);
- windDirectionNumb = 1;
- }
- if (Latitude > 20 && Latitude <= 27) //Hadley Cell - Sub-Tropical Ridge, North Westerly trade wind
- {
- TradeWindTendancy = (North + East).normalized * (windSpeed * (float)CurrentAtmoPressure); // * RecipDeltaAtmoPressure);
- windDirectionNumb = 8;
- }
- if (Latitude > 27 && Latitude <= 33) //Sub-tropical Ridge, Westerlies
- {
- TradeWindTendancy = East * (windSpeed * (float)CurrentAtmoPressure); // * RecipDeltaAtmoPressure);
- windDirectionNumb = 4;
- }
- if (Latitude > 33 && Latitude <= 40) //Sub-Tropical Ridge - Ferrel Cell, Mid-Latitude. Westerlies
- {
- TradeWindTendancy = East * (windSpeed * (float)CurrentAtmoPressure); // * RecipDeltaAtmoPressure);
- windDirectionNumb = 4;
- }
- if (Latitude > 40 && Latitude <= 80) //Ferrel Cell - Polar Cell/Vortex, High Latitude. High Pressure, North Westerlies
- {
- TradeWindTendancy = (North + East).normalized * (windSpeed * (float)CurrentAtmoPressure); // * RecipDeltaAtmoPressure);
- windDirectionNumb = 8;
- }
- if (Latitude > 80 && Latitude <= 90) //Extreme high polar region, High Pressure, Northerlies
- {
- TradeWindTendancy = North * (windSpeed * (float)CurrentAtmoPressure); // * RecipDeltaAtmoPressure);
- windDirectionNumb = 1;
- }
- //Southern hemisphere
- if (Latitude < -5 && Latitude >= -15) //ITCZ - Hadley Cell, South Easterlies
- {
- TradeWindTendancy = (-North + -East).normalized * (windSpeed * (float)CurrentAtmoPressure); // * RecipDeltaAtmoPressure);
- windDirectionNumb = 6;
- }
- if (Latitude < -15 && Latitude >= -20) //Hadley Cell, Southerlies
- {
- TradeWindTendancy = -North * (windSpeed * (float)CurrentAtmoPressure); // * RecipDeltaAtmoPressure);
- windDirectionNumb = 3;
- }
- if (Latitude < -20 && Latitude >= -27) //Hadley Cell - Sub-Tropical Ridge, North Westerlies
- {
- TradeWindTendancy = (North + East).normalized * (windSpeed * (float)CurrentAtmoPressure); // * RecipDeltaAtmoPressure);
- windDirectionNumb = 7;
- }
- if (Latitude < -27 && Latitude >= -33) //Sub-Tropical Ridge, Westerlies
- {
- TradeWindTendancy = East * (windSpeed * (float)CurrentAtmoPressure); // * RecipDeltaAtmoPressure);
- windDirectionNumb = 4;
- }
- if (Latitude < -33 && Latitude >= -40)//Sub-Tropical Ridge - Ferrel Cell, Westerlies
- {
- TradeWindTendancy = East * (windSpeed * (float)CurrentAtmoPressure); //* RecipDeltaAtmoPressure);
- windDirectionNumb = 4;
- }
- if (Latitude < -40 && Latitude >= -80) //Ferrel Cell - Polar Cell/Vortex, High Latitude. High Pressure, South Westerlies
- {
- TradeWindTendancy = (-North + East).normalized * (windSpeed * (float)CurrentAtmoPressure); // * RecipDeltaAtmoPressure);
- windDirectionNumb = 7;
- }
- if (Latitude < -80 && Latitude >= -90) //Polar Cell, High Latitude, High Pressure, Southerlies
- {
- TradeWindTendancy = -North * (windSpeed * (float)CurrentAtmoPressure); //* RecipDeltaAtmoPressure);
- windDirectionNumb = 3;
- }
- }
- else if (orbitingBodyName == "Jool")
- {
- //Trade wind stuff below
- if (Latitude >= -5 && Latitude <= 5) //Easterly trade wind at the Inter-Tropical Convergence zone
- {
- //Debug.Log("Wind is Easterly!");
- //This area is nominally of lower pressure
- TradeWindTendancy = -East * (windSpeed * (float)CurrentAtmoPressure); // * RecipDeltaAtmoPressure);
- windDirectionNumb = 2;
- }
- if (Latitude > 5 && Latitude <= 15) //Hadley Cell, North Easterly trade wind
- {
- TradeWindTendancy = (North + -East).normalized * (windSpeed * (float)CurrentAtmoPressure); // * RecipDeltaAtmoPressure);
- windDirectionNumb = 5;
- }
- if (Latitude > 15 && Latitude <= 20) //Hadley Cell, Northerly trade wind.
- {
- TradeWindTendancy = North * (windSpeed * (float)CurrentAtmoPressure);// * RecipDeltaAtmoPressure);
- windDirectionNumb = 1;
- }
- if (Latitude > 20 && Latitude <= 27) //Hadley Cell - Sub-Tropical Ridge, North Westerly trade wind
- {
- TradeWindTendancy = (North + East).normalized * (windSpeed * (float)CurrentAtmoPressure); // * RecipDeltaAtmoPressure);
- windDirectionNumb = 8;
- }
- if (Latitude > 27 && Latitude <= 33) //Sub-tropical Ridge, Westerlies
- {
- TradeWindTendancy = East * (windSpeed * (float)CurrentAtmoPressure); // * RecipDeltaAtmoPressure);
- windDirectionNumb = 4;
- }
- if (Latitude > 33 && Latitude <= 40) //Sub-Tropical Ridge - Ferrel Cell, Mid-Latitude. Westerlies
- {
- TradeWindTendancy = East * (windSpeed * (float)CurrentAtmoPressure); // * RecipDeltaAtmoPressure);
- windDirectionNumb = 4;
- }
- if (Latitude > 40 && Latitude <= 80) //Ferrel Cell - Polar Cell/Vortex, High Latitude. High Pressure, North Westerlies
- {
- TradeWindTendancy = (North + East).normalized * (windSpeed * (float)CurrentAtmoPressure); // * RecipDeltaAtmoPressure);
- windDirectionNumb = 8;
- }
- if (Latitude > 80 && Latitude <= 90) //Extreme high polar region, High Pressure, Northerlies
- {
- TradeWindTendancy = North * (windSpeed * (float)CurrentAtmoPressure); // * RecipDeltaAtmoPressure);
- windDirectionNumb = 1;
- }
- //Southern hemisphere
- if (Latitude < -5 && Latitude >= -15) //ITCZ - Hadley Cell, South Easterlies
- {
- TradeWindTendancy = (-North + -East).normalized * (windSpeed * (float)CurrentAtmoPressure); // * RecipDeltaAtmoPressure);
- windDirectionNumb = 6;
- }
- if (Latitude < -15 && Latitude >= -20) //Hadley Cell, Southerlies
- {
- TradeWindTendancy = -North * (windSpeed * (float)CurrentAtmoPressure); // * RecipDeltaAtmoPressure);
- windDirectionNumb = 3;
- }
- if (Latitude < -20 && Latitude >= -27) //Hadley Cell - Sub-Tropical Ridge, North Westerlies
- {
- TradeWindTendancy = (North + East).normalized * (windSpeed * (float)CurrentAtmoPressure); // * RecipDeltaAtmoPressure);
- windDirectionNumb = 7;
- }
- if (Latitude < -27 && Latitude >= -33) //Sub-Tropical Ridge, Westerlies
- {
- TradeWindTendancy = East * (windSpeed * (float)CurrentAtmoPressure); // * RecipDeltaAtmoPressure);
- windDirectionNumb = 4;
- }
- if (Latitude < -33 && Latitude >= -40)//Sub-Tropical Ridge - Ferrel Cell, Westerlies
- {
- TradeWindTendancy = East * (windSpeed * (float)CurrentAtmoPressure); //* RecipDeltaAtmoPressure);
- windDirectionNumb = 4;
- }
- if (Latitude < -40 && Latitude >= -80) //Ferrel Cell - Polar Cell/Vortex, High Latitude. High Pressure, South Westerlies
- {
- TradeWindTendancy = (-North + East).normalized * (windSpeed * (float)CurrentAtmoPressure); // * RecipDeltaAtmoPressure);
- windDirectionNumb = 7;
- }
- if (Latitude < -80 && Latitude >= -90) //Polar Cell, High Latitude, High Pressure, Southerlies
- {
- TradeWindTendancy = -North * (windSpeed * (float)CurrentAtmoPressure); //* RecipDeltaAtmoPressure);
- windDirectionNumb = 3;
- }
- }
- else
- {
- Debug.Log("KWS: Orbiting body doesn't contain atmosphere or has not been added to climate database");
- }
- return TradeWindTendancy;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement