從turtle海龜動畫 學習 Python - 高中彈性課程系列 10 藝術畫 紫雨無聲落下 自定義海龜形狀

46 篇文章 1 订阅
32 篇文章 1 订阅

Goal: 藉由有趣的「海龜繪圖」學會基礎的 Python 程式設計
本篇著重在以 Python 海龜繪圖模擬藝術圖形, 線條藝術, 板塊藝術, 紫雨無聲落下, 等, 以及與生成式藝術的關聯.

在这里插入图片描述

“Talk is cheap. Show me the code.”
― Linus Torvalds

老子第41章
上德若谷
大白若辱
大方無隅
大器晚成
大音希聲
大象無形
道隱無名

拳打千遍, 身法自然

“There’s no shortage of remarkable ideas, what’s missing is the will to execute them.” – Seth Godin
「很棒的點子永遠不會匱乏,然而缺少的是執行點子的意志力。」—賽斯.高汀

高中彈性課程系列

本系列文章之連結

  • 從turtle海龜動畫學習Python-高中彈性課程1 link

  • 從turtle海龜動畫 學習 Python - 高中彈性課程系列 2 安裝 Python, 線上執行 Python link

  • 從turtle海龜動畫 學習 Python - 高中彈性課程系列 3 烏龜繪圖 所需之Python基礎 link

  • 從turtle海龜動畫 學習 Python - 高中彈性課程系列 4 烏龜開始畫圖 link

  • 從turtle海龜動畫 學習 Python - 高中彈性課程系列 5 用函數封裝重複性指令-呼叫函數令烏龜畫正 n 邊形 link

  • 從turtle海龜動畫 學習 Python - 高中彈性課程系列 6 畫多重旋轉圓,螺旋正方形 link

  • 從turtle海龜動畫 學習 Python - 7 遞歸 recursive - 高中彈性課程系列 link

  • 從turtle海龜動畫 學習 Python - 高中彈性課程系列 8 碎形 (分形 fractal) link

  • 從turtle海龜動畫 學習 Python - 高中彈性課程系列 8.1 碎形 L-system link

  • 從turtle海龜動畫 學習 Python - 高中彈性課程系列 9 Python 物件導向介紹 link

  • 從turtle海龜動畫 學習 Python - 高中彈性課程系列 9.1 Python 物件導向的練習 link

  • 從turtle海龜動畫 學習 Python - 高中彈性課程系列 10 藝術畫 自定義海龜形狀 link

  • 從turtle海龜動畫 學習 Python - 高中彈性課程系列 10.1 藝術畫 python繪製天然雪花結晶 https://blog.csdn.net/m0_47985483/article/details/122262036 link

  • 從turtle海龜動畫 學習 Python - 高中彈性課程系列 10.2 藝術畫 Python 製作生成式藝術 link

  • 從turtle海龜動畫 學習 Python - 高中彈性課程系列 11.1 氣泡排序 - 用 turtle 呈現演算法之執行動作 link

  • 從turtle海龜動畫 學習 Python - 高中彈性課程系列 11.2 maze 迷宮 - 用 turtle 呈現演算法之執行動作 link

  • 從turtle海龜動畫 學習 Python - 高中彈性課程系列 11.3 連分數演算法與轉轉相除法- 用 turtle 呈現演算法之執行動作 link

  • 從turtle海龜動畫 學習 Python - 高中彈性課程系列 11.4 最短路徑 Dijkstra- 用 turtle 呈現演算法之執行動作 link



(原 part2 之後面 藝術畫部分)

12. 海龜繪圖與藝術畫

Ref: 使用python成为藝術家, https://my.oschina.net/u/4531265/blog/4278176 link

Ref: python图形绘制库turtle中文开发文档及示例大全
https://blog.csdn.net/A757291228/article/details/105884899 link

12.1 海龜繪圖畫 隨機線段 藝術

平行線段的版本

random lines_parallel_水平_參考自R

# Ref: A Guide to the TurtleGraphics Package for R_入門例子
# random lines
# By Prof. P-J Lai MATH NKNU 20201012
# parallel or angle 30 版本

import turtle
import random

