import numpy as np

def rotation_matrix2d_ccw(angle:float):
    """
    Function that returns the 2d rotation matrix (counter-clockwise)

    Args:
    -----
        angle(float)    : The angle passed in degrees
    
    Returns:
    --------
        rot_mat(np.ndarray) : The rotation matrix returned in (2,2) 
    """
    rot_mat = np.zeros((2,2))
    angle2rad = np.pi/180

    theta   = angle*angle2rad
    costheta = np.cos(theta)
    sintheta = np.sin(theta)
    rot_mat[0,0] = costheta
    rot_mat[0,1] = -sintheta
    rot_mat[1,0] = sintheta
    rot_mat[1,1] = costheta

    return rot_mat

def rotation_matrix2d_cw(angle:float):
    """
    Function that returns the 2d rotation matrix (clockwise)

    Args:
    -----
        angle(float)    : The angle passed in degrees
    
    Returns:
    --------
        rot_mat(np.ndarray) : The rotation matrix returned in (2,2) 
    """
    rot_mat = rotation_matrix2d_ccw(angle)
    rot_mat[1,0] = -rot_mat[1,0]
    rot_mat[0,1] = -rot_mat[0,1]

    return rot_mat

