| import numpy as np |
| from shapely.geometry import * |
| from shapely.affinity import * |
|
|
| from env_utils import get_obj_pos, get_obj_names |
| from ctrl_utils import put_first_on_second |
|
|
| |
| def get_total(xs): |
| return np.sum(xs) |
|
|
| |
| def eval_line(x, slope, y_intercept): |
| return x * slope + y_intercept |
|
|
| |
| def get_pt_to_the_left(pt, dist): |
| return pt + [-dist, 0] |
|
|
| |
| def get_pt_to_the_top(pt, dist): |
| return pt + [0, dist] |
|
|
| |
| def make_line_by_length(length): |
| line = LineString([[0, 0], [length, 0]]) |
| return line |
|
|
| |
| def make_vertical_line_by_length(length): |
| line = make_line_by_length(length) |
| vertical_line = rotate(line, 90) |
| return vertical_line |
|
|
| |
| def interpolate_line(line, t): |
| pt = line.interpolate(t, normalized=True) |
| return np.array(pt.coords[0]) |
|
|
| |
| line = make_line_by_length(1) |
| new_shape = scale(line, xfact=2, yfact=2) |
|
|
| |
| put_first_on_second('object1', 'object0') |
|
|
| |
| obj_names = get_obj_names() |
| pos_2d = get_obj_pos(obj_names[0]) |