T = turtle.Turtle()
T.shape('turtle')
T.speed(0)
T.pensize(5)
turtle.bgcolor('black')
#turtle.tracer(0,0)
T.lt(30)

for i in range(200):
    T.penup()
    T.goto(random.randint(-500,100),random.randint(-400,400))
    T.pendown()
    T.pencolor(random.random(),random.random(),random.random())
    T.fillcolor('green')
    
    T.fd(500)
    #T.lt(random.randint(0,360))
線段的角度是隨機的版本

randomLines_pensize3_PythonTurtle_1
背景調成黑色
randomLines_pensize3_bgcolor_black_PythonTurtle_1

# random lines
# By Prof. P-J Lai MATH NKNU 20201012

import turtle
import random

T = turtle.Turtle()
T.shape('turtle')
T.speed(0)
T.pensize(2)
turtle.tracer(0,0)

for i in range(500):
    T.penup()
    T.goto(random.randint(-300,300),random.randint(-300,300))
    T.pendown()
    T.pencolor(random.random(),random.random(),random.random())
    T.fillcolor('green')
    
    T.fd(500)
    T.lt(random.randint(0,360))
 
長度, 粗細, 也隨機

random lines_randomWidth_randomLength_5

# Ref: A Guide to the TurtleGraphics Package for R_入門例子
# random lines
# By Prof. P-J Lai MATH NKNU 20201012

import turtle
import random

T = turtle.Turtle()
T.shape('turtle')
T.speed(0)
T.fillcolor('green')
T.pensize(3)
turtle.bgcolor('black')
#turtle.tracer(0,0)
penSizeList = [1,2,3,4,5]

for i in range(600):
    T.penup()
    T.goto(random.randint(-400,400),random.randint(-400,400))
    T.pendown()
    T.pensize(random.choice(penSizeList))
    T.pencolor(random.random(),random.random(),random.random())

    #T.fd(500)
    T.fd(random.randint(50,600))
    T.lt(random.randint(0,360))
    
    

12.2 海龜繪圖畫 板塊藝術: 蓋章, 定義海龜形狀

此例子, 主要用到海龜蓋章的指令!
此例子, 也用到自定義海龜形狀的指令!

以下用 Logo繪製之板塊藝術, 參考自 BFOIT
Introduction to Computer Programming
ref: http://guyhaas.com/bfoit/itp/Operators.html
link

Introduction to Computer Programming_板塊藝術
我們試著用 Python 實作

以下是試做第一次之簡易版

流程設計:

先定義自己的板塊形狀用 turtle.Shape(“compound”)
  • 畫筆要先提起, 隨機跳躍, 再蓋章, 重複幾次
    下圖是蓋章200次的結果

PythonTurtle板塊藝術_試做1

先定義自己的烏龜形狀, 改成長方形:
用 turtle.Shape(“compound”)
(以下用 s=turtle.Shape(“compound”) 太複雜, 後面會改成用 get_poly()的方法)

>>> import turtle
>>> T=turtle.Turtle()
>>> s=turtle.Shape("compound")
>>> poly1=((0,0),(10,0),(10,15),(0,15))
>>> s.addcomponent(poly1,"red","blue")
>>> turtle.register_shape("myshape",s)
>>> T.shape("myshape")
>>> T.fd(200)
進行畫筆先提起, 隨機跳躍, 再放下畫筆, 蓋章, 重複幾次
>>> T.penup()
>>> import random
>>> T.goto(random.randint(1,200),random.randint(1,200))
>>> T.stamp()
(7,)
>>> T.goto(random.randint(1,200),random.randint(1,200))
>>> T.stamp()
(8,)
>>> T.goto(random.randint(1,200),random.randint(1,200))
>>> T.goto(random.randint(1,200),random.randint(1,200))
>>> T.stamp()
(9,)
>>> T.goto(random.randint(1,200),random.randint(1,200))
>>> T.stamp()
(10,)
>>> T.goto(random.randint(1,200),random.randint(1,200))

寫成一個函數

polygon_art_1.py

