def bcosPoints(pb, pe):
    """Return Bezier control points, when pb and pe stand for a full period
    from (0,0) to (2*pi, 0), respectively, in the user's coordinate system.
    The returned points can be used to draw up to four Bezier curves for
    the complete cosine function graph from 0 to 2*pi.
    """
    f = abs(pe - pb) * 0.5 / math.pi     # represents the unit
    alfa = 5.34295228e-01
    beta = 1.01474288e+00
    # adjust for either horizontal or vertical
    if pb.y == pe.y:
        y_ampl = (0, f)
        y_alfa = (0, f * alfa)
        y_beta = (0, f * beta)
    elif pb.x == pe.x:
        y_ampl = (-f, 0)
        y_alfa = (-f * alfa, 0)
        y_beta = (-f * beta, 0)
    else:
        raise ValueError("can only draw horizontal or vertical")
        
    p0 = pb - y_ampl
    p4 = pe - y_ampl
    p1 = pb + (pe - pb)*0.25
    p2 = pb + (pe - pb)*0.5 + y_ampl
    p3 = pb + (pe - pb)*0.75
    k1 = pb + (pe - pb)*(1./12.)  - y_beta
    k2 = pb + (pe - pb)*(2./12.)  - y_alfa
    k3 = pb + (pe - pb)*(4./12.)  + y_alfa
    k4 = pb + (pe - pb)*(5./12.)  + y_beta
    k5 = pb + (pe - pb)*(7./12.)  + y_beta
    k6 = pb + (pe - pb)*(8./12.)  + y_alfa
    k7 = pb + (pe - pb)*(10./12.) - y_alfa
    k8 = pb + (pe - pb)*(11./12.) - y_beta
    return p0, k1, k2, p1, k3, k4, p2, k5, k6, p3, k7, k8, p4
Return Bezier control points, when pb and pe stand for a full period
    from (0,0) to (2*pi, 0), respectively, in the user's coordinate system.
    The returned points can be used to draw up to four Bezier curves for
    the complete cosine function graph from 0 to 2*pi.
    
recipes/Python/Draw Sine Function in PDF/drawSines.py