Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

A03 ana ascic #76

Open
wants to merge 6 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
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
32 changes: 32 additions & 0 deletions lecture_02/assignment_01/ana-ascic/assignment_01.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
from compas.artists import Artist
from compas.datastructures import Mesh
from compas.geometry import Box
from compas.geometry import Frame
from compas.geometry import Plane
from compas.geometry import Projection
from compas.geometry import Vector

# Define a Frame, which is not in the origin and a bit tilted to the world frame
frame = Frame.from_points([1, 1, 0], [1, 0, -0.1], [2, 1, 0.1])

# Create a Box with that frame
box = Box(frame, 1, 1, 1) # xsize, ysize, zsize

# Create a Projection (can be orthogonal, parallel or perspective)
projection_plane = Plane([0, 0, 0], [0, 0, 1])
P = Projection.from_plane_and_direction(projection_plane, [0, 0, 1])

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

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

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

# Draw and all to a list
artist1.draw()
artist2.draw_edges(color="#00ff00")
Loading