import turtle
T=turtle.Turtle()
s=turtle.Shape("compound")
poly1=((0,0),(10,0),(10,15),(0,15))
s.addcomponent(poly1,"red","blue")
turtle.register_shape("myshape",s)
T.shape("myshape")
T.penup()

import random
for i in range(200):
    T.goto(random.randint(-200,200),random.randint(-200,200))
    T.stamp()

以下將板塊加大, 改成正方形,
PythonTurtle板塊藝術_試做2_加大

import turtle
T=turtle.Turtle()
s=turtle.Shape("compound")
poly1=((0,0),(50,0),(50,50),(0,50))
s.addcomponent(poly1,"red","blue")
turtle.register_shape("myshape",s)
T.shape("myshape")
T.penup()

import random
for i in range(100):
    T.goto(random.randint(-200,200),random.randint(-200,200))
    T.stamp()
以下改成用 get_poly() 方法定義形狀 並改成隨機顏色

發現用 compound shape 可以結合數個多邊形, 但是顏色似乎不好更改,

以下改成用
get_poly() 的方法
用法,
如果只有一個形狀, 可以用 此方法較單純:

begin_poly()
海龜畫出一個多邊形
end_poly()
再取名註冊成一個形狀
register_shape("myshape",get_poly())
將海龜形狀令為此新定義之形狀 “myshape”
T.shape("myShape")

24.1.3.7. Special Turtle methods

begin_poly()
,,,,# 海龜畫出一個多邊形
end_poly()
register_shape("myshape",get_poly())

官網的說明:
24.1.3.7. Special Turtle methods
turtle.begin_poly()
Start recording the vertices of a polygon. Current turtle position is first vertex of polygon.
turtle.end_poly()
Stop recording the vertices of a polygon. Current turtle position is last vertex of polygon. This will be connected with the first vertex.
turtle.get_poly()
Return the last recorded polygon.

以下為實作程式碼:

>>> turtle.home() 
>>> turtle.begin_poly() 
>>> turtle.fd(100) 
>>> turtle.left(20) 
>>> turtle.fd(30) 
>>> turtle.left(60) 
>>>turtle.fd(50) 
>>> turtle.end_poly() 
>>> p = turtle.get_poly() 
>>> register_shape("myFavouriteShape", p) 

註: 可以將

>>> p = turtle.get_poly() 
>>> register_shape("myFavouriteShape", p) 

簡化為

>>> register_shape("myFavouriteShape",  turtle.get_poly() ) 

發現順利試出
polygon_art_get_poly()_color_4

# By Prof. P-J Lai MATH NKNU 20200817
# polygon_art_get_poly()_color_4.py
# 發現用 compound shape 可以結合數個多邊形, 但是顏色似乎不好更改,
##如果只有一個形狀, 可以用 
##24.1.3.7. Special Turtle methods
##begin_poly()
##end_poly()
##register_shape("myshape",get_poly())
##T.shape("myShape")
##較單純!


import turtle
import random
T=turtle.Turtle()

T.home()
T.begin_poly()
T.fd(50)
T.lt(90)
T.fd(50)
T.lt(90)
T.fd(50)
T.lt(90)
T.fd(50)
T.lt(50)
T.end_poly()
myPoly=T.get_poly()
turtle.register_shape("myShape",myPoly)
T.shape("myShape")

T.reset()
T.penup()
for i in range(100):
    T.color((random.random(),random.random(),random.random()))
    T.goto(random.randint(-200,200),random.randint(-200,200))
    T.stamp()

Ex: 參考 BFOIT 站
Introduction to Computer Programming
ref: http://guyhaas.com/bfoit/itp/Operators.html
之圖
BIG_DrawRandomBoxes3
將以上 Python codes 改進成類似上圖, 板塊之形狀可以是大小不一之長方形(包含正方形).

Ex: 參考 BFOIT 站
Introduction to Computer Programming
ref: http://guyhaas.com/bfoit/itp/Operators.html
之圖
BIG_DrawRandomTurtles4

將以上 Python codes 改進成類似上圖, 板塊之形狀可以是大小不一之任意形狀或符號.

12.3 海龜繪圖模擬 紫雨無聲落下 (如何讓多隻海龜一起移動?)

