def cone_with_slice(angles, which, fill_args={}, ax=None, label=None,
                    Y=None):

    ax, poly, constraint, rays = cone_rays(angles, which, ax=ax, fill_args=fill_args)
    eta = rays[0]
    representation = constraints((constraint, np.zeros(2)), None)

    if Y is None:
        Y = simulate_from_constraints(representation)

    pyplot.scatter(Y[0], Y[1], s=100, label=label)
    ax.fill(poly[:,0], poly[:,1], label=r'$C(y)$', **fill_args)
    ax.arrow(0,0,eta[0]/200.,eta[1]/200., label=r'$\eta$', linewidth=5, head_width=0.05, fc='k')


    Vp, _, Vm = representation.pivots(eta, Y)[:3]

    Yperp = Y - (np.dot(eta, Y) / 
                 np.linalg.norm(eta)**2 * eta)

    if Vm == np.inf:
        Vm = 10000

    width_points = np.array([(Yperp + Vp*eta /  
                              np.linalg.norm(eta)**2),
                             (Yperp + Vm*eta /  
                              np.linalg.norm(eta)**2)])

    ax.plot(width_points[:,0], width_points[:,1], 'r--', linewidth=2)
    ax.scatter(width_points[:,0], width_points[:,1], label=r'${\cal V}$', s=150, marker='x', linewidth=2, c='k')

    return ax, poly, constraint, rays
def cone_with_point(angles, which, fill_args={}, ax=None, label=None,
                    Y=None):

    ax, poly, constraint, rays = cone_rays(angles, which, ax=ax, fill_args=fill_args)
    eta = rays[0]
    representation = constraints((constraint, np.zeros(2)), None)
    if Y is None:
        Y = simulate_from_constraints(representation)
    pyplot.scatter(Y[0], Y[1], s=100, label=label)
    return ax, poly, constraint, rays
Example #3
0
def cone_with_point(angles, which, fill_args={}, ax=None, label=None, Y=None):

    ax, poly, constraint, rays = cone_rays(angles,
                                           which,
                                           ax=ax,
                                           fill_args=fill_args)
    eta = rays[0]
    representation = constraints((constraint, np.zeros(2)), None)
    if Y is None:
        Y = simulate_from_constraints(representation)
    pyplot.scatter(Y[0], Y[1], s=100, label=label)
    return ax, poly, constraint, rays
def cone_with_arrow(angles, which, fill_args={}, ax=None, label=None,
                    Y=None):

    ax, poly, constraint, rays = cone_rays(angles, which, ax=ax, fill_args=fill_args)
    eta = rays[0]
    representation = constraints((constraint, np.zeros(2)), None)
    if Y is None:
        Y = simulate_from_constraints(representation)
    pyplot.scatter(Y[0], Y[1], s=100, label=label)
    ax.fill(poly[:,0], poly[:,1], label=r'$C(y)$', **fill_args)
    ax.arrow(0,0,eta[0]/200.,eta[1]/200., label=r'$\eta$', linewidth=5, head_width=0.05, fc='k')
    return ax, poly, constraint, rays
Example #5
0
def hull_with_point(W, fill=True, fill_args={}, label=None, ax=None, Y=None):
    f, A, b, pairs, angles, perimeter = just_hull(W,
                                                  fill=fill,
                                                  label=label,
                                                  ax=ax,
                                                  fill_args=fill_args)

    representation = constraints((A, b), None)
    if Y is None:
        Y = simulate_from_constraints(representation)
    a = f.gca()
    a.scatter(Y[0], Y[1], label=r'$y$', s=100)

    return f, A, b, pairs, angles, perimeter
def hull_with_point(W, fill=True, fill_args={}, label=None, ax=None,
                    Y=None):
    f, A, b, pairs, angles, perimeter = just_hull(W,
                                                  fill=fill,
                                                  label=label,
                                                  ax=ax,
                                                  fill_args=fill_args)
    
    representation = constraints((A,b), None)
    if Y is None:
        Y = simulate_from_constraints(representation)
    a = f.gca()
    a.scatter(Y[0], Y[1], label=r'$y$', s=100)

    return f, A, b, pairs, angles, perimeter
