{"id":166,"date":"2021-02-20T12:13:10","date_gmt":"2021-02-20T08:43:10","guid":{"rendered":"https:\/\/ashkankhodaverdi.com\/pr\/?p=166"},"modified":"2026-02-09T04:18:55","modified_gmt":"2026-02-09T00:48:55","slug":"matrix-wall","status":"publish","type":"post","link":"https:\/\/ashkankhodaverdi.com\/pr\/matrix-wall\/","title":{"rendered":"Matrix wall"},"content":{"rendered":"\n<figure class=\"wp-block-image size-large is-style-default\"><a href=\"https:\/\/ashkankhodaverdi.com\/pr\/wp-content\/uploads\/2021\/02\/wallmatrix-1.jpg\"><img fetchpriority=\"high\" decoding=\"async\" width=\"1920\" height=\"1080\" src=\"https:\/\/ashkankhodaverdi.com\/pr\/wp-content\/uploads\/2021\/02\/wallmatrix-1.jpg\" alt=\"\" class=\"wp-image-181\" srcset=\"https:\/\/ashkankhodaverdi.com\/pr\/wp-content\/uploads\/2021\/02\/wallmatrix-1.jpg 1920w, https:\/\/ashkankhodaverdi.com\/pr\/wp-content\/uploads\/2021\/02\/wallmatrix-1-600x338.jpg 600w, https:\/\/ashkankhodaverdi.com\/pr\/wp-content\/uploads\/2021\/02\/wallmatrix-1-300x169.jpg 300w, https:\/\/ashkankhodaverdi.com\/pr\/wp-content\/uploads\/2021\/02\/wallmatrix-1-150x84.jpg 150w, https:\/\/ashkankhodaverdi.com\/pr\/wp-content\/uploads\/2021\/02\/wallmatrix-1-768x432.jpg 768w, https:\/\/ashkankhodaverdi.com\/pr\/wp-content\/uploads\/2021\/02\/wallmatrix-1-1536x864.jpg 1536w\" sizes=\"(max-width: 1920px) 100vw, 1920px\" \/><\/a><\/figure>\n\n\n\n<p>This is the final project for Coursera course I&#8217;ve completed in December 2020.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large is-style-default\"><img decoding=\"async\" width=\"1470\" height=\"770\" src=\"https:\/\/ashkankhodaverdi.com\/pr\/wp-content\/uploads\/2021\/02\/1.png\" alt=\"\" class=\"wp-image-168\" srcset=\"https:\/\/ashkankhodaverdi.com\/pr\/wp-content\/uploads\/2021\/02\/1.png 1470w, https:\/\/ashkankhodaverdi.com\/pr\/wp-content\/uploads\/2021\/02\/1-600x314.png 600w, https:\/\/ashkankhodaverdi.com\/pr\/wp-content\/uploads\/2021\/02\/1-300x157.png 300w, https:\/\/ashkankhodaverdi.com\/pr\/wp-content\/uploads\/2021\/02\/1-150x79.png 150w, https:\/\/ashkankhodaverdi.com\/pr\/wp-content\/uploads\/2021\/02\/1-768x402.png 768w\" sizes=\"(max-width: 1470px) 100vw, 1470px\" \/><\/figure>\n\n\n\n<p>The process is summarized as follows: a network of points on a plane formed the first squares. The grids of the upper squares were formed by the tokenization of a random number and several &#8220;If conditions&#8221;. Eventually, the squares were swiped together.<br>I put the code here to find out exactly what I did.<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: python; light: false; title: ; toolbar: true; notranslate\" title=\"\">\nimport rhinoscriptsyntax as rs\nimport random as rnd\n\ndef PointMatrix(IMAX,JMAX,KMAX):\n\n    #set up empty list\n    ptList = &#x5B;]\n    ptDict = {}\n    \n    #loop to generate point values as a product of the loop counter\n    #save values in list\n    for i in range(IMAX):\n        for j in range(JMAX):\n            for k in range(KMAX):\n                #define x,y,z in terms of i,j,k\n                x = i #+ (i*i)#* 5 #+ (rnd.random()*3)#\n                y = j #* 3 #+ (rnd.random()*5)\n                z = k #+ (k*k)#* 5 #+ (rnd.random()*3)#\n                #save point values in dictionary\n                point = (x,y,z)\n                ptDict&#x5B;(i,j,k)] = point\n                #print out dictionary key:value pairs\n                #print (i,j,k), &#039;:&#039;, point\n                #render point in rhinospace\n                #rs.AddPoint(point)\n        \n    #main itteration\n    for i in range(IMAX):\n        for j in range(JMAX):\n            for k in range(KMAX):\n                if i &gt; 0 and j &gt; 0 and k &gt; 0:\n                    ####  CREATE GEOMETRY  ####\n                    #CREATE BACK CURVE\n                    crvBack = rs.AddCurve((ptDict&#x5B;(i-1,j,k-1)], ptDict&#x5B;(i,j,k-1)],\n                    ptDict&#x5B;(i,j,k)], ptDict&#x5B;(i-1,j,k)], ptDict&#x5B;(i-1,j,k-1)]),1)\n                    #CREATE FRONT CURVE\n                    #create construction surface to find grid of points\n                    srf = rs.AddSrfPt((ptDict&#x5B;(i-1,j-1,k-1)], ptDict&#x5B;(i,j-1,k-1)], \n                    ptDict&#x5B;(i,j-1,k)], ptDict&#x5B;(i-1,j-1,k)]))\n                    #rebuild surface to create 4 x 4 grid (9 quadrants)\n                    rs.RebuildSurface(srf, (3,3), (4,4))\n                    #extract points from grid\n                    pts = rs.SurfacePoints(srf)\n                    #call function to reveal order of points\n                    #numberPoints(pts)\n                    #delete construction surface\n                    rs.DeleteObject(srf)\n                    #generate random integer between 1 and 9 to select quadrant\n                    quadNum = rnd.randint(1,9)\n                    #use quadNum to create front rectangle and sweep profile\n                    if quadNum == 1:\n                        crvFront = rs.AddCurve((pts&#x5B;0],pts&#x5B;4],pts&#x5B;5],pts&#x5B;1],pts&#x5B;0]),1)\n                        profile = rs.AddLine(ptDict&#x5B;(i-1,j,k-1)], pts&#x5B;0])\n                    if quadNum == 2:\n                        crvFront = rs.AddCurve((pts&#x5B;1],pts&#x5B;5],pts&#x5B;6],pts&#x5B;2],pts&#x5B;1]),1)\n                        profile = rs.AddLine(ptDict&#x5B;(i-1,j,k-1)], pts&#x5B;1])\n                    if quadNum == 3:\n                        crvFront = rs.AddCurve((pts&#x5B;2],pts&#x5B;6],pts&#x5B;7],pts&#x5B;3],pts&#x5B;2]),1)\n                        profile = rs.AddLine(ptDict&#x5B;(i-1,j,k-1)], pts&#x5B;2])\n                    if quadNum == 4:\n                        crvFront = rs.AddCurve((pts&#x5B;4],pts&#x5B;8],pts&#x5B;9],pts&#x5B;5],pts&#x5B;4]),1)\n                        profile = rs.AddLine(ptDict&#x5B;(i-1,j,k-1)], pts&#x5B;4])\n                    if quadNum == 5:\n                        crvFront = rs.AddCurve((pts&#x5B;5],pts&#x5B;9],pts&#x5B;10],pts&#x5B;6],pts&#x5B;5]),1)\n                        profile = rs.AddLine(ptDict&#x5B;(i-1,j,k-1)], pts&#x5B;5])\n                    if quadNum == 6:\n                        crvFront = rs.AddCurve((pts&#x5B;6],pts&#x5B;10],pts&#x5B;11],pts&#x5B;7],pts&#x5B;6]),1)\n                        profile = rs.AddLine(ptDict&#x5B;(i-1,j,k-1)], pts&#x5B;6])\n                    if quadNum == 7:\n                        crvFront = rs.AddCurve((pts&#x5B;8],pts&#x5B;12],pts&#x5B;13],pts&#x5B;9],pts&#x5B;8]),1)\n                        profile = rs.AddLine(ptDict&#x5B;(i-1,j,k-1)], pts&#x5B;8])\n                    if quadNum == 8:\n                        crvFront = rs.AddCurve((pts&#x5B;9],pts&#x5B;13],pts&#x5B;14],pts&#x5B;10],pts&#x5B;9]),1)\n                        profile = rs.AddLine(ptDict&#x5B;(i-1,j,k-1)], pts&#x5B;9])\n                    if quadNum == 9:\n                        crvFront = rs.AddCurve((pts&#x5B;10],pts&#x5B;14],pts&#x5B;15],pts&#x5B;11],pts&#x5B;10]),1)\n                        profile = rs.AddLine(ptDict&#x5B;(i-1,j,k-1)], pts&#x5B;10])\n\n                    #add curves to list\n                    crvs = &#x5B;crvBack,crvFront]\n                    profile = &#x5B;profile]\n                    #create surface geometry\n                    rs.AddSweep2(crvs, profile)\n                    \ndef numberPoints(points):\n    for i in range(len(points)):\n        #rs.AddPoint(points&#x5B;i])\n        rs.AddTextDot(i, points&#x5B;i])\n            \ndef main():\n    \n    #get values from user\n    imax = rs.GetInteger(&#039;Enter x&#039;, 5)\n    jmax = rs.GetInteger(&#039;Enter y&#039;, 2)\n    kmax = rs.GetInteger(&#039;Enter z&#039;, 5)\n    \n    rs.EnableRedraw(False)\n    PointMatrix(imax,jmax,kmax)\n    rs.EnableRedraw(True)\n    \n#call main() function to start program\nmain()\n\n\n<\/pre><\/div>\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>This is the final project for Coursera course I&#8217;ve completed in December 2020. The process is summarized as follows: a&hellip; <\/p>\n","protected":false},"author":1,"featured_media":172,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_price":"","_stock":"","_tribe_ticket_header":"","_tribe_default_ticket_provider":"","_ticket_start_date":"","_ticket_end_date":"","_tribe_ticket_show_description":"","_tribe_ticket_show_not_going":false,"_tribe_ticket_use_global_stock":"","_tribe_ticket_global_stock_level":"","_global_stock_mode":"","_global_stock_cap":"","_tribe_rsvp_for_event":"","_tribe_ticket_going_count":"","_tribe_ticket_not_going_count":"","_tribe_tickets_list":"[]","_tribe_ticket_has_attendee_info_fields":false,"h5ap_radio_sources":[],"footnotes":""},"categories":[33],"tags":[],"class_list":["post-166","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-architecture"],"_links":{"self":[{"href":"https:\/\/ashkankhodaverdi.com\/pr\/wp-json\/wp\/v2\/posts\/166","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/ashkankhodaverdi.com\/pr\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/ashkankhodaverdi.com\/pr\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/ashkankhodaverdi.com\/pr\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/ashkankhodaverdi.com\/pr\/wp-json\/wp\/v2\/comments?post=166"}],"version-history":[{"count":8,"href":"https:\/\/ashkankhodaverdi.com\/pr\/wp-json\/wp\/v2\/posts\/166\/revisions"}],"predecessor-version":[{"id":183,"href":"https:\/\/ashkankhodaverdi.com\/pr\/wp-json\/wp\/v2\/posts\/166\/revisions\/183"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/ashkankhodaverdi.com\/pr\/wp-json\/wp\/v2\/media\/172"}],"wp:attachment":[{"href":"https:\/\/ashkankhodaverdi.com\/pr\/wp-json\/wp\/v2\/media?parent=166"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/ashkankhodaverdi.com\/pr\/wp-json\/wp\/v2\/categories?post=166"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/ashkankhodaverdi.com\/pr\/wp-json\/wp\/v2\/tags?post=166"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}