參考 YouTube上講解以 Processing 語言模擬"紫雨" 的影片
Ref: https://youtu.be/KkyIDI6rQJI
link

Ex: 你可以用 Python 的 turtle module 重現一次
“The Coding Train” 系列中, 模擬"紫雨" 的動畫嗎?


以下初步試做

PythonTurtle_purpleRain_藝術_test_2.py
在 for loop 中:
重複產生單一烏龜物件, 形狀為一紫色小細長條長方型, 起始位置隨機指定, 再令他由上往下前進400單位長
PythonTurtle_purpleRain_藝術_test_2

## 11. 烏龜繪圖模擬紫雨藝術
# By Prof. P-J Lai MATH NKNU 20200921

##參考 YpuTube上講解以 Processing 模擬"紫雨" 的影片
##Ref: https://youtu.be/KkyIDI6rQJI
##[link](https://youtu.be/KkyIDI6rQJI)
##
##**Ex:** 你可以用 Python 的 turtle module 重現一次
##"The Coding Train"  模擬"紫雨" 的動畫嗎?
##
##以下初步試做



# 發現用 compound shape 可以結合數個多邊形, 但是顏色似乎不好更改,
##如果只有一個形狀, 可以用 
##24.1.3.7. Special Turtle methods
##begin_poly()
##end_poly()
##register_shape("myshape",get_poly())
##T.shape("myShape")
##較單純!


#用tracer(1,0.999999), tracer(2,10)還, tracer(2,20000)是太瞬間
#tracer(1.9,5) # 此速度較剛好 20201003



from turtle import *
import random
T=Turtle()
T.reset()
T.home()
T.speed(0)
#用tracer(1,0.999999), tracer(2,10)還, tracer(2,20000)是太瞬間
#tracer(1.9,5) # 此速度較剛好 20201003


T.begin_poly()
T.fd(3)
T.lt(90)
T.fd(30)
T.lt(90)
T.fd(3)
T.lt(90)
T.fd(30)
T.lt(90)
T.end_poly()
myPoly=T.get_poly()
register_shape("myShape",myPoly)

T.shape("myShape")
T.color(138/256, 43/256, 226/256)
purpleColor = (138/256, 43/256, 226/256)

#T.speed(0)


class purpleRain(Turtle):
    def __init__(self, shape):
        Turtle.__init__(self, shape=shape,visible=True)
        self.color(purpleColor)
        self.lt(90)
        self.penup()
        self.speed(3)
        self.hideturtle()
        self.goto(random.randint(-350,300),random.randint(-300,320))
        self.showturtle()
        

def main():
    T = purpleRain("myShape")
    #T.speed(0)
    T.bk(100)
    for i in range(20):
        T = purpleRain("myShape")
        T.bk(400)
    return

if __name__=="__main__":
    msg = main()
    print(msg)
    mainloop()

以上的效果, 造成只能序列輪流下一滴雨


以下我們改成先產生例如, turtleNumber = 50 個烏龜物件, 起始位置隨機指定, 再要求這 50 個烏龜物件執行上面程式碼的迴圈動作: 由上往下前進400單位長

以下是先產生 turtleNumber = 50 個烏龜物件, 起始位置隨機指定, 之初始畫面
在这里插入图片描述
主要修改之處如下:

def main():
    turtleNumber = 50
    Tgroup = list(range(turtleNumber))
    
    for i in range(turtleNumber):
        # Tgroup = Tgroup.append(purpleRain("myShape"))
        # 上行, 物件元素無法用append增加進list
        Tgroup[i] = purpleRain("myShape")
        
    '''
    for i in range(turtleNumber):
        #T = purpleRain("myShape")
        Tgroup[i].bk(400)
    '''
    return

接著我們把註解掉之處取消註解, 讓各物件滴落
‘’’
for i in range(turtleNumber):
#T = purpleRain(“myShape”)
Tgroup[i].bk(400)
‘’’

