def surface_calc(upper_board, lower_board, intersection):
        vec1 = Vector(lower_board.length_vector[0], lower_board.length_vector[1], lower_board.length_vector[2])
        vec2 = Vector(upper_board.length_vector[0], upper_board.length_vector[1], upper_board.length_vector[2])
        if upper_board.width > 10:
            ang = vec1.angle(vec2)
            print("stop")
        if vec1.angle(vec2) > 0.5:
            len_intersection = lower_board.width
            wid_intersection = upper_board.width
        else:
            # for now we assume that they are parallel in this case, potential error source for later, though
            print("parallel ones")
            len_intersection = min(upper_board.length, lower_board.length)
            wid_intersection = min(upper_board.width, lower_board.width)

        dim1 = scale_vector(upper_board.length_vector, len_intersection*.5)
        dim2 = scale_vector(upper_board.width_vector, wid_intersection*.5)

        # this procedure is necessary only because of the glue path planning to make sure points are always ordered clockwise
        ang = angle_vectors_signed(dim1, dim2, Vector(0, 0, 1))
        if ang > 0:
            pt1 = intersection + dim1 - dim2
            pt2 = intersection + dim1 + dim2
            pt3 = intersection - dim1 + dim2
            pt4 = intersection - dim1 - dim2
        else:
            pt1 = intersection - dim1 + dim2
            pt2 = intersection + dim1 + dim2
            pt3 = intersection + dim1 - dim2
            pt4 = intersection - dim1 - dim2

        intersection_surf = Polygon([pt1, pt2, pt3, pt4])
        return intersection_surf
    def board_intersection(brd1, brd2):
        vec1 = Vector(brd1.length_vector[0], brd1.length_vector[1], brd1.length_vector[2])
        vec2 = Vector(brd2.length_vector[0], brd2.length_vector[1], brd2.length_vector[2])
        line1 = line_creator(brd1.centre_point, vec1, brd1.length)
        line2 = line_creator(brd2.centre_point, vec2, brd2.length)

        # to check whether the boards are parallel
        if vec1.angle(vec2) > 0.1:
            int_pt = intersection_line_line_xy(line1, line2)
        else:
            target_width = min(brd1.width, brd2.width)
            upper_boarder_1 = brd1.centre_point + brd1.width_vector*brd1.width
            lower_boarder_1 = brd1.centre_point

            # expand here later to deal with gluing parallel boards
            return 0
        # since intersection also hits when the lines intersect in their continuation, we have to add that one
        if distance_point_point(brd1.centre_point, int_pt) < brd1.length / 2 and \
            distance_point_point(brd2.centre_point, int_pt) < brd2.length / 2:
            return int_pt
        else:
            return 0
예제 #3
0
파일: cross_1b.py 프로젝트: tetov/ITA19
from compas.geometry import Vector

u = Vector(1.0, 0.0, 0.0)
v = Vector(0.0, 1.0, 0.0)

uxv = u.cross(v)

u_uxv = u.angle(uxv)
v_uxv = v.angle(uxv)

print(u_uxv)
print(v_uxv)
예제 #4
0
파일: cross_2b.py 프로젝트: tetov/ITA19
from compas.geometry import Vector

u = Vector(1.0, 0.0, 0.0)
v = Vector(0.0, 1.0, 0.0)

uxv = u.cross(v)

print(u.angle(v))
print(v.angle(u))