void IFlightControlParameter.UpdateAutopilot(FlightCtrlState c) { if (Enabled) { c.wheelThrottle = (float)KOSMath.Clamp(Value, -1, 1); } }
public override void Set(object value) { var dblValue = System.Convert.ToDouble(value); base.Set(System.Math.Abs(stepIncrement) < 0.0001 ? KOSMath.Clamp(dblValue, min, max) : KOSMath.ClampToIndent(dblValue, min, max, stepIncrement)); }
public RgbaColor(float red, float green, float blue, float alpha = (float)1.0) : this() { Red = KOSMath.Clamp(red, 0, 255); Green = KOSMath.Clamp(green, 0, 255); Blue = KOSMath.Clamp(blue, 0, 255); Alpha = KOSMath.Clamp(alpha, 0, 255); }
private void SetRotation(Vector vectorValue) { if (vectorValue == null) { yaw = 0.0f; pitch = 0.0f; roll = 0.0f; } else { yaw = (float)KOSMath.Clamp(vectorValue.X, -1, 1); pitch = (float)KOSMath.Clamp(vectorValue.Y, -1, 1); roll = (float)KOSMath.Clamp(vectorValue.Z, -1, 1); } }
private void SetTranslation(Vector vectorValue) { if (vectorValue == null) { fore = 0.0f; top = 0.0f; starboard = 0.0f; } else { starboard = (float)KOSMath.Clamp(vectorValue.X, -1, 1); top = (float)KOSMath.Clamp(vectorValue.Y, -1, 1); fore = (float)KOSMath.Clamp(vectorValue.Z, -1, 1); } }
void IFlightControlParameter.UpdateValue(object value, SharedObjects shared) { if (!Enabled) { ((IFlightControlParameter)this).EnableControl(shared); } try { Value = KOSMath.Clamp(Convert.ToDouble(value), 0, 1); } catch { throw new KOSWrongControlValueTypeException( "THROTTLE", KOSNomenclature.GetKOSName(value.GetType()), string.Format("{0} in the range [0..1]", KOSNomenclature.GetKOSName(typeof(ScalarValue))) ); } }