def main():
    turtleNumber = 50
    Tgroup = list(range(turtleNumber))
    
    for i in range(turtleNumber):
        # Tgroup = Tgroup.append(purpleRain("myShape"))
        # 上行, 物件元素無法用append增加進list
        Tgroup[i] = purpleRain("myShape")
        
    for i in range(turtleNumber):
        #T = purpleRain("myShape")
        Tgroup[i].bk(400)
    
    return

結果出現各物件依序滴落的狀況, 仍然沒辦法同時
PythonTurtle_purpleRain_藝術_test_3_各物件依序滴落

此時我們面臨到, 如何讓多隻海龜同時(一起)移動? 的問題

Q: 如何讓多隻海龜一起移動?
我們查了網路上的解法, 在 stackoverflow 上, 提供3種解法
注意以下三種方法, threading 還是只使用單顆 CPU, 在硬體上並沒有真正平行執行,
method 1. 每隻都動一小段, 換下一隻
method 2. 用 ontimer()
method 3. 用 thread

Slatkin 那本書 sec41, 建議使用 concurrent.futures 模組的 ProcessPoolExcutor 類, 語法較簡單, 可以真正的平行執行 一些特定類型的程式, isolated, high-leverage 類型的任務, 意指, 父行程與子行程間只須轉移少量資料, 就能進行大量計算的那種類型的任務, 例如 最大公因數演算法, 還有許多數學演算法也都適合,
Ref: Brett Slatkin, Effective Python, sec41, 中譯本, 基峯出版.

以下我們先嘗試用 method 1. 每隻都動一小段, 換下一隻:
只需將原先之 codes

for i in range(turtleNumber):
        #T = purpleRain("myShape")
        Tgroup[i].bk(400)

改成

for k in range(400):
        for i in range(turtleNumber):
            Tgroup[i].bk(5)

發現移動速度太慢, 即使用T.speed(0), 還是太慢
改用 tracer(20,1), 發現速度就快了

PythonTurtle_purpleRain_藝術_test_3_同時

## 11. 烏龜繪圖模擬紫雨藝術
# By Prof. P-J Lai MATH NKNU 20200921

##參考 YpuTube上講解以 Processing 模擬"紫雨" 的影片
##Ref: https://youtu.be/KkyIDI6rQJI
##[link](https://youtu.be/KkyIDI6rQJI)
##
##**Ex:** 你可以用 Python 的 turtle module 重現一次
##"The Coding Train"  模擬"紫雨" 的動畫嗎?
##
##以下初步試做


# 發現用 compound shape 可以結合數個多邊形, 但是顏色似乎不好更改,
##如果只有一個形狀, 可以用 
##24.1.3.7. Special Turtle methods
##begin_poly()
##end_poly()
##register_shape("myshape",get_poly())
##T.shape("myShape")
##較單純!


#用tracer(1,0.999999), tracer(2,10)還, tracer(2,20000)是太瞬間
#tracer(1.9,5) # 此速度較剛好 20201003


from turtle import *
import random
T=Turtle()
T.reset()
T.home()
#T.speed(0)
#用tracer(1,0.999999), tracer(2,10)還, tracer(2,20000)是太瞬間
#tracer(1.9,5) # 此速度較剛好 20201003
tracer(20,1)

T.begin_poly()
T.fd(3)
T.lt(90)
T.fd(30)
T.lt(90)
T.fd(3)
T.lt(90)
T.fd(30)
T.lt(90)
T.end_poly()
myPoly=T.get_poly()
register_shape("myShape",myPoly)

T.shape("myShape")
T.color(138/256, 43/256, 226/256)
purpleColor = (138/256, 43/256, 226/256)



class purpleRain(Turtle):
    def __init__(self, shape):
        Turtle.__init__(self, shape=shape,visible=True)
        self.color(purpleColor)
        self.lt(90)
        self.penup()
        self.speed(5)
        self.hideturtle()
        self.goto(random.randint(-350,300),random.randint(0,320))
        self.showturtle()
        

def main():
    turtleNumber = 50
    Tgroup = list(range(turtleNumber))
    
    for i in range(turtleNumber):
        # Tgroup = Tgroup.append(purpleRain("myShape"))
        # 上行codes, 物件元素無法用append增加進list
        Tgroup[i] = purpleRain("myShape")
        
    for k in range(400):
        for i in range(turtleNumber):
            Tgroup[i].bk(5)
    
    return

