import math


def cartesian_offset(azm, inc, sd, origin=(0, 0)):
    """
    Calculate the (X, Y) cartesian coordinate offset.

    :param azm:    (float) azimuth angle in degrees
    :param inc:    (float) inclination angle in degrees
    :param sd:     (float) slope distance in any units
    :param origin: (tuple(float, float)) optional origin coordinate
    """
    hd = sd * math.cos(math.radians(inc))
    x = hd * math.sin(math.radians(azm))
    y = hd * math.cos(math.radians(azm))
    return (x, y) if not origin else (x+origin[0], y+origin[1])