Ychaos Generating Chaotic images

Source: Internet
Author: User

Ychaos is a software that generates chaotic images through mathematical formulas, demonstrating the beauty of chaos and the beauty of mathematics. The software defines a simple set of scripting languages for describing mathematical expressions . When using, you need to write the mathematical expression in the form of the script, parsing the script code to generate the corresponding graphics and images. This software is very much related to why I have previously written the Why Mathematical image generation tool and why mathematical graphical visualizer (open source). They use the same set of mathematical expressions to parse the code. If you are interested in a graphic image of students, welcome to join QQ Exchange Group : 367752815

First, the use of software

Double-click the Ychaos image generation software . exe to start the software .

      software in two modes : edit mode and image generation mode . The default is edit mode, keyboard f1 for switching between the two modes. keyboard f2 used to switch to image generation mode , . Drag the right mouse button to set the viewport position and the scroll wheel for the viewport's zoom. Press the keyboard f x

The folder "Images" contains a variety of configuration files for generating images . You can open a file by dragging a configuration file into the software. You can also open a profile ...from the menu item. To make the file selection open. You can also use the shortcut key ctrl+f to load a configuration file . To open a set of points for a Lorenz attractor:

When you open a profile , it goes into edit mode , and when you press F2 , it switches to image generation mode and generates a chaotic image. As shown in the following:

Press F5 or through the "view, Math script edit Panel ..." in the menu item to open the Math script editing panel, where you can edit and modify the mathematical formula. As shown in the following:

In edit mode, there is a control on the right that sets the initial variable value for the mathematical formula.

When the formula is finished editing, if you want to convert the point set to an image, you need to set the image clipping range and set it through the controls:

One of the buttons,auto set Extend, automatically sets the image clipping range by the extent of the point set. Users can also adjust the clipping range directly in a two-dimensional scene.

In the image generation mode, you can set the display channel of the image, such as RGB three color channels, image inverse color and so on. The point set data can be converted into color images in two ways, one is a color expression and the other is a pseudo-color table. For images that use pseudo-color + inverse color:

The image generation mode has a control for image generation control:

The button "Process" is used to generate the image.

Second, the principle of software

Ychaos will be the user input mathematical formula iterative processing, so-called iteration is to do their own output as their input, and constantly do the loop processing.

When someone encounters math, it's daunting, don't worry, the mathematical formula for generating chaos is usually simple. For example, enter the formula as:

x = sin (y) +0.5

y = sin (x) +0.5

Given the initial value of x, y , the two formulas are executed all the time, each execution will get a pair (x, y) value , and then each generated (x, y) A collection of values produces a point set graphic and an image.

Again, as the Lorenz attractor in the image above, the formula requires the expression:

u=a* (Y-x)

V=b*x-y-X*z

W=x*y-c*z

X=x+u*t

Y=y+v*t

Z=z+w*t

With the above formula, you also need to set the initial value for the corresponding variable, the initial value used in the image above is:

a=10.000000

b=28.000000

c=2.666667

t=0.001000

x=-10.000000

y=10.000000

z=25.000000

Third, script syntax

Since the mathematical formula is to be expressed in a way that the computer can recognize, a scripting language is required.

[1] constant

The following 9 constant values are present

PI 3.1415927

E 2.7182818

GOLD 0.6180034

SQRT2 1.4142136

SQRT3 1.7320508

Degree 57.2957795130824f//180/PI

RADIAN 0.01745329251994f//pi/180

Millionth 0.000001f// One out of 10,000

Dimi 0.0001f// One of the extremely

Constant names are uppercase letters , in formulas such as (PI + E) or sin (pi*0.5)

[2] Numerical analysis

Parsing support for integers 2,8,10,16 Four kinds of binary

(1) 0X at the beginning of the system , Xabcdef case can be , such as 0xFFFF

(2) 0Y starting with 2 , Y case can be , such as 0y10101010000

(3) 0 starting with 8 , such as 07523, notice the " " And the like will fail parsing

(4) default is Ten in-process

Two ways to support the resolution of floating-point numbers

(1) Format as "0.12" , cannot omit the preceding 0,

(2) Scientific expression Format . shaped like 1.2e2

[3] variables and their assigned values

All data types in the system are of type float, and there are two types of variables:

1. Fixed Variables

The system uses a- z of the English lowercase letters to denote variables , which can store a single real number , or a real array . if the real data , The array size is the number of vertices that were previously set ( See 3).

Set to a single real number

A = 3.1415// assigns a value of 3.1415
The fixed variable, x, Y, will make up the 2D vertex position coordinates for drawing and image generation.

2. Temporary variables

A variable with a name that can be customized, a string that begins with a letter or underscore, and has a maximum of 7 bytes.

[4] Operator

See the documentation for the complete operator Description: "operator description. txt"

1. Standard single-mesh operators

+,-

such as :a =-B

2. Standard Binocular operator

+,-, *,/,%,^ <,>,=,&,|

such as : c = A * b if Both are a single real number then the result of the operation C is a single real number , otherwise C is a real array

3. Function Monocular operator shaped like sin (a)

Positive,negative,abs,floor,ceil,sign,sqrt,exp,log,log2,log10,sin,cos,tan,asin,acos,atan,rand

4. Function binocular operator shape as pow (A, b)

Add,sub,multiply,divide,max,min,mod,pow,atan2,rand2,

5. Function trinocular operator shaped like lerp (A, B, R)

Lerp,clamp,gray,add3,min3,max3,average3

6. Function four mesh operator shape such as average4 (A, B, C, D)

Add4,min4,max4,average4

[5] operator nesting using

Support {}, [], () These three types of bracket markers , parentheses must appear in pairs . supports maximum + Nesting of parentheses . as : 

( -2+ (5.0* (9 + ((1+2))/3) + 2))

-{exp[5*sqrt (1-abs[sin{rand (100)}]) + 6]}

[6] Expression statements

There are three types of expressions in the script:

A normal statement, such as: u=a* (y-x), assigns the value of the formula on the right side of the equal sign to the left variable.

Static statements, such as:k = [static]0.5*q* (u*u + v*v) precede the formula with a [static] prefix, indicating that the expression is executed only at the beginning of the script processing.

A looping statement, such as:y=[loop:64]k+y*y , indicates that the expression needs to be cycled through .

Iv. Configuration Files

After the user edits a chaotic image, it can be saved to a configuration file with the following format:

[Scriptlines] It's a mathematical formula .

u=a* (Y-x)

V=b*x-y-X*z

W=x*y-c*z

X=x+u*t

Y=y+v*t

Z=z+w*t

[Variables] This is the variable initial value that the formula needs to set

a=10.000000

b=28.000000

c=2.666667

t=0.001000

x=-10.000000

y=10.000000

z=25.000000

[Colortable] Color table formula for converting vertex data to color images

size=1024

Red=log (v*4) *18.0

Green=log (v*3) *20.0

Blue=

colorscalered=1.000000

colorscalegreen=1.000000

colorscaleblue=1.000000

[Pseudo] image Pseudo-color, another way to transform vertex data into color image

winpos=127

winwid=255

Pseudoname=default

Used=false

[Params] other relevant parameters

The total number of iterations of the iteration=10000000 formula

stepvalue=0.000100

imageminx=-25.677399 the clipping range needed to convert vertex coordinates into images

imageminy=-25.972094

imagemaxx=24.993305

imagemaxy=24.698610

processspeed=2000 speed when generating an image

Software:

1.1 Version: http://files.cnblogs.com/files/WhyEngine/YChaos_1_1.7z

Ychaos Generating Chaotic images

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.