if __name__=="__main__":
    msg = main()
    print(msg)
    mainloop()


以下幾乎完成, 使用 while, 使紫雨持續落下,

可惜速度無法調到適當之快, 感覺有點慢, 不管 tracer()是設多少值
PythonTurtle_purpleRain_藝術_test_4_while.pyPythonTurtle_purpleRain_藝術_test_4_while

## 11. 烏龜繪圖模擬紫雨藝術
# By Prof. P-J Lai MATH NKNU 20200921

##參考 YpuTube上講解以 Processing 模擬"紫雨" 的影片
##Ref: https://youtu.be/KkyIDI6rQJI
##[link](https://youtu.be/KkyIDI6rQJI)
##
##**Ex:** 你可以用 Python 的 turtle module 重現一次
##"The Coding Train"  模擬"紫雨" 的動畫嗎?
##
##以下初步試做


# 發現用 compound shape 可以結合數個多邊形, 但是顏色似乎不好更改,
##如果只有一個形狀, 可以用 
##24.1.3.7. Special Turtle methods
##begin_poly()
##end_poly()
##register_shape("myshape",get_poly())
##T.shape("myShape")
##較單純!

#用tracer(300,10), 此速度還是有點慢, tracer(1000,10) 較快 20201017

from turtle import *
import random
T=Turtle(visible=False)

T.hideturtle()
T.penup()
#T.speed(0)
#用tracer(1,0.999999), tracer(2,10)還, tracer(2,20000)是太瞬間
#tracer(1.9,5) # 此速度較剛好 20201003
tracer(1000,10)

T.begin_poly()
T.fd(2)
T.lt(90)
T.fd(30)
T.lt(90)
T.fd(2)
T.lt(90)
T.fd(30)
T.lt(90)
T.end_poly()
myPoly=T.get_poly()
register_shape("myShape",myPoly)

T.shape("myShape")
T.color(138/256, 43/256, 226/256)
purpleColor = (138/256, 43/256, 226/256)

class purpleRain(Turtle):
    def __init__(self, shape):
        Turtle.__init__(self, shape=shape,visible=False)
        self.color(purpleColor)
        self.lt(90)
        self.penup()
        self.speed(0)
        self.hideturtle()
        self.goto(random.randint(-400,400),random.randint(400,1400))
        self.showturtle()
        
def main():
    turtleNumber = 500
    Tgroup = list(range(turtleNumber))
    
    for i in range(turtleNumber):
        Tgroup[i] = purpleRain("myShape")

    while True:    
        for k in range(400):
            for i in range(turtleNumber):
                Tgroup[i].bk(5)
                if Tgroup[i].ycor() < -400:
                    Tgroup[i].goto(random.randint(-400,400),random.randint(400,600))                    
    return

if __name__=="__main__":
    msg = main()
    print(msg)
    mainloop()

12.4 Python繪製天然雪花結晶

全文較長, 請參考另一篇:
python繪製天然雪花結晶, https://blog.csdn.net/m0_47985483/article/details/122262036 link

