---
# System prepended metadata

title: 'ICMA224: Project 1'
tags: [template]

---

---
tags: template
---

# ICMA224: Project 1
:::info
Name: `Tititan Wisitnonthachai`
Student ID: `6280302`
:::

## Project 1.1: Glide Reflection



### Task 1

Consider the following glide reflection:

![](https://i.imgur.com/onlleI5.png)

**After you run the given code, what results do you get?**

![](https://i.imgur.com/yNHhdEd.png)



**What is the matrix that gives this glide reflection? How do you obtain it mathematically? State explicitly all matrices involved.**

$A= \begin{pmatrix} 1 & 0 & 5 \\ 0 & -1 & 0 \\ 0 & 0 & 1 \end{pmatrix}$


**All your codes:**

pts = [(3.00000000000000, 6.21956426595685), (3.50707549289735, 6.20881238157487), (3.51782737727933, 7.00445182584115), (2.49639836099154, 6.98294805707719), (2.48564647660957, 6.24106803472080), (3.00000000000000, 6.21956426595685), (3.00000000000000, 4.81106741191790), (4.61451958424095, 5.58520308742022), (3.00000000000000, 4.81106741191790), (1.41045803841190, 4.33798449911092), (3.00000000000000, 4.81106741191790), (3.00000000000000, 3.67136766742837), (4.43173754974735, 2.37038965720918), (4.60376769985898, 2.48866038541093), (4.43173754974735, 2.37038965720918), (3.00000000000000, 3.67136766742837), (2.16308994515027, 2.00000000000000), (2.00000000000000, 2.00000000000000)]
pts = homog(pts)
P = matrix(pts).T
print('Dimension of P is ',P.dimensions())
pic = plotmat(P)
show(pic,gridlines=true,aspect_ratio=1,figsize=[3,3])

A = matrix(3,[
    [1,0,5],
    [0,-1,0],
    [0,0,1]])
#A = rotmat(pi/2)
#A = rotmat_affine(pi/2)
print('The matrix A is'); print(A)

P1 = A*P
pic = plotmat(P,P1,labels=['matrix P','matrix P1'])
show(pic,gridlines=true,aspect_ratio=1,figsize=[4,4])

### Task 2

Consider the following glide reflection:

![](https://i.imgur.com/MS3YLwV.png)

**After you run the given codes, what results do you get?**

![](https://i.imgur.com/jxlRYLR.png)



**What is the matrix that gives this glide reflection? How do you obtain it mathematically? State explicitly all matrices involved.**

As $A= \begin{pmatrix} 1 & 0 \\ 0 & -1  \end{pmatrix}$

Have to reflex on x-axis and $\begin{pmatrix} 5  \\ 0 \end{pmatrix}$ So, there are five units on x-axis,
and 0 for y-axis.

**All your codes:**

pts = [(3.00000000000000, 6.21956426595685), (3.50707549289735, 6.20881238157487), (3.51782737727933, 7.00445182584115), (2.49639836099154, 6.98294805707719), (2.48564647660957, 6.24106803472080), (3.00000000000000, 6.21956426595685), (3.00000000000000, 4.81106741191790), (4.61451958424095, 5.58520308742022), (3.00000000000000, 4.81106741191790), (1.41045803841190, 4.33798449911092), (3.00000000000000, 4.81106741191790), (3.00000000000000, 3.67136766742837), (4.43173754974735, 2.37038965720918), (4.60376769985898, 2.48866038541093), (4.43173754974735, 2.37038965720918), (3.00000000000000, 3.67136766742837), (2.16308994515027, 2.00000000000000), (2.00000000000000, 2.00000000000000)]
pts = homog(pts)
P = matrix(pts).T

A = matrix(3,[
[1,0,5],
[0,1,5],
[0,0,1]])
B = matrix(3,[
[1,-1, 5],
[1,1, 5],
[0,0,1]])
C = matrix(3,[
[1,1, 5],
[1,-1, 5],
[0,0,1]])
A2 = C*B^-1
P2 = A*P
P3 = A2*P2

name = 'Tititan' #<-- change this to yours, nickname is ok
sid = '6280302' #<-- change this to yours, must be student ID
txtstring = '{}\n{}'.format(name,sid)
txt = text(txtstring,(2,12),background_color='orange') #you may adjust the coordinates of your text where appropriate
pt1 = P2.columns()[3]
pt2 = P3.columns()[12]
print('glide reflection matrix = '); print(A2)
print('Check point 1 = ({} , {})'.format(pt1[0],pt1[1]))
print('Check point 2 = ({} , {})'.format(pt2[0],pt2[1]))
pic = plotmat(P,P2,P3,labels=['P','P2','P3'])
line = plot(x,(x,0,16),color='green',linestyle='--')
show(pic+line+txt,gridlines=True,aspect_ratio=1,figsize=[4,8],xmax=16)


---

## Project 1.2: Somersaulting Man

### Task 1

**After you run the given codes, what results do you get?**

![](https://i.imgur.com/1y1xSne.png)




**Explain how do you obtain each image. State explcitly all matrices involved.**

:writing_hand:
.
.
.
.


**All your codes:**

pts = [(0.,4.219564265956846) ,
(0.507075492897354,4.2088123815748695) ,
(0.5178273772793307,5.004451825841146) ,
(-0.5036016390084558,4.982948057077193) ,
(-0.5143535233904325,4.2410680347208) ,
(0.,4.219564265956846) , (0.,2.8110674119178967) ,
(1.614519584240954,3.58520308742022) ,
(0.,2.8110674119178967) ,
(-1.5895419615881026,2.337984499110921) ,
(0.,2.8110674119178967) , (0.,1.6713676674283648) ,
(1.4317375497473501 ,0.37038965720918243) ,
(1.6037676998589774 ,0.4886603854109263) ,
(1.4317375497473501 ,0.37038965720918243) ,
(0.,1.6713676674283648) , (-0.8369100548497336,0.) , (-1.,0.)
]
pts = homog(pts)
P = matrix(pts).T

A = matrix(3,[
    [1,0,0],
    [0,1,0],
    [0,0,1]])

B=rotmat_affine(-pi/2)

C=matrix(3,3,[1,0,3,0,1,5,0,0,1])

D=matrix(3,3,[1,0,12,0,1,9,0,0,1])

E=matrix(3,3,[1,0,20,0,1,6,0,0,1])

F=matrix(3,3,[1,0,23,0,1,0,0,0,1])

P1 = A*P

P2= B*P1
P3= C*P2

P4= B*P2
P5= D*P4

P6=B*P4
P7=E*P6

P8=B*P6
P9=F*P8

pt1 = P1.columns()[3]
pt2 = P1.columns()[10]
print('glide reflection matrix = '); print(A)
print('Check point 1 = ({} , {})'.format(pt1[0],pt1[1]))
print('Check point 2 = ({} , {})'.format(pt2[0],pt2[1]))
pic = plotmat(P,P1)
line = plot(0,(x,0,12),color='green',linestyle='--')
show(pic+line,gridlines=True,aspect_ratio=1,figsize=[4,8],xmax=12)

name = 'Tititan' #<-- change this to yours, nickname is ok
sid = '6280302' #<-- change this to yours, must be student ID
txtstring = '{}\n{}'.format(name,sid)
txt = text(txtstring,(2,12),background_color='orange') #you may adjust the coordinates of your text where appropriate
pt1 = P2.columns()[3]
pt2 = P3.columns()[12]
print('glide reflection matrix = '); print(A2)
print('Check point 1 = ({} , {})'.format(pt1[0],pt1[1]))
print('Check point 2 = ({} , {})'.format(pt2[0],pt2[1]))
pic = plotmat(P,P2,P3,labels=['P','P2','P3'])
line = plot(x,(x,0,16),color='green',linestyle='--')
show(pic+line+txt,gridlines=True,aspect_ratio=1,figsize=[4,8],xmax=16)

myname = 'Tititan' # Use your name, nickname is ok
myid = '6280302' # Use your student ID
txt = text('Created by: {}\n ID: {}'.format(myname,myid),(10,1),background_color='orange')
pic = plotmat(P,P3,P5,P7,P9) # your image
show(pic+txt,gridlines=True,aspect_ratio=1,figsize=[10,4])  # put text in picture


### Task 2

**After you run the given codes, what results do you get?**

![](https://i.imgur.com/GM8YKTn.png)



### Task 3

**After you run the given codes, what results do you get?**

![](https://i.imgur.com/ZehBveX.png)


**All your codes:**

pts = pts=[(0,1),(2,3),(0,1),(2,-1),(0,-1),(0,-3),(0,-1),(-2,-1),(-1,0),(-3,2),(-1,0),(0,1)]
pts = homog(pts)
P = matrix(pts).T

A = matrix(3,[
    [1,0,0],
    [0,1,0],
    [0,0,1]])

B=rotmat_affine(-pi/2)

C=matrix(3,3,[1,0,3,0,1,5,0,0,1])

D=matrix(3,3,[1,0,12,0,1,9,0,0,1])

E=matrix(3,3,[1,0,20,0,1,6,0,0,1])

F=matrix(3,3,[1,0,23,0,1,0,0,0,1])

P1 = A*P

P2= B*P1
P3= C*P2

P4= B*P2
P5= D*P4

P6=B*P4
P7=E*P6

P8=B*P6
P9=F*P8

pt1 = P1.columns()[3]
pt2 = P1.columns()[10]
print('glide reflection matrix = '); print(A)
print('Check point 1 = ({} , {})'.format(pt1[0],pt1[1]))
print('Check point 2 = ({} , {})'.format(pt2[0],pt2[1]))
pic = plotmat(P,P1)
line = plot(0,(x,0,12),color='green',linestyle='--')
show(pic+line,gridlines=True,aspect_ratio=1,figsize=[4,8],xmax=12)

myname = 'Tititan' # Use your name, nickname is ok
myid = '6280302' # Use your student ID
txt = text('Created by: {}\n ID: {}'.format(myname,myid),(10,1),background_color='orange')
pic = plotmat(P,P3,P5,P7,P9) # your image
show(pic+txt,gridlines=True,aspect_ratio=1,figsize=[10,4])  # put text in picture