Question: Optical illusions: Drawing A Hole in Line Paper

I am interested and intrigued by optical illusions, such as that entitled 'Drawing A Hole in Line Paper

 - 3D Trick Art' by artist Jonathan Stephen Harris. Check out this YouTube video  to appreciate the following. Not being good at art, I tried to replicate this illusion using Maple..  The program below is merely a start towards this goal.  I have a procedure which draws the outline of the letter A.  Different letters have different peculiarities: I chose the letter A since it is relatively easy in that it does not have curves.  It does have a triangular region, so I created a separate procedure for that.  The whole letter A can be rotated through an angle phi.   Also I have drawn a grid of parallelograms for use as the lines drawn on the paper - but this I think has bugs. .

     The method I have used is rather long and messy, just using coordinate geometry, for the vertex points of the A, then rotating them through an angle phi.   Also in the program is a grid of parallelograms, for use in drawing the lines across the page.  That's as far as I've got.  Major problems I foresee is seeing/calculating where these lines meet the outline of the letter A, where vertical lines would be drawn.  Also, the artist draws in shading - how can that be done in Maple?  My attempt at the task has brought up some issues that there must be a simpler, better method of doing this.  eg first put the coords in a vector, and use matrix multiplication to calculate the new coords.  My method is long and error prone. 

   I'd appreciate some feedback about any attempts similar to this.  In my program I tried to fill the color of the polygon which was the boundary of the A, but it filled in the base trapezoidal region as well.  On top of that I failed to color the small triangular region a different color.  As always, any help or suggestions would be gratefully received. 






# nrows= Number of rows ncols is one more than nrows


#Width, w, and length, l, of sides of the parallelograms/polygons c[i,j]



for i from 0 to nrows do

  for j from 0 to ncols do

#c[i,j] := rectangle([i+1,j], [i,j+1], color=red):

c[i,j] := polygon([[x0,y0],[x0+i*w*cos(psi),y0+i*w*sin(psi)],[x0+i*w*cos(psi)+j*l*cos(theta),y0+i*w*sin(psi)+j*l*sin(theta)], [x0+j*l*cos(theta),y0+j*l*sin(theta)]], filled=true,color=red):


  end do:

end do:

plots[display](seq(seq(c[i,j], j=0..ncols),i=0..nrows), scaling=constrained);


#for i from 0 to nrows do

#  for j from 0 to ncols do

   #c[i,j] := rectangle([j+1,i], [j,i+1], color=white):

#  end do;

#end do;

#pl1:=plots[display](seq(seq(c[j,i], i=0..ncols),j=0..nrows), scaling=constrained):

pl1:=plots[display](seq(seq(c[i,j], i=0..ncols),j=0..nrows), scaling=constrained):




# To draw the letter A

# Using proc poly_out:  also to put in initial coords (x0,y0) of lower left foot of A, then rotate the letter A through an angle of phi


# thet is angle the left "diagonal" makes with the horizontal.

# l is the length of the diagonals - ie the left and right hand sloping sides of the letter A

# w is width of the feet of the letter A.  (Both equal width)

# topl is the "top length" of the horizontal top part of the letter A.

# (x0, y0) are the coords of the bottom left point of the letter A.

# phi is the anti-clockwise angle of rotation about (0,0)


poly_out:=proc(thet,l,w, topl, x0, y0, phi)

local outA, outAr,trig, trigr,D,E,F,G, corr, eps:




trig:=polygon([[x0+(2*l*cos(thet)+topl)/2, y0+l*sin(thet)-eps],[x0+w+(l/3+corr*w)*cos(thet), y0+(l/3+corr*w)*sin(thet)],[x0+2*l*cos(thet)+topl-w-(l/3+corr*w)*cos(thet), y0+(l/3+corr*w)*sin(thet)]]):


trigr:=polygon([[(x0+(2*l*cos(thet)+topl)/2)*cos(phi)-(y0+l*sin(thet)-eps)*sin(phi),(x0+(2*l*cos(#thet)+topl)/2)*sin(phi)+(y0+l*sin(thet)-eps)*cos(phi)],[(x0+w+(l/3+corr*w)*cos(thet))*cos(phi)-(y#0+(l/3+corr*w)*sin(thet))*sin(phi),(x0+w+(l/3+corr*w)*cos(thet))*sin(phi)+(y0+(l/3+corr*w)*sin(th#et))*cos(phi)],[(x0+2*l*cos(thet)+topl-w-(l/3+corr*w)*cos(thet))*cos(phi)-(y0+(l/3+corr*w)*sin(th#et))*sin(phi),(x0+2*l*cos(thet)+topl-w-(l/3+corr*w)*cos(thet))*sin(phi)+( #y0+(l/3+corr*w)*sin(thet))*cos(phi)]], color=white,filled=true):


outA:=polygon([[x0,y0],[x0+l*cos(thet),y0+l*sin(thet)],[x0+l*cos(thet),y0+l*sin(thet)],[x0+l*cos(thet)+topl,y0+l*sin(thet)],[x0+2*l*cos(thet)+topl,y0], [x0+2*l*cos(thet)+topl-w,y0],[x0+5*l*cos(thet)/3+topl-w,y0+l*sin(thet)/3],[x0+l*cos(thet)/3+w,y0+l*sin(thet)/3], [x0+w,y0]]):


outAr:=polygon([[x0*cos(phi)-y0*sin(phi),x0*sin(phi)+y0*cos(phi)],[(x0+l*cos(thet))*cos(phi)-(y0+l*sin(thet))*sin(phi),(x0+l*cos(thet))*sin(phi)+(y0+l*sin(thet))*cos(phi)],[(x0+l*cos(thet))*cos(phi)-(y0+l*sin(thet))*sin(phi),(x0+l*cos(thet))*sin(phi)+(y0+l*sin(thet))*cos(phi)],[(x0+l*cos(thet)+topl)*cos(phi)-(y0+l*sin(thet))*sin(phi),(x0+l*cos(thet)+topl)*sin(phi)+(y0+l*sin(thet))*cos(phi)],[(x0+2*l*cos(thet)+topl)*cos(phi)-y0*sin(phi),(x0+2*l*cos(thet)+topl)*sin(phi)+y0*cos(phi)], [(x0+2*l*cos(thet)+topl-w)*cos(phi)-y0*sin(phi),(x0+2*l*cos(thet)+topl-w)*sin(phi)+y0*cos(phi)],


[(x0+l*cos(thet)/3+w)*cos(phi)-(y0+l*sin(thet)/3)*sin(phi),(x0+l*cos(thet)/3+w)*sin(phi)+(y0+l*sin(thet)/3)*cos(phi)], [(x0+w)*cos(phi)-y0*sin(phi),(x0+w)*sin(phi)+y0*cos(phi)]], color=grey,filled=true):




plots[display](outAr,trigr, axes=none, scaling=constrained);  # view=[-l..l,-l..l]);

#outA & trig removed from display – these give the `upright` #letter A

end proc:

plot1:=poly_out(Pi/3,15,3,3, 0,0, Pi/15):

plots[display](plot1, pl1);

Please Wait...