Reference

  • 用 Logo繪製之板塊藝術, 參考自 BFOIT
    Introduction to Computer Programming
    ref: http://guyhaas.com/bfoit/itp/Operators.html
    link)

  • 美麗的圖形 https://www.pinterest.com/drnagy18/fonalgrafika1/ link

  • Python带你找回童年的万花尺, http://baijiahao.baidu.com/s?id=1651085589151024260 link

  • 使用 python 成为藝術家, https://my.oschina.net/u/4531265/blog/4278176 link

  • 等等!等高線居然可以有非凡的藝術氣質?!https://www.getit01.com/p2018041735235656/ link

  • Python——畫一棵漂亮的樱花樹, https://blog.csdn.net/weixin_43943977/article/details/102691392 link
    非常漂亮的樹!

  • 呈現碎形樹 “Coding Challenge #14: Fractal Trees - Recursive”
    https://www.youtube.com/watch?v=0jjeOYMjmDU&t=8s, link

  • Generative art in Python: Fractal Trees
    https://youtu.be/EICpm9rnPjE link

  • Generative art in Python: Basic Tiling, https://youtu.be/Cm_SzDlQ2cM link

  • 模擬 starfield 星際大戰的光速飛行場景有聲音 Coding Challenge #1: Starfield in Processing with music
    https://www.youtube.com/watch?v=KWhnilgKM1M link

  • 海龜打點 turtle.dot() 的效果, 可以呈現迷宮或是某些演算法, 走過之位置:
    本篇很好的文章介紹: 從 Python 海龜繪圖初入門到使用遞迴(遞歸) 畫嵌套圖形, 碎形及進階迷宮演算法等:
    数据结构与算法(Python版)——(3)通俗易懂的介绍递归(上),
    https://blog.csdn.net/weixin_45901519/article/details/109456646 link
    這份迷宮程式碼稍微複雜, 把程式碼複製, 存為.py檔, 迷宮初始資料複製到 maze2.txt, 放在同一資料夾下, 就可以執行.

  • 生成式藝術和演算法創作07 L, https://zhuanlan.zhihu.com/p/50712698 link

  • Michael Hansmeyer:塑造不可思议, https://v.youku.com/v_show/id_XNDc4MDM2NzA4.html link

  • https://youtu.be/qtPi0JvmWbs
    Generative Art
    生成藝術暑期工作營
    東南大學建築學院 建築運算與應用研究所

  • Creative Algorithms - Generative Design & Creative Coding Art
    https://youtu.be/Z9NLxrkMWM4

  • https://en.wikipedia.org/wiki/L-system
    L-system_Fractal_Farn_Wiki.gif
    Wiki上的 gif 檔
    看了就覺得很爽
    看到這種動畫你應該會一種願望, 想要自己寫程式把它實做出來

  • https://youtu.be/J0LyZSgVKVc
    Making Mathematical Art with L-Systems
    Tom Rocks Maths
    10.1萬 位訂閱者
    Tom Rocks Maths intern Max Cairney-Leeming explains how to make mathematical art using Lindenmayer Systems…
    L-systems consist of lists of symbols which represent a drawing function, and a set of rules that are applied to the symbols iteratively. Starting from a simple axiom - often just a straight line - complex systems can be generated which demonstrate fractal-like behaviour. The Heighway Dragon Curve is one such example, as well as realistic plants and trees that are used in animations in films and video games.
    Produced by Max Cairney-Leeming with assistance from Dr Tom Crawford. Max is a second year student studying Maths and Computer Science at the University of Oxford. Tom is an Early-Career Teaching and Outreach Fellow at St Edmund Hall: https://www.seh.ox.ac.uk/people/tom-c…
    For more maths content check out Tom’s website https://tomrocksmaths.com/
    You can also follow Tom on Facebook, Twitter and Instagram @tomrocksmaths.
    https://www.facebook.com/tomrocksmaths/
    https://twitter.com/tomrocksmaths
    https://www.instagram.com/tomrocksmaths/
    Get your Tom Rocks Maths merchandise here:
    https://beautifulequations.net/collec…
    Thank you to the following for providing images/video clips under a Creative Commons licence:
    Schmendreck
    Icecreeper28
    Ryoichi Mizuno
    Confreaks

  • https://en.wikipedia.org/wiki/L-system

  • http://algorithmicbotany.org/

  • http://algorithmicbotany.org/papers/#abop 各種圖

  • Brett Slatkin, Effective Python, sec41, 中譯本, 基峯出版.
    Slatkin 那本書 sec41, 建議使用 concurrent.futures 模組的 ProcessPoolExcutor 類, 語法較簡單, 可以真正的平行執行 一些特定類型的程式, isolated, high-leverage 類型的任務, 意指, 父行程與子行程間只須轉移少量資料, 就能進行大量計算的那種類型的任務, 例如 最大公因數演算法, 還有許多數學演算法也都適合,

  • 洪錦魁, Python 王者歸來, ch12 類, ch30 多任務線程與多線程, 清華大學出版, 2019.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值