Exemplo n.º 1
0
def cutting_plane(mesh, ry=10, rz=-50):
    plane = Plane(mesh.centroid(), Vector(1, 0, 0))
    Ry = Rotation.from_axis_and_angle(Vector(0, 1, 0), radians(ry),
                                      plane.point)
    Rz = Rotation.from_axis_and_angle(Vector(0, 0, 1), radians(rz),
                                      plane.point)
    plane.transform(Rz * Ry)
    return plane
Exemplo n.º 2
0
T = Translation([-xmin, -ymin, -zmin])

mesh.transform(T)

# ==============================================================================
# Cutting plane YZ (rotated over 30 deg)
# ==============================================================================

plane = Plane(mesh.centroid(), Vector(1, 0, 0))

Ry = Rotation.from_axis_and_angle(Vector(0, 1, 0), radians(10), plane.point)
Rz = Rotation.from_axis_and_angle(Vector(0, 0, 1), radians(-50), plane.point)

T = Translation([3, 0, 0])

plane.transform(T * Rz * Ry)

# ==============================================================================
# Compute intersections
# ==============================================================================

intersections = []

for u, v in list(mesh.edges()):
    a = mesh.vertex_attributes(u, 'xyz')
    b = mesh.vertex_attributes(v, 'xyz')
    x = intersection_segment_plane((a, b), plane)
    if not x:
        continue
    L_ax = length_vector(subtract_vectors(x, a))
    L_ab = length_vector(subtract_vectors(b, a))