Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 35 additions & 0 deletions lecture_02/assignment_01/tiziano_derme/assignment_01.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
"""Assignment 01: Project box to xy-plane
"""
from compas.geometry import Box
from compas.geometry import Frame
from compas.geometry import Projection
from compas.artists import Artist
from compas.datastructures import Mesh
from compas.geometry import Plane

# Define a Frame, which is not in the origin and a bit tilted to the world frame
frame = Frame([2, 2, 2], [0.978, 0.010, -0.210], [0.090, 0.882, 0.463])


# Create a Box with that frame
box = Box(frame, 1.5, 1.5, 1.5)

# Create a Projection (can be orthogonal, parallel or perspective)
point = [0,0,0]
normal = [0,0,1]
plane = Plane(point, normal)
P = Projection.from_plane(plane)

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

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

# Create artists
artist1 = Artist(box)
artist2 = Artist(mesh_projected)

# Draw
artist1.draw()
artist2.draw_edges(color="#00ff00")