using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public static class TrajectoryComputation
{

    public static float LinearFunction(float t)
    {
        return t;
    }

    public static Vector3 SinusoidaleFunction(Vector3 direction, float amplitude, float movementSpeed, float t)
    {
        float frequency = 1.0f;
        float Tau = 2 * Mathf.PI;

        float x = Mathf.Lerp(0, 100, t) * movementSpeed;
        float y = amplitude * Mathf.Sin((Tau * frequency * x) /*+ movementSpeed*/);

        float angle = Vector2.Dot(Vector2.right, direction);
        Debug.Log(Mathf.Abs(angle));

        // Apply rotation matrix based on angle
        float xRot = x * Mathf.Cos(angle) - y * Mathf.Sin(angle);
        float yRot = x * Mathf.Sin(angle) + y * Mathf.Cos(angle);

        return new Vector3(xRot, yRot, 0.0f);
    }
}
