import logging

import numpy as np

logger = logging.getLogger(__name__)


def distance_from_COR(angle: int, move_to_beam: float) -> None:
    """
    calculate the distance of an object from the center of rotation
    """

    distance = move_to_beam / np.tan(np.deg2rad(angle))

    if (angle > 0 and move_to_beam > 0) or (angle < 0 and move_to_beam < 0):
        # downstream of eta
        # downstream of phi
        logger.info(f"suggest: umvr(lab_x,{distance})")

    if (angle > 0 and move_to_beam < 0) or (angle < 0 and move_to_beam > 0):
        # upstream of eta
        # upstream of phi
        logger.info(f"suggest: umvr(lab_x,{-distance})")
