예제 #1
0
def vec_and_step(tang, W):
    (begin, end) = utils.get_line_ends(0, 0, W, tang)
    (x_vec, y_vec) = (end[0] - begin[0], end[1] - begin[1])
    length = math.hypot(x_vec, y_vec)
    (x_norm, y_norm) = (x_vec / length, y_vec / length)
    step = length / W
    return (x_norm, y_norm, step)
예제 #2
0
def vec_and_step(tang, W):
    (begin, end) = utils.get_line_ends(0, 0, W, tang)
    (x_vec, y_vec) = (end[0] - begin[0], end[1] - begin[1])
    length = math.hypot(x_vec, y_vec)
    (x_norm, y_norm) = (x_vec / length, y_vec / length)
    step = length / W

    return (x_norm, y_norm, step)
예제 #3
0
def ortho_vec_and_step(tang, W):
    ortho_tang = -1.0 / tang
    (ortho_begin, ortho_end) = utils.get_line_ends(0, 0, W, ortho_tang)
    (x_vec, y_vec) = (ortho_end[0] - ortho_begin[0], ortho_end[1] - ortho_begin[1])
    length = math.hypot(x_vec, y_vec)
    (x_norm, y_norm) = (x_vec / length, y_vec / length)
    step = length / W

    print (x_norm, y_norm, step)
    return (x_norm, y_norm, step)