Animating randomized L-Systems in real time

栏目: IT技术 · 发布时间: 5年前

内容简介:or clickhere orhere orhere (SEIZURE WARNING) for some more examples of what can be generatedClicking anywhere on the visualization will bring up a menu with a bunch of sliders you can use to change how the L-Systems are generated. Clicking off the menu wil

Random L-Systems Visualizer

Click here to start the visualization

or clickhere orhere orhere (SEIZURE WARNING) for some more examples of what can be generated

How to use this site:

Clicking anywhere on the visualization will bring up a menu with a bunch of sliders you can use to change how the L-Systems are generated. Clicking off the menu will make it disppear. Using the menu you can control the following parameters:

  • Fade time : The time it takes for a line to completely fade away

  • Line length : The length of the shortest possible straight line (the distance that the turtle moves when it is told to move forward)

  • Line width : The width of the lines being drawn

  • Lines per frame : The number of lines that are drawn every frame

  • Time per frame : How often a frame is drawn

  • Angle randomness : 100% angle randomness means all angles are randomly chosen from between 5° and 180°. 0% angle randomness means all angles are chosen from a pool of around 10 "nice looking" angles (such as 90°, 20°, etc)

  • Maximum system length : The length to grow each system's string before switching to a new system

The remaining parameters are explained in the following diagram of a complete L-System:

Animating randomized L-Systems in real time

If you want to share your current settings you can click the save settings in url button at the bottom of the menu and it will change the URL of the page to one that includes all the current parameters.

A brief explanation of L-Systems:

Growing an L-System

An L-System is a string rewriting system that can generate fractal and tree like structures. They consist of a seed string and a set of rules to grow the seed into a more complex string. Each rule operates on a single character of the string, and replaces that character with another string. For example, consider the following seed and rules:

Seed: "abc"  
Rules:  
    "a" -> "cc",  
    "c" -> "ba"

Applying these rules to the seed will yield the string "ccbba" . Now the same rules can be applied to this new string to grow the system even more:

"ccbba" becomes "bababbcc"

"bababbcc" becomes "bccbccbbbaba"

etc

Visualizing an L-System

L-Systems can be visualized in many different ways, but the most common method involves using a turtle .

First, you come up with an L-System as well as an arbitrary angle, A , to associate the L-System with. Then, you grow your L-System string by applying rules to the seed numerous times. To draw the L-System using the turtle you interpret every character of the grown string as an instruction to the turtle. Most L-Systems visualizers (including this one) use the following character set:

  • "F": Move the turtle forward
  • "+": Turn the turtle A degrees clockwise
  • "-": Turn the turtle A degrees counterclockwise
  • "[": Push the current position of the turtle onto a stack
  • "]": Pop a position off the stack and move the turtle to that position

Any other characters can be ignored by the turtle.


以上就是本文的全部内容,希望本文的内容对大家的学习或者工作能带来一定的帮助,也希望大家多多支持 码农网

查看所有标签

猜你喜欢:

本站部分资源来源于网络,本站转载出于传递更多信息之目的,版权归原作者或者来源机构所有,如转载稿涉及版权问题,请联系我们

创新者

创新者

[美] 沃尔特·艾萨克森 / 关嘉伟、牛小婧 / 中信出版社 / 2017-4 / 88.00元

《创新者》是沃尔特·艾萨克森继全球畅销书《史蒂夫·乔布斯传》之后的又一部力作,不仅讲述了计算机和互联网从无到有的发展历程,为我们 生动地刻画出数字时代的创新者群像,还深度挖掘互联网的精神内核,解读了“诗意科学”这个重大主题。 在近200年的数字化进程中群星闪耀,艾萨克森从第一个计算机程序的创造者、浪漫主义诗人拜伦之女埃达•洛夫莱斯伯爵夫人说起,细数了这一群将科学与人文融合的创新者,他们包括第......一起来看看 《创新者》 这本书的介绍吧!

CSS 压缩/解压工具
CSS 压缩/解压工具

在线压缩/解压 CSS 代码

XML、JSON 在线转换
XML、JSON 在线转换

在线XML、JSON转换工具

Markdown 在线编辑器
Markdown 在线编辑器

Markdown 在线编辑器