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;
		}
Пример #2
0
    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);
    }
Пример #3
0
    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);
    }
Пример #4
0
        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);
        }
Пример #5
0
        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;
        }