public static int GetNewTangentKeyMode(int currentTangentMode, TangentDirection leftRight, TangentMode mode) { int output = currentTangentMode; if (leftRight == TangentDirection.Left) { output &= -7; output |= ((int)mode) << 1; } else { output &= -25; output |= ((int)mode) << 3; } return output; }
float DirectionToTangent(Vector2 direction, TangentDirection tangentDirection) { if (tangentDirection == TangentDirection.In && direction.x > 0.0001f) { return(float.PositiveInfinity); } if (tangentDirection == TangentDirection.Out && direction.x < -0.0001f) { return(float.PositiveInfinity); } return(direction.y / direction.x); }
public static int GetNewTangentKeyMode(int currentTangentMode, TangentDirection leftRight, TangentMode mode) { int output = currentTangentMode; if (leftRight == TangentDirection.Left) { output &= -7; output |= (( int )mode) << 1; } else { output &= -25; output |= (( int )mode) << 3; } return(output); }
public static Vector3 GetTangent(this Quaternion quaternion, TangentDirection direction) { switch (direction) { case TangentDirection.Up: return(Vector3.Transform(Vector3.UnitY, quaternion)); case TangentDirection.Down: return(Vector3.Transform(-Vector3.UnitY, quaternion)); case TangentDirection.Left: return(Vector3.Transform(Vector3.UnitX, quaternion)); case TangentDirection.Right: return(Vector3.Transform(-Vector3.UnitX, quaternion)); } return(Vector3.Zero); }
public static Vector3 GetTangent(this Quaternion quaternion, TangentDirection direction) { switch(direction) { case TangentDirection.Up: return Vector3.Transform(Vector3.UnitY, quaternion); case TangentDirection.Down: return Vector3.Transform(-Vector3.UnitY, quaternion); case TangentDirection.Left: return Vector3.Transform(Vector3.UnitX, quaternion); case TangentDirection.Right: return Vector3.Transform(-Vector3.UnitX, quaternion); } return Vector3.Zero; }