Example #7
0
def hull_with_slice(W,
                    fill=True,
                    fill_args={},
                    label=None,
                    ax=None,
                    Y=None,
                    eta=None):
    f, A, b, pairs, angles, perimeter = just_hull(W,
                                                  fill=fill,
                                                  label=label,
                                                  ax=ax,
                                                  fill_args=fill_args)

    representation = constraints((A, b), None)
    if Y is None:
        Y = simulate_from_constraints(representation)

    ax.scatter(Y[0], Y[1], label=r'$y$', s=100)

    if eta is None:
        eta = np.random.standard_normal(2)

    ax.arrow(0, 0, eta[0], eta[1], linewidth=5, head_width=0.05, fc='k')

    Vp, _, Vm = representation.pivots(eta, Y)[:3]

    Yperp = Y - (np.dot(eta, Y) / np.linalg.norm(eta)**2 * eta)

    if Vm == np.inf:
        Vm = 10000

    width_points = np.array([(Yperp + Vp * eta / np.linalg.norm(eta)**2),
                             (Yperp + Vm * eta / np.linalg.norm(eta)**2)])

    ax.plot(width_points[:, 0], width_points[:, 1], 'r--', linewidth=2)
    ax.scatter(width_points[:, 0],
               width_points[:, 1],
               label=r'${\cal V}$',
               s=150,
               marker='x',
               linewidth=2,
               c='k')

    return f, A, b, pairs, angles, perimeter
Example #8
0
def cone_with_slice(angles, which, fill_args={}, ax=None, label=None, Y=None):

    ax, poly, constraint, rays = cone_rays(angles,
                                           which,
                                           ax=ax,
                                           fill_args=fill_args)
    eta = rays[0]
    representation = constraints((constraint, np.zeros(2)), None)

    if Y is None:
        Y = simulate_from_constraints(representation)

    pyplot.scatter(Y[0], Y[1], s=100, label=label)
    ax.fill(poly[:, 0], poly[:, 1], label=r'$C(y)$', **fill_args)
    ax.arrow(0,
             0,
             eta[0] / 200.,
             eta[1] / 200.,
             label=r'$\eta$',
             linewidth=5,
             head_width=0.05,
             fc='k')

    Vp, _, Vm = representation.pivots(eta, Y)[:3]

    Yperp = Y - (np.dot(eta, Y) / np.linalg.norm(eta)**2 * eta)

    if Vm == np.inf:
        Vm = 10000

    width_points = np.array([(Yperp + Vp * eta / np.linalg.norm(eta)**2),
                             (Yperp + Vm * eta / np.linalg.norm(eta)**2)])

    ax.plot(width_points[:, 0], width_points[:, 1], 'r--', linewidth=2)
    ax.scatter(width_points[:, 0],
               width_points[:, 1],
               label=r'${\cal V}$',
               s=150,
               marker='x',
               linewidth=2,
               c='k')

    return ax, poly, constraint, rays
Example #9
0
def cone_with_arrow(angles, which, fill_args={}, ax=None, label=None, Y=None):

    ax, poly, constraint, rays = cone_rays(angles,
                                           which,
                                           ax=ax,
                                           fill_args=fill_args)
    eta = rays[0]
    representation = constraints((constraint, np.zeros(2)), None)
    if Y is None:
        Y = simulate_from_constraints(representation)
    pyplot.scatter(Y[0], Y[1], s=100, label=label)
    ax.fill(poly[:, 0], poly[:, 1], label=r'$C(y)$', **fill_args)
    ax.arrow(0,
             0,
             eta[0] / 200.,
             eta[1] / 200.,
             label=r'$\eta$',
             linewidth=5,
             head_width=0.05,
             fc='k')
    return ax, poly, constraint, rays
def hull_with_slice(W, fill=True, fill_args={}, label=None, ax=None,
                    Y=None,
                    eta=None):
    f, A, b, pairs, angles, perimeter = just_hull(W,
                                                  fill=fill,
                                                  label=label,
                                                  ax=ax,
                                                  fill_args=fill_args)
    
    representation = constraints((A,b), None)
    if Y is None:
        Y = simulate_from_constraints(representation)

    ax.scatter(Y[0], Y[1], label=r'$y$', s=100)

    if eta is None:
        eta = np.random.standard_normal(2)

    ax.arrow(0,0,eta[0],eta[1], linewidth=5, head_width=0.05, fc='k')

    Vp, _, Vm = representation.pivots(eta, Y)[:3]

    Yperp = Y - (np.dot(eta, Y) / 
                 np.linalg.norm(eta)**2 * eta)

    if Vm == np.inf:
        Vm = 10000

    width_points = np.array([(Yperp + Vp*eta /  
                              np.linalg.norm(eta)**2),
                             (Yperp + Vm*eta /  
                              np.linalg.norm(eta)**2)])

    ax.plot(width_points[:,0], width_points[:,1], 'r--', linewidth=2)
    ax.scatter(width_points[:,0], width_points[:,1], label=r'${\cal V}$', s=150, marker='x', linewidth=2, c='k')


    return f, A, b, pairs, angles, perimeter