Introduction[]
This tutorial will cover the basic notion of parametric equations, and how they apply to Blockland.
Mathematical Functions and graphs[]
In algebra, you may be familiar with how a function is described with y on one side of the equals sign, and x on the other. For example:
y = x
y = x^2
y = x + 3
and so on.
There are other ways of describing functions, that do the exact same thing. For example, with the equation
y=x^2
we can also describe both y and x in terms of a third variable:
x=t
y=t^2
This does the exact same thing as y=x^2
Similarly, this works for more complex equations such as 2-D circles, spheres, etc:
The more familiar "x^2+y^2=r" equation for a circle now becomes:
x=a*cos(t)
y=a*sin(t)
How does this help me?[]
In Blockland, while you are scripting, you need to define the x, y, and z coordinates for the bricks you are graphing. With parametric equations, you are given a formula for each x, y, and z coordinate. All you have to do now is just input these formulae in a way that Blockland understands, and you can make some very fancy things.
Notice that in the example below, x and z are defined using the i variable.
Butterfly[]
%e=2.71828182845904523536; for( %i = 0 ; %i < 10000 ; %i++ ) { %posx = mSin(%i)* ( mPow(%e,mCos(%i)) - 2*mCos(4*%i) - mPow((mSin(%i/12)),5) ); %posz = mCos(%i)* ( mPow(%e,mCos(%i)) - 2*mCos(4*%i) - mPow((mSin(%i/12)),5) ); %temp = new fxDTSBrick() { datablock = "brick1x1Data"; position = 25*%posx SPC 1 SPC 25*%posz; rotation = "0 0 0 0"; colorID = "16"; scale = "1 1 1"; angleID = "0"; colorfxID = "0"; shapefxID = "0"; isPlanted = 1; }; }
Deltoid Curve[]
for( %i = 0 ; %i < 1000 ; %i++ ) { %a=0.5; %posx = 2*%a*mCos(%i)+%a*mCos(2*%i); %posz = 2*%a*mSin(%i)-%a*mSin(2*%i); %posy = 1; %temp = new fxDTSBrick() { datablock = "brick1x1Data"; position = 50*%posx SPC %posy SPC 50*%posz; rotation = "0 0 0 0"; colorID = "16"; scale = "1 1 1"; angleID = "0"; colorfxID = "0"; shapefxID = "0"; isPlanted = 1; }; }
Epicycloids[]
There is an entire group of curves that can be made as "Epicycloids". The image shown below uses the value of k=3.8. Here, as well, the parametric equations can be plugged directly into Blockland:
for( %i = 0 ; %i < 10000 ; %i++ ) { %k=3.8; %posx = (%k+1)*mCos(%i)-mCos((%k+1)*%i); %posz = (%k+1)*mSin(%i)-mSin((%k+1)*%i); %temp = new fxDTSBrick() { datablock = "brick1x1Data"; position = 25*%posx SPC 1 SPC 25*%posz; rotation = "0 0 0 0"; colorID = "16"; scale = "1 1 1"; angleID = "0"; colorfxID = "0"; shapefxID = "0"; isPlanted = 1; }; }
Hypocycloids[]
Similarly, there is a class of curves known as Hypocycloids.
The above image is with the value of k=3.8. Wikipedia has several values and images on display with which to experiment.
for( %i = 0 ; %i < 10000 ; %i++ ) { %k=3.8; %posx = (%k-1)*mCos(%i)+mCos((%k-1)*%i); %posz = (%k-1)*mSin(%i)-mSin((%k-1)*%i); %temp = new fxDTSBrick() { datablock = "brick1x1Data"; position = 25*%posx SPC 1 SPC 25*%posz; rotation = "0 0 0 0"; colorID = "16"; scale = "1 1 1"; angleID = "0"; colorfxID = "0"; shapefxID = "0"; isPlanted = 1; }; }
Hypotrochoids[]
Hypotrochoids are another example of curves that can be scripted with parametric equations. Here, the x and y formula are just as from wikipedia... and all you need to set are the values for R, r, and d (in this example the values have been provided by wikipedia!)
for( %i = 0 ; %i < 5000 ; %i++ ) { %R=5; %ra=3; %d=5; %posx = (%R-%ra)*mCos(%i)+%d*mCos(((%R-%ra)/%ra)*%i); %posz = (%R-%ra)*mSin(%i)-%d*mSin(((%R-%ra)/%ra)*%i); %temp = new fxDTSBrick() { datablock = "brick1x1Data"; position = 10*%posx SPC 1 SPC 10*%posz; rotation = "0 0 0 0"; colorID = "16"; scale = "1 1 1"; angleID = "0"; colorfxID = "0"; shapefxID = "0"; isPlanted = 1; }; }
Limaçon trisectrix[]
The Limaçon trisectrix is a special instance of the trisectrix of Pascal (also called the limaçon of Pascal). Here, again, once you get the basic formula down, you can have a wide variety of curves with different values inserted into a and b.
for( %i = 0 ; %i < 5000 ; %i++ ) { %a=4; %b=2; %posx = (%a/2)+%b*mCos(%i)+(%a/2)*mCos(2*%i); %posz = %b*mSin(%i)+(%a/2)*mSin(2*%i); %temp = new fxDTSBrick() { datablock = "brick1x1Data"; position = 10*%posx SPC 1 SPC 10*%posz; rotation = "0 0 0 0"; colorID = "16"; scale = "1 1 1"; angleID = "0"; colorfxID = "0"; shapefxID = "0"; isPlanted = 1; }; }
Lissajous[]
"A Lissajous curve is the graph of the system of parametric equations
x=A*sin(at+δ), y=B*sin(bt) which describes complex harmonic motion."
for( %i = 0 ; %i < 5000 ; %i++ ) { %AA=1; %BB=1; %a=9; %b=8; %phi=2; %posx = %AA*mSin(%a*%i+%phi); %posz = %BB*mSin(%b*%i); %temp = new fxDTSBrick() { datablock = "brick1x1Data"; position = 10*%posx SPC 1 SPC 10*%posz; rotation = "0 0 0 0"; colorID = "16"; scale = "1 1 1"; angleID = "0"; colorfxID = "0"; shapefxID = "0"; isPlanted = 1; }; }
3D Curves[]
Viviani's Curve[]
%pi = 3.1415926535897932384626433832795; for( %t = 0 ; %t < (4*%pi) ; %t+=0.1 ) { %a=2; %b=1; %posx = %a*(1+mCos(%t)); %posy = 2*mSin(%t/2); %posz = mSin(%t); %temp = new fxDTSBrick() { datablock = "brick1x1Data"; position = 10*%posx SPC 10*%posy SPC 10*%posz; rotation = "0 0 0 0"; colorID = "16"; scale = "1 1 1"; angleID = "0"; colorfxID = "0"; shapefxID = "0"; isPlanted = 1; }; }
Tornado[]
for( %i = 0 ; %i < 300 ; %i+=0.1 ) { %posx = %i*mCos(%i); %posy = %i; %posz = %i*mSin(%i); %temp = new fxDTSBrick() { datablock = "brick1x1Data"; position = %posx SPC %posy SPC %posz; rotation = "0 0 0 0"; colorID = "16"; scale = "1 1 1"; angleID = "0"; colorfxID = "0"; shapefxID = "0"; isPlanted = 1; }; }
Clélies Curves[]
%pi = 3.1415926535897932384626433832795; for( %t = 0 ; %t < (8*%pi) ; %t+=0.05 ) { %a=4; //radius %m=(4/5); %posx = %a*mSin(%m*%t)*mCos(%t); %posy = %a*mSin(%m*%t)*mSin(%t); %posz = %a*mCos(%m*%t); %temp = new fxDTSBrick() { datablock = "brick1x1Data"; position = 10*%posx SPC 10*%posy SPC 10*%posz; rotation = "0 0 0 0"; colorID = "16"; scale = "1 1 1"; angleID = "0"; colorfxID = "0"; shapefxID = "0"; isPlanted = 1; }; }
3D Curve[]
for( %t = 1 ; %t < 20 ; %t+=0.01 ) { %posx = 2*mSin(3*%t)*mCos(%t); %posy = 2*mSin(3*%t)*mSin(%t); %posz = mSin(3*%t); %temp = new fxDTSBrick() { datablock = "brick1x1Data"; position = 10*%posx SPC 10*%posy SPC 10*%posz; rotation = "0 0 0 0"; colorID = "16"; scale = "1 1 1"; angleID = "0"; colorfxID = "0"; shapefxID = "0"; isPlanted = 1; }; }
Another 3D curve[]
for( %t = 1 ; %t < 20 ; %t+=0.01 ) { %posx = 3*mCos(%t)+mCos(10*%t)*mCos(%t); %posy = mSin(10*%t); %posz = 3*mSin(%t)+mCos(10*%t)*mSin(%t); %temp = new fxDTSBrick() { datablock = "brick1x1Data"; position = 10*%posx SPC 10*%posy SPC 10*%posz; rotation = "0 0 0 0"; colorID = "16"; scale = "1 1 1"; angleID = "0"; colorfxID = "0"; shapefxID = "0"; isPlanted = 1; }; }
Another 3D curve[]
for( %t = 1 ; %t < 25 ; %t+=0.01 ) { %posx = 5*mCos(%t)-mCos(5*%t); %posy = %t; %posz = 5*mSin(%t)-mSin(5*%t); %temp = new fxDTSBrick() { datablock = "brick1x1Data"; position = 10*%posx SPC 10*%posy SPC 10*%posz; rotation = "0 0 0 0"; colorID = "16"; scale = "1 1 1"; angleID = "0"; colorfxID = "0"; shapefxID = "0"; isPlanted = 1; }; }
Loxodromes[]
You can alter the number of loops by altering the a value.
for( %t = 1 ; %t < 25 ; %t+=0.01 ) { %a=2; %posx = mCos(%t) * mCos( (1/mTan(%a*%t)) ); %posy = mSin(%t) * mCos( (1/mTan(%a*%t)) ); %posz = -mSin(1/mTan(%a*%t)); %temp = new fxDTSBrick() { datablock = "brick1x1Data"; position = 50*%posx SPC 50*%posy SPC 50*%posz; rotation = "0 0 0 0"; colorID = "16"; scale = "1 1 1"; angleID = "0"; colorfxID = "0"; shapefxID = "0"; isPlanted = 1; }; }
See Also[]
MathWorld, Parametric Equations
Wikipedia, Parametric Equations