point = [0, 0, 0]
normal = [0, 0, -1]
plane = Plane(point, normal)
direction = [2, -2, 1]
P = Projection.from_plane_and_direction(plane, direction)

# Create a Mesh from the Box
mesh = Mesh.from_shape(box)
tmesh = Mesh.from_shape(box_transformed)

# Apply the Projection onto the mesh
mesh_projected = tmesh.transformed(P)

# clear layer
artist = BoxArtist(box, layer="Default")
artist.clear_layer()

# defining Artists
artist1 = BoxArtist(box)
artist2 = BoxArtist(box_transformed)
artist3 = MeshArtist(mesh_projected)
artist4 = FrameArtist(frame, scale=1.0)
artist5 = FrameArtist(frame1, scale=1.0)

# Draw
artist1.draw()
artist2.draw()
artist3.draw_edges(color="#00ffff")
artist4.draw()
artist5.draw()
Пример #2
0
"""
width, length, height = 1, 1, 8
box = Box(F, width, length, height)

#create projection
projection_plane = Plane([0, 0, 0], [0, 0, 1])  #world XY plane
P = Projection.from_plane(projection_plane)  #orthogonal projection

print("Projection:\n", P)
"""
CREATE PROJECTED MESH
"""
mesh_01 = Mesh.from_shape(box)
projected_mesh = mesh_01

try:
    projected_mesh.transform(P)
except:
    print("Something went wrong with the projection")
"""
ARTISTS
"""
artist_01 = BoxArtist(box, layer='box')
artist_02 = MeshArtist(mesh_01, layer='box::projection edges')

artist_01.clear_layer()
artist_02.clear_layer()

artist_01.draw()
artist_02.draw_edges(color="#00ff00")