C# Class Kramax.Utility.Utils

Show file Open project: Kramax/KramaxAutoPilot

Public Methods

Method Description
Clamp ( this val, double min, double max ) : double
Clamp ( this val, float min, float max ) : float
CurrentAngleTargetRel ( double current, double target, double maxAngle ) : double

calculates the angle to feed corrected for 0/360 crossings eg. if the target is 350 and the current is 10, it will return 370 giving a diff of -20 degrees else you get +ve 340 and the turn is in the wrong direction

IsNeutral ( AxisBinding axis ) : bool
SpeedUnitToMSec ( this speedUnit, SpeedMode mode, SpeedUnits units, Vessel vessel ) : double
TryGetValue ( this node, string key, KeyCode defaultValue ) : KeyCode
TryGetValue ( this node, string key, Rect defaultValue ) : Rect
TryGetValue ( this node, string key, bool defaultValue ) : bool
TryGetValue ( this node, string key, double defaultValue ) : double
TryGetValue ( this node, string key, float defaultValue ) : float
TryGetValue ( this node, string key, int defaultValue ) : int
TryGetValue ( this node, string key, string defaultValue ) : string
calcStagnationPres ( Vessel vessel ) : double
calculateTargetHeading ( Quaternion rotation, Vessel vessel, VesselData vdata ) : double

calculate current heading from plane rotation

calculateTargetHeading ( Vector3 direction, VesselData vdata ) : double

calculate current heading from plane normal vector

getPlaneNormal ( Quaternion rotation, Vessel vessel ) : Vector3
getPlaneRotation ( Vector3 planeNormal, Vessel vessel ) : Quaternion

calculate the planet relative rotation from the plane normal vector

getPlaneRotation ( double heading, Vessel vessel, VesselData vdata ) : Quaternion
hasPitchInput ( ) : bool
hasRollInput ( ) : bool
hasThrottleInput ( ) : bool
hasYawInput ( ) : bool
headingClamp ( this valToClamp, double maxHeading ) : double

Circular rounding to keep compass measurements within a 360 degree range maxHeading is the top limit, bottom limit is maxHeading - 360

mSecToSpeedUnit ( this mSec, SpeedMode mode, SpeedUnits units, Vessel vessel ) : double
projectOnPlane ( this vector, UnityEngine.Vector3d planeNormal ) : UnityEngine.Vector3d
speedUnitTransform ( SpeedUnits units, double soundSpeed ) : double
unitString ( SpeedUnits unit ) : string
vecHeading ( double target, VesselData vdata ) : Vector3

Plane normal vector from a given heading (surface right vector)

Method Details

Clamp() public static method

public static Clamp ( this val, double min, double max ) : double
val this
min double
max double
return double

Clamp() public static method

public static Clamp ( this val, float min, float max ) : float
val this
min float
max float
return float

CurrentAngleTargetRel() public static method

calculates the angle to feed corrected for 0/360 crossings eg. if the target is 350 and the current is 10, it will return 370 giving a diff of -20 degrees else you get +ve 340 and the turn is in the wrong direction
public static CurrentAngleTargetRel ( double current, double target, double maxAngle ) : double
current double
target double
maxAngle double
return double

IsNeutral() public static method

public static IsNeutral ( AxisBinding axis ) : bool
axis AxisBinding
return bool

SpeedUnitToMSec() public static method

public static SpeedUnitToMSec ( this speedUnit, SpeedMode mode, SpeedUnits units, Vessel vessel ) : double
speedUnit this
mode SpeedMode
units SpeedUnits
vessel Vessel
return double

TryGetValue() public static method

public static TryGetValue ( this node, string key, KeyCode defaultValue ) : KeyCode
node this
key string
defaultValue KeyCode
return KeyCode

TryGetValue() public static method

public static TryGetValue ( this node, string key, Rect defaultValue ) : Rect
node this
key string
defaultValue UnityEngine.Rect
return UnityEngine.Rect

TryGetValue() public static method

public static TryGetValue ( this node, string key, bool defaultValue ) : bool
node this
key string
defaultValue bool
return bool

TryGetValue() public static method

public static TryGetValue ( this node, string key, double defaultValue ) : double
node this
key string
defaultValue double
return double

TryGetValue() public static method

public static TryGetValue ( this node, string key, float defaultValue ) : float
node this
key string
defaultValue float
return float

TryGetValue() public static method

public static TryGetValue ( this node, string key, int defaultValue ) : int
node this
key string
defaultValue int
return int

TryGetValue() public static method

public static TryGetValue ( this node, string key, string defaultValue ) : string
node this
key string
defaultValue string
return string

calcStagnationPres() public static method

public static calcStagnationPres ( Vessel vessel ) : double
vessel Vessel
return double

calculateTargetHeading() public static method

calculate current heading from plane rotation
public static calculateTargetHeading ( Quaternion rotation, Vessel vessel, VesselData vdata ) : double
rotation UnityEngine.Quaternion
vessel Vessel
vdata VesselData
return double

calculateTargetHeading() public static method

calculate current heading from plane normal vector
public static calculateTargetHeading ( Vector3 direction, VesselData vdata ) : double
direction Vector3
vdata VesselData
return double

getPlaneNormal() public static method

public static getPlaneNormal ( Quaternion rotation, Vessel vessel ) : Vector3
rotation UnityEngine.Quaternion
vessel Vessel
return Vector3

getPlaneRotation() public static method

calculate the planet relative rotation from the plane normal vector
public static getPlaneRotation ( Vector3 planeNormal, Vessel vessel ) : Quaternion
planeNormal Vector3
vessel Vessel
return UnityEngine.Quaternion

getPlaneRotation() public static method

public static getPlaneRotation ( double heading, Vessel vessel, VesselData vdata ) : Quaternion
heading double
vessel Vessel
vdata VesselData
return UnityEngine.Quaternion

hasPitchInput() public static method

public static hasPitchInput ( ) : bool
return bool

hasRollInput() public static method

public static hasRollInput ( ) : bool
return bool

hasThrottleInput() public static method

public static hasThrottleInput ( ) : bool
return bool

hasYawInput() public static method

public static hasYawInput ( ) : bool
return bool

headingClamp() public static method

Circular rounding to keep compass measurements within a 360 degree range maxHeading is the top limit, bottom limit is maxHeading - 360
public static headingClamp ( this valToClamp, double maxHeading ) : double
valToClamp this
maxHeading double
return double

mSecToSpeedUnit() public static method

public static mSecToSpeedUnit ( this mSec, SpeedMode mode, SpeedUnits units, Vessel vessel ) : double
mSec this
mode SpeedMode
units SpeedUnits
vessel Vessel
return double

projectOnPlane() public static method

public static projectOnPlane ( this vector, UnityEngine.Vector3d planeNormal ) : UnityEngine.Vector3d
vector this
planeNormal UnityEngine.Vector3d
return UnityEngine.Vector3d

speedUnitTransform() public static method

public static speedUnitTransform ( SpeedUnits units, double soundSpeed ) : double
units SpeedUnits
soundSpeed double
return double

unitString() public static method

public static unitString ( SpeedUnits unit ) : string
unit SpeedUnits
return string

vecHeading() public static method

Plane normal vector from a given heading (surface right vector)
public static vecHeading ( double target, VesselData vdata ) : Vector3
target double
vdata VesselData
return Vector3