Contact
CoCalc Logo Icon
StoreFeaturesDocsShareSupport News Sign UpSign In
| Download
Views: 48
Kernel: SageMath (stable)

Transformation

Sam Su

2/8/2018

# Create a polygon with given points. p1 = vector([0,0]) p2 = vector([0,1]) p3 = vector([1,1]) P = polygon([p1,p2,p3]) show(P)
Image in a Jupyter notebook
# Shear transformation A = Matrix([[1,3],[0,1]]) Q = polygon([A*p1,A*p2,A*p3],color="green") show(P+Q)
Image in a Jupyter notebook
# Translation v = vector([2,1]) Q = polygon([p1+v,p2+v,p3+v],color="green") show(P+Q)
Image in a Jupyter notebook
# Rotation theta = pi/6 A = Matrix([[cos(theta),-sin(theta)],[sin(theta),cos(theta)]]) Q = polygon([A*p1,A*p2,A*p3],color="green") show(P+Q)
Image in a Jupyter notebook
# Reflection theta = pi/6 A = Matrix([[cos(2*theta),sin(2*theta)],[sin(2*theta),-cos(2*theta)]]) Q = polygon([A*p1,A*p2,A*p3],color="green") show(P+Q)
Image in a Jupyter notebook
# Scaling A = Matrix([[2,0],[0,1/3]]) Q = polygon([A*p1,A*p2,A*p3],color="green") show(P+Q)
Image in a Jupyter notebook