server.py
def generate_sample_points(points_X, points_Y):
    '''Generate 100 sampled points for a gesture.

    In this function, we should convert every gesture or template to a set of 100 points, such that we can compare
    the input gesture and a template computationally.

    :param points_X: A list of X-axis values of a gesture.
    :param points_Y: A list of Y-axis values of a gesture.

    :return:
        sample_points_X: A list of X-axis values of a gesture after sampling, containing 100 elements.
        sample_points_Y: A list of Y-axis values of a gesture after sampling, containing 100 elements.
    '''
    sample_points_X, sample_points_Y = [], []
    # TODO: Start sampling (12 points)

    # Calculate the euclidean distance between consecutive points
    distance = np.sqrt(np.ediff1d(points_X, to_begin=0) ** 2 + np.ediff1d(points_Y, to_begin=0) ** 2)
    # Calculate the cumulative distance
    cumulative_distance = np.cumsum(distance)
    # Normalize the cumulative distance between 0 and 1
    total_distance = cumulative_distance[-1]
    cumulative_distance_norm = cumulative_distance / total_distance

    # Interpolate numbers into 1-D space for both X and Y
    interp1d_X = interp1d(cumulative_distance_norm, points_X, kind='linear')
    interp1d_Y = interp1d(cumulative_distance_norm, points_Y, kind='linear')

    # Create the sample points for X and Y
    sample_points_X, sample_points_Y = interp1d_X(evenly_spaced_100_numbers), interp1d_Y(evenly_spaced_100_numbers)
    return sample_points_X, sample_points_Y
Generate 100 sampled points for a gesture.

    In this function, we should convert every gesture or template to a set of 100 points, such that we can compare
    the input gesture and a template computationally.

    :param points_X: A list of X-axis values of a gesture.
    :param points_Y: A list of Y-axis values of a gesture.

    :return:
        sample_points_X: A list of X-axis values of a gesture after sampling, containing 100 elements.
        sample_points_Y: A list of Y-axis values of a gesture after sampling, containing 100 elements.
    
Generate 100 sampled points for a gesture.
In this function, we should convert every gesture or template to a set of 100 points, such that we can compare
the input gesture and a template computationally.
Generate 100 sampled points for a gesture . In this function we should convert every gesture or template to a set of 100 points such that we can compare the input gesture and a template computationally .
def generate_sample_points(points_X, points_Y):
    sample_points_X, sample_points_Y = [], []
    distance = np.sqrt(np.ediff1d(points_X, to_begin=0) ** 2 + np.ediff1d(points_Y, to_begin=0) ** 2)
    cumulative_distance = np.cumsum(distance)
    total_distance = cumulative_distance[-1]
    cumulative_distance_norm = cumulative_distance / total_distance
    interp1d_X = interp1d(cumulative_distance_norm, points_X, kind='linear')
    interp1d_Y = interp1d(cumulative_distance_norm, points_Y, kind='linear')
    sample_points_X, sample_points_Y = interp1d_X(evenly_spaced_100_numbers), interp1d_Y(evenly_spaced_100_numbers)
    return sample_points_X, sample_points_Y
def generate_sample_points ( points_X , points_Y ) : sample_points_X , sample_points_Y = [ ] , [ ] distance = np . sqrt ( np . ediff1d ( points_X , to_begin = 0 ) ** 2 + np . ediff1d ( points_Y , to_begin = 0 ) ** 2 ) cumulative_distance = np . cumsum ( distance ) total_distance = cumulative_distance [ - 1 ] cumulative_distance_norm = cumulative_distance / total_distance interp1d_X = interp1d ( cumulative_distance_norm , points_X , kind = 'linear' ) interp1d_Y = interp1d ( cumulative_distance_norm , points_Y , kind = 'linear' ) sample_points_X , sample_points_Y = interp1d_X ( evenly_spaced_100_numbers ) , interp1d_Y ( evenly_spaced_100_numbers ) return sample_points_X , sample_points_Y
Generate 100 sampled points for a gesture.
Generate 100 sampled points for a gesture .
'''Generate 100 sampled points for a gesture.

    In this function, we should convert every gesture or template to a set of 100 points, such that we can compare
    the input gesture and a template computationally.

    :param points_X: A list of X-axis values of a gesture.
    :param points_Y: A list of Y-axis values of a gesture.

    :return:
        sample_points_X: A list of X-axis values of a gesture after sampling, containing 100 elements.
        sample_points_Y: A list of Y-axis values of a gesture after sampling, containing 100 elements.
    ''' # TODO: Start sampling (12 points) # Calculate the euclidean distance between consecutive points # Calculate the cumulative distance # Normalize the cumulative distance between 0 and 1 # Interpolate numbers into 1-D space for both X and Y # Create the sample points for X and Y
A list of X-axis values of a gesture after sampling, containing 100 elements.
sample_points_Y: A list of Y-axis values of a gesture after sampling, containing 100 elements.
A list of X - axis values of a gesture after sampling containing 100 elements . sample_points_Y : A list of Y - axis values of a gesture after sampling containing 100 elements .
points_X
A list of X-axis values of a gesture.
A list of X - axis values of a gesture .
points_Y
A list of Y-axis values of a gesture.
A list of Y - axis